From 2818ad97f5b302f76e3296195bf8daae1868c435 Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Sun, 17 Mar 2019 09:12:50 +0800 Subject: dex: implement recovery mechanism (#258) * dex: implement recovery mechanism The DEXON recovery protocol allows us to use the Ethereum blockchain as a fallback consensus chain to coordinate recovery. * fix --- test/genesis.json | 9 +++++++-- test/run_test.sh | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/genesis.json b/test/genesis.json index fc6cd7fe4..8be5a844d 100644 --- a/test/genesis.json +++ b/test/genesis.json @@ -19,6 +19,7 @@ "miningVelocity": 0.1875, "nextHalvingSupply": "0x813f3978f89409844000000", "lastHalvedAmount": "0x4d8c55aefb8c05b5c000000", + "minGasPrice": "0x3b9aca00", "blockGasLimit": 40000000, "lambdaBA": 250, "lambdaDKG": 1500, @@ -30,8 +31,12 @@ "0x21e19e0c9bab2400000", "0x21e19e0c9bab2400000", "0x152d02c7e14af6800000" - ], - "minGasPrice": "0x3b9aca00" + ] + }, + "recovery": { + "contract": "0xf675c0e9bf4b949f50dcec5b224a70f0361d4680", + "timeout": 30, + "confirmation": 1 } }, "nonce": "0x42", diff --git a/test/run_test.sh b/test/run_test.sh index 48934ab7c..b6db1ba09 100755 --- a/test/run_test.sh +++ b/test/run_test.sh @@ -1,6 +1,6 @@ #!/bin/bash -NETWORK="--bootnodes enode://0478aa13c91aa0db8e93b668313b7eb0532fbdb24f64772375373b14dbe326c238ad09ab4469f6442c9a9753f1275aeec2e531912c14a958ed1feb4ae7e227ef@127.0.0.1:30301" +BOOTNODE_FLAGS="--bootnodes enode://0478aa13c91aa0db8e93b668313b7eb0532fbdb24f64772375373b14dbe326c238ad09ab4469f6442c9a9753f1275aeec2e531912c14a958ed1feb4ae7e227ef@127.0.0.1:30301" GENESIS="genesis.json" GDEX="../build/bin/gdex" @@ -42,10 +42,12 @@ __FILE__ # A standalone RPC server for accepting RPC requests. datadir=$PWD/Dexon.rpc -rm -rf $datadir -$GDEX --datadir=$datadir init ${GENESIS} +if [ "$1" != "--continue" ]; then + rm -rf $datadir + $GDEX --datadir=$datadir init ${GENESIS} +fi $GDEX \ - ${NETWORK} \ + ${BOOTNODE_FLAGS} \ --verbosity=3 \ --gcmode=archive \ --datadir=$datadir --nodekey=keystore/rpc.key \ @@ -61,15 +63,19 @@ NUM_NODES=$(cat ${GENESIS} | grep 'DEXON Test Node' | wc -l) # Nodes for i in $(seq 0 $(($NUM_NODES - 1))); do datadir=$PWD/Dexon.$i - rm -rf $datadir - $GDEX --datadir=$datadir init ${GENESIS} + + if [ "$1" != "--continue" ]; then + rm -rf $datadir + $GDEX --datadir=$datadir init ${GENESIS} + fi $GDEX \ - ${NETWORK} \ + ${BOOTNODE_FLAGS} \ --bp \ --verbosity=4 \ --gcmode=archive \ --datadir=$datadir --nodekey=keystore/test$i.key \ --port=$((30305 + $i)) \ + --recovery.network-rpc="https://rinkeby.infura.io" \ --rpc --rpcapi=eth,net,web3,debug \ --rpcaddr=0.0.0.0 --rpcport=$((8547 + $i * 2)) \ --ws --wsapi=eth,net,web3,debug \ -- cgit v1.2.3