feay(feynman): include history storage in witness for blockhash opcode (#1218)

* feat(feynman): include history storage in witness for blockhash

* update param
This commit is contained in:
Péter Garamvölgyi 2025-07-01 11:59:54 +02:00 committed by GitHub
parent 3661d1841d
commit 1043f668fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View file

@ -490,6 +490,13 @@ func opBlockhashPostFeynman(pc *uint64, interpreter *EVMInterpreter, scope *Scop
witness.AddBlockHash(num64)
}
num.SetBytes(res[:])
// for provability, revm loads block hash from the history storage system contract,
// so we need to ensure that the corresponding slot is present in the execution witness.
ringIndex := num64 % params.HistoryServeWindow
var key common.Hash
binary.BigEndian.PutUint64(key[24:], ringIndex)
interpreter.evm.StateDB.GetState(params.HistoryStorageAddress, key)
} else {
num.Clear()
}

View file

@ -174,8 +174,6 @@ const (
BlobTxBlobGaspriceUpdateFraction = 5007716 // Controls the maximum rate of change for blob gas price, using Prague parameters
BlobTxTargetBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob // Target consumable blob gas for data blobs per block (for 1559-like pricing), using Prague parameters
HistoryServeWindow = 8192 // Number of blocks to serve historical block hashes for, EIP-2935.
)
// Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations
@ -197,4 +195,5 @@ var (
// EIP-2935 - Serve historical block hashes from state
HistoryStorageAddress = common.HexToAddress("0x0000F90827F1C53a10cb7A02335B175320002935")
HistoryStorageCode = common.FromHex("3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500")
HistoryServeWindow = uint64(8191)
)

View file

@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 8 // Minor version component of the current release
VersionPatch = 63 // Patch version component of the current release
VersionPatch = 64 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)