Skip to content

Commit

Permalink
Fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
nytzuga committed Jan 4, 2024
1 parent 19b3073 commit e8ffb13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
5 changes: 0 additions & 5 deletions commontype/fee_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,6 @@ func (c *FeeConfig) UnmarshalBinary(data []byte) error {
return err
}

c.MinBaseFee, err = utils.UnpackBigInt(&p)
if err != nil {
return err
}

c.TargetGas, err = utils.UnpackBigInt(&p)
if err != nil {
return err
Expand Down
11 changes: 5 additions & 6 deletions utils/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"github.com/ethereum/go-ethereum/common"
)

const BigIntBytesLength = 32

// IncrOne increments bytes value by one
func IncrOne(bytes []byte) {
index := len(bytes) - 1
Expand Down Expand Up @@ -50,11 +52,8 @@ func BytesToHashSlice(b []byte) []common.Hash {

func PackBigInt(p *wrappers.Packer, number *big.Int) error {
p.PackBool(number == nil)
if p.Err != nil {
return p.Err
}
if number != nil {
p.PackBytes(number.Bytes())
if p.Err == nil && number != nil {
p.PackFixedBytes(number.FillBytes(make([]byte, BigIntBytesLength)))
}

return p.Err
Expand All @@ -66,7 +65,7 @@ func UnpackBigInt(p *wrappers.Packer) (*big.Int, error) {
return nil, p.Err
}

number := big.NewInt(0).SetBytes(p.UnpackBytes())
number := big.NewInt(0).SetBytes(p.UnpackFixedBytes(BigIntBytesLength))
return number, p.Err
}

Expand Down

0 comments on commit e8ffb13

Please sign in to comment.