Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

feemarket: non-determinism on block gas #1151

Closed
mmsqe opened this issue Jun 25, 2022 · 2 comments · Fixed by #1166
Closed

feemarket: non-determinism on block gas #1151

mmsqe opened this issue Jun 25, 2022 · 2 comments · Fixed by #1166

Comments

@mmsqe
Copy link
Contributor

mmsqe commented Jun 25, 2022

System info: [Include Ethermint commit, operating system name, and other relevant details]

Steps to reproduce:

  1. run make test-sim-nondeterminism with mmsqe@4d64b4b

Expected behavior: [--- PASS: TestAppStateDeterminism]

Actual behavior: [--- FAIL: TestAppStateDeterminism ]

__Additional info: block_gas brings the diff caused by random length memo, fixed memo length could bypass the test

@adu-web3
Copy link
Contributor

the reason is easy:
https://github.com/mmsqe/cosmos-sdk/blob/dbe1dba5a6dfa118412a6a3ea795c5f1b746eee7/simapp/helpers/test_helpers.go#L26

r := rand.New(rand.NewSource(time.Now().UnixNano()))

GenTx is not using Simstate.Rand, so every time it creates memo with different length.
And ethermint.AnteHandler is consuming gas according to the tx bytes length, so finally gas used is not deterministic.

@mmsqe
Copy link
Contributor Author

mmsqe commented Jun 28, 2022

memo with rand seed works, this test "PASS" randomly before with larger NumBlocks, since we get blockSize 0 with gasWanted 0 based on matrix, which always compare same hash

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants