-
Notifications
You must be signed in to change notification settings - Fork 1.7k
EIP-98: Optional transaction state root #4296
Conversation
@@ -375,6 +375,9 @@ impl<'x> OpenBlock<'x> { | |||
let unclosed_state = s.block.state.clone(); | |||
|
|||
s.engine.on_close_block(&mut s.block); | |||
if let Err(e) = s.block.state.commit() { | |||
warn!("Encountered error on state commit: {}", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that error be propagated upstream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how commit error are handles in the rest of the codebase.
@@ -65,6 +67,7 @@ impl From<ethjson::spec::Params> for CommonParams { | |||
subprotocol_name: p.subprotocol_name.unwrap_or_else(|| "eth".to_owned()), | |||
min_gas_limit: p.min_gas_limit.into(), | |||
fork_block: if let (Some(n), Some(h)) = (p.fork_block, p.fork_hash) { Some((n.into(), h.into())) } else { None }, | |||
eip98_transition: p.eip98_transition.map_or(0, Into::into), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't that enable eip98
automatically for spec files where that prop is not defined (private chains?)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is the intention
@@ -519,8 +519,14 @@ impl State { | |||
|
|||
// TODO uncomment once to_pod() works correctly. | |||
// trace!("Applied transaction. Diff:\n{}\n", state_diff::diff_pod(&old, &self.to_pod())); | |||
self.commit()?; | |||
let receipt = Receipt::new(self.root().clone(), e.cumulative_gas_used, e.logs); | |||
let state_root = match env_info.number < engine.params().eip98_transition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using if-else
here would a bit more idiomatic and suprisingly shorter then match
.
This PR removes intermediate trie commits when EIP-98 is enabled. Actual transaction parallelization is to follow.