[PVM] AddressStateTx and tests refactoring #372
Merged
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.
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