diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bbbf0476419..9bc056d70ab2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,8 @@ - [#5055](https://github.com/ChainSafe/forest/issues/5055) Fixed an issue where Forest fails on duplicate drand entries. This would only happen on new devnets. +- [#6103](https://github.com/ChainSafe/forest/pull/6103) Fixed `eth_getTransactionCount` to return the nonce of the requested tipset and not its parent. + ## Forest v0.30.1 "Laurelin" Mandatory release for mainnet node operators. It sets the NV27 _Golden Week_ network upgrade to epoch `5_348_280` which corresponds to `Wed 24 Sep 23:00:00 UTC 2025`. It also includes a few improvements that help with snapshot generation and inspection. diff --git a/src/rpc/methods/eth.rs b/src/rpc/methods/eth.rs index a35d9381ab9a..29043d60c4f8 100644 --- a/src/rpc/methods/eth.rs +++ b/src/rpc/methods/eth.rs @@ -2252,7 +2252,10 @@ impl RpcMethod<2> for EthGetTransactionCount { block_param.clone(), ResolveNullTipset::TakeOlder, )?; - let state = StateTree::new_from_root(ctx.store_owned(), ts.parent_state())?; + + let (state_cid, _) = ctx.state_manager.tipset_state(&ts).await?; + + let state = StateTree::new_from_root(ctx.store_owned(), &state_cid)?; let actor = state.get_required_actor(&addr)?; if is_evm_actor(&actor.code) { let evm_state = evm::State::load(ctx.store(), actor.code, actor.state)?; diff --git a/src/state_manager/mod.rs b/src/state_manager/mod.rs index 53845000c9ef..9a14553ad0a8 100644 --- a/src/state_manager/mod.rs +++ b/src/state_manager/mod.rs @@ -393,7 +393,7 @@ impl StateManager where DB: Blockstore + Send + Sync + 'static, { - /// Returns the pair of (parent state root, message receipt root). This will + /// Returns the pair of (state root, message receipt root). This will /// either be cached or will be calculated and fill the cache. Tipset /// state for a given tipset is guaranteed not to be computed twice. pub async fn tipset_state(self: &Arc, tipset: &Arc) -> anyhow::Result {