mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 15:33:47 +00:00
change withdrawals hash
This commit is contained in:
parent
1483c960ed
commit
cd5a7d3391
6 changed files with 9 additions and 9 deletions
|
|
@ -383,7 +383,7 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr
|
||||||
header.BaseFee = eip1559.CalcBaseFee(config, parent.Header())
|
header.BaseFee = eip1559.CalcBaseFee(config, parent.Header())
|
||||||
}
|
}
|
||||||
if config.IsShanghai(header.Number) {
|
if config.IsShanghai(header.Number) {
|
||||||
header.WithdrawalsHash = &types.EmptyWithdrawalsHash
|
header.WithdrawalsHash = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var receipts []*types.Receipt
|
var receipts []*types.Receipt
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ func (h *Header) SanityCheck() error {
|
||||||
// that is: no transactions, no uncles and no withdrawals.
|
// that is: no transactions, no uncles and no withdrawals.
|
||||||
func (h *Header) EmptyBody() bool {
|
func (h *Header) EmptyBody() bool {
|
||||||
if h.WithdrawalsHash != nil {
|
if h.WithdrawalsHash != nil {
|
||||||
return h.TxHash == EmptyTxsHash && *h.WithdrawalsHash == EmptyWithdrawalsHash
|
return h.TxHash == EmptyTxsHash && h.WithdrawalsHash == nil
|
||||||
}
|
}
|
||||||
return h.TxHash == EmptyTxsHash && h.UncleHash == EmptyUncleHash
|
return h.TxHash == EmptyTxsHash && h.UncleHash == EmptyUncleHash
|
||||||
}
|
}
|
||||||
|
|
@ -323,7 +323,7 @@ func NewBlockWithWithdrawals(header *Header, txs []*Transaction, uncles []*Heade
|
||||||
if withdrawals == nil {
|
if withdrawals == nil {
|
||||||
b.header.WithdrawalsHash = nil
|
b.header.WithdrawalsHash = nil
|
||||||
} else if len(withdrawals) == 0 {
|
} else if len(withdrawals) == 0 {
|
||||||
b.header.WithdrawalsHash = &EmptyWithdrawalsHash
|
b.header.WithdrawalsHash = nil
|
||||||
} else {
|
} else {
|
||||||
h := DeriveSha(Withdrawals(withdrawals), hasher)
|
h := DeriveSha(Withdrawals(withdrawals), hasher)
|
||||||
b.header.WithdrawalsHash = &h
|
b.header.WithdrawalsHash = &h
|
||||||
|
|
@ -353,8 +353,7 @@ func CopyHeader(h *Header) *Header {
|
||||||
}
|
}
|
||||||
|
|
||||||
if h.WithdrawalsHash != nil {
|
if h.WithdrawalsHash != nil {
|
||||||
cpy.WithdrawalsHash = new(common.Hash)
|
cpy.WithdrawalsHash = nil
|
||||||
*cpy.WithdrawalsHash = *h.WithdrawalsHash
|
|
||||||
}
|
}
|
||||||
if h.ExcessBlobGas != nil {
|
if h.ExcessBlobGas != nil {
|
||||||
cpy.ExcessBlobGas = new(uint64)
|
cpy.ExcessBlobGas = new(uint64)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ var (
|
||||||
EmptyReceiptsHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
|
EmptyReceiptsHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
|
||||||
|
|
||||||
// EmptyWithdrawalsHash is the known hash of the empty withdrawal set.
|
// 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
|
// TrieRootHash returns the hash itself if it's non-empty or the predefined
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,8 @@ func validate(jt JumpTable) JumpTable {
|
||||||
|
|
||||||
func newCancunInstructionSet() JumpTable {
|
func newCancunInstructionSet() JumpTable {
|
||||||
instructionSet := newShanghaiInstructionSet()
|
instructionSet := newShanghaiInstructionSet()
|
||||||
enable4844(&instructionSet) // EIP-4844 (DATAHASH opcode)
|
// Not included in bor's cancun fork
|
||||||
|
// enable4844(&instructionSet) // EIP-4844 (DATAHASH opcode)
|
||||||
enable1153(&instructionSet) // EIP-1153 "Transient Storage"
|
enable1153(&instructionSet) // EIP-1153 "Transient Storage"
|
||||||
enable5656(&instructionSet) // EIP-5656 (MCOPY opcode)
|
enable5656(&instructionSet) // EIP-5656 (MCOPY opcode)
|
||||||
enable6780(&instructionSet) // EIP-6780 SELFDESTRUCT only in same transaction
|
enable6780(&instructionSet) // EIP-6780 SELFDESTRUCT only in same transaction
|
||||||
|
|
|
||||||
|
|
@ -793,7 +793,7 @@ func getBody(block *types.Block) *engine.ExecutionPayloadBodyV1 {
|
||||||
|
|
||||||
// Post-shanghai withdrawals MUST be set to empty slice instead of nil
|
// Post-shanghai withdrawals MUST be set to empty slice instead of nil
|
||||||
if withdrawals == nil && block.Header().WithdrawalsHash != nil {
|
if withdrawals == nil && block.Header().WithdrawalsHash != nil {
|
||||||
withdrawals = make([]*types.Withdrawal, 0)
|
withdrawals = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return &engine.ExecutionPayloadBodyV1{
|
return &engine.ExecutionPayloadBodyV1{
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ func newFetchResult(header *types.Header, fastSync bool) *fetchResult {
|
||||||
if !header.EmptyBody() {
|
if !header.EmptyBody() {
|
||||||
item.pending.Store(item.pending.Load() | (1 << bodyType))
|
item.pending.Store(item.pending.Load() | (1 << bodyType))
|
||||||
} else if header.WithdrawalsHash != nil {
|
} else if header.WithdrawalsHash != nil {
|
||||||
item.Withdrawals = make(types.Withdrawals, 0)
|
item.Withdrawals = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if fastSync && !header.EmptyReceipts() {
|
if fastSync && !header.EmptyReceipts() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue