fix : fix the contract testing

This commit is contained in:
Sai Kumar 2022-04-05 21:22:51 +05:30
parent 4aef5ff22a
commit 56bd697701
2 changed files with 21 additions and 21 deletions

View File

@ -24,38 +24,38 @@ USER4_KEY="user4"
USER4_MNEMONIC="doll midnight silk carpet brush boring pluck office gown inquiry duck chief aim exit gain never tennis crime fragile ship cloud surface exotic patch"
# remove existing daemon and client
rm -rf ~/.ethermint*
rm -rf ~/.chibaclonk*
# Import keys from mnemonics
echo $VAL_MNEMONIC | ethermintd keys add $VAL_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER1_MNEMONIC | ethermintd keys add $USER1_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER2_MNEMONIC | ethermintd keys add $USER2_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER3_MNEMONIC | ethermintd keys add $USER3_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER4_MNEMONIC | ethermintd keys add $USER4_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $VAL_MNEMONIC | chibaclonkd keys add $VAL_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER1_MNEMONIC | chibaclonkd keys add $USER1_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER2_MNEMONIC | chibaclonkd keys add $USER2_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER3_MNEMONIC | chibaclonkd keys add $USER3_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER4_MNEMONIC | chibaclonkd keys add $USER4_KEY --recover --keyring-backend test --algo "eth_secp256k1"
ethermintd init $MONIKER --chain-id $CHAINID
chibaclonkd init $MONIKER --chain-id $CHAINID
# Set gas limit in genesis
cat $HOME/.ethermintd/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.ethermintd/config/tmp_genesis.json && mv $HOME/.ethermintd/config/tmp_genesis.json $HOME/.ethermintd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
# Reduce the block time to 1s
sed -i -e '/^timeout_commit =/ s/= .*/= "850ms"/' $HOME/.ethermintd/config/config.toml
sed -i -e '/^timeout_commit =/ s/= .*/= "850ms"/' $HOME/.chibaclonkd/config/config.toml
# Allocate genesis accounts (cosmos formatted addresses)
ethermintd add-genesis-account "$(ethermintd keys show $VAL_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
ethermintd add-genesis-account "$(ethermintd keys show $USER1_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
ethermintd add-genesis-account "$(ethermintd keys show $USER2_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
ethermintd add-genesis-account "$(ethermintd keys show $USER3_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
ethermintd add-genesis-account "$(ethermintd keys show $USER4_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
chibaclonkd add-genesis-account "$(chibaclonkd keys show $VAL_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
chibaclonkd add-genesis-account "$(chibaclonkd keys show $USER1_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
chibaclonkd add-genesis-account "$(chibaclonkd keys show $USER2_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
chibaclonkd add-genesis-account "$(chibaclonkd keys show $USER3_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
chibaclonkd add-genesis-account "$(chibaclonkd keys show $USER4_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
# Sign genesis transaction
ethermintd gentx $VAL_KEY 1000000000000000000stake --amount=1000000000000000000000aphoton --chain-id $CHAINID --keyring-backend test
chibaclonkd gentx $VAL_KEY 1000000000000000000stake --amount=1000000000000000000000aphoton --chain-id $CHAINID --keyring-backend test
# Collect genesis tx
ethermintd collect-gentxs
chibaclonkd collect-gentxs
# Run this to ensure everything worked and that the genesis file is setup correctly
ethermintd validate-genesis
chibaclonkd validate-genesis
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
ethermintd start --pruning=nothing --rpc.unsafe --keyring-backend test --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable
chibaclonkd start --pruning=nothing --rpc.unsafe --keyring-backend test --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable

View File

@ -181,7 +181,7 @@ function setupNetwork({ runConfig, timeout }) {
stdio: ['ignore', runConfig.verboseLog ? 'pipe' : 'ignore', 'pipe'],
});
logger.info(`Starting Ethermintd process... timeout: ${timeout}ms`);
logger.info(`Starting Chibaclonkd process... timeout: ${timeout}ms`);
if (runConfig.verboseLog) {
ethermintdProc.stdout.pipe(process.stdout);
}
@ -191,14 +191,14 @@ function setupNetwork({ runConfig, timeout }) {
process.stdout.write(oLine);
}
if (oLine.indexOf('Starting JSON-RPC server') !== -1) {
logger.info('Ethermintd started');
logger.info('Chibaclonkd started');
resolve(ethermintdProc);
}
});
});
const timeoutPromise = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('Start ethermintd timeout!')), timeout);
setTimeout(() => reject(new Error('Start chibaclonkd timeout!')), timeout);
});
return Promise.race([spawnPromise, timeoutPromise]);
}