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 #348

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

evlekht
Copy link
Member

@evlekht evlekht commented Jul 23, 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-19 dev
#335

@evlekht evlekht changed the base branch from evlekht/new-dev-resulting to cortina-15-dev/cortina-cleanup July 24, 2024 09:28
@evlekht evlekht force-pushed the cortina-15-dev/cortina-cleanup branch from 0f8c1c3 to eb5231d Compare July 24, 2024 10:41
@evlekht evlekht force-pushed the cortina-15-dev/addr-state-tx-test-refactor branch from 0018a72 to 4fa4308 Compare July 24, 2024 10:42
mo-c4t
mo-c4t previously approved these changes Jul 24, 2024
havan
havan previously approved these changes Jul 24, 2024
Copy link
Member

@havan havan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look consistent with the original PR.

@havan havan added the checked Temporary label for Cortina-15 revert label Jul 24, 2024
@evlekht evlekht force-pushed the cortina-15-dev/cortina-cleanup branch from eb5231d to 6112960 Compare July 25, 2024 12:56
Base automatically changed from cortina-15-dev/cortina-cleanup to dev July 25, 2024 12:57
@evlekht evlekht dismissed stale reviews from havan and mo-c4t July 25, 2024 12:57

The base branch was changed.

@evlekht evlekht force-pushed the cortina-15-dev/addr-state-tx-test-refactor branch from 4fa4308 to 6881669 Compare July 25, 2024 12:59
@evlekht evlekht marked this pull request as ready for review July 25, 2024 13:00
@evlekht evlekht force-pushed the cortina-15-dev/addr-state-tx-test-refactor branch from 6881669 to 449e162 Compare July 25, 2024 13:00
@evlekht evlekht merged commit 8d23dfe into dev Jul 25, 2024
15 of 16 checks passed
@evlekht evlekht deleted the cortina-15-dev/addr-state-tx-test-refactor branch July 25, 2024 13:01
evlekht added a commit that referenced this pull request Aug 1, 2024
evlekht added a commit that referenced this pull request Aug 1, 2024
evlekht added a commit that referenced this pull request Aug 1, 2024
evlekht added a commit that referenced this pull request Aug 1, 2024
evlekht added a commit that referenced this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checked Temporary label for Cortina-15 revert
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants