Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
39bcca1
update launch script path & remove duplicate
zsystm Jun 30, 2025
3cdf48f
chore: add private keys info in local_node.sh
zsystm Jun 30, 2025
5e5d68a
add bech32 and bank e2e tests
zsystm Jun 30, 2025
521cb75
add undelegate test
zsystm Jun 30, 2025
700d0e4
faster local node and udpate delegate test
zsystm Jun 30, 2025
7730135
add create validator tc
zsystm Jul 1, 2025
66762f5
update delegate tc
zsystm Jul 1, 2025
38c6b3e
update test codes
zsystm Jul 1, 2025
f1f2222
chore: remove un-used variable
zsystm Jul 1, 2025
59b0c5d
add edit validator tc
zsystm Jul 1, 2025
7ae0efb
add cancel unbonding tc
zsystm Jul 2, 2025
e9f5d63
chore: format test files
zsystm Jul 2, 2025
bd816d3
add redelegate tc
zsystm Jul 2, 2025
3e7f78f
skip gas estimation for faster tests
zsystm Jul 2, 2025
a6d581a
add redelegations query test
zsystm Jul 2, 2025
16cefb4
chore: refactor variable names
zsystm Jul 2, 2025
eb8018d
chore: change filename
zsystm Jul 3, 2025
cfab441
add validators query test and fix gov interface
zsystm Jul 3, 2025
15c16a1
add set withdraw address tc
zsystm Jul 3, 2025
69188bb
order test sequences and add withdraw delegator reward tc
zsystm Jul 3, 2025
493c781
add claim rewards tc
zsystm Jul 4, 2025
52ae413
add withdraw validator commission
zsystm Jul 4, 2025
0dbd25a
Merge remote-tracking branch 'upstream/main' into tests/precompile-e2…
zsystm Jul 7, 2025
0e8e714
add fund community pool tc
zsystm Jul 7, 2025
04ee14f
add deposit validator rewards pool tc
zsystm Jul 7, 2025
05667ef
add validator queries tc
zsystm Jul 8, 2025
40be276
chore: unify convention
zsystm Jul 8, 2025
b016803
add erc20 tc
zsystm Jul 8, 2025
987e026
update local node script
zsystm Jul 8, 2025
e1f4400
fix slashing query and add e2e tests for it
zsystm Jul 8, 2025
f7477c2
fix: decode bech32 consensus address before converting to bytes
zsystm Jul 8, 2025
8882b2c
add gov tc
zsystm Jul 10, 2025
f26aa13
add more tcs to gov precompile (should fix cancel)
zsystm Jul 10, 2025
054b0ff
fix cancel proposal tc
zsystm Jul 10, 2025
9a567d3
add p256 tc
zsystm Jul 10, 2025
d063c7a
remove un-used variables
zsystm Jul 10, 2025
4071ca1
Merge remote-tracking branch 'origin/precompiles/slashing-signing-inf…
zsystm Jul 11, 2025
4db49ee
add werc20 tc
zsystm Jul 11, 2025
a78959d
more timeout and verbose log
zsystm Jul 11, 2025
5b088e8
fix local_node.sh
zsystm Jul 11, 2025
7a76e82
add edgecase test for staking precompile and lint local node script
zsystm Jul 11, 2025
f347e42
revert solidity test script change
zsystm Jul 11, 2025
2a3438a
chore: trim comments
zsystm Jul 11, 2025
84b3160
p256 happy case
zsystm Jul 11, 2025
4e21385
Merge branch 'main' into tests/precompile-e2e-tests-hardhat
vladjdk Jul 15, 2025
18c1d39
Merge branch 'main' into tests/precompile-e2e-tests-hardhat
zsystm Jul 16, 2025
1ac961a
Merge branch 'main' into tests/precompile-e2e-tests-hardhat
Jul 16, 2025
27e8e47
Merge branch 'main' into tests/precompile-e2e-tests-hardhat
Jul 17, 2025
0693d09
refactoring
zsystm Jul 18, 2025
ff99df8
refactor: make findEvent as common
zsystm Jul 18, 2025
6350282
Merge remote-tracking branch 'upstream/main' into tests/precompile-e2…
zsystm Jul 21, 2025
109ab85
check delegation shares and balance also
zsystm Jul 21, 2025
bd74eda
add checking user balance for withdraw delegator reward test
zsystm Jul 21, 2025
b08b07a
add checking user balance for claim rewards tc
zsystm Jul 21, 2025
f814266
strict balance check
zsystm Jul 21, 2025
8a17f8f
add user balance check for fund community pool tc
zsystm Jul 21, 2025
4f69fb6
add user balance check for deposit validator rewards pool tc
zsystm Jul 21, 2025
d4042b6
should use owner, not contract address itself
zsystm Jul 21, 2025
1cb044a
Merge remote-tracking branch 'origin/fix/erc20-approve-event' into te…
zsystm Jul 21, 2025
43d0962
add event checks for erc20 precompile tc
zsystm Jul 21, 2025
3b084be
add balance checks for werc20 tc
zsystm Jul 21, 2025
9320fa5
add balance check for gov deposit tc
zsystm Jul 21, 2025
ae29f95
add balance check for gov cancel proposal tc
zsystm Jul 21, 2025
15e4a88
Merge remote-tracking branch 'upstream/main' into tests/precompile-e2…
zsystm Jul 22, 2025
61bb46b
Merge remote-tracking branch 'upstream/main' into tests/precompile-e2…
zsystm Jul 24, 2025
e16881c
add revert e2e test cases
zsystm Jul 24, 2025
3fde716
lint: unused variable
zsystm Jul 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 55 additions & 52 deletions local_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ KEYALGO="eth_secp256k1"

