17
17
package eip1559
18
18
19
19
import (
20
+ "fmt"
20
21
"math/big"
21
22
22
23
"github.com/ethereum/go-ethereum/common"
24
+ "github.com/ethereum/go-ethereum/consensus/misc"
23
25
"github.com/harmony-one/harmony/block"
24
26
"github.com/harmony-one/harmony/internal/params"
27
+ "github.com/pkg/errors"
25
28
)
26
29
27
- /*
28
30
// VerifyEIP1559Header verifies some header attributes which were changed in EIP-1559,
29
31
// - gas limit check
30
32
// - basefee check
31
- func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types .Header) error {
33
+ func VerifyEIP1559Header (config * params.ChainConfig , parent , header * block .Header ) error {
32
34
// 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 ()
36
38
}
37
- if err := misc.VerifyGaslimit(parentGasLimit, header.GasLimit); err != nil {
39
+ if err := misc .VerifyGaslimit (parentGasLimit , header .GasLimit () ); err != nil {
38
40
return err
39
41
}
40
42
// Verify the header is not malformed
@@ -43,13 +45,12 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade
43
45
}
44
46
// Verify the baseFee is correct based on the parent header.
45
47
expectedBaseFee := CalcBaseFee (config , parent )
46
- if header.BaseFee.Cmp(expectedBaseFee) != 0 {
48
+ if header .BaseFee () .Cmp (expectedBaseFee ) != 0 {
47
49
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 () )
49
51
}
50
52
return nil
51
53
}
52
- */
53
54
54
55
// CalcBaseFee calculates the basefee of the header.
55
56
func CalcBaseFee (config * params.ChainConfig , parent * block.Header ) * big.Int {
0 commit comments