Refactoring contracts macro logic into separate modules #2992
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.
Refactors the
contracts
module into several smaller modules grouped by task. The previous modules was very long and interleaved a lot of logic for various parts of the contracts state machine. This refactoring groups functions by specificity, task correlation and reusability.All code changes here are exclusively moves with no changes to functionality.
The split is as follows:
mod.rs
contains definitions of the data structures used to handle contracts, the entry point for contract handling, as well as a documentation overview.bootstrap.rs
is the logic that initialized the central data structures, such as the handler and the functions statecheck.rs
is all the logic required to create the function that checks a contract.replace.rs
is all the logic required to create a function that abstracts via contractshared.rs
are Kani/contract-specific helper functions that are used in more than one ofbootstrap
,check
orreplace
helpers.rs
are Kani/contract-independent helper functionsI was going to make the
old
PR but I shudder at the though of appending more logic to the extremely longcontracts.rs
file so I figured I'd split the logic real quick before adding more.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.