-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Handle new state transition bytecode and new consensus parameter version #2621
Handle new state transition bytecode and new consensus parameter version #2621
Conversation
d2cdb38
to
81b6582
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good to me. I'd suggest rebasing this on top of the test suite PR #2598 and add tests before merging.
impl<Storage> UpdateMerklizedTables for StorageTransaction<Storage> | ||
where | ||
Storage: KeyValueInspect<Column = Column>, | ||
Storage: KeyValueInspect<Column = Column> + IterableStore<Column = Column>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we use the IterableStore
? I only see inserts currently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here:
let keys_iterator = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replied in the other thread, I see that IterableStore
is a requirement for GetMerkleizedTablesParameters
, but we don't seem to use that trait currently - so I think we could drop this requirement for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes, no need on UpdateMerkleizedTables
. Removed in c8e6774.
) -> anyhow::Result<()>; | ||
} | ||
|
||
pub trait GetMerkleizedTablesParameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we use this trait? Or is the intention to use this to get the latest versions to feed to the update functions later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where I want to check that I got the required storage trait bounds correctly. The Idea is that we'll have something akin to the GenericDatabase
to iterate over keys.
There is a blanket implementation of the trait for anything that implements both KeyValueInspect<Column = Column> + IterableStore<Column = Column>
. GenericDatabase<RocksDB<Description: DatabaseDescription>>
satisfies the trait bounds, so it seems like a reasonable choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I just mean that this trait doesn't seem to be used anywhere. I.e. there's no code currently calling get_latest_consensus_parameters_version
and get_latest_state_transition_bytecode_version
. Do you picture these methods to be called by the binary and then added to the UpdateMerkleizedTransaction
before executing the process_block
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also as a nit I'd consider either moving this trait to a separate module or pushing it down a bit in the file, as UpdateMerklizedTablesTransaction::process_block
is the main entry point of the update module and should be declared first imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, we need to find a strategy about how we want to handle traits. I am afraid that with more "process" functions and more transaction types to handle, we will over-rely on traits to extend the functions available to a given struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, hopefully we shouldn't require much more than these extra functions beyond the process_block
function.
…on on upgrade transaction
…ansition bytecode version
Co-authored-by: Mårten Blankfors <[email protected]>
19ba384
to
453819e
Compare
06c9de2
to
928ac03
Compare
@acerone85 i think after the base branch was changed you need to cherry-pick specific commits and then rebase and force push :) , lgtm though happy to approve after its done |
…bles-for-upgrade-transactions
As much as I am all for rebase over merge, once another branch has been merged into the working branch, I prefer working with merge. In this case |
As much as I respect people having different preferences, I personally don't think it's too much of a hassle to maintain stacked PRs while rebasing and the resulting version history is just so much easier to navigate. I typicall do While I agree that merge is typically quicker1, a rebased branch is easier to read which saves time in the long run. It makes reviews much easier as well. Case in point, the current PR currently has 43 commits to be compared against master (many inherited from the base PR). Whereas if you look at this PR which is very similar (although slightly simpler) which was rebased just has three commits which are easy to interpret, providing a simpler context for reviewers: Footnotes
|
I also use a rebase heavy workflow, especially for stacked PRs. However, in the same moment that I get a merge commit in my branch, I switch to a merge-based workflow because merge commits during rebases are a pain. For me, when I am working on a stacked PR that targets a branch git fetch origin
git rebase --onto origin/target-branch target_branch
# solve conflicts, finish rebase
git branch -f target_branch origin/target_branch When the branch origin/target_branch gets merged, (The same workflow works very well also if you have several PRs stacked on top of each other). |
Yeah this is why I try to avoid merges as much as possible 😅. I only update my PRs by merging the base branch if it's a large ongoing review, and I know the reviewers prefer the merge variant. But then I'm basically stuck with merges until the PR is completed, which can turn quite painful if more changes are requested and the base keeps updating. |
…lobal_roots-populate-tables-for-upgrade-transactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a merge artifact that would be nice to clean up but we can do that in another PR as well.
Co-authored-by: Mårten Blankfors <[email protected]>
…lobal_roots-populate-tables-for-upgrade-transactions
on on upgrade transaction
Closes #2584
Questions for the reviewers:
UpdateMerklizedTables
trait. Is this reasonable?Linked Issues/PRs
Description
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]