Skip to content

fix(seismic-viem): fetch latest block hash after other RPC calls#123

Open
drappi-ai wants to merge 2 commits intomainfrom
cdai__fix-stale-latest-block-hash
Open

fix(seismic-viem): fetch latest block hash after other RPC calls#123
drappi-ai wants to merge 2 commits intomainfrom
cdai__fix-stale-latest-block-hash

Conversation

@drappi-ai
Copy link
Copy Markdown
Contributor

@drappi-ai drappi-ai commented Mar 19, 2026

Summary

Moves resolveBlockParams() out of Promise.all so it runs after nonce and chainId resolution. This minimizes the window between fetching the latest block hash and using it in the transaction, reducing the chance of submitting a stale recentBlockHash.

Users reported recentBlockHash values that were minutes to hours stale. We traced the full stack (viem transport, nginx, reth node) and confirmed the node returns fresh blocks — the staleness originates from some intermediate layer in the browser/dapp environment. By deferring the block fetch to the last possible moment, we shrink the staleness window regardless of the root cause.

Test plan

  • bun run typecheck passes
  • Integration tests with sanvil (bun run viem:test)
  • Shielded writes and signed reads still work end-to-end

Move resolveBlockParams() out of Promise.all so it runs after
nonce and chainId resolution.  This minimizes the window between
fetching the latest block hash and using it in the transaction,
reducing the chance of submitting a stale recentBlockHash.
@drappi-ai drappi-ai force-pushed the cdai__fix-stale-latest-block-hash branch from 3a32573 to 6cbbb97 Compare March 19, 2026 16:07
@drappi-ai drappi-ai changed the title fix(seismic-viem): prevent stale latest block hash in tx metadata fix(seismic-viem): fetch latest block hash after other RPC calls Mar 19, 2026
@cdrappi cdrappi marked this pull request as ready for review March 19, 2026 16:11
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.

1 participant