Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancun cannot happen before Merge #7474

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
"github.com/ledgerwatch/erigon/common/debug"
"github.com/ledgerwatch/erigon/common/hexutil"
"github.com/ledgerwatch/erigon/consensus"
"github.com/ledgerwatch/erigon/consensus/misc"
"github.com/ledgerwatch/erigon/core/state"
"github.com/ledgerwatch/erigon/core/types"
"github.com/ledgerwatch/erigon/core/types/accounts"
Expand Down Expand Up @@ -380,13 +379,6 @@ func (c *Clique) Finalize(config *chain.Config, header *types.Header, state *sta
) (types.Transactions, types.Receipts, error) {
// No block rewards in PoA, so the state remains as is and uncles are dropped
header.UncleHash = types.CalcUncleHash(nil)
if config.IsCancun(header.Time) {
if parent := chain.GetHeaderByHash(header.ParentHash); parent != nil {
header.SetExcessDataGas(misc.CalcExcessDataGas(parent.ExcessDataGas, misc.CountBlobs(txs)))
} else {
header.SetExcessDataGas(new(big.Int))
}
}
return txs, r, nil
}

Expand Down
9 changes: 2 additions & 7 deletions consensus/clique/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,8 @@ func (c *Clique) verifyCascadingFields(chain consensus.ChainHeaderReader, header
// Verify the header's EIP-1559 attributes.
return err
}
if !chain.Config().IsCancun(header.Time) {
if header.ExcessDataGas != nil {
return fmt.Errorf("invalid excessDataGas before fork: have %v, expected 'nil'", header.ExcessDataGas)
}
} else if err := misc.VerifyEip4844Header(chain.Config(), parent, header); err != nil {
// Verify the header's EIP-4844 attributes.
return err
if header.ExcessDataGas != nil {
return fmt.Errorf("invalid excessDataGas before fork: have %v, expected 'nil'", header.ExcessDataGas)
}

// Retrieve the snapshot needed to verify this header and cache it
Expand Down
16 changes: 2 additions & 14 deletions consensus/ethash/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,8 @@ func VerifyHeaderBasics(chain consensus.ChainHeaderReader, header, parent *types
// Verify the header's EIP-1559 attributes.
return err
}
if !chain.Config().IsCancun(header.Time) {
if header.ExcessDataGas != nil {
return fmt.Errorf("invalid excessDataGas before fork: have %v, expected 'nil'", header.ExcessDataGas)
}
} else if err := misc.VerifyEip4844Header(chain.Config(), parent, header); err != nil {
// Verify the header's EIP-4844 attributes.
return err
if header.ExcessDataGas != nil {
return fmt.Errorf("invalid excessDataGas before fork: have %v, expected 'nil'", header.ExcessDataGas)
}

// Verify that the block number is parent's +1
Expand Down Expand Up @@ -569,13 +564,6 @@ func (ethash *Ethash) Finalize(config *chain.Config, header *types.Header, state
) (types.Transactions, types.Receipts, error) {
// Accumulate any block and uncle rewards and commit the final state root
accumulateRewards(config, state, header, uncles)
if config.IsCancun(header.Time) {
if parent := chain.GetHeaderByHash(header.ParentHash); parent != nil {
header.SetExcessDataGas(misc.CalcExcessDataGas(parent.ExcessDataGas, misc.CountBlobs(txs)))
} else {
header.SetExcessDataGas(new(big.Int))
}
}
return txs, r, nil
}

Expand Down