parent
83627b9967
commit
52a3f9c66f
@ -56,6 +56,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
* (rpc) [tharsis#598](https://github.com/tharsis/ethermint/pull/598) Check truncation when creating a `BlockNumber` from `big.Int`
|
||||||
* (evm) [tharsis#597](https://github.com/tharsis/ethermint/pull/597) Check for `uint64` -> `int64` block height overflow on `GetHashFn`
|
* (evm) [tharsis#597](https://github.com/tharsis/ethermint/pull/597) Check for `uint64` -> `int64` block height overflow on `GetHashFn`
|
||||||
* (evm) [tharsis#579](https://github.com/tharsis/ethermint/pull/579) Update `DeriveChainID` function to handle `v` signature values `< 35`.
|
* (evm) [tharsis#579](https://github.com/tharsis/ethermint/pull/579) Update `DeriveChainID` function to handle `v` signature values `< 35`.
|
||||||
* (encoding) [tharsis#478](https://github.com/tharsis/ethermint/pull/478) Register `Evidence` to amino codec.
|
* (encoding) [tharsis#478](https://github.com/tharsis/ethermint/pull/478) Register `Evidence` to amino codec.
|
||||||
|
@ -9,13 +9,15 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
|
||||||
|
|
||||||
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
|
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
|
|
||||||
|
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
|
||||||
|
|
||||||
|
ethermint "github.com/tharsis/ethermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BlockNumber represents decoding hex string to block values
|
// BlockNumber represents decoding hex string to block values
|
||||||
@ -35,6 +37,11 @@ const (
|
|||||||
|
|
||||||
// NewBlockNumber creates a new BlockNumber instance.
|
// NewBlockNumber creates a new BlockNumber instance.
|
||||||
func NewBlockNumber(n *big.Int) BlockNumber {
|
func NewBlockNumber(n *big.Int) BlockNumber {
|
||||||
|
if !n.IsInt64() {
|
||||||
|
// default to latest block if it overflows
|
||||||
|
return EthLatestBlockNumber
|
||||||
|
}
|
||||||
|
|
||||||
return BlockNumber(n.Int64())
|
return BlockNumber(n.Int64())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,10 +183,13 @@ func (bnh *BlockNumberOrHash) decodeFromString(input string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if blockNumber > math.MaxInt64 {
|
|
||||||
return fmt.Errorf("blocknumber %d is too high", blockNumber)
|
bnInt, err := ethermint.SafeInt64(blockNumber)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
bn := BlockNumber(blockNumber)
|
|
||||||
|
bn := BlockNumber(bnInt)
|
||||||
bnh.BlockNumber = &bn
|
bnh.BlockNumber = &bn
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user