Skip to content
Open
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
945cf95
refactor(systemtests): change CheckTxsQueuedSync to CheckTxsQueuedAsync
cloudgray Oct 14, 2025
7723a96
refactor(systemtests): remove calling AfterEachAction from TestTxsOrd…
cloudgray Oct 14, 2025
b200286
refactor(systemtests): refactor account type
cloudgray Oct 14, 2025
c547ce0
refactor(systemtests): apply mutex for accounts
cloudgray Oct 14, 2025
6c54985
refactor(systemtests): apply account pool to test cases
cloudgray Oct 14, 2025
4545f7a
refactor(systemtests): apply account pool to eip7702 test
cloudgray Oct 14, 2025
9f81d0d
refactor(systemtests): fix CheckTxsQueuedAsync
cloudgray Oct 14, 2025
544dd55
refactor(systemtests): apply global chain
cloudgray Oct 14, 2025
74b48ba
refactor(systemtests): fix eip7702 test
cloudgray Oct 14, 2025
bcb7711
refactor(systemtests): fix test suite
cloudgray Oct 14, 2025
9210700
chore(systemtests): refactor test suite
cloudgray Oct 14, 2025
a2bb3fc
refactor(systemtests): fix eip712 test
cloudgray Oct 14, 2025
d9bf2eb
refactor(systemtests): fix validation method
cloudgray Oct 14, 2025
807bbe9
refactor(systemtests): refactor suite
cloudgray Oct 14, 2025
0fca2e4
WIP: refactor test suite
cloudgray Oct 14, 2025
fefa55b
chore: modify makefile
cloudgray Oct 14, 2025
7196b9f
Merge branch 'main' into refactor/systemtests
aljo242 Oct 15, 2025
b3477b9
refactor: change upgrade test file name and apply --mempool.max-txs=0…
cloudgray Oct 17, 2025
c56e5a0
refactor test suite
cloudgray Oct 17, 2025
4927921
refactor(systemtest): add test cases
cloudgray Oct 17, 2025
dda7167
refactor(systemtest): enable chainupgrade test
cloudgray Oct 17, 2025
219f64d
refactor(systemtest): refactor suite
cloudgray Oct 17, 2025
9db3ac0
fix system tests
cloudgray Oct 17, 2025
f6f5410
fix system tests
cloudgray Oct 17, 2025
5f3fba5
Merge branch 'main' into refactor/systemtests
cloudgray Oct 17, 2025
f8499e5
fix system tests
cloudgray Oct 17, 2025
f83b2e5
refactor test cases
cloudgray Oct 17, 2025
f57e42c
chore: change test name
cloudgray Oct 17, 2025
dc8e0d0
fix upgrade test
cloudgray Oct 17, 2025
fd4dccd
fix upgrade test
cloudgray Oct 17, 2025
06cff50
Merge branch 'main' into refactor/systemtests
cloudgray Oct 19, 2025
3bafdd6
resolve merge conflic
cloudgray Oct 19, 2025
4d456b4
test(systemtests): remove additional test accounts setting
cloudgray Oct 20, 2025
491aca4
test(systemtests): fix helper function for pending txs
cloudgray Oct 20, 2025
e3fe2e8
test(systemtests): fix test case
cloudgray Oct 20, 2025
c5a21e9
tet(systemtests): refactor test execution
cloudgray Oct 20, 2025
8479fa1
test(systemtests): remove account pool
cloudgray Oct 20, 2025
0addd12
test(systemtests): fix pending cosmos tx verification
cloudgray Oct 20, 2025
349afbd
chore: update CHANGELOG.md
cloudgray Oct 20, 2025
b8ec74d
chore: update comments
cloudgray Oct 20, 2025
e922c54
test(systemtests): increase block time of replacement test cases
cloudgray Oct 20, 2025
289fb7b
fix: rollback block time increase for test
cloudgray Oct 20, 2025
50ac4e6
test(systemtests): apply 6s blocktime only for specific test case
cloudgray Oct 20, 2025
6ae5a77
test(systemtests): apply 9s blocktime only for specific test case
cloudgray Oct 20, 2025
786b4d3
chore: modify Makefile
cloudgray Oct 20, 2025
4b20c3e
test(systemtest): disable non-deterministic test case
cloudgray Oct 20, 2025
9523ea5
Merge branch 'main' into refactor/systemtests
cloudgray Oct 21, 2025
6cacc47
resolve merge conflict
cloudgray Oct 23, 2025
3dc5193
Merge branch 'main' into refactor/systemtests
cloudgray Oct 23, 2025
b6fb49b
Merge branch 'main' into refactor/systemtests
cloudgray Oct 27, 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
- [\#709](https://github.com/cosmos/evm/pull/709) Fix mempool e2e test
- [\#710](https://github.com/cosmos/evm/pull/710) Fix EoA-CA Identification logic
- [\#711](https://github.com/cosmos/evm/pull/711) Add debug_traceCall api

- [\#720](https://github.com/cosmos/evm/pull/720) Refactor systemtests

### FEATURES

Expand Down
16 changes: 12 additions & 4 deletions evmd/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package evmd

import (
"context"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/evm/x/vm/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/evm/x/vm/types"

storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)

// UpgradeName defines the on-chain upgrade name for the sample EVMD upgrade
Expand Down Expand Up @@ -49,6 +50,13 @@ func (app EVMD) RegisterUpgradeHandlers() {
URIHash: "example_uri_hash",
})

// Persist the EVM coin metadata in keeper state. Chains bootstrapped on earlier
// binaries never stored this information (it lived only in process globals),
// so migrating nodes would otherwise see an empty EvmCoinInfo on upgrade.
if err := app.EVMKeeper.InitEvmCoinInfo(sdkCtx); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this a few lines down - why do we need to initialize this twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems when I merge main branch, I should have accept one of changes from #736 or my upgrade handler fix. But I accepted both.

fixed (6cacc47)

return nil, err
}

// (Required for NON-18 denom chains *only)
// Update EVM params to add Extended denom options
// Ensure that this corresponds to the EVM denom
Expand Down
8 changes: 1 addition & 7 deletions tests/systemtests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@
WAIT_TIME ?= 20s

test:
go test -failfast -timeout=30m -p=1 -mod=readonly -tags='system_test' -v ./... -run TestCosmosTxCompat --wait-time=$(WAIT_TIME) --block-time=9.5s --binary evmd --chain-id local-4221
go test -failfast -timeout=30m -p=1 -mod=readonly -tags='system_test' -v ./... -run TestTxsReplacement --wait-time=$(WAIT_TIME) --block-time=9.5s --binary evmd --chain-id local-4221
go test -failfast -timeout=30m -p=1 -mod=readonly -tags='system_test' -v ./... -run TestTxsOrdering --wait-time=$(WAIT_TIME) --block-time=3s --binary evmd --chain-id local-4221
go test -failfast -timeout=30m -p=1 -mod=readonly -tags='system_test' -v ./... -run TestExceptions --wait-time=$(WAIT_TIME) --block-time=8s --binary evmd --chain-id local-4221
go test -failfast -timeout=30m -p=1 -mod=readonly -tags='system_test' -v ./... -run TestEIP7702 --wait-time=$(WAIT_TIME) --block-time=5s --binary evmd --chain-id local-4221
go test -failfast -timeout=30m -p=1 -mod=readonly -tags='system_test' -v ./... -run TestEIP712 --wait-time=$(WAIT_TIME) --block-time=5s --binary evmd --chain-id local-4221
go test -failfast -timeout=30m -p=1 -mod=readonly -tags='system_test' -v ./... -run 'TestUpgrade|TestEth' --wait-time=$(WAIT_TIME) --block-time=5s --binary evmd --chain-id local-4221
go test -failfast -timeout=30m -mod=readonly -tags='system_test' -v ./... --wait-time=$(WAIT_TIME) --binary evmd --chain-id local-4221
49 changes: 31 additions & 18 deletions tests/systemtests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,46 @@ cp ./build/evmd ./tests/systemtests/binaries/v0.4

## Run Individual test

### Run test cases for txs ordering
Each scenario now has its own `Test…` wrapper in `main_test.go`, so you can target a specific flow directly. For example, to exercise the mempool ordering suite:

```shell
go test -p 1 -parallel 1 -mod=readonly -tags='system_test' -v ./... \
--run TestTxsOrdering --verbose --binary evmd --block-time 5s --chain-id local-4221
cd tests/systemtests
go test -failfast -mod=readonly -tags=system_test ./... -run TestMempoolTxsOrdering \
--verbose --binary evmd --block-time 3s --chain-id local-4221
```

### Run test cases for txs replacement
Mempool scenarios:

```shell
go test -p 1 -parallel 1 -mod=readonly -tags='system_test' -v ./... \
--run TestTxsReplacement --verbose --binary evmd --block-time 5s --chain-id local-4221
```
| Test name | Description |
|-----------|-------------|
| `TestMempoolTxsOrdering` | Ordering of pending transactions across nodes |
| `TestMempoolTxsReplacement` | Replacement behaviour for EVM transactions |
| `TestMempoolTxsReplacementWithCosmosTx` | Replacement when Cosmos transactions are present |
| `TestMempoolMixedTxsReplacementEVMAndCosmos` | Mixed Cosmos/EVM replacement coverage |
| `TestMempoolTxRebroadcasting` | Rebroadcasting and nonce-gap handling |
| `TestMempoolCosmosTxsCompatibility` | Cosmos-only transactions interacting with the mempool |

### Run test exceptions
EIP-712 scenarios:

```shell
go test -p 1 -parallel 1 -mod=readonly -tags='system_test' -v ./... \
--run TestExceptions --verbose --binary evmd --block-time 5s --chain-id local-4221
```
| Test name | Description |
|-----------|-------------|
| `TestEIP712BankSend` | Single transfer signed via EIP-712 |
| `TestEIP712BankSendWithBalanceCheck` | Transfer plus balance assertions |
| `TestEIP712MultipleBankSends` | Sequential transfers with nonce management |

### Run EIP-7702 test
Account abstraction:

```shell
go test -p 1 -mod=readonly -tags='system_test' -v ./... \
--run TestEIP7702 --verbose --binary evmd --block-time 3s --chain-id local-4221
```
| Test name | Description |
|-----------|-------------|
| `TestAccountAbstractionEIP7702` | Account abstraction (EIP-7702) flow |

Chain lifecycle:

| Test name | Description |
|-----------|-------------|
| `TestChainUpgrade` | End-to-end upgrade handling |

> ℹ️ The shared system test suite keeps a single chain alive across multiple tests when the node arguments are identical. Running several tests back-to-back therefore re-uses the same process unless a scenario explicitly changes the node configuration.

## Run all tests

Expand Down
31 changes: 0 additions & 31 deletions tests/systemtests/accountabstraction/interface.go

This file was deleted.

66 changes: 37 additions & 29 deletions tests/systemtests/accountabstraction/test_eip7702.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build system_test

package accountabstraction

import (
Expand All @@ -10,23 +12,29 @@ import (
. "github.com/onsi/ginkgo/v2"
//nolint:revive // dot imports are fine for Ginkgo
. "github.com/onsi/gomega"
)

func TestEIP7702(t *testing.T) {
const (
user0 = "acc0"
user1 = "acc1"
)
suite "github.com/cosmos/evm/tests/systemtests/suite"
)

func RunEIP7702(t *testing.T, base *suite.BaseTestSuite) {
Describe("test EIP-7702 scenorios", Ordered, func() {
var (
s AccountAbstractionTestSuite
s *TestSuite
user0Acc *suite.TestAccount
user1Acc *suite.TestAccount
user0 string
user1 string
)

// We intentionally use BeforeAll instead of BeforeAll because,
// The test takes too much time if we restart network for each test case.
BeforeAll(func() {
s = NewTestSuite(t)
s = NewTestSuite(base)
user0Acc = s.BaseTestSuite.Acc(0)
user1Acc = s.BaseTestSuite.Acc(1)
user0 = user0Acc.ID
user1 = user1Acc.ID
s.SetPrimaryAccount(user0Acc)
s.SetupTest(t)
})

Expand Down Expand Up @@ -59,20 +67,20 @@ func TestEIP7702(t *testing.T) {
authChainID func() uint64
authNonce func() uint64
authAddress func() common.Address
authSigner string
txSender string
authSigner func() string
txSender func() string
expDelegation bool
}

DescribeTable("SetCode authorization scenarios", func(tc testCase) {
authorization := createSetCodeAuthorization(tc.authChainID(), tc.authNonce(), tc.authAddress())
signedAuthorization, err := signSetCodeAuthorization(s.GetPrivKey(tc.authSigner), authorization)
signedAuthorization, err := signSetCodeAuthorization(s.GetPrivKey(tc.authSigner()), authorization)
Expect(err).To(BeNil())

txHash, err := s.SendSetCodeTx(tc.txSender, signedAuthorization)
txHash, err := s.SendSetCodeTx(tc.txSender(), signedAuthorization)
Expect(err).To(BeNil(), "error while sending SetCode tx")
s.WaitForCommit(txHash)
s.CheckSetCode(tc.authSigner, tc.authAddress(), tc.expDelegation)
s.CheckSetCode(tc.authSigner(), tc.authAddress(), tc.expDelegation)
},
Entry("setCode with invalid chainID should fail", testCase{
authChainID: func() uint64 { return s.GetChainID() + 1 },
Expand All @@ -82,8 +90,8 @@ func TestEIP7702(t *testing.T) {
authAddress: func() common.Address {
return s.GetCounterAddr()
},
authSigner: user0,
txSender: user0,
authSigner: func() string { return user0 },
txSender: func() string { return user0 },
expDelegation: false,
}),
Entry("setCode with empty address should reset delegation", testCase{
Expand All @@ -94,8 +102,8 @@ func TestEIP7702(t *testing.T) {
authAddress: func() common.Address {
return common.HexToAddress("0x0")
},
authSigner: user0,
txSender: user0,
authSigner: func() string { return user0 },
txSender: func() string { return user0 },
expDelegation: false,
}),
Entry("setCode with invalid address should fail", testCase{
Expand All @@ -106,8 +114,8 @@ func TestEIP7702(t *testing.T) {
authAddress: func() common.Address {
return common.BytesToAddress([]byte("invalid"))
},
authSigner: user0,
txSender: user0,
authSigner: func() string { return user0 },
txSender: func() string { return user0 },
expDelegation: true,
}),
Entry("setCode with EoA address should fail", testCase{
Expand All @@ -118,8 +126,8 @@ func TestEIP7702(t *testing.T) {
authAddress: func() common.Address {
return s.GetAddr(user1)
},
authSigner: user0,
txSender: user0,
authSigner: func() string { return user0 },
txSender: func() string { return user0 },
expDelegation: true,
}),
Entry("same signer/sender with matching nonce should fail", testCase{
Expand All @@ -130,8 +138,8 @@ func TestEIP7702(t *testing.T) {
authAddress: func() common.Address {
return s.GetCounterAddr()
},
authSigner: user0,
txSender: user0,
authSigner: func() string { return user0 },
txSender: func() string { return user0 },
expDelegation: false,
}),
Entry("same signer/sender with future nonce sholud succeed", testCase{
Expand All @@ -142,8 +150,8 @@ func TestEIP7702(t *testing.T) {
authAddress: func() common.Address {
return s.GetCounterAddr()
},
authSigner: user0,
txSender: user0,
authSigner: func() string { return user0 },
txSender: func() string { return user0 },
expDelegation: true,
}),
Entry("different signer/sender with current nonce should succeed", testCase{
Expand All @@ -154,8 +162,8 @@ func TestEIP7702(t *testing.T) {
authAddress: func() common.Address {
return s.GetCounterAddr()
},
authSigner: user1,
txSender: user0,
authSigner: func() string { return user1 },
txSender: func() string { return user0 },
expDelegation: true,
}),
Entry("different signer/sender with future nonce should fail", testCase{
Expand All @@ -166,8 +174,8 @@ func TestEIP7702(t *testing.T) {
authAddress: func() common.Address {
return s.GetCounterAddr()
},
authSigner: user1,
txSender: user0,
authSigner: func() string { return user1 },
txSender: func() string { return user0 },
expDelegation: false,
}),
)
Expand Down
Loading
Loading