Skip to content

Instantly share code, notes, and snippets.

@fxfactorial
Created January 30, 2025 20:14
Show Gist options
  • Save fxfactorial/f94005836b574b665dcd69f7e1dd2324 to your computer and use it in GitHub Desktop.
Save fxfactorial/f94005836b574b665dcd69f7e1dd2324 to your computer and use it in GitHub Desktop.
Fixing the dreaded "missing trie node"..."(path ) state ....is not available, not found" on geth and its many forks
  1. first find when we have actual state found give big timeout because it can take a bit of time
$ cast rpc --rpc-timeout=9999999999 --rpc-url=localhost:3545 debug_getAccessibleState $(cast
to-hex START_BLOCK) $(cast to-hex END_BLOCK)

where START_BLOCK is the beginning the search and END_BLOCK is the end of the search

  1. Get the block hash and rewind the chain to it

now say we got back 12594554 from step 1, lets find its corresponding block hash and rewind the chain to it

$ cast block --rpc-url=localhost:3545 12594554 --json | jq .hash

which gave back 0x67790e70a68fbbb2cf9336aa4b945b0dba1620cd5e7a5732a64960ce5d8a72fe and lets set the head to it (also this could take a while so do the --rpc-timeout)

$ cast rpc --rpc-timeout=9999999999 --rpc-url=localhost:3545 debug_setHead $(cast to-hex 12594554)
  1. Finally lets do the fcu call to update the block pointers to that block hash, notice we do it on the authed port and the jwt secret
$ cast rpc --jwt-secret $(cat jwt.txt) --rpc-url=localhost:8551 engine_forkchoiceUpdatedV3
	'{"headBlockHash":"0x67790e70a68fbbb2cf9336aa4b945b0dba1620cd5e7a5732a64960ce5d8a72fe",
      "safeBlockHash":"0x67790e70a68fbbb2cf9336aa4b945b0dba1620cd5e7a5732a64960ce5d8a72fe",
      "finalizedBlockHash":"0x67790e70a68fbbb2cf9336aa4b945b0dba1620cd5e7a5732a64960ce5d8a72fe"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment