Verify excessBlobGas (EIP-4844) (#8269)

This commit is contained in:
Andrew Ashikhmin 2023-09-22 11:52:33 +02:00 committed by GitHub
parent 75b0ba0c69
commit e62e131a8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 8 deletions

View File

@ -242,12 +242,18 @@ func (s *Merge) verifyHeader(chain consensus.ChainHeaderReader, header, parent *
return consensus.ErrUnexpectedWithdrawals
}
cancun := chain.Config().IsCancun(header.Time)
if cancun {
return misc.VerifyPresenceOfCancunHeaderFields(header)
} else {
if !chain.Config().IsCancun(header.Time) {
return misc.VerifyAbsenceOfCancunHeaderFields(header)
}
if err := misc.VerifyPresenceOfCancunHeaderFields(header); err != nil {
return err
}
expectedExcessBlobGas := misc.CalcExcessBlobGas(parent)
if *header.ExcessBlobGas != expectedExcessBlobGas {
return fmt.Errorf("invalid excessBlobGas: have %d, want %d", *header.ExcessBlobGas, expectedExcessBlobGas)
}
return nil
}
func (s *Merge) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {

View File

@ -50,7 +50,7 @@ func VerifyEip1559Header(config *chain.Config, parent, header *types.Header, ski
expectedBaseFee := CalcBaseFee(config, parent)
if header.BaseFee.Cmp(expectedBaseFee) != 0 {
return fmt.Errorf("invalid baseFee: have %s, want %s, parentBaseFee %s, parentGasUsed %d",
expectedBaseFee, header.BaseFee, parent.BaseFee, parent.GasUsed)
header.BaseFee, expectedBaseFee, parent.BaseFee, parent.GasUsed)
}
return nil
}

View File

@ -22,9 +22,6 @@ func TestExecutionSpec(t *testing.T) {
dir := filepath.Join(".", "execution-spec-tests")
// TODO(yperbasis): fix me
bt.skipLoad(`^cancun/eip4844_blobs/excess_blob_gas/`)
checkStateRoot := true
bt.walk(t, dir, func(t *testing.T, name string, test *BlockTest) {