Skip to content

New and fixed tests for gas refunding and block weight reporting#1883

Merged
timbrinded merged 19 commits intomasterfrom
timbo-test-block-weights
Oct 26, 2022
Merged

New and fixed tests for gas refunding and block weight reporting#1883
timbrinded merged 19 commits intomasterfrom
timbo-test-block-weights

Conversation

@timbrinded
Copy link
Copy Markdown
Contributor

What does it do?

Contains tests for MOON-1913, as well as additional tests for:

  • Checking gas is refunded if eth txn fails before it gets added to txn pool
  • Checking that we don't have unreported weight

What important points reviewers should know?

This refactors existing test tests/smoke-tests/test-block-weight-per-class.ts in order to make it a more functional flavour.

I've added the a memo feature to the context function, so I can pass immutable state between tests. This is massively reduces the amount of async calls required to do multiple tests on the same data set.

What alternative implementations were considered?

We used to have a lot of old code that used global scope lets to pass state around, which was unsafe and messy. However duplicating and pushing everything into the tests themselves would not be performant.

Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?

Related:
polkadot-evm/frontier#865
https://purestake.atlassian.net/browse/MOON-1912

What value does it bring to the blockchain users?

Better gas usage reporting and ultimately will flag up any incorrectly full blocks on prod networks.

@timbrinded timbrinded added B0-silent Changes should not be mentioned in any release notes D2-notlive PR doesn't change runtime code (so can't be audited) labels Oct 20, 2022
Comment thread tests/smoke-tests/test-block-weights.ts Outdated
Comment thread tests/package.json Outdated
@timbrinded timbrinded requested a review from crystalin October 20, 2022 17:04
Comment thread tests/smoke-tests/test-block-weights.ts Outdated
@timbrinded timbrinded merged commit 3fe4aef into master Oct 26, 2022
@timbrinded timbrinded deleted the timbo-test-block-weights branch October 26, 2022 15:20
imstar15 pushed a commit to AvaProtocol/moonbeam that referenced this pull request May 16, 2023
…nbeam-foundation#1883)

* Draft new weight tests

* Hardened test

* Updated test

* Calculated non-ext weights

* Combined block weight packs

* Added context state storage

* first draft

* reverted pkg.json changes

* Fixed context

* Lint

* lint

* removed chai-roughly

* Killed memo idea

* tidied comments

* lint

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

Labels

B0-silent Changes should not be mentioned in any release notes D2-notlive PR doesn't change runtime code (so can't be audited)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants