1717package eip1559
1818
1919import (
20+ "fmt"
2021 "math/big"
2122
2223 "github.com/ethereum/go-ethereum/common"
24+ "github.com/ethereum/go-ethereum/consensus/misc"
2325 "github.com/harmony-one/harmony/block"
2426 "github.com/harmony-one/harmony/internal/params"
27+ "github.com/pkg/errors"
2528)
2629
27- /*
2830// VerifyEIP1559Header verifies some header attributes which were changed in EIP-1559,
2931// - gas limit check
3032// - basefee check
31- func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types .Header) error {
33+ func VerifyEIP1559Header (config * params.ChainConfig , parent , header * block .Header ) error {
3234 // Verify that the gas limit remains within allowed bounds
33- parentGasLimit := parent.GasLimit
34- if !config.IsLondon(parent.Number) {
35- parentGasLimit = parent.GasLimit * config.ElasticityMultiplier()
35+ parentGasLimit := parent .GasLimit ()
36+ if ! config .IsLondon (parent .Number () ) {
37+ parentGasLimit = parent .GasLimit () * config .ElasticityMultiplier ()
3638 }
37- if err := misc.VerifyGaslimit(parentGasLimit, header.GasLimit); err != nil {
39+ if err := misc .VerifyGaslimit (parentGasLimit , header .GasLimit () ); err != nil {
3840 return err
3941 }
4042 // Verify the header is not malformed
@@ -43,13 +45,12 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade
4345 }
4446 // Verify the baseFee is correct based on the parent header.
4547 expectedBaseFee := CalcBaseFee (config , parent )
46- if header.BaseFee.Cmp(expectedBaseFee) != 0 {
48+ if header .BaseFee () .Cmp (expectedBaseFee ) != 0 {
4749 return fmt .Errorf ("invalid baseFee: have %s, want %s, parentBaseFee %s, parentGasUsed %d" ,
48- header.BaseFee, expectedBaseFee, parent.BaseFee, parent.GasUsed)
50+ header .BaseFee () , expectedBaseFee , parent .BaseFee () , parent .GasUsed () )
4951 }
5052 return nil
5153}
52- */
5354
5455// CalcBaseFee calculates the basefee of the header.
5556func CalcBaseFee (config * params.ChainConfig , parent * block.Header ) * big.Int {
0 commit comments