forked from cerc-io/laconicd-deprecated
evm: update msgs to accept zero gas price (#299)
* update keeper to accept gas price=0; default pending to latest * cleanup * more cleanup * more cleanup * more cleanup * more cleanup * ante: copy IncrementSequenceDecorator from SDK's AnteHandler * improve bloom test * lint * update msg error Co-authored-by: Federico Kunze <federico.kunze94@gmail.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze
Federico Kunze
parent
51b68d7512
commit
1f63ddfe96
+2
-2
@@ -19,8 +19,8 @@ func BeginBlock(k Keeper, ctx sdk.Context, req abci.RequestBeginBlock) {
|
||||
|
||||
// Consider removing this when using evm as module without web3 API
|
||||
bloom := ethtypes.BytesToBloom(k.Bloom.Bytes())
|
||||
k.SetBlockBloomMapping(ctx, bloom, req.Header.GetHeight()-1)
|
||||
k.SetBlockHashMapping(ctx, req.Header.LastBlockId.GetHash(), req.Header.GetHeight()-1)
|
||||
k.SetBlockBloomMapping(ctx, bloom, req.Header.GetHeight())
|
||||
k.SetBlockHashMapping(ctx, req.Header.LastBlockId.GetHash(), req.Header.GetHeight())
|
||||
k.Bloom = big.NewInt(0)
|
||||
k.TxCount = 0
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func (k Keeper) GetBlockHashMapping(ctx sdk.Context, hash []byte) (int64, error)
|
||||
store := ctx.KVStore(k.blockKey)
|
||||
bz := store.Get(hash)
|
||||
if len(bz) == 0 {
|
||||
return 0, fmt.Errorf("block with hash '%s' not found", ethcmn.BytesToHash(hash))
|
||||
return 0, fmt.Errorf("block with hash '%s' not found", ethcmn.BytesToHash(hash).Hex())
|
||||
}
|
||||
|
||||
height := binary.BigEndian.Uint64(bz)
|
||||
|
||||
+4
-4
@@ -76,8 +76,8 @@ func (msg MsgEthermint) GetSignBytes() []byte {
|
||||
|
||||
// ValidateBasic runs stateless checks on the message
|
||||
func (msg MsgEthermint) ValidateBasic() error {
|
||||
if msg.Price.Sign() != 1 {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidValue, "price must be positive %s", msg.Price)
|
||||
if msg.Price.Sign() == -1 {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidValue, "price cannot be negative %s", msg.Price)
|
||||
}
|
||||
|
||||
// Amount can be 0
|
||||
@@ -175,8 +175,8 @@ func (msg MsgEthereumTx) Type() string { return TypeMsgEthereumTx }
|
||||
// ValidateBasic implements the sdk.Msg interface. It performs basic validation
|
||||
// checks of a Transaction. If returns an error if validation fails.
|
||||
func (msg MsgEthereumTx) ValidateBasic() error {
|
||||
if msg.Data.Price.Sign() != 1 {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidValue, "price must be positive %s", msg.Data.Price)
|
||||
if msg.Data.Price.Sign() == -1 {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidValue, "price cannot be negative %s", msg.Data.Price)
|
||||
}
|
||||
|
||||
// Amount can be 0
|
||||
|
||||
Reference in New Issue
Block a user