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

imp: add support for electra #375

Merged
merged 15 commits into from
Mar 11, 2025
Merged

imp: add support for electra #375

merged 15 commits into from
Mar 11, 2025

Conversation

gjermundgaraba
Copy link
Contributor

Description

closes: #368


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Wrote unit and integration tests.
  • Added relevant natspec and godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@gjermundgaraba gjermundgaraba requested a review from srdtrk as a code owner March 8, 2025 09:42
@gjermundgaraba gjermundgaraba changed the title Gjermund/electra imp: add support for electra Mar 8, 2025
Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.86%. Comparing base (1f242e0) to head (376ee90).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #375   +/-   ##
=======================================
  Coverage   99.86%   99.86%           
=======================================
  Files          14       14           
  Lines         731      731           
=======================================
  Hits          730      730           
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@srdtrk srdtrk left a comment

Choose a reason for hiding this comment

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

Great work. Did my initial pass. Let's try to address as much of these as we can before merging.

@@ -88,6 +90,7 @@ func (s *IbcEurekaTestSuite) SetupSuite(ctx context.Context, proofType operator.
eth, simd := s.EthChain, s.CosmosChains[0]

var prover string
shouldGenerateRustFixtures := false
Copy link
Member

Choose a reason for hiding this comment

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

This variable seems useless

@@ -326,11 +332,13 @@ where
},
account_update,
consensus_update: update.clone(),
});
};
headers.push(header.clone());
Copy link
Member

Choose a reason for hiding this comment

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

nit: You can add the debug statement before this push and remove the clone if you want since pushing cannot fail anyway...

impl IICS26RouterMsgs::Payload {
/// Returns the commitment path for the payload.
#[must_use]
pub fn commitment_hash(&self) -> Vec<u8> {
Copy link
Member

Choose a reason for hiding this comment

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

need not be public

Suggested change
pub fn commitment_hash(&self) -> Vec<u8> {
fn commitment_hash(&self) -> Vec<u8> {

@@ -29,6 +30,37 @@ impl IICS26RouterMsgs::Packet {
path
}

/// Returns the packet commitment
#[must_use]
pub fn commit_packet(&self) -> Vec<u8> {
Copy link
Member

Choose a reason for hiding this comment

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

Should be renamed imo.

Suggested change
pub fn commit_packet(&self) -> Vec<u8> {
pub fn packet_commitment(&self) -> Vec<u8> {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kinda of agree, but I was using the naming from ibc-go to just be consistent. I'm OK with either honestly

Comment on lines +48 to +51
let mut app_bytes = Vec::new();
for payload in &self.payloads {
app_bytes.extend_from_slice(&payload.commitment_hash());
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: You should be able to do this via iterator methods on self.payloads

Copy link
Member

@srdtrk srdtrk left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -27,11 +27,13 @@ pub enum EthereumIBCError {
#[error("insufficient number of sync committee participants ({0})")]
InsufficientSyncCommitteeParticipants(u64),

#[error("update header contains deneb specific information")]
MustBeDeneb,
#[error("unsupported fork version, we only support electra")]
Copy link
Member

Choose a reason for hiding this comment

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

I feel like this should be MustBeElectra, or we will forget to update this string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, maybe that's better, will change to that!

/// `get_generalized_index(BeaconState, "next_sync_committee")`
pub const NEXT_SYNC_COMMITTEE_INDEX: u64 = 55;
pub const NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA: u64 = 87;
/// `get_generalized_index(BeaconBlockBody, "execution_payload")`
pub const EXECUTION_PAYLOAD_INDEX: u64 = 25;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub const EXECUTION_PAYLOAD_INDEX: u64 = 25;
pub const EXECUTION_PAYLOAD_GINDEX: u64 = 25;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, will do!

@gjermundgaraba gjermundgaraba merged commit cf3b2d8 into main Mar 11, 2025
108 of 110 checks passed
@gjermundgaraba gjermundgaraba deleted the gjermund/electra branch March 11, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement electra changes for the ethereum light client
2 participants