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

operator fee #1

Closed
wants to merge 9 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reformat
  • Loading branch information
yuwen01 committed Sep 30, 2024
commit 7db3a3ec2af5014aefcb05fd5d0e60778b821104
25 changes: 14 additions & 11 deletions crates/protocol/src/block_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,20 @@ impl L1BlockInfoTx {
.elasticity_multiplier
.try_into()
.map_err(|_| BlockInfoError::Eip1559Elasticity)?;
let (operator_fee_scalar, operator_fee_constant) = if scalar[0] == L1_SCALAR_HOLOCENE {
let operator_fee_scalar = Ok::<u32, BlockInfoError>(u32::from_be_bytes(
scalar[12..16].try_into().map_err(|_| BlockInfoError::OperatorFeeScalar)?,
))?;
let operator_fee_constant = Ok::<u64, BlockInfoError>(u64::from_be_bytes(
scalar[16..24].try_into().map_err(|_| BlockInfoError::OperatorFeeConstant)?,
))?;
(operator_fee_scalar, operator_fee_constant)
} else {
(0, 0)
};
let (operator_fee_scalar, operator_fee_constant) = (scalar[0] == L1_SCALAR_HOLOCENE)
.then(|| {
let operator_fee_scalar = u32::from_be_bytes(
scalar[12..16].try_into().map_err(|_| BlockInfoError::OperatorFeeScalar)?,
);
let operator_fee_constant = u64::from_be_bytes(
scalar[16..24]
.try_into()
.map_err(|_| BlockInfoError::OperatorFeeConstant)?,
);
Ok::<(u32, u64), BlockInfoError>((operator_fee_scalar, operator_fee_constant))
})
.transpose()?
.unwrap_or_default();
return Ok(Self::Holocene(L1BlockInfoHolocene {
number: l1_header.number,
time: l1_header.timestamp,
Expand Down