forked from cerc-io/laconicd-deprecated
chore: address the pr comments
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"context"
|
||||
"errors"
|
||||
"math/big"
|
||||
|
||||
|
||||
@@ -16,10 +16,6 @@ import (
|
||||
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
||||
)
|
||||
|
||||
func nextFn(ctx sdk.Context, _ sdk.Tx, _ bool) (sdk.Context, error) {
|
||||
return ctx, nil
|
||||
}
|
||||
|
||||
func (suite MiddlewareTestSuite) TestEthSigVerificationDecorator() {
|
||||
txHandler := middleware.ComposeMiddlewares(noopTxHandler, ante.NewEthSigVerificationMiddleware(suite.app.EvmKeeper))
|
||||
addr, privKey := tests.NewAddrKey()
|
||||
@@ -288,26 +284,22 @@ func (suite MiddlewareTestSuite) TestEthGasConsumeDecorator() {
|
||||
if tc.expPanic {
|
||||
suite.Require().Panics(func() {
|
||||
_, _, _ = txHandler.CheckTx(sdk.WrapSDKContext(suite.ctx.WithIsCheckTx(true).WithGasMeter(sdk.NewGasMeter(1))), txtypes.Request{Tx: tc.tx}, txtypes.RequestCheckTx{})
|
||||
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
_, _, err := txHandler.CheckTx(sdk.WrapSDKContext(suite.ctx.WithIsCheckTx(true).WithGasMeter(sdk.NewInfiniteGasMeter())), txtypes.Request{Tx: tc.tx}, txtypes.RequestCheckTx{})
|
||||
|
||||
// ctx, err := t.AnteHandle(suite.ctx.WithIsCheckTx(true).WithGasMeter(sdk.NewInfiniteGasMeter()), tc.tx, false, nextFn)
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err)
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
}
|
||||
// suite.Require().Equal(tc.gasLimit, ctx.GasMeter().Limit())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite MiddlewareTestSuite) TestCanTransferDecorator() {
|
||||
// dec := ante.NewCanTransferMiddleware(suite.app.EvmKeeper)
|
||||
txHandler := middleware.ComposeMiddlewares(noopTxHandler, ante.NewCanTransferMiddleware(suite.app.EvmKeeper))
|
||||
|
||||
addr, privKey := tests.NewAddrKey()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
context "context"
|
||||
"context"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
@@ -66,10 +66,7 @@ func (txh txRouter) route(req tx.Request) (tx.Handler, error) {
|
||||
return next, nil
|
||||
}
|
||||
}
|
||||
// // handle as totally normal Cosmos SDK tx
|
||||
// if _, ok = reqTx.(sdk.Tx); !ok {
|
||||
// return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid transaction type: %T", reqTx)
|
||||
// }
|
||||
// handle as totally normal Cosmos SDK tx
|
||||
return txh.cosmos, nil
|
||||
}
|
||||
|
||||
@@ -100,7 +97,7 @@ func (txh txRouter) SimulateTx(ctx context.Context, req tx.Request) (res tx.Resp
|
||||
return next.SimulateTx(ctx, req)
|
||||
}
|
||||
|
||||
var _ authmiddleware.SignatureVerificationGasConsumer = DefaultSigVerificationGasConsumer
|
||||
var _ = DefaultSigVerificationGasConsumer
|
||||
|
||||
// DefaultSigVerificationGasConsumer is the default implementation of SignatureVerificationGasConsumer. It consumes gas
|
||||
// for signature verification based upon the public key type. The cost is fetched from the given params and is matched
|
||||
|
||||
Reference in New Issue
Block a user