Giter Club home page Giter Club logo

Comments (5)

jsvisa avatar jsvisa commented on July 18, 2024 1

yeah, but this will fail for ethereum's dev node, we need to add a feature to seperate them.

from reth.

Troublor avatar Troublor commented on July 18, 2024

After a quick inspection, it seems AutoSeal does not set the receipts_root in the block header:

let Block { mut header, body, .. } = block.block;
let body = BlockBody { transactions: body, ommers, withdrawals, requests };
trace!(target: "consensus::auto", ?execution_outcome, ?header, ?body, "executed block, calculating state root and completing header");
// calculate the state root
header.state_root = db.state_root(execution_outcome.state())?;
trace!(target: "consensus::auto", root=?header.state_root, ?body, "calculated root");
// finally insert into storage
self.insert_new_block(header.clone(), body);
// set new header with hash that should have been updated by insert_new_block
let new_header = header.seal(self.best_hash);

from reth.

jsvisa avatar jsvisa commented on July 18, 2024

I think it maybe related with

pub fn calculate_receipt_root_optimism(
receipts: &[ReceiptWithBloom],
chain_spec: &reth_chainspec::ChainSpec,
timestamp: u64,
) -> B256 {
// There is a minor bug in op-geth and op-erigon where in the Regolith hardfork,
// the receipt root calculation does not include the deposit nonce in the receipt
// encoding. In the Regolith Hardfork, we must strip the deposit nonce from the
// receipts before calculating the receipt root. This was corrected in the Canyon
// hardfork.
if chain_spec.is_fork_active_at_timestamp(reth_chainspec::Hardfork::Regolith, timestamp) &&
!chain_spec.is_fork_active_at_timestamp(reth_chainspec::Hardfork::Canyon, timestamp)
{
let receipts = receipts
.iter()
.cloned()
.map(|mut r| {
r.receipt.deposit_nonce = None;
r
})
.collect::<Vec<_>>();
return ordered_trie_root_with_encoder(receipts.as_slice(), |r, buf| {
r.encode_inner(buf, false)
})
}
ordered_trie_root_with_encoder(receipts, |r, buf| r.encode_inner(buf, false))
}

try to investigate and fix it

from reth.

jsvisa avatar jsvisa commented on July 18, 2024

@Troublor you're right, the receipts_root were not calculated. I'm trying to fix it.

from reth.

Troublor avatar Troublor commented on July 18, 2024

@jsvisa FYI, I tried to added this code into build_and_execute function, it seems to work:

// calculate the receipts root
header.receipts_root = execution_outcome
    .receipts
    .optimism_root_slow(0, &chain_spec, header.timestamp)
    .expect("receipts root should never be none");

from reth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.