Revert "change withdrawals hash"

This reverts commit cd5a7d3391.
This commit is contained in:
Arpit Temani 2023-11-09 18:09:39 +05:30
parent cd5a7d3391
commit 3106cb143b
6 changed files with 9 additions and 9 deletions

View file

@ -383,7 +383,7 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr
header.BaseFee = eip1559.CalcBaseFee(config, parent.Header())
}
if config.IsShanghai(header.Number) {
header.WithdrawalsHash = nil
header.WithdrawalsHash = &types.EmptyWithdrawalsHash
}
var receipts []*types.Receipt

View file

@ -176,7 +176,7 @@ func (h *Header) SanityCheck() error {
// that is: no transactions, no uncles and no withdrawals.
func (h *Header) EmptyBody() bool {
if h.WithdrawalsHash != nil {
return h.TxHash == EmptyTxsHash && h.WithdrawalsHash == nil
return h.TxHash == EmptyTxsHash && *h.WithdrawalsHash == EmptyWithdrawalsHash
}
return h.TxHash == EmptyTxsHash && h.UncleHash == EmptyUncleHash
}
@ -323,7 +323,7 @@ func NewBlockWithWithdrawals(header *Header, txs []*Transaction, uncles []*Heade
if withdrawals == nil {
b.header.WithdrawalsHash = nil
} else if len(withdrawals) == 0 {
b.header.WithdrawalsHash = nil
b.header.WithdrawalsHash = &EmptyWithdrawalsHash
} else {
h := DeriveSha(Withdrawals(withdrawals), hasher)
b.header.WithdrawalsHash = &h
@ -353,7 +353,8 @@ func CopyHeader(h *Header) *Header {
}
if h.WithdrawalsHash != nil {
cpy.WithdrawalsHash = nil
cpy.WithdrawalsHash = new(common.Hash)
*cpy.WithdrawalsHash = *h.WithdrawalsHash
}
if h.ExcessBlobGas != nil {
cpy.ExcessBlobGas = new(uint64)

View file

@ -39,7 +39,7 @@ var (
EmptyReceiptsHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
// EmptyWithdrawalsHash is the known hash of the empty withdrawal set.
// EmptyWithdrawalsHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
EmptyWithdrawalsHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
)
// TrieRootHash returns the hash itself if it's non-empty or the predefined

View file

@ -83,8 +83,7 @@ func validate(jt JumpTable) JumpTable {
func newCancunInstructionSet() JumpTable {
instructionSet := newShanghaiInstructionSet()
// Not included in bor's cancun fork
// enable4844(&instructionSet) // EIP-4844 (DATAHASH opcode)
enable4844(&instructionSet) // EIP-4844 (DATAHASH opcode)
enable1153(&instructionSet) // EIP-1153 "Transient Storage"
enable5656(&instructionSet) // EIP-5656 (MCOPY opcode)
enable6780(&instructionSet) // EIP-6780 SELFDESTRUCT only in same transaction

View file

@ -793,7 +793,7 @@ func getBody(block *types.Block) *engine.ExecutionPayloadBodyV1 {
// Post-shanghai withdrawals MUST be set to empty slice instead of nil
if withdrawals == nil && block.Header().WithdrawalsHash != nil {
withdrawals = nil
withdrawals = make([]*types.Withdrawal, 0)
}
return &engine.ExecutionPayloadBodyV1{

View file

@ -78,7 +78,7 @@ func newFetchResult(header *types.Header, fastSync bool) *fetchResult {
if !header.EmptyBody() {
item.pending.Store(item.pending.Load() | (1 << bodyType))
} else if header.WithdrawalsHash != nil {
item.Withdrawals = nil
item.Withdrawals = make(types.Withdrawals, 0)
}
if fastSync && !header.EmptyReceipts() {