Skip to content

Commit e247123

Browse files
committed
fix: Add RequestHash header field for SDK compatibility
1 parent 3c454e7 commit e247123

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

core/types/block.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ type Header struct {
115115
// Included for Ethereum compatibility in Scroll SDK
116116
ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"`
117117

118+
// RequestsHash was added by EIP-7685 and is ignored in legacy headers.
119+
RequestsHash *common.Hash `json:"requestsHash" rlp:"optional"`
120+
118121
// Hacky: used internally to mark the header as requested by the downloader at the deliver queue.
119122
// Note: This is only used internally to mark a previously requested block, it is not included
120123
// in db, on the network wire protocol, or in RPC responses.
@@ -314,6 +317,26 @@ func CopyHeader(h *Header) *Header {
314317
cpy.BlockSignature = make([]byte, len(h.BlockSignature))
315318
copy(cpy.BlockSignature, h.BlockSignature)
316319
}
320+
if h.WithdrawalsHash != nil {
321+
cpy.WithdrawalsHash = new(common.Hash)
322+
*cpy.WithdrawalsHash = *h.WithdrawalsHash
323+
}
324+
if h.ExcessBlobGas != nil {
325+
cpy.ExcessBlobGas = new(uint64)
326+
*cpy.ExcessBlobGas = *h.ExcessBlobGas
327+
}
328+
if h.BlobGasUsed != nil {
329+
cpy.BlobGasUsed = new(uint64)
330+
*cpy.BlobGasUsed = *h.BlobGasUsed
331+
}
332+
if h.ParentBeaconRoot != nil {
333+
cpy.ParentBeaconRoot = new(common.Hash)
334+
*cpy.ParentBeaconRoot = *h.ParentBeaconRoot
335+
}
336+
if h.RequestsHash != nil {
337+
cpy.RequestsHash = new(common.Hash)
338+
*cpy.RequestsHash = *h.RequestsHash
339+
}
317340
return &cpy
318341
}
319342

@@ -377,6 +400,27 @@ func (b *Block) BaseFee() *big.Int {
377400
return new(big.Int).Set(b.header.BaseFee)
378401
}
379402

403+
func (b *Block) BeaconRoot() *common.Hash { return b.header.ParentBeaconRoot }
404+
func (b *Block) RequestsHash() *common.Hash { return b.header.RequestsHash }
405+
406+
func (b *Block) ExcessBlobGas() *uint64 {
407+
var excessBlobGas *uint64
408+
if b.header.ExcessBlobGas != nil {
409+
excessBlobGas = new(uint64)
410+
*excessBlobGas = *b.header.ExcessBlobGas
411+
}
412+
return excessBlobGas
413+
}
414+
415+
func (b *Block) BlobGasUsed() *uint64 {
416+
var blobGasUsed *uint64
417+
if b.header.BlobGasUsed != nil {
418+
blobGasUsed = new(uint64)
419+
*blobGasUsed = *b.header.BlobGasUsed
420+
}
421+
return blobGasUsed
422+
}
423+
380424
func (b *Block) Header() *Header { return CopyHeader(b.header) }
381425

382426
// Body returns the non-header content of the block.

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 8 // Minor version component of the current release
27-
VersionPatch = 20 // Patch version component of the current release
27+
VersionPatch = 21 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)