Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion local-multi-validator/scripts/setup-genesis-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ update_genesis '.app_state["gov"]["params"]["expedited_voting_period"]="150s"'

# EVM
update_genesis `printf '.app_state["evm"]["params"]["evm_denom"]="%s"' $DENOM`
update_genesis '.app_state["evm"]["params"]["active_static_precompiles"]=["0x00000000000000000000000000000000000000CB","0x00000000000000000000000000000000000000ca","0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805"]'
update_genesis '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805","0xEC00000000000000000000000000000000000001"]'

# EVM Chain config
update_genesis `printf '.app_state["evm"]["params"]["chain_config"]["chain_id"]=%s' $EVM_CHAIN_ID`
Expand Down
2 changes: 1 addition & 1 deletion local-native/scripts/setup-genesis-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ update_genesis '.app_state["gov"]["params"]["max_deposit_period"]="300s"'
update_genesis '.app_state["gov"]["params"]["voting_period"]="300s"'
update_genesis '.app_state["gov"]["params"]["expedited_voting_period"]="60s"'
update_genesis ".app_state[\"evm\"][\"params\"][\"evm_denom\"]=\"$DENOM\""
update_genesis '.app_state["evm"]["params"]["active_static_precompiles"]=["0x00000000000000000000000000000000000000CB","0x00000000000000000000000000000000000000ca","0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805"]'
update_genesis '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805","0xEC00000000000000000000000000000000000001"]'
update_genesis ".app_state[\"staking\"][\"params\"][\"bond_denom\"]=\"$DENOM\""
update_genesis ".app_state[\"mint\"][\"params\"][\"mint_denom\"]=\"$DENOM\""
update_genesis '.consensus["params"]["abci"]["vote_extensions_enable_height"]="2"'
Expand Down
63 changes: 63 additions & 0 deletions precompiles/usigverifier/genesis_scripts_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package usigverifier_test

import (
"os"
"path/filepath"
"strings"
"testing"

"github.com/stretchr/testify/require"

usigverifierprecompile "github.com/pushchain/push-chain-node/precompiles/usigverifier"
)

// legacyUSigVerifierAddress is where the Ed25519 signature verifier precompile
// used to live. Nothing is registered at it any more, so a genesis that still
// declares it active routes calls to an unimplemented address, which panics
// (recovered by baseapp, so the tx just fails).
const legacyUSigVerifierAddress = "0x00000000000000000000000000000000000000ca"

// legacyUtxHashVerifierAddress is the other stale entry: the utxhashverifier
// precompile has no implementation anywhere in the tree, and the
// remove-utxverifier upgrade strips it from live chains. Leaving it in genesis
// would re-introduce on every fresh chain exactly the address that upgrade
// exists to remove.
const legacyUtxHashVerifierAddress = "0x00000000000000000000000000000000000000cb"

// TestGenesisScriptsActivateCurrentVerifier guards the genesis half of
// F-2026-18829: a fresh chain must activate the address the verifier is actually
// registered at, and must not declare the legacy one.
func TestGenesisScriptsActivateCurrentVerifier(t *testing.T) {
repoRoot := filepath.Join("..", "..")

scripts := []string{
"scripts/test_node.sh",
"local-native/scripts/setup-genesis-auto.sh",
"local-multi-validator/scripts/setup-genesis-auto.sh",
"testnet/core/setup/setup_genesis_validator.sh",
}

for _, script := range scripts {
t.Run(script, func(t *testing.T) {
raw, err := os.ReadFile(filepath.Join(repoRoot, script))
require.NoError(t, err)

var line string
for _, l := range strings.Split(string(raw), "\n") {
if strings.Contains(l, "active_static_precompiles") {
line = l
break
}
}
require.NotEmpty(t, line, "no active_static_precompiles assignment found")

require.NotContains(t, strings.ToLower(line), strings.ToLower(legacyUSigVerifierAddress),
"genesis must not declare the legacy verifier address, nothing is registered at it")
require.NotContains(t, strings.ToLower(line), strings.ToLower(legacyUtxHashVerifierAddress),
"genesis must not declare the utxhashverifier address, nothing is registered at it")
require.Contains(t, strings.ToLower(line),
strings.ToLower(usigverifierprecompile.USigVerifierPrecompileAddress),
"genesis must activate the verifier address the node registers")
})
}
}
2 changes: 1 addition & 1 deletion scripts/test_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ from_scratch () {
update_test_genesis '.app_state["gov"]["params"]["expedited_voting_period"]="15s"'

update_test_genesis `printf '.app_state["evm"]["params"]["evm_denom"]="%s"' $DENOM`
update_test_genesis '.app_state["evm"]["params"]["active_static_precompiles"]=["0x00000000000000000000000000000000000000CB","0x00000000000000000000000000000000000000ca","0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805"]'
update_test_genesis '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805","0xEC00000000000000000000000000000000000001"]'
update_test_genesis '.app_state["erc20"]["params"]["native_precompiles"]=["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]' # https://eips.ethereum.org/EIPS/eip-7528
update_test_genesis `printf '.app_state["erc20"]["token_pairs"]=[{contract_owner:1,erc20_address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",denom:"%s",enabled:true}]' $DENOM`
update_test_genesis '.app_state["feemarket"]["params"]["no_base_fee"]=false'
Expand Down
Loading
Loading