Skip to content

Conversation

@almk-dev
Copy link
Member

@almk-dev almk-dev commented Oct 16, 2025

Description

Adds teardowns to integration evmd integration tests and added locks for state reads and commits.
Also adds the count=1 flag to Makefile test targets so that flakes are discovered earlier (locally).

Addresses the following tests:

  • TestCheckTxHandlerForCommittedAndLowerNonceTxs race and flake
    • runReorg()/StateAt race
  • TestBlockchainRaceCondition nil pointer error

Closes: #722

@almk-dev almk-dev changed the title create new context fix(ci): solve gas meter race condition in unit tests Oct 16, 2025
@almk-dev almk-dev marked this pull request as ready for review October 21, 2025 15:52
@almk-dev almk-dev changed the title fix(ci): solve gas meter race condition in unit tests fix(ci): solve gas meter race condition in integration tests Oct 21, 2025
@vladjdk
Copy link
Member

vladjdk commented Oct 22, 2025

Regarding the TestBlockchainRaceCondition test, are we sure that this race condition only occurs during testing, and not during production. If it occurs in production, is it a problem? If so, what should we do to solve it?

@almk-dev
Copy link
Member Author

almk-dev commented Oct 23, 2025

@vladjdk There is actually no data race in the TestBlockchainRaceCondition test. It's just a nil pointer error that was introduced because now we call CacheContext() so we need to actually set up the test properly with a multistore.

[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x22df70b]

goroutine 43 [running]:
github.com/cosmos/cosmos-sdk/types.Context.CacheContext({{0x0, 0x0}, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, 0x1, {0x0, ...}, ...}, ...})
	/home/runner/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.53.4/types/context.go:357 +0xeb
github.com/cosmos/evm/mempool.(*Blockchain).StateAt(0xc000c70808, {0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef, 0x12, ...})
	/home/runner/work/evm/evm/mempool/blockchain.go:217 +0x538
github.com/cosmos/evm/mempool_test.TestBlockchainRaceCondition.func3()
	/home/runner/work/evm/evm/mempool/blockchain_test.go:99 +0x155
created by github.com/cosmos/evm/mempool_test.TestBlockchainRaceCondition in goroutine 41
	/home/runner/work/evm/evm/mempool/blockchain_test.go:95 +0x1365
FAIL	github.com/cosmos/evm/mempool	0.157s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix unit test CI flakes

3 participants