Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PVM] AddressStateTx and tests refactoring #372

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

evlekht
Copy link
Member

@evlekht evlekht commented Aug 1, 2024

Why this should be merged

This PR is mainly focused on rewriting addressStateTx execution and syntacticVerify tests as well as refactoring some parts of addressStateTx execution logic.

Previous syntacticVerify wasn't correctly splitting test cases for testing package and wasn't handling all required test cases.

Previous execution test wasn't correctly testing things at all and there were also separate test function for testing node deferring/resuming.

And addressStateTx execution logic just had some checks and state actions in a not optimal order.

This PR also updates tx builder, so its addressStateTx method will support upgradeVersion1.

How this works

SyntacticVerify test were simply rewritten, so it will match pattern of other syntactic tests, where each test case it called with its own t.Run(). There are also previously missing test cases, that were added.

AddressStateTx execution refactoring is basically only about renaming and some reshuffling of checks and state function calls, so checks will always go first before any other action, also prioritizing stateless checks first.

There are other small changes, but they're mostly renaming.

The most complex change is execution logic test rewrite. This complexity comes out of of transaction structure, 64 possible bits of address states, permissions logic and 3 different phases (for now ) that are putting different limitations on allowed bits and tx structure. So, it all have to be combined, and not every combination is possible. And some of combinations require different mock setups for state.

codec.UpgradeVersion

In athens, we added new feature to codec.
Its a technical field called "UpgradeVersionID". It must be first field in struct.
This field value is used to determine upgradeVersion value.
And fields of marshallable with codec structs like transactions, they could have tag "upgradeversion:n". Fields with this tag will be ignored if structure upgradeVersion is less, than tags value.

How this was tested

With new unit tests.

Additional references

Original PR based on cortina-15 dev
#348

@evlekht evlekht force-pushed the dev-c0/addr-state-tx-tests branch 3 times, most recently from 5e31830 to c47e4c6 Compare August 1, 2024 17:50
@evlekht evlekht changed the title Dev c0/addr state tx tests [PVM] AddressStateTx and tests refactoring Aug 2, 2024
@evlekht evlekht force-pushed the dev-c0/addr-state-tx-tests branch from c47e4c6 to c0873f7 Compare August 2, 2024 16:08
mo-c4t
mo-c4t previously approved these changes Aug 5, 2024
@evlekht evlekht force-pushed the dev-c0/addr-state-tx-tests branch from c0873f7 to 47482e5 Compare August 7, 2024 13:00
@evlekht evlekht changed the base branch from dev-c0/base to dev August 7, 2024 13:00
@evlekht evlekht dismissed mo-c4t’s stale review August 7, 2024 13:00

The base branch was changed.

@evlekht evlekht marked this pull request as ready for review August 7, 2024 13:00
@evlekht evlekht merged commit be45b91 into dev Aug 7, 2024
@evlekht evlekht deleted the dev-c0/addr-state-tx-tests branch August 7, 2024 13:05
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.

2 participants