forked from cerc-io/laconicd-deprecated
evm: check height overflow (#597)
* evm: check height overflow * rm * c++
This commit is contained in:
@@ -66,8 +66,14 @@ func (k Keeper) VMConfig(msg core.Message, params types.Params, tracer vm.Tracer
|
||||
// 3. The requested height is from a height greater than the latest one
|
||||
func (k Keeper) GetHashFn() vm.GetHashFunc {
|
||||
return func(height uint64) common.Hash {
|
||||
h := int64(height)
|
||||
ctx := k.Ctx()
|
||||
|
||||
h, err := ethermint.SafeInt64(height)
|
||||
if err != nil {
|
||||
k.Logger(ctx).Error("failed to cast height to int64", "error", err)
|
||||
return common.Hash{}
|
||||
}
|
||||
|
||||
switch {
|
||||
case ctx.BlockHeight() == h:
|
||||
// Case 1: The requested height matches the one from the context so we can retrieve the header
|
||||
|
||||
Reference in New Issue
Block a user