Skip to content

New witness calculation and DA config #436

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

Merged

Conversation

SozinM
Copy link
Contributor

@SozinM SozinM commented Feb 19, 2025

📝 Summary

New witness calculation algo.
DA config.
Reserve space for builder_tx in block_da_size.

Note:
If da_config.max_da_tx_size is too small, execute function of OpBuilder will panic, because it's improssible to insert builder transaction.
estimate_builder_tx_da_size may be a little bit heavy, maybe we could precompute tx size for builder_tx and reuse it

💡 Motivation and Context


✅ I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

Add DA config to builder
Account for builder_tx in block_da_size.
@SozinM SozinM mentioned this pull request Feb 20, 2025
3 tasks
// Check that it's possible to create builder tx, considering max_da_tx_size, otherwise panic
if let Some(tx_da_limit) = ctx.da_config.max_da_tx_size() {
// Panic indicate max_da_tx_size misconfiguration
assert!(tx_da_limit >= builder_tx_da_size as u64);
Copy link
Contributor

Choose a reason for hiding this comment

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

is this copied from the payload builder in reth? wondering if there should be an error log as well here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this little piece is mine
I'll add a message, thank you!

Comment on lines 1302 to 1329
self.builder_signer()
.map(|signer| {
let base_fee = self.base_fee();
// Create message with block number for the builder to sign
let nonce = db
.load_cache_account(signer.address)
.map(|acc| acc.account_info().unwrap_or_default().nonce)
.map_err(|_| {
PayloadBuilderError::other(OpPayloadBuilderError::AccountLoadFailed(
signer.address,
))
})?;

// Create the EIP-1559 transaction
let eip1559 = OpTypedTransaction::Eip1559(TxEip1559 {
chain_id: self.chain_id(),
nonce,
gas_limit: builder_tx_gas,
max_fee_per_gas: base_fee.into(),
max_priority_fee_per_gas: 0,
to: TxKind::Call(Address::ZERO),
// Include the message as part of the transaction data
input: message.into(),
..Default::default()
});
let tx = eip1559;
// Sign the transaction
let builder_tx = signer.sign_tx(tx).map_err(PayloadBuilderError::other)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicated code here, can encapsulate into a get_signed_builder_tx function

Solar Mithril added 3 commits February 20, 2025 16:07
Move builder tx creation to dedicated function
@SozinM
Copy link
Contributor Author

SozinM commented Feb 21, 2025

Considering it got approves from @ferranbt and @avalonche (in PM) i'm merging this

@SozinM SozinM merged commit b5b5a87 into flashbots:reth-1.2.0 Feb 21, 2025
4 checks passed
@SozinM SozinM deleted the msozin/op-rbuilder/witness-da branch March 11, 2025 10: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.

3 participants