Commit 670a292d authored by mdj33's avatar mdj33 Committed by vipwzw

fix ut

parent 98554f8c
...@@ -101,7 +101,7 @@ function main() { ...@@ -101,7 +101,7 @@ function main() {
echo "============ run main end =================" echo "============ run main end ================="
find . -maxdepth 1 -type d -name "*-ci" -exec rm -rf {} \; find . -maxdepth 1 -type d -name "*-ci" -exec rm -rf {} \;
dir=$(find . -maxdepth 1 -type d ! -name system ! -name . ! -name cross2eth | sed 's/^\.\///') dir=$(find . -maxdepth 1 -type d ! -name system ! -name . | sed 's/^\.\///')
for app in $dir; do for app in $dir; do
run_single_app "${app}" "$TESTCASEFILE" "down" run_single_app "${app}" "$TESTCASEFILE" "down"
done done
...@@ -112,7 +112,7 @@ function main() { ...@@ -112,7 +112,7 @@ function main() {
fi fi
elif [ "${OP}" == "down" ]; then elif [ "${OP}" == "down" ]; then
if [ "${DAPP}" == "all" ] || [ "${DAPP}" == "ALL" ]; then if [ "${DAPP}" == "all" ] || [ "${DAPP}" == "ALL" ]; then
dir=$(find . -maxdepth 1 -type d ! -name system ! -name . ! -name cross2eth | sed 's/^\.\///') dir=$(find . -maxdepth 1 -type d ! -name system ! -name . | sed 's/^\.\///')
for app in $dir; do for app in $dir; do
down_dapp "${app}" down_dapp "${app}"
done done
......
...@@ -209,8 +209,8 @@ txFee=0 ...@@ -209,8 +209,8 @@ txFee=0
#私对私token转账,花费token(true)还是BTY(false), #私对私token转账,花费token(true)还是BTY(false),
tokenFee=false tokenFee=false
#curve H point #curve H point
pointHX="10190477835300927557649934238820360529458681672073866116232821892325659279502" pointHX="19172955941344617222923168298456110557655645809646772800021167670156933290312"
pointHY="7969140283216448215269095418467361784159407896899334866715345504515077887397" pointHY="21116962883761739586121793871108889864627195706475546685847911817475098399811"
#电路最大支持1024个叶子hash,10 level, 配置可以小于1024,但不能大于 #电路最大支持1024个叶子hash,10 level, 配置可以小于1024,但不能大于
maxTreeLeaves=1024 maxTreeLeaves=1024
...@@ -361,6 +361,9 @@ Enable=0 ...@@ -361,6 +361,9 @@ Enable=0
[fork.sub.multisig] [fork.sub.multisig]
Enable=0 Enable=0
[fork.sub.mix]
Enable=0
[fork.sub.unfreeze] [fork.sub.unfreeze]
Enable=0 Enable=0
ForkTerminatePart=0 ForkTerminatePart=0
......
...@@ -299,7 +299,7 @@ pointHX="19172955941344617222923168298456110557655645809646772800021167670156933 ...@@ -299,7 +299,7 @@ pointHX="19172955941344617222923168298456110557655645809646772800021167670156933
pointHY="21116962883761739586121793871108889864627195706475546685847911817475098399811" pointHY="21116962883761739586121793871108889864627195706475546685847911817475098399811"
#电路最大支持1024个叶子hash,10 level, 配置可以小于1024,但不能大于 #电路最大支持1024个叶子hash,10 level, 配置可以小于1024,但不能大于
maxTreeLeaves=1024 maxTreeLeaves=1024
hashSeed="19172955941344617222923168298456110557655645809646772800021167670156933290312"
[metrics] [metrics]
#是否使能发送metrics数据的发送 #是否使能发送metrics数据的发送
......
...@@ -7,11 +7,6 @@ MIX_CLI32="docker exec ${NODE2} /root/chain33-cli " ...@@ -7,11 +7,6 @@ MIX_CLI32="docker exec ${NODE2} /root/chain33-cli "
#1nl receiver chain30 #1nl receiver chain30
MIX_CLI30="docker exec ${NODE4} /root/chain33-cli " MIX_CLI30="docker exec ${NODE4} /root/chain33-cli "
xsedfix=""
if [ "$(uname)" == "Darwin" ]; then
xsedfix=".bak"
fi
# shellcheck source=/dev/null # shellcheck source=/dev/null
#source test-rpc.sh #source test-rpc.sh
...@@ -113,7 +108,6 @@ function mix_transfer() { ...@@ -113,7 +108,6 @@ function mix_transfer() {
} }
function mix_deposit() { function mix_deposit() {
proof="0e420e0a8963195ab7fc4a610d8cd758a04be4950317c1c0cdfff701e207d03c0f72b5c669058434b3db24ef57f9a0d9e443d78a3b661e1cd2a1f6c1cdbdb855081c95f92a68286a0aa4d17615f9e61ed073ecb9aa4cbb86feaf4007dc86de8f139e1ff01ff5a6ff5e46db1ede026243c47755cfc33c3dbe4f8871fc62322a3a230ffd865b7b5bfc0e99677877517f562245cdda012e28941b4bad8a25d5edb427152ca0948940a12f489aa259377b0eb0cd1f084faf4dd9ae08c43aba780a6a0245a3a5d13253523272bc7b82ed16ecbcfa94fce8f3033fcf863240134265b70e2ff0b31a35ce0c5d0cba7efb7a4ede29e884da05ee3ede095433c9bfd6fea5"
hash=$(${CLI} send mix deposit -m 1000000000 -p ./gnark/ -w "" -v true -t 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -a 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR -r 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 -e coins -s bty -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01) hash=$(${CLI} send mix deposit -m 1000000000 -p ./gnark/ -w "" -v true -t 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -a 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR -r 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 -e coins -s bty -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
echo "${hash}" echo "${hash}"
query_tx "${CLI}" "${hash}" query_tx "${CLI}" "${hash}"
...@@ -126,9 +120,8 @@ function mix_deposit() { ...@@ -126,9 +120,8 @@ function mix_deposit() {
authHash=$(${MIX_CLI32} mix wallet notes -a 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR -s 3 | jq -r ".notes[0].noteHash") authHash=$(${MIX_CLI32} mix wallet notes -a 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR -s 3 | jq -r ".notes[0].noteHash")
authKey=$(${MIX_CLI32} mix wallet notes -a 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR -s 3 | jq -r ".notes[0].secret.returnKey") authKey=$(${MIX_CLI32} mix wallet notes -a 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR -s 3 | jq -r ".notes[0].secret.returnKey")
echo "authHash=$authHash,authKey=$authKey" echo "authHash=$authHash,authKey=$authKey"
proof="1c33f86a705d387a191d598cdf5a4d97d839e49013ec8b73fb265a62bafc03fc17e9b34a36c6f015f49d1e944c945ff16bc3c7b4886591578c780fa829f140560fea4be7ddf3a98a5a620010f7a210456158e3f20b88a5a120980c8b960d15fb1c50a4d93b78c3cb3bc729152e1cd0b1574b3cc63a4ce6fb5f8e51828320df861d70f529eab34712c213a605dda2f05eda7fc4b0aefc99adb2817eb10548489d12591f64709a5ad3dd32a1ebfcdb70c50288af1185b4fa3e9a25636b9cc9df0c22880ab3541018fa25a9fb232ed4dd47e0aa92de0c4ee2f0fab57fe95df096fc01fc054d1331088bb57efd36df79ab36686df37dcb9284943d2047df96bd7635"
rawData=$(${MIX_CLI32} mix auth -n "$authHash" -a "$authKey" -p ./gnark/ -w "" -v true -e coins -s bty) rawData=$(${MIX_CLI32} mix auth -n "$authHash" -a "$authKey" -p ./gnark/ -w "" -v true -e coins -s bty)
signData=$(${CLI} wallet sign -d $rawData -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01) signData=$(${CLI} wallet sign -d "$rawData" -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
hash=$(${CLI} wallet send -d "$signData") hash=$(${CLI} wallet send -d "$signData")
echo "${hash}" echo "${hash}"
query_tx "${CLI}" "${hash}" query_tx "${CLI}" "${hash}"
...@@ -137,9 +130,8 @@ function mix_deposit() { ...@@ -137,9 +130,8 @@ function mix_deposit() {
echo "transfer to 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k" echo "transfer to 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"
transHash=$(${MIX_CLI31} mix wallet notes -a 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 -s 1 | jq -r ".notes[0].noteHash") transHash=$(${MIX_CLI31} mix wallet notes -a 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 -s 1 | jq -r ".notes[0].noteHash")
proof="1c33f86a705d387a191d598cdf5a4d97d839e49013ec8b73fb265a62bafc03fc17e9b34a36c6f015f49d1e944c945ff16bc3c7b4886591578c780fa829f140560fea4be7ddf3a98a5a620010f7a210456158e3f20b88a5a120980c8b960d15fb1c50a4d93b78c3cb3bc729152e1cd0b1574b3cc63a4ce6fb5f8e51828320df861d70f529eab34712c213a605dda2f05eda7fc4b0aefc99adb2817eb10548489d12591f64709a5ad3dd32a1ebfcdb70c50288af1185b4fa3e9a25636b9cc9df0c22880ab3541018fa25a9fb232ed4dd47e0aa92de0c4ee2f0fab57fe95df096fc01fc054d1331088bb57efd36df79ab36686df37dcb9284943d2047df96bd7635-172b267f5d1d1a629b364388c803405485aee2d5a86c4438dddba011c5ce77b42d7e5f12179642372f325af5d6fca46d169a2437e732461c4f4993a4ac3938a92c89038d4ba4434dacf7113c59e7be32a1952e0a452bd23621fa7159af74eb351a5ca048e591be47db5d45d54505c8924c7c1c5ec3d4df8e5b7c6e7f3ccf563d1acf12ad74b6985d9ba676a3db5abb69f0d4b687f8f11d019479ef22671b1cc90511e3fa819ad60f07d20329af3bfc0344f1a96b61e3f77c50885c5701be8e480482a58a06b3469b2d5821fca30e8d283c2e8e26c2106604709280e00c3df77f2ea8d9b4263ddedeab056d206c4665ed2caa28d4af67f09f32922239e1e5e572-1b66ecc95b8caf448d3bd235662c24a218a5c75ab42d41a8def3310424ac2d4515dfe9c9c77ad041e76ca2175d7e91de608cd39dea0194dc4eed7304d3126b230041306b465e74397b104db0303d87e0b02d052f6c7486d249a4dd5635f268ed1cd9180c6603351d1d74ed3f64283b0bfb75736d391892818f037b2549cb7e6d0b139b88edbf530fc3711e5c9235fa0e5b10af2fd03ac5993a6936d52ed51f250cfc84d3a379b9caa41ce9bf911259c1d7da73f8551032af8e3939c4d03e9cb125d0871b2e7a4ed474b87376188fd2fc463d0807d9bd701a6339c82489b523e022151dc964977616cc1d12176aad27d596b3e5caa4538d8716f93bfcaa2f2588"
rawData=$(${MIX_CLI31} mix transfer -m 600000000 -n "$transHash" -t 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -p ./gnark/ -w "" -v true -e coins -s bty) rawData=$(${MIX_CLI31} mix transfer -m 600000000 -n "$transHash" -t 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -p ./gnark/ -w "" -v true -e coins -s bty)
signData=$(${CLI} wallet sign -d $rawData -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01) signData=$(${CLI} wallet sign -d "$rawData" -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
hash=$(${CLI} wallet send -d "$signData") hash=$(${CLI} wallet send -d "$signData")
echo "${hash}" echo "${hash}"
query_tx "${CLI}" "${hash}" query_tx "${CLI}" "${hash}"
...@@ -148,9 +140,8 @@ function mix_deposit() { ...@@ -148,9 +140,8 @@ function mix_deposit() {
echo "withdraw" echo "withdraw"
withdrawHash=$(${MIX_CLI30} mix wallet notes -a 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -s 1 | jq -r ".notes[0].noteHash") withdrawHash=$(${MIX_CLI30} mix wallet notes -a 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -s 1 | jq -r ".notes[0].noteHash")
proof="152d166b3cbf1863f9da7ebb478a99d170544653d870a48533a48da8c484f2590fc795d9db67816b39a3dec2562dccfc5920b88236b766b8c3879e1d991121aa1b28801f92fac0597d397dc605b1e479742dbc3354bd1f33c8b52fac95cf047c29302a139eef9c948d148641e91d8b122785570d4a6c753c289e61bba96860c719fad87bb0954fc6ed3616f32af3f978aa26aeb03d123d312f569be901057c64123a2fed3890d5c0e59b3cff0e527dfe23b3f069227fd975a11c41133772cd311aa1b7ab4ff4849e01d7475c99e6e5fbc3fb0c1817e5f0a3ae98a7dc513af1e011aadc35e47b0359e39d89a50ff585b436fd27f5bc0bc973047c5b2fd52cd606"
rawData=$(${MIX_CLI30} mix withdraw -m 600000000 -n "$withdrawHash" -p ./gnark/ -w "" -v true -e coins -s bty) rawData=$(${MIX_CLI30} mix withdraw -m 600000000 -n "$withdrawHash" -p ./gnark/ -w "" -v true -e coins -s bty)
signData=$(${CLI} wallet sign -d $rawData -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115) signData=$(${CLI} wallet sign -d "$rawData" -k 0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115)
hash=$(${CLI} wallet send -d "$signData") hash=$(${CLI} wallet send -d "$signData")
echo "${hash}" echo "${hash}"
...@@ -162,7 +153,7 @@ function mix_deposit() { ...@@ -162,7 +153,7 @@ function mix_deposit() {
balance=$(${CLI} account balance -a 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -e mix | jq -r ".balance") balance=$(${CLI} account balance -a 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -e mix | jq -r ".balance")
if [ "${balance}" != "6.0000" ]; then if [ "${balance}" != "6.0000" ]; then
echo "account 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k should be 6.0000, real is $balance" echo "account 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k should be 6.0000, real is $balance"
# exit 1 exit 1
fi fi
} }
...@@ -198,7 +189,6 @@ function mix_token_test() { ...@@ -198,7 +189,6 @@ function mix_token_test() {
query_tx "${CLI}" "${hash}" query_tx "${CLI}" "${hash}"
echo "mix deposit" echo "mix deposit"
proof="12c840fed692d2f38e6d227e6b4dfe46f0107075035adbb035c652f9e00a662b2ce53546477aff0fc320dd8c505cab2861d494a173be2fdfb6ddb033542a8bb10826dce453a6aa7c728e821b67a7c0dac14dd76135c04d71985e6682a4a4e0ca033be19ce61562235ae9d62cb8409599331da4b11718169fdddde4b6e4642f60031f64e90a2c37f627059af4db30e92ce9d3f45a7f4683088f048ed2e34d331a0966758a7849abfe4a15d2f7df52a1be3270bd13b2c87d559cfd85c3e12aed911627413fb9e99be990e0b4ea9c61ef68ba655bf003cbc050d92febfc337c32b52e7c30942536885d0b62ea3b44261f557d12ef4c24cc3728d4ea91d39b19ebf5"
hash=$(${CLI} send mix deposit -m 1000000000 -p ./gnark/ -w "" -v true -t 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -e token -s GD -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01) hash=$(${CLI} send mix deposit -m 1000000000 -p ./gnark/ -w "" -v true -t 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -e token -s GD -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
echo "${hash}" echo "${hash}"
query_tx "${CLI}" "${hash}" query_tx "${CLI}" "${hash}"
...@@ -206,9 +196,8 @@ function mix_token_test() { ...@@ -206,9 +196,8 @@ function mix_token_test() {
query_note "${MIX_CLI30}" 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k 1 query_note "${MIX_CLI30}" 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k 1
echo "transfer to 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" echo "transfer to 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
transHash=$(${MIX_CLI30} mix wallet notes -a 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -s 1 | jq -r ".notes[0].noteHash") transHash=$(${MIX_CLI30} mix wallet notes -a 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k -s 1 | jq -r ".notes[0].noteHash")
proof="19af0372674c7a4b2ab9126abe97862a75c0359998c02846fc9e43c6a75ef93d100b12a6f0caefb55d45407b8fee49271a20be3fe1615ca535635cf58a20625922cb46d5f9c41054f6d85b4c7df1ac5d308d3c0187f2b787befe5fcf80f790351a200124cdde88299fa3b6bdf9e88969607ea4816066f51f05d77b2034b5676817a8ece901f5df1993b242d1cf2bfd0f91d4478b33ff0994d6ea70830feaecf40d12f855ccd1cf73e2c7e27f5cf1df357c25293decc91d8cc252bbb5e19cd3741a90834263874d77ca79e6e69e6711cc4d73f1045942448eb3600dd58a1e084b1960fe8bf0dbfcb54dfdbed79f3c3c9b5a22469a7aa4e195b247bfd26f1fca73-17b4593758ceed61ac96cba435d5bfe6b7cdcdc8e2e4deab88aeadf433e37542131a1c2f4f5383a57387b2de3b5767e91d301b9e42da4858513bf897c8441ce205284b694309a57dc8dcdea27922742c446c94413054de7451f6f21d0425fecb1ce6b7a52d044fdbf52f842cd8fb2c4539a0cfa7973293fa78b0c5e656df40650ad4d041ecc9f50c72c4de2db6f917a5e08dff6f59e7a48bdd9f74667193fa7218ec30659bc1409354f58ae3fc98be3b0810dc83a39a4ee84e586487747b62e61e5f07914c2e94bd86128944106239ba523377d87216cb2c91191e1ac3c1a7382a3e9ee7868da53d20fdef596008c4641b48ca2b052a3c569ff5a2364aab5aa5-234cd13277ef10f2ffe28cd56964411b70040e2bec022e00ac068c9a5c94ed510b2f04e1a4377efd2e83f543cdfdfae0b1bd70595b5b6ea0db15b6c161354dd90e0028c5ae061cb46e10cbdd58d7558798350956777981178a3a08ad4f8513af06fb315045f3f438358206e543ad7b5caa93e9b9d82f7452a7d57dbf48ebd4c42f8583c62a050bd2b143340bdcbeb641679a49a607ee13e7fde5d1eba0217a1b0384ff474d6d5f041b1eba24b70b8f807b4bc45a4751a7cba10d806fef6ba6f122fa1928ba8328e89f82c2281330460931a69324e14fe584e0a9ab851b069a6304e0178f04a0bc89ffb50e7755328ba8ef84ca830424bed6ef3a8142c567ff2b"
rawData=$(${MIX_CLI30} mix transfer -m 600000000 -n "$transHash" -t 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs -p ./gnark/ -w "" -v true -e token -s GD) rawData=$(${MIX_CLI30} mix transfer -m 600000000 -n "$transHash" -t 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs -p ./gnark/ -w "" -v true -e token -s GD)
signData=$(${CLI} wallet sign -d $rawData -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01) signData=$(${CLI} wallet sign -d "$rawData" -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
hash=$(${CLI} wallet send -d "$signData") hash=$(${CLI} wallet send -d "$signData")
echo "${hash}" echo "${hash}"
query_tx "${CLI}" "${hash}" query_tx "${CLI}" "${hash}"
...@@ -217,9 +206,8 @@ function mix_token_test() { ...@@ -217,9 +206,8 @@ function mix_token_test() {
echo "withdraw token GD" echo "withdraw token GD"
withdrawHash=$(${MIX_CLI30} mix wallet notes -a 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs -s 1 | jq -r ".notes[0].noteHash") withdrawHash=$(${MIX_CLI30} mix wallet notes -a 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs -s 1 | jq -r ".notes[0].noteHash")
proof="2ae76d20889a6be8c9173bd7fa93883a4d3f018b01d083f80809e363b954fab626327fc97e34d830a8101fa6c6fce2fcbc613a8794776488a9acad7983af189f225e1b7284f40ab265092524c20219da32ccf4ac6dc2a8b2de924e43e8763c421bf55d90f6615e15aa228549b09f48f7072af6f768528da8a7b13611950b8e611513ec503c0ea0a0782106eb85dc0493a117f699465cff63d44beec2668ab368207bab40cf1867e11fbc947408339f04cd991eda2b1a250fb181080f575cfe650cc4e1144a6f02e997d49269c0406a373913bc2530fd96fa2856c459de596da71d12b0e8aef76d33d4e862879636c9f9d21ff49789d93f9f671013c9e0489774"
rawData=$(${MIX_CLI30} mix withdraw -m 600000000 -n "$withdrawHash" -p ./gnark/ -w "" -v true -e token -s GD) rawData=$(${MIX_CLI30} mix withdraw -m 600000000 -n "$withdrawHash" -p ./gnark/ -w "" -v true -e token -s GD)
signData=$(${CLI} wallet sign -d $rawData -k 0xcacb1f5d51700aea07fca2246ab43b0917d70405c65edea9b5063d72eb5c6b71) signData=$(${CLI} wallet sign -d "$rawData" -k 0xcacb1f5d51700aea07fca2246ab43b0917d70405c65edea9b5063d72eb5c6b71)
hash=$(${CLI} wallet send -d "$signData") hash=$(${CLI} wallet send -d "$signData")
echo "${hash}" echo "${hash}"
query_tx "${CLI}" "${hash}" query_tx "${CLI}" "${hash}"
...@@ -230,7 +218,7 @@ function mix_token_test() { ...@@ -230,7 +218,7 @@ function mix_token_test() {
balance=$(${CLI} asset balance -a 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs -e mix --asset_exec token --asset_symbol GD | jq -r ".balance") balance=$(${CLI} asset balance -a 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs -e mix --asset_exec token --asset_symbol GD | jq -r ".balance")
if [ "${balance}" != "6.0000" ]; then if [ "${balance}" != "6.0000" ]; then
echo "account 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs should be 6.0000, real is $balance" echo "account 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs should be 6.0000, real is $balance"
# exit 1 exit 1
fi fi
} }
function query_note() { function query_note() {
...@@ -289,9 +277,7 @@ function mix() { ...@@ -289,9 +277,7 @@ function mix() {
mix_set_wallet mix_set_wallet
mix_transfer mix_transfer
elif elif [ "${2}" == "test" ]; then
[ "${2}" == "test" ]
then
mix_test "${1}" mix_test "${1}"
fi fi
......
...@@ -453,6 +453,9 @@ func CalcTreeProve(db dbm.KV, exec, symbol, rootHash, leaf string) (*mixTy.Commi ...@@ -453,6 +453,9 @@ func CalcTreeProve(db dbm.KV, exec, symbol, rootHash, leaf string) (*mixTy.Commi
for i := status.ArchiveRootsSeq; i > 0; i-- { for i := status.ArchiveRootsSeq; i > 0; i-- {
roots, err := getArchiveRoots(db, exec, symbol, i) roots, err := getArchiveRoots(db, exec, symbol, i)
if err != nil {
return nil, errors.Wrapf(err, "getArchiveRoots,i=%d", i)
}
leaves, err := getCommitRootLeaves(db, exec, symbol, mixTy.Byte2Str(roots.Roots[0])) leaves, err := getCommitRootLeaves(db, exec, symbol, mixTy.Byte2Str(roots.Roots[0]))
if err == nil { if err == nil {
p, err := getProveData(mixTy.Str2Byte(leaf), leaves.Leaves) p, err := getProveData(mixTy.Str2Byte(leaf), leaves.Leaves)
......
...@@ -45,9 +45,9 @@ func TestGetProveData(t *testing.T) { ...@@ -45,9 +45,9 @@ func TestGetProveData(t *testing.T) {
proves := []string{ proves := []string{
"21467822781369104390668289189963532506973289112396605437823854946060028754354", "21467822781369104390668289189963532506973289112396605437823854946060028754354",
"4010939160279929375357088561050093294975728828994381439611270589357856115894", "367337696696422936865919560478589243810446804477597373440139066420957868266",
"19203142125680456902129919467753534834062383756119332074615431762320316227830", "5538594811879266165080692952618163249542275094298127431082963485737222728396",
"5949485921924623528448830799540295699445001672535082168235329176256394356669", "143025316472030670451892215893941356364968202515180811944684799652132907215",
} }
var leave [][]byte var leave [][]byte
...@@ -59,7 +59,7 @@ func TestGetProveData(t *testing.T) { ...@@ -59,7 +59,7 @@ func TestGetProveData(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, uint32(5), ret.NumLeaves) assert.Equal(t, uint32(5), ret.NumLeaves)
assert.Equal(t, uint32(1), ret.ProofIndex) assert.Equal(t, uint32(1), ret.ProofIndex)
assert.Equal(t, "12154966389094759868987627011400429400046999538507894392248611367616715657246", ret.RootHash) assert.Equal(t, "2857051084155588640772960772751117206153267452172716633910046945631762242957", ret.RootHash)
assert.Equal(t, len(proves), len(ret.ProofSet)) assert.Equal(t, len(proves), len(ret.ProofSet))
for i, k := range proves { for i, k := range proves {
assert.Equal(t, k, ret.ProofSet[i]) assert.Equal(t, k, ret.ProofSet[i])
......
...@@ -17,18 +17,18 @@ func TestAuthorize(t *testing.T) { ...@@ -17,18 +17,18 @@ func TestAuthorize(t *testing.T) {
r1cs, err := frontend.Compile(ecc.BN254, backend.GROTH16, &authCircuit) r1cs, err := frontend.Compile(ecc.BN254, backend.GROTH16, &authCircuit)
assert.NoError(err) assert.NoError(err)
{ {
authCircuit.TreeRootHash.Assign("950328190378475063285997697131233976268556642407874368795731039491163033995") authCircuit.TreeRootHash.Assign("18953560960857123326054550555759265877143310030168748002053709716397549796490")
authCircuit.AuthorizeHash.Assign("12118078255438699776281693699296572905522325280239057706039401491884511470990") authCircuit.AuthorizeHash.Assign("4895770928816523282558547614022568289586238930922185617307655942541278140196")
authCircuit.AuthorizeSpendHash.Assign("21866258877426223880121052705448065394371888667902748431050285218933372701264") authCircuit.AuthorizeSpendHash.Assign("17847836824302447823607018011193117302314262324241905063439417486141908449945")
authCircuit.ReceiverPubKey.Assign("13496572805321444273664325641440458311310163934354047265362731297880627774936") authCircuit.ReceiverPubKey.Assign("13496572805321444273664325641440458311310163934354047265362731297880627774936")
authCircuit.ReturnPubKey.Assign("10193030166569398670555398535278072963719579248877156082361830729347727033510") authCircuit.ReturnPubKey.Assign("10193030166569398670555398535278072963719579248877156082361830729347727033510")
authCircuit.AuthorizePubKey.Assign("2302306531516619173363925550130201424458047172090558749779153607734711372580") authCircuit.AuthorizePubKey.Assign("21375443884718346645287794853944958188610587325651351394209548420684867245331")
authCircuit.AuthorizePriKey.Assign("17822967620457187568904804290291537271142779717280482398091401115827760898835") authCircuit.AuthorizePriKey.Assign("17822967620457187568904804290291537271142779717280482398091401115827760898835")
authCircuit.NoteRandom.Assign("2824204835") authCircuit.NoteRandom.Assign("2824204835")
authCircuit.Amount.Assign("28242048") authCircuit.Amount.Assign("28242048")
authCircuit.SpendFlag.Assign("1") authCircuit.SpendFlag.Assign("1")
authCircuit.NoteHash.Assign("11183619348394875496624033204802036013086293645689330234403504655205992608466") authCircuit.NoteHash.Assign("4641322019922509455032097629889269851124503217947103069347447050214760728147")
authCircuit.Path0.Assign("19561523370160677851616596032513161448778901506614020103852017946679781620105") authCircuit.Path0.Assign("19561523370160677851616596032513161448778901506614020103852017946679781620105")
authCircuit.Path1.Assign("13898857070666440684265042188056372750257678232709763835292910585848522658637") authCircuit.Path1.Assign("13898857070666440684265042188056372750257678232709763835292910585848522658637")
......
...@@ -39,7 +39,7 @@ func TestDeposit(t *testing.T) { ...@@ -39,7 +39,7 @@ func TestDeposit(t *testing.T) {
{ {
//var witness Deposit //var witness Deposit
depositCircuit.NoteHash.Assign("11183619348394875496624033204802036013086293645689330234403504655205992608466") depositCircuit.NoteHash.Assign("14803109164298493466684583242985432968056297173621710679077236816845588688436")
depositCircuit.Amount.Assign(28242048) depositCircuit.Amount.Assign(28242048)
depositCircuit.ReceiverPubKey.Assign("13496572805321444273664325641440458311310163934354047265362731297880627774936") depositCircuit.ReceiverPubKey.Assign("13496572805321444273664325641440458311310163934354047265362731297880627774936")
depositCircuit.ReturnPubKey.Assign("10193030166569398670555398535278072963719579248877156082361830729347727033510") depositCircuit.ReturnPubKey.Assign("10193030166569398670555398535278072963719579248877156082361830729347727033510")
......
...@@ -18,15 +18,15 @@ func TestTransferInput(t *testing.T) { ...@@ -18,15 +18,15 @@ func TestTransferInput(t *testing.T) {
assert.NoError(err) assert.NoError(err)
{ {
inputCircuit.TreeRootHash.Assign("950328190378475063285997697131233976268556642407874368795731039491163033995") inputCircuit.TreeRootHash.Assign("457812157273975068180144939194931372467682914013265626991402231230450012330")
inputCircuit.AuthorizeSpendHash.Assign("21866258877426223880121052705448065394371888667902748431050285218933372701264") inputCircuit.AuthorizeSpendHash.Assign("14463129595522277797353018005538222902035087589748809554960616199173731919802")
inputCircuit.NullifierHash.Assign("18261754976334473090934939020486888794395514077667802499672726421629833403191") inputCircuit.NullifierHash.Assign("12376093571606701949533526735186436482268907783512509935977783346861805262929")
inputCircuit.ShieldAmountX.Assign("12598656472198560295956115825363858683566688303969048230275808317634686855820") inputCircuit.ShieldAmountX.Assign("12598656472198560295956115825363858683566688303969048230275808317634686855820")
inputCircuit.ShieldAmountY.Assign("5287524325952639485224317845546845679649328720392059741208352845659048630229") inputCircuit.ShieldAmountY.Assign("5287524325952639485224317845546845679649328720392059741208352845659048630229")
inputCircuit.ShieldPointHX.Assign("19172955941344617222923168298456110557655645809646772800021167670156933290312") inputCircuit.ShieldPointHX.Assign("19172955941344617222923168298456110557655645809646772800021167670156933290312")
inputCircuit.ShieldPointHY.Assign("21116962883761739586121793871108889864627195706475546685847911817475098399811") inputCircuit.ShieldPointHY.Assign("21116962883761739586121793871108889864627195706475546685847911817475098399811")
inputCircuit.ReceiverPubKey.Assign("13496572805321444273664325641440458311310163934354047265362731297880627774936") inputCircuit.ReceiverPubKey.Assign("20094753906906836700810108535649927887994772258248603565615394844515069419451")
inputCircuit.ReturnPubKey.Assign("10193030166569398670555398535278072963719579248877156082361830729347727033510") inputCircuit.ReturnPubKey.Assign("10193030166569398670555398535278072963719579248877156082361830729347727033510")
inputCircuit.AuthorizePubKey.Assign("2302306531516619173363925550130201424458047172090558749779153607734711372580") inputCircuit.AuthorizePubKey.Assign("2302306531516619173363925550130201424458047172090558749779153607734711372580")
inputCircuit.NoteRandom.Assign("2824204835") inputCircuit.NoteRandom.Assign("2824204835")
...@@ -35,7 +35,7 @@ func TestTransferInput(t *testing.T) { ...@@ -35,7 +35,7 @@ func TestTransferInput(t *testing.T) {
inputCircuit.SpendPriKey.Assign("10190477835300927557649934238820360529458681672073866116232821892325659279502") inputCircuit.SpendPriKey.Assign("10190477835300927557649934238820360529458681672073866116232821892325659279502")
inputCircuit.SpendFlag.Assign("1") inputCircuit.SpendFlag.Assign("1")
inputCircuit.AuthorizeFlag.Assign("1") inputCircuit.AuthorizeFlag.Assign("1")
inputCircuit.NoteHash.Assign("11183619348394875496624033204802036013086293645689330234403504655205992608466") inputCircuit.NoteHash.Assign("1933334234871933218683301093524793045543211425994253628606123874146452475778")
inputCircuit.Path0.Assign("19561523370160677851616596032513161448778901506614020103852017946679781620105") inputCircuit.Path0.Assign("19561523370160677851616596032513161448778901506614020103852017946679781620105")
inputCircuit.Path1.Assign("13898857070666440684265042188056372750257678232709763835292910585848522658637") inputCircuit.Path1.Assign("13898857070666440684265042188056372750257678232709763835292910585848522658637")
......
...@@ -20,7 +20,7 @@ func TestTransferOutput(t *testing.T) { ...@@ -20,7 +20,7 @@ func TestTransferOutput(t *testing.T) {
{ {
outCircuit.NoteHash.Assign("11183619348394875496624033204802036013086293645689330234403504655205992608466") outCircuit.NoteHash.Assign("14803109164298493466684583242985432968056297173621710679077236816845588688436")
outCircuit.ShieldAmountX.Assign("12598656472198560295956115825363858683566688303969048230275808317634686855820") outCircuit.ShieldAmountX.Assign("12598656472198560295956115825363858683566688303969048230275808317634686855820")
outCircuit.ShieldAmountY.Assign("5287524325952639485224317845546845679649328720392059741208352845659048630229") outCircuit.ShieldAmountY.Assign("5287524325952639485224317845546845679649328720392059741208352845659048630229")
outCircuit.ShieldPointHX.Assign("19172955941344617222923168298456110557655645809646772800021167670156933290312") outCircuit.ShieldPointHX.Assign("19172955941344617222923168298456110557655645809646772800021167670156933290312")
......
...@@ -17,19 +17,19 @@ func TestWithdraw(t *testing.T) { ...@@ -17,19 +17,19 @@ func TestWithdraw(t *testing.T) {
r1cs, err := frontend.Compile(ecc.BN254, backend.GROTH16, &withdrawCircuit) r1cs, err := frontend.Compile(ecc.BN254, backend.GROTH16, &withdrawCircuit)
assert.NoError(err) assert.NoError(err)
{ {
withdrawCircuit.TreeRootHash.Assign("950328190378475063285997697131233976268556642407874368795731039491163033995") withdrawCircuit.TreeRootHash.Assign("457812157273975068180144939194931372467682914013265626991402231230450012330")
withdrawCircuit.AuthorizeSpendHash.Assign("21866258877426223880121052705448065394371888667902748431050285218933372701264") withdrawCircuit.AuthorizeSpendHash.Assign("14463129595522277797353018005538222902035087589748809554960616199173731919802")
withdrawCircuit.NullifierHash.Assign("18261754976334473090934939020486888794395514077667802499672726421629833403191") withdrawCircuit.NullifierHash.Assign("12376093571606701949533526735186436482268907783512509935977783346861805262929")
withdrawCircuit.Amount.Assign("28242048") withdrawCircuit.Amount.Assign("28242048")
withdrawCircuit.ReceiverPubKey.Assign("13496572805321444273664325641440458311310163934354047265362731297880627774936") withdrawCircuit.ReceiverPubKey.Assign("20094753906906836700810108535649927887994772258248603565615394844515069419451")
withdrawCircuit.ReturnPubKey.Assign("10193030166569398670555398535278072963719579248877156082361830729347727033510") withdrawCircuit.ReturnPubKey.Assign("10193030166569398670555398535278072963719579248877156082361830729347727033510")
withdrawCircuit.AuthorizePubKey.Assign("2302306531516619173363925550130201424458047172090558749779153607734711372580") withdrawCircuit.AuthorizePubKey.Assign("2302306531516619173363925550130201424458047172090558749779153607734711372580")
withdrawCircuit.NoteRandom.Assign("2824204835") withdrawCircuit.NoteRandom.Assign("2824204835")
withdrawCircuit.SpendPriKey.Assign("10190477835300927557649934238820360529458681672073866116232821892325659279502") withdrawCircuit.SpendPriKey.Assign("10190477835300927557649934238820360529458681672073866116232821892325659279502")
withdrawCircuit.SpendFlag.Assign("1") withdrawCircuit.SpendFlag.Assign("1")
withdrawCircuit.AuthorizeFlag.Assign("1") withdrawCircuit.AuthorizeFlag.Assign("1")
withdrawCircuit.NoteHash.Assign("11183619348394875496624033204802036013086293645689330234403504655205992608466") withdrawCircuit.NoteHash.Assign("1933334234871933218683301093524793045543211425994253628606123874146452475778")
withdrawCircuit.Path0.Assign("19561523370160677851616596032513161448778901506614020103852017946679781620105") withdrawCircuit.Path0.Assign("19561523370160677851616596032513161448778901506614020103852017946679781620105")
withdrawCircuit.Path1.Assign("13898857070666440684265042188056372750257678232709763835292910585848522658637") withdrawCircuit.Path1.Assign("13898857070666440684265042188056372750257678232709763835292910585848522658637")
......
...@@ -42,13 +42,6 @@ func ExampleX25519() { ...@@ -42,13 +42,6 @@ func ExampleX25519() {
// Output: // Output:
} }
func ExampleX25519_Params() {
c25519 := X25519()
p := c25519.Params()
fmt.Printf("Name: %s BitSize: %d", p.Name, p.BitSize)
// Output: Name: Curve25519 BitSize: 255
}
func TestX25519(t *testing.T) { func TestX25519(t *testing.T) {
dh := X25519() dh := X25519()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment