Skip to content

Commit

Permalink
fix block rlp encode issue
Browse files Browse the repository at this point in the history
  • Loading branch information
FletcherMan committed Jun 27, 2023
1 parent 1201e3f commit 9a7bdc2
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions core/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ type Header struct {
MixDigest common.Hash `json:"mixHash"`
Nonce BlockNonce `json:"nonce"`

// BaseFee was added by EIP-1559 and is ignored in legacy headers.
BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"`

// BLSData was the field specified for morphism
BLSData BLSData `json:"blsData" rlp:"optional"`

// BaseFee was added by EIP-1559 and is ignored in legacy headers.
BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"`

// WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.
// Included for Ethereum compatibility in Scroll SDK
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"`
Expand Down Expand Up @@ -129,25 +129,27 @@ func (h *Header) Hash() common.Hash {
Nonce BlockNonce

// BaseFee was added by EIP-1559 and is ignored in legacy headers.
BaseFee *big.Int `rlp:"optional"`
BaseFee *big.Int `rlp:"optional"`
WithdrawalsHash *common.Hash `rlp:"optional"`
}
h2 := &headerNoBLS{
ParentHash: h.ParentHash,
UncleHash: h.UncleHash,
Coinbase: h.Coinbase,
Root: h.Root,
TxHash: h.TxHash,
ReceiptHash: h.ReceiptHash,
Bloom: h.Bloom,
Difficulty: h.Difficulty,
Number: h.Number,
GasLimit: h.GasLimit,
GasUsed: h.GasUsed,
Time: h.Time,
Extra: h.Extra,
MixDigest: h.MixDigest,
Nonce: h.Nonce,
BaseFee: h.BaseFee,
ParentHash: h.ParentHash,
UncleHash: h.UncleHash,
Coinbase: h.Coinbase,
Root: h.Root,
TxHash: h.TxHash,
ReceiptHash: h.ReceiptHash,
Bloom: h.Bloom,
Difficulty: h.Difficulty,
Number: h.Number,
GasLimit: h.GasLimit,
GasUsed: h.GasUsed,
Time: h.Time,
Extra: h.Extra,
MixDigest: h.MixDigest,
Nonce: h.Nonce,
BaseFee: h.BaseFee,
WithdrawalsHash: h.WithdrawalsHash,
}
return rlpHash(h2)
}
Expand Down

0 comments on commit 9a7bdc2

Please sign in to comment.