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

feat(protocol): Batch Utilities #191

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat(protocol): Batch Utilities #191

wants to merge 2 commits into from

Conversation

refcell
Copy link
Collaborator

@refcell refcell commented Oct 27, 2024

Description

Ports batch utilities to op-alloy-protocol.

Provenance

Part of a port migrating the batch types from kona-derive to op-alloy. See kona#695.

@refcell
Copy link
Collaborator Author

refcell commented Oct 27, 2024

crates/protocol/src/utils.rs Outdated Show resolved Hide resolved
crates/protocol/src/utils.rs Show resolved Hide resolved
crates/protocol/src/utils.rs Outdated Show resolved Hide resolved
Base automatically changed from rf/feat/batch-errors to main October 28, 2024 12:41
Comment on lines +271 to +284
/// Checks if the signature of the passed [TxEnvelope] is protected.
pub const fn is_protected_v(tx: &TxEnvelope) -> bool {
match tx {
TxEnvelope::Legacy(tx) => {
let v = tx.signature().v().to_u64();
if 64 - v.leading_zeros() <= 8 {
return v != 27 && v != 28 && v != 1 && v != 0;
}
// anything not 27 or 28 is considered protected
true
}
_ => true,
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI @onbjerg, I've upstreamed this to TxEnvelope in alloy: alloy-rs/alloy#1578

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can refactor this out later once it lands in a release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-protocol Area: protocol crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants