Wait one block confirmation in tests #1438
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this implement/fix? Explain your changes.
CONFIRMATIONS
from 'config' is set to the default value of '12' or according to the matching env var if defined. It is referenced incommon-files/utils/event-queue.mjs
which is used by 'nightfall-optimist' and 'nightfall-client' to wait for a configured number of block confimrations before a L1 event is propagated and processed allowing for L1 re-org.During tests you usually want to either use a lower number of confirmations (such as 1) or when tests rely on this behaviour using a higher number of confimrations (like when testing L1 re-org) but leveraging Ganache like that:
test/utils.mjs
some test file
.github/workflows/on-pull-request-master.yml
most e2e test are setup withCONFIRMATIONS: 1
, however value of env vars are not automatically propagated to containers and therefore the default value of '12' applies. Fixed that by editingdocker-compose.*.yml
files.test/utils.mjs
also waits for a number of block confirmations in 'submitTransaction' and in 'waitForEvent'. Curently it is hardcoded and set to '12', fixed it to grab the confirmations number from 'config'/cli
) used by tests and 'proposer' / 'challenger' currently setsweb3.eth.transactionConfirmationBlocks
to the hardcoded value of '12'. Fixed that to useprocess.env.CONFIRMATIONS || 12
instead ('config' is not currently used by Nf3 / CLI so I did not use node 'config').Does this close any currently open issues?
Not that I'm aware of
What commands can I run to test the change?
Run all tests as usuall both locally and in CI (focus on these e2e tests that have
CONFIRMATIONS: 1
which is all e2e tests except for 'client-authentication-test', 'test-apps')Any other comments?