LOGLEVEL="info"
# Set dedicated home directory for the evmd instance
HOMEDIR="$HOME/.evmd"
CHAINDIR="$HOME/.evmd"

BASEFEE=10000000

# Path variables
CONFIG=$HOMEDIR/config/config.toml
APP_TOML=$HOMEDIR/config/app.toml
GENESIS=$HOMEDIR/config/genesis.json
TMP_GENESIS=$HOMEDIR/config/tmp_genesis.json
CONFIG_TOML=$CHAINDIR/config/config.toml
APP_TOML=$CHAINDIR/config/app.toml
GENESIS=$CHAINDIR/config/genesis.json
TMP_GENESIS=$CHAINDIR/config/tmp_genesis.json

# validate dependencies are installed
command -v jq >/dev/null 2>&1 || {
Expand Down Expand Up @@ -76,8 +76,8 @@ fi
# User prompt if neither -y nor -n was passed as a flag
# and an existing local node configuration is found.
if [[ $overwrite = "" ]]; then
if [ -d "$HOMEDIR" ]; then
printf "\nAn existing folder at '%s' was found. You can choose to delete this folder and start a new local node with new keys from genesis. When declined, the existing local node is started. \n" "$HOMEDIR"
if [ -d "$CHAINDIR" ]; then
printf "\nAn existing folder at '%s' was found. You can choose to delete this folder and start a new local node with new keys from genesis. When declined, the existing local node is started. \n" "$CHAINDIR"
echo "Overwrite the existing configuration and start a new local node? [y/n]"
read -r overwrite
else
Expand All @@ -88,41 +88,46 @@ fi
# Setup local node if overwrite is set to Yes, otherwise skip setup
if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
# Remove the previous folder
rm -rf "$HOMEDIR"
rm -rf "$CHAINDIR"

# Set client config
evmd config set client chain-id "$CHAINID" --home "$HOMEDIR"
evmd config set client keyring-backend "$KEYRING" --home "$HOMEDIR"
evmd config set client chain-id "$CHAINID" --home "$CHAINDIR"
evmd config set client keyring-backend "$KEYRING" --home "$CHAINDIR"

# myKey address 0x7cb61d4117ae31a12e393a1cfa3bac666481d02e | os10jmp6sgh4cc6zt3e8gw05wavvejgr5pwjnpcky
# myKey address 0x7cb61d4117ae31a12e393a1cfa3bac666481d02e | cosmos10jmp6sgh4cc6zt3e8gw05wavvejgr5pwjnpcky
# myKey's private key: 0xe9b1d63e8acd7fe676acb43afb390d4b0202dab61abec9cf2a561e4becb147de # gitleaks:allow
VAL_KEY="mykey"
VAL_MNEMONIC="gesture inject test cycle original hollow east ridge hen combine junk child bacon zero hope comfort vacuum milk pitch cage oppose unhappy lunar seat"

# dev0 address 0xc6fe5d33615a1c52c08018c47e8bc53646a0e101 | os1cml96vmptgw99syqrrz8az79xer2pcgp84pdun
# dev0 address 0xC6Fe5D33615a1C52c08018c47E8Bc53646A0E101 | cosmos1cml96vmptgw99syqrrz8az79xer2pcgp84pdun
# dev0's private key: 0x88cbead91aee890d27bf06e003ade3d4e952427e88f88d31d61d3ef5e5d54305 # gitleaks:allow
USER1_KEY="dev0"
USER1_MNEMONIC="copper push brief egg scan entry inform record adjust fossil boss egg comic alien upon aspect dry avoid interest fury window hint race symptom"

# dev1 address 0x963ebdf2e1f8db8707d05fc75bfeffba1b5bac17 | os1jcltmuhplrdcwp7stlr4hlhlhgd4htqh3a79sq
# dev1 address 0x963EBDf2e1f8DB8707D05FC75bfeFFBa1B5BaC17 | cosmos1jcltmuhplrdcwp7stlr4hlhlhgd4htqh3a79sq
# dev1's private key: 0x741de4f8988ea941d3ff0287911ca4074e62b7d45c991a51186455366f10b544 # gitleaks:allow
USER2_KEY="dev1"
USER2_MNEMONIC="maximum display century economy unlock van census kite error heart snow filter midnight usage egg venture cash kick motor survey drastic edge muffin visual"

# dev2 address 0x40a0cb1C63e026A81B55EE1308586E21eec1eFa9 | os1gzsvk8rruqn2sx64acfsskrwy8hvrmafqkaze8
# dev2 address 0x40a0cb1C63e026A81B55EE1308586E21eec1eFa9 | cosmos1gzsvk8rruqn2sx64acfsskrwy8hvrmafqkaze8
# dev2's private key: 0x3b7955d25189c99a7468192fcbc6429205c158834053ebe3f78f4512ab432db9 # gitleaks:allow
USER3_KEY="dev2"
USER3_MNEMONIC="will wear settle write dance topic tape sea glory hotel oppose rebel client problem era video gossip glide during yard balance cancel file rose"

# dev3 address 0x498B5AeC5D439b733dC2F58AB489783A23FB26dA | os1fx944mzagwdhx0wz7k9tfztc8g3lkfk6rrgv6l
# dev3 address 0x498B5AeC5D439b733dC2F58AB489783A23FB26dA | cosmos1fx944mzagwdhx0wz7k9tfztc8g3lkfk6rrgv6l
# dev3's private key: 0x8a36c69d940a92fcea94b36d0f2928c7a0ee19a90073eda769693298dfa9603b # gitleaks:allow
USER4_KEY="dev3"
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"

# Import keys from mnemonics
echo "$VAL_MNEMONIC" | evmd keys add "$VAL_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR"
echo "$USER1_MNEMONIC" | evmd keys add "$USER1_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR"
echo "$USER2_MNEMONIC" | evmd keys add "$USER2_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR"
echo "$USER3_MNEMONIC" | evmd keys add "$USER3_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR"
echo "$USER4_MNEMONIC" | evmd keys add "$USER4_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR"
echo "$VAL_MNEMONIC" | evmd keys add "$VAL_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR"
echo "$USER1_MNEMONIC" | evmd keys add "$USER1_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR"
echo "$USER2_MNEMONIC" | evmd keys add "$USER2_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR"
echo "$USER3_MNEMONIC" | evmd keys add "$USER3_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR"
echo "$USER4_MNEMONIC" | evmd keys add "$USER4_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR"

# Set moniker and chain-id for the example chain (Moniker can be anything, chain-id must be an integer)
evmd init $MONIKER -o --chain-id "$CHAINID" --home "$HOMEDIR"
echo "$VAL_MNEMONIC" | evmd init $MONIKER -o --chain-id "$CHAINID" --home "$CHAINDIR" --recover

# Change parameter token denominations to desired value
jq '.app_state["staking"]["params"]["bond_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
Expand All @@ -148,36 +153,34 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
# Set gas limit in genesis
jq '.consensus.params.block.max_gas="10000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"

if [[ $1 == "pending" ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/timeout_propose = "3s"/timeout_propose = "30s"/g' "$CONFIG"
sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' "$CONFIG"
sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' "$CONFIG"
sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' "$CONFIG"
sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' "$CONFIG"
sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' "$CONFIG"
sed -i '' 's/timeout_commit = "5s"/timeout_commit = "150s"/g' "$CONFIG"
sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' "$CONFIG"
else
sed -i 's/timeout_propose = "3s"/timeout_propose = "30s"/g' "$CONFIG"
sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' "$CONFIG"
sed -i 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' "$CONFIG"
sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' "$CONFIG"
sed -i 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' "$CONFIG"
sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' "$CONFIG"
sed -i 's/timeout_commit = "5s"/timeout_commit = "150s"/g' "$CONFIG"
sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' "$CONFIG"
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/timeout_propose = "3s"/timeout_propose = "2s"/g' "$CONFIG_TOML"
sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "200ms"/g' "$CONFIG_TOML"
sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "500ms"/g' "$CONFIG_TOML"
sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "200ms"/g' "$CONFIG_TOML"
sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "500ms"/g' "$CONFIG_TOML"
sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "200ms"/g' "$CONFIG_TOML"
sed -i '' 's/timeout_commit = "5s"/timeout_commit = "1s"/g' "$CONFIG_TOML"
sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "5s"/g' "$CONFIG_TOML"
else
sed -i 's/timeout_propose = "3s"/timeout_propose = "2s"/g' "$CONFIG_TOML"
sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "200ms"/g' "$CONFIG_TOML"
sed -i 's/timeout_prevote = "1s"/timeout_prevote = "500ms"/g' "$CONFIG_TOML"
sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "200ms"/g' "$CONFIG_TOML"
sed -i 's/timeout_precommit = "1s"/timeout_precommit = "500ms"/g' "$CONFIG_TOML"
sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "200ms"/g' "$CONFIG_TOML"
sed -i 's/timeout_commit = "5s"/timeout_commit = "1s"/g' "$CONFIG_TOML"
sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "5s"/g' "$CONFIG_TOML"
fi

# enable prometheus metrics and all APIs for dev node
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/prometheus = false/prometheus = true/' "$CONFIG"
sed -i '' 's/prometheus = false/prometheus = true/' "$CONFIG_TOML"
sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 1000000000000/g' "$APP_TOML"
sed -i '' 's/enabled = false/enabled = true/g' "$APP_TOML"
sed -i '' 's/enable = false/enable = true/g' "$APP_TOML"
else
sed -i 's/prometheus = false/prometheus = true/' "$CONFIG"
sed -i 's/prometheus = false/prometheus = true/' "$CONFIG_TOML"
sed -i 's/prometheus-retention-time = "0"/prometheus-retention-time = "1000000000000"/g' "$APP_TOML"
sed -i 's/enabled = false/enabled = true/g' "$APP_TOML"
sed -i 's/enable = false/enable = true/g' "$APP_TOML"
Expand All @@ -194,14 +197,14 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
sed -i.bak 's/pruning-interval = "0"/pruning-interval = "10"/g' "$APP_TOML"

# Allocate genesis accounts (cosmos formatted addresses)
evmd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR"
evmd genesis add-genesis-account "$USER1_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR"
evmd genesis add-genesis-account "$USER2_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR"
evmd genesis add-genesis-account "$USER3_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR"
evmd genesis add-genesis-account "$USER4_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR"
evmd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR"
evmd genesis add-genesis-account "$USER1_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR"
evmd genesis add-genesis-account "$USER2_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR"
evmd genesis add-genesis-account "$USER3_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR"
evmd genesis add-genesis-account "$USER4_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR"

# Sign genesis transaction
evmd genesis gentx "$VAL_KEY" 1000000000000000000000atest --gas-prices ${BASEFEE}atest --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$HOMEDIR"
evmd genesis gentx "$VAL_KEY" 1000000000000000000000atest --gas-prices ${BASEFEE}atest --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$CHAINDIR"
## In case you want to create multiple validators at genesis
## 1. Back to `evmd keys add` step, init more keys
## 2. Back to `evmd add-genesis-account` step, add balance for those
Expand All @@ -210,10 +213,10 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
## 5. Copy the `gentx-*` folders under `~/.clonedOsd/config/gentx/` folders into the original `~/.evmd/config/gentx`

# Collect genesis tx
evmd genesis collect-gentxs --home "$HOMEDIR"
evmd genesis collect-gentxs --home "$CHAINDIR"

# Run this to ensure everything worked and that the genesis file is setup correctly
evmd genesis validate-genesis --home "$HOMEDIR"
evmd genesis validate-genesis --home "$CHAINDIR"

if [[ $1 == "pending" ]]; then
echo "pending mode is on, please wait for the first block committed."
Expand All @@ -224,6 +227,6 @@ fi
evmd start "$TRACE" \
--log_level $LOGLEVEL \
--minimum-gas-prices=0.0001atest \
--home "$HOMEDIR" \
--home "$CHAINDIR" \
--json-rpc.api eth,txpool,personal,net,debug,web3 \
--chain-id "$CHAINID"
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions precompiles/slashing/slashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ func (p Precompile) run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [
bz, err = p.GetSigningInfo(ctx, method, contract, args)
case GetSigningInfosMethod:
bz, err = p.GetSigningInfos(ctx, method, contract, args)
case GetParamsMethod:
bz, err = p.GetParams(ctx, method, contract, args)
default:
return nil, fmt.Errorf(cmn.ErrUnknownMethod, method.Name)
}
Expand Down
Loading
Loading