update fork

This commit is contained in:
0xmuralik
2022-10-10 16:08:33 +05:30
parent 632d53e34a
commit 56d59feaa0
383 changed files with 36784 additions and 21462 deletions
+5 -6
View File
@@ -16,7 +16,7 @@ Increasingly difficult tests are provided:
To run the tests, you can use the `test-helper.js` utility to test all suites under `ganache` or `ethermint` network. The `test-helper.js` will help you spawn an `ethermintd` process before running the tests.
You can simply run `yarn test --network ethermint` to run all tests with ethermint network, or you can run `yarn test --network ganache` to use ganache shipped with truffle. In most cases, there two networks should produce identical test results.
You can simply run `yarn test --network ethermint` to run all tests with ethermint network, or you can run `yarn test --network ganache` to use ganache shipped with truffle. In most cases, there two networks should produce identical test results.
If you only want to run a few test cases, append the name of tests following by the command line. For example, use `yarn test --network ethermint basic` to run the `basic` test under `ethermint` network.
@@ -32,13 +32,12 @@ You will now have three ethereum accounts unlocked in the test node:
- `0xddd64b4712f7c8f1ace3c145c950339eddaf221d` (User 1)
- `0x0f54f47bf9b8e317b214ccd6a7c3e38b893cd7f0` (user 2)
Keep the terminal window open, go into any of the tests and run `yarn test-ethermint`. You should see `ethermintd` accepting transactions and producing blocks. You should be able to query for any transaction via:
- `ethermintd query tx <cosmos-sdk tx>`
- `curl localhost:8545 -H "Content-Type:application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["<ethereum tx>"],"id":1}'`
From here, in your other available terminal,
From here, in your other available terminal,
And obviously more, via the Ethereum JSON-RPC API).
When in doubt, you can also run the tests against a Ganache instance via `yarn test-ganache`, to make sure they are behaving correctly.
@@ -48,11 +47,11 @@ When in doubt, you can also run the tests against a Ganache instance via `yarn t
The [`init-test-node.sh`](./init-test-node.sh) script sets up ethermint with the following accounts:
- `ethm10jmp6sgh4cc6zt3e8gw05wavvejgr5pwtu750w` (Validator)
- `0x7cB61D4117AE31a12E393a1Cfa3BaC666481D02E`
- `0x7cB61D4117AE31a12E393a1Cfa3BaC666481D02E`
- `ethm1cml96vmptgw99syqrrz8az79xer2pcgp767p9e` (User 1)
- `0xC6Fe5D33615a1C52c08018c47E8Bc53646A0E101`
- `0xC6Fe5D33615a1C52c08018c47E8Bc53646A0E101`
- `ethm1jcltmuhplrdcwp7stlr4hlhlhgd4htqhgjpff2` (user 2)
- `0x963EBDf2e1f8DB8707D05FC75bfeFFBa1B5BaC17`
- `0x963EBDf2e1f8DB8707D05FC75bfeFFBa1B5BaC17`
Each with roughly 100 ETH available (1e18 photon).
+18 -18
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 ~/.laconic*
rm -rf ~/.ethermint*
# Import keys from mnemonics
echo $VAL_MNEMONIC | laconicd keys add $VAL_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER1_MNEMONIC | laconicd keys add $USER1_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER2_MNEMONIC | laconicd keys add $USER2_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER3_MNEMONIC | laconicd keys add $USER3_KEY --recover --keyring-backend test --algo "eth_secp256k1"
echo $USER4_MNEMONIC | laconicd keys add $USER4_KEY --recover --keyring-backend test --algo "eth_secp256k1"
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"
laconicd init $MONIKER --chain-id $CHAINID
ethermintd init $MONIKER --chain-id $CHAINID
# Set gas limit in genesis
cat $HOME/.laconicd/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
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
# Reduce the block time to 1s
sed -i -e '/^timeout_commit =/ s/= .*/= "850ms"/' $HOME/.laconicd/config/config.toml
sed -i -e '/^timeout_commit =/ s/= .*/= "850ms"/' $HOME/.ethermintd/config/config.toml
# Allocate genesis accounts (cosmos formatted addresses)
laconicd add-genesis-account "$(laconicd keys show $VAL_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
laconicd add-genesis-account "$(laconicd keys show $USER1_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
laconicd add-genesis-account "$(laconicd keys show $USER2_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
laconicd add-genesis-account "$(laconicd keys show $USER3_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
laconicd add-genesis-account "$(laconicd keys show $USER4_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test
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
# Sign genesis transaction
laconicd gentx $VAL_KEY 1000000000000000000stake --amount=1000000000000000000000aphoton --chain-id $CHAINID --keyring-backend test
ethermintd gentx $VAL_KEY 1000000000000000000stake --amount=1000000000000000000000aphoton --chain-id $CHAINID --keyring-backend test
# Collect genesis tx
laconicd collect-gentxs
ethermintd collect-gentxs
# Run this to ensure everything worked and that the genesis file is setup correctly
laconicd validate-genesis
ethermintd validate-genesis
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
laconicd start --pruning=nothing --rpc.unsafe --keyring-backend test --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable --mode validator
ethermintd start --pruning=nothing --rpc.unsafe --keyring-backend test --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable
+1 -1
View File
@@ -13,7 +13,7 @@
]
},
"dependencies": {
"truffle": "5.4.14",
"truffle": "5.5.8",
"yargs": "^17.0.1",
"patch-package": "^6.4.7"
},
+1 -1
View File
@@ -11,6 +11,6 @@
"truffle-assertions": "^0.9.2"
},
"dependencies": {
"@truffle/hdwallet-provider": "^1.5.1-alpha.1"
"@truffle/hdwallet-provider": "^1.6.0"
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"@truffle/hdwallet-provider": "^1.4.1",
"@truffle/hdwallet-provider": "^1.6.0",
"concurrently": "^6.2.0",
"truffle-assertions": "^0.9.2"
},
+3 -3
View File
@@ -181,7 +181,7 @@ function setupNetwork({ runConfig, timeout }) {
stdio: ['ignore', runConfig.verboseLog ? 'pipe' : 'ignore', 'pipe'],
});
logger.info(`Starting Laconicd process... timeout: ${timeout}ms`);
logger.info(`Starting Ethermintd 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('Laconicd started');
logger.info('Ethermintd started');
resolve(ethermintdProc);
}
});
});
const timeoutPromise = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('Start laconicd timeout!')), timeout);
setTimeout(() => reject(new Error('Start ethermintd timeout!')), timeout);
});
return Promise.race([spawnPromise, timeoutPromise]);
}
+1000 -139
View File
File diff suppressed because it is too large Load Diff