separate L2 update as a standalone function#390
Closed
varun-doshi wants to merge 1 commit intopolytope-labs:mainfrom
Closed
separate L2 update as a standalone function#390varun-doshi wants to merge 1 commit intopolytope-labs:mainfrom
varun-doshi wants to merge 1 commit intopolytope-labs:mainfrom
Conversation
seunlanlege
reviewed
Feb 28, 2025
modules/ismp/core/src/consensus.rs
Outdated
Comment on lines
142
to
150
| /// Process the L2 state update | ||
| fn verify_l2_state_update( | ||
| &self, | ||
| trusted_consensus_state: Vec<u8>, | ||
| consensus_state_id: ConsensusStateId, | ||
| state_machine_map: &mut BTreeMap<StateMachine, Vec<StateCommitmentHeight>>, | ||
| consensus_proof: Vec<u8> | ||
| )-> Result<Vec<u8>, Error>; | ||
|
|
Member
There was a problem hiding this comment.
So this isn't really the intended direction. Rather you should construct new implementations of the ConsensusClient trait for the various L2 proof types. This trait implementation will be configured with the state machine id of the ethereum chain, and accepts storage proofs of ethereum, proving new finalized L2 state commitments
148ff38 to
fdd4b49
Compare
seunlanlege
reviewed
Mar 5, 2025
Comment on lines
+296
to
+323
| let consensus_state = ConsensusState::decode(&mut &trusted_consensus_state[..]) | ||
| .map_err(|_| Error::Custom("Cannot decode trusted consensus state".to_string()))?; | ||
|
|
||
| // Parse update based on the type | ||
| let update = match BeaconClientUpdate::decode(&mut &consensus_proof[..]) { | ||
| Ok(update) => update, | ||
| Err(_) => { | ||
| // Try to decode as a standalone L2 update | ||
| match L2StateUpdate::decode(&mut &consensus_proof[..]) { | ||
| Ok(l2_update) => { | ||
| // Handle standalone L2 update without changing beacon state | ||
| return self.process_l2_update( | ||
| host, | ||
| consensus_state_id, | ||
| consensus_state, | ||
| l2_update, | ||
| ); | ||
| }, | ||
| Err(_) => { | ||
| return Err(Error::Custom("Cannot decode update".to_string())); | ||
| }, | ||
| } | ||
| }, | ||
| }; | ||
|
|
||
| // Process full beacon update with optional L2 updates | ||
| self.process_beacon_update(host, consensus_state_id, consensus_state, update) | ||
| } |
Member
There was a problem hiding this comment.
The goal is that the verification of L2 state assertions to happen independent of the sync-committee client so it can be updated independently, potentially replacing it entirely with our future zk-casper light client. So you'd have to put the verifiers into new crates
Member
|
stale |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ref #239
Note: this creates an additional trait function, hence currently is a breaking change. Will update as adviced