Skip to content

Conversation

nadtech-hub
Copy link

This should close #7894

Signed-off-by: Aliaksei Misiukevich <[email protected]>
Signed-off-by: Aliaksei Misiukevich <[email protected]>
Copy link

cla-assistant bot commented Sep 8, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
Copy link

cla-assistant bot commented Sep 8, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

This PR doesn't accomplish the desired goal. You've moved all of the slashing_protection crate into eip_3076, but what we would ideally do, is just extract the "pure" EIP-3076 code (without database dependencies) into eip_3076, while leaving all of the database code and Lighthouse-specific logic in the slashing_protection crate.

This would allow us to reduce the dependency surface of crates like eth2 which only need the "pure" EIP-3076 code, and should not depend on Lighthouse's implementation details (our choice of sqlite for the slashing protection database).

Copy link
Member

Choose a reason for hiding this comment

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

The whole interchange-tests directory should not be committed. It was part of the .gitignore in slashing_protection, and should continue to be ignored.

The source lives here:

@michaelsproul michaelsproul added the waiting-on-author The reviewer has suggested changes and awaits thier implementation. label Sep 9, 2025
@nadtech-hub
Copy link
Author

This PR doesn't accomplish the desired goal. You've moved all of the slashing_protection crate into eip_3076, but what we would ideally do, is just extract the "pure" EIP-3076 code (without database dependencies) into eip_3076, while leaving all of the database code and Lighthouse-specific logic in the slashing_protection crate.

This would allow us to reduce the dependency surface of crates like eth2 which only need the "pure" EIP-3076 code, and should not depend on Lighthouse's implementation details (our choice of sqlite for the slashing protection database).

Makes sense, I'll do changes accordingly

@nadtech-hub nadtech-hub marked this pull request as draft September 9, 2025 03:20
@michaelsproul
Copy link
Member

Thanks!

Let us know if you have any questions, some of the stuff might be tricky to extract

@nadtech-hub
Copy link
Author

nadtech-hub commented Sep 9, 2025

Thanks!

Let us know if you have any questions, some of the stuff might be tricky to extract

It was matter of migrating interchange, signed_block and signed_attestation and corresponding tests, wasn't it? For some reason, I moved the whole thing)

Signed-off-by: Aliaksei Misiukevich <[email protected]>
@nadtech-hub nadtech-hub marked this pull request as ready for review September 13, 2025 10:31
@michaelsproul
Copy link
Member

I think just moving the interchange and its immediate dependents is the way to go, yeah.

Copy link
Member

Choose a reason for hiding this comment

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

This is the wrong SignedAttestation. You should move this one:

#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
pub struct SignedAttestation {
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
pub source_epoch: Epoch,
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
pub target_epoch: Epoch,
#[serde(skip_serializing_if = "Option::is_none")]
pub signing_root: Option<Hash256>,
}
.

Copy link
Member

Choose a reason for hiding this comment

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

Also the wrong SignedBlock.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think Safe, NotSafe or SigningRoot need to be here either. Just move the Interchange type. Start by moving interchange.rs

@nadtech-hub nadtech-hub changed the title Migrating slashing protection Migrating eip-3076 Sep 15, 2025
@nadtech-hub
Copy link
Author

I think just moving the interchange and its immediate dependents is the way to go, yeah.

I also thought that interchange file format needs be moved out along with inner data structures. Separating interchange from database is cumbersome

@michaelsproul
Copy link
Member

The interchange format is the main thing we need to pull out, even if it's just the type definition. Can you elaborate on the interaction with the database that makes it hard to extract?

@nadtech-hub
Copy link
Author

nadtech-hub commented Sep 15, 2025

The interchange format is the main thing we need to pull out, even if it's just the type definition. Can you elaborate on the interaction with the database that makes it hard to extract?

Interchange test modules are harder to migrate because of cohesion with db.
Interchange structure is extractable as a whole but tests will remain in slashing_protection.
Some data structures are replicated in interchange.

@michaelsproul
Copy link
Member

Yeah that sounds acceptable. The main thing we're trying to accomplish is pulling out the type definitions so we can remove the dependency of the eth2 crate on slashing_protection. Instead eth2 should depend on eip_3076.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author The reviewer has suggested changes and awaits thier implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extract EIP-3076 into its own crate
2 participants