From 3467451103eea7159870eaca8cfe7b486dd0a717 Mon Sep 17 00:00:00 2001 From: Brandon Weng <18161326+BrandonWeng@users.noreply.github.com> Date: Mon, 31 Oct 2022 22:57:17 -0400 Subject: [PATCH 1/4] done --- app/ante.go | 1 + app/ante_test.go | 203 ++++++++++++++++++++ app/antedecorators/depdecorators/signers.go | 5 +- app/apptesting/test_suite.go | 3 +- go.mod | 4 +- go.sum | 8 +- 6 files changed, 217 insertions(+), 7 deletions(-) create mode 100644 app/ante_test.go diff --git a/app/ante.go b/app/ante.go index 88d1682664..071cfefead 100644 --- a/app/ante.go +++ b/app/ante.go @@ -90,6 +90,7 @@ func NewAnteHandlerAndDepGenerator(options HandlerOptions) (sdk.AnteHandler, sdk sdk.CustomDepWrappedAnteDecorator(ante.NewIncrementSequenceDecorator(options.AccountKeeper), depdecorators.SignerDepDecorator{ReadOnly: false}), sdk.DefaultWrappedAnteDecorator(ibcante.NewAnteDecorator(options.IBCKeeper)), sdk.DefaultWrappedAnteDecorator(dex.NewTickSizeMultipleDecorator(*options.DexKeeper)), + sdk.DefaultWrappedAnteDecorator(dex.NewTickSizeMultipleDecorator(*options.DexKeeper)), } anteHandler, anteDepGenerator := sdk.ChainAnteDecorators(anteDecorators...) diff --git a/app/ante_test.go b/app/ante_test.go new file mode 100644 index 0000000000..295c5d872a --- /dev/null +++ b/app/ante_test.go @@ -0,0 +1,203 @@ +package app_test + +import ( + "context" + "testing" + + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + acltypes "github.com/cosmos/cosmos-sdk/x/accesscontrol/types" + pp "github.com/k0kubun/pp/v3" + + "github.com/cosmos/cosmos-sdk/x/auth/ante" + xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + aclutils "github.com/sei-protocol/sei-chain/aclmapping/utils" + app "github.com/sei-protocol/sei-chain/app" + "github.com/sei-protocol/sei-chain/app/apptesting" + "github.com/sei-protocol/sei-chain/utils/tracing" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "go.opentelemetry.io/otel" +) + +// AnteTestSuite is a test suite to be used with ante handler tests. +type AnteTestSuite struct { + apptesting.KeeperTestHelper + + anteHandler sdk.AnteHandler + anteDepGenerator sdk.AnteDepGenerator + clientCtx client.Context + txBuilder client.TxBuilder + testAcc sdk.AccAddress + testAccPriv cryptotypes.PrivKey +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(AnteTestSuite)) +} + +// SetupTest setups a new test, with new app, context, and anteHandler. +func (suite *AnteTestSuite) SetupTest(isCheckTx bool) { + suite.Setup() + + // keys and addresses + suite.testAccPriv, _, suite.testAcc = testdata.KeyTestPubAddr() + initalBalance := sdk.Coins{sdk.NewInt64Coin("atom", 100000000000)} + suite.FundAcc(suite.testAcc, initalBalance) + + suite.Ctx = suite.Ctx.WithBlockHeight(1) + + msgValidator := sdkacltypes.NewMsgValidator(aclutils.StoreKeyToResourceTypePrefixMap) + suite.Ctx = suite.Ctx.WithMsgValidator(msgValidator) + + // Set up TxConfig. + encodingConfig := simapp.MakeTestEncodingConfig() + // We're using TestMsg encoding in some tests, so register it here. + encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) + testdata.RegisterInterfaces(encodingConfig.InterfaceRegistry) + + suite.clientCtx = client.Context{}. + WithTxConfig(encodingConfig.TxConfig) + + wasmConfig := wasmtypes.DefaultWasmConfig() + defaultTracer, _ := tracing.DefaultTracerProvider() + otel.SetTracerProvider(defaultTracer) + tr := defaultTracer.Tracer("component-main") + + antehandler, anteDepGenerator, err := app.NewAnteHandlerAndDepGenerator( + app.HandlerOptions{ + HandlerOptions: ante.HandlerOptions{ + AccountKeeper: suite.App.AccountKeeper, + BankKeeper: suite.App.BankKeeper, + FeegrantKeeper: suite.App.FeeGrantKeeper, + SignModeHandler: suite.clientCtx.TxConfig.SignModeHandler(), + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + // BatchVerifier: app.batchVerifier, + }, + IBCKeeper: suite.App.IBCKeeper, + WasmConfig: &wasmConfig, + OracleKeeper: &suite.App.OracleKeeper, + DexKeeper: &suite.App.DexKeeper, + AccessControlKeeper: &suite.App.AccessControlKeeper, + TracingInfo: &tracing.Info{ + Tracer: &tr, + TracerContext: context.Background(), + }, + }, + ) + + suite.Require().NoError(err) + suite.anteHandler = antehandler + suite.anteDepGenerator = anteDepGenerator +} + +// CreateTestTx is a helper function to create a tx given multiple inputs. +func (suite *AnteTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums []uint64, accSeqs []uint64, chainID string) (xauthsigning.Tx, error) { + // First round: we gather all the signer infos. We use the "set empty + // signature" hack to do that. + var sigsV2 []signing.SignatureV2 + for i, priv := range privs { + sigV2 := signing.SignatureV2{ + PubKey: priv.PubKey(), + Data: &signing.SingleSignatureData{ + SignMode: suite.clientCtx.TxConfig.SignModeHandler().DefaultMode(), + Signature: nil, + }, + Sequence: accSeqs[i], + } + + sigsV2 = append(sigsV2, sigV2) + } + err := suite.txBuilder.SetSignatures(sigsV2...) + if err != nil { + return nil, err + } + + // Second round: all signer infos are set, so each signer can sign. + sigsV2 = []signing.SignatureV2{} + for i, priv := range privs { + signerData := xauthsigning.SignerData{ + ChainID: chainID, + AccountNumber: accNums[i], + Sequence: accSeqs[i], + } + sigV2, err := tx.SignWithPrivKey( + suite.clientCtx.TxConfig.SignModeHandler().DefaultMode(), signerData, + suite.txBuilder, priv, suite.clientCtx.TxConfig, accSeqs[i]) + if err != nil { + return nil, err + } + + sigsV2 = append(sigsV2, sigV2) + } + err = suite.txBuilder.SetSignatures(sigsV2...) + if err != nil { + return nil, err + } + + return suite.txBuilder.GetTx(), nil +} + + +func (suite *AnteTestSuite) TestValidateDepedencies() { + suite.SetupTest(true) // setup + suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() + + // msg and signatures + msg := testdata.NewTestMsg(suite.testAcc) + feeAmount := testdata.NewTestFeeAmount() + gasLimit := testdata.NewTestGasLimit() + suite.Require().NoError(suite.txBuilder.SetMsgs(msg)) + suite.txBuilder.SetFeeAmount(feeAmount) + suite.txBuilder.SetGasLimit(gasLimit) + + privs, accNums, accSeqs := []cryptotypes.PrivKey{}, []uint64{}, []uint64{} + invalidTx, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.Ctx.ChainID()) + suite.Require().NoError(err) + + _, err = suite.anteHandler(suite.Ctx, invalidTx, false) + + suite.Require().NotNil(err, "Did not error on invalid tx") + + privs, accNums, accSeqs = []cryptotypes.PrivKey{suite.testAccPriv}, []uint64{8}, []uint64{0} + + handlerCtx, cms := aclutils.CacheTxContext(suite.Ctx) + validTx, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.Ctx.ChainID()) + + suite.Require().NoError(err) + depdenencies, _ := suite.anteDepGenerator([]sdkacltypes.AccessOperation{}, validTx) + _, err = suite.anteHandler(handlerCtx, validTx, false) + suite.Require().Nil(err, "ValidateBasicDecorator returned error on valid tx. err: %v", err) + err = acltypes.ValidateAccessOps(depdenencies) + require.NoError(suite.T(), err) + + missing := handlerCtx.MsgValidator().ValidateAccessOperations(depdenencies, cms.GetEvents()) + pp.Default.SetColoringEnabled(false) + + pp.Println(missing) + suite.Require().Empty(missing) + + // test decorator skips on recheck + suite.Ctx = suite.Ctx.WithIsReCheckTx(true) + + // decorator should skip processing invalidTx on recheck and thus return nil-error + handlerCtx, cms = aclutils.CacheTxContext(suite.Ctx) + depdenencies, _ = suite.anteDepGenerator([]sdkacltypes.AccessOperation{}, invalidTx) + _, err = suite.anteHandler(handlerCtx, invalidTx, false) + missing = handlerCtx.MsgValidator().ValidateAccessOperations(depdenencies, cms.GetEvents()) + pp.Println(missing) + + err = acltypes.ValidateAccessOps(depdenencies) + require.NoError(suite.T(), err) + + suite.Require().Empty(missing) + + suite.Require().Nil(err, "ValidateBasicDecorator ran on ReCheck") +} diff --git a/app/antedecorators/depdecorators/signers.go b/app/antedecorators/depdecorators/signers.go index f123e8dca5..9d8043c3b8 100644 --- a/app/antedecorators/depdecorators/signers.go +++ b/app/antedecorators/depdecorators/signers.go @@ -6,7 +6,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - utils "github.com/sei-protocol/sei-chain/aclmapping/utils" ) type SignerDepDecorator struct { @@ -27,8 +26,8 @@ func (d SignerDepDecorator) AnteDeps(txDeps []sdkacltypes.AccessOperation, tx sd for _, signer := range sigTx.GetSigners() { txDeps = append(txDeps, sdkacltypes.AccessOperation{ AccessType: accessType, - ResourceType: sdkacltypes.ResourceType_KV, - IdentifierTemplate: utils.GetPrefixedIdentifierTemplatePerModule(utils.ACCOUNT, signer.String(), string(authtypes.AddressStoreKeyPrefix)), + ResourceType: sdkacltypes.ResourceType_KV_AUTH_ADDRESS_STORE, + IdentifierTemplate: string(authtypes.AddressStoreKey(signer)), }) } return next(txDeps, tx) diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index 860d6192c3..01c71943d3 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -143,7 +143,8 @@ func (s *KeeperTestHelper) BuildTx( txBuilder client.TxBuilder, msgs []sdk.Msg, sigV2 signing.SignatureV2, - memo string, txFee sdk.Coins, + memo string, + txFee sdk.Coins, gasLimit uint64, ) authsigning.Tx { err := txBuilder.SetMsgs(msgs[0]) diff --git a/go.mod b/go.mod index 6e14e14b52..1c8fa74557 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/k0kubun/pp/v3 v3.2.0 github.com/pkg/errors v0.9.1 github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.5.0 @@ -88,6 +89,7 @@ require ( github.com/lib/pq v1.10.6 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/magiconair/properties v1.8.6 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -132,7 +134,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.246 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.247 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index 4774c572f6..3a99941321 100644 --- a/go.sum +++ b/go.sum @@ -734,6 +734,8 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/k0kubun/pp/v3 v3.2.0 h1:h33hNTZ9nVFNP3u2Fsgz8JXiF5JINoZfFq4SvKJwNcs= +github.com/k0kubun/pp/v3 v3.2.0/go.mod h1:ODtJQbQcIRfAD3N+theGCV1m/CBxweERz2dapdz1EwA= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -800,6 +802,8 @@ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -1100,8 +1104,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.246 h1:qX6ycebWYECnh9DIP9xqCFHVgJ8U4yHuR+asr/vuOVE= -github.com/sei-protocol/sei-cosmos v0.1.246/go.mod h1:KPV8lFdD2Ki/M2wZTpfX3LCcuMAZnmcUzYJycjbmOYM= +github.com/sei-protocol/sei-cosmos v0.1.247 h1:g9Ne8UOZwAW5bqxacZ39Gq0Xi6YfhK/ryR+QtyWqiJs= +github.com/sei-protocol/sei-cosmos v0.1.247/go.mod h1:KPV8lFdD2Ki/M2wZTpfX3LCcuMAZnmcUzYJycjbmOYM= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From c6dd37e11708377f18041951e725bd8dd76aaa0e Mon Sep 17 00:00:00 2001 From: Brandon Weng <18161326+BrandonWeng@users.noreply.github.com> Date: Mon, 31 Oct 2022 22:58:48 -0400 Subject: [PATCH 2/4] clean up --- app/ante.go | 1 - app/ante_test.go | 2 -- 2 files changed, 3 deletions(-) diff --git a/app/ante.go b/app/ante.go index 071cfefead..88d1682664 100644 --- a/app/ante.go +++ b/app/ante.go @@ -90,7 +90,6 @@ func NewAnteHandlerAndDepGenerator(options HandlerOptions) (sdk.AnteHandler, sdk sdk.CustomDepWrappedAnteDecorator(ante.NewIncrementSequenceDecorator(options.AccountKeeper), depdecorators.SignerDepDecorator{ReadOnly: false}), sdk.DefaultWrappedAnteDecorator(ibcante.NewAnteDecorator(options.IBCKeeper)), sdk.DefaultWrappedAnteDecorator(dex.NewTickSizeMultipleDecorator(*options.DexKeeper)), - sdk.DefaultWrappedAnteDecorator(dex.NewTickSizeMultipleDecorator(*options.DexKeeper)), } anteHandler, anteDepGenerator := sdk.ChainAnteDecorators(anteDecorators...) diff --git a/app/ante_test.go b/app/ante_test.go index 295c5d872a..d0a575c0b6 100644 --- a/app/ante_test.go +++ b/app/ante_test.go @@ -181,7 +181,6 @@ func (suite *AnteTestSuite) TestValidateDepedencies() { missing := handlerCtx.MsgValidator().ValidateAccessOperations(depdenencies, cms.GetEvents()) pp.Default.SetColoringEnabled(false) - pp.Println(missing) suite.Require().Empty(missing) // test decorator skips on recheck @@ -192,7 +191,6 @@ func (suite *AnteTestSuite) TestValidateDepedencies() { depdenencies, _ = suite.anteDepGenerator([]sdkacltypes.AccessOperation{}, invalidTx) _, err = suite.anteHandler(handlerCtx, invalidTx, false) missing = handlerCtx.MsgValidator().ValidateAccessOperations(depdenencies, cms.GetEvents()) - pp.Println(missing) err = acltypes.ValidateAccessOps(depdenencies) require.NoError(suite.T(), err) From 698b10b5405f75e8ee3541d22c8972d1cd9e3b91 Mon Sep 17 00:00:00 2001 From: Brandon Weng <18161326+BrandonWeng@users.noreply.github.com> Date: Mon, 31 Oct 2022 23:03:42 -0400 Subject: [PATCH 3/4] done --- app/ante_test.go | 3 --- go.mod | 4 +--- go.sum | 8 ++------ 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/app/ante_test.go b/app/ante_test.go index d0a575c0b6..ad7b0de8d3 100644 --- a/app/ante_test.go +++ b/app/ante_test.go @@ -14,7 +14,6 @@ import ( sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" "github.com/cosmos/cosmos-sdk/types/tx/signing" acltypes "github.com/cosmos/cosmos-sdk/x/accesscontrol/types" - pp "github.com/k0kubun/pp/v3" "github.com/cosmos/cosmos-sdk/x/auth/ante" xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" @@ -179,8 +178,6 @@ func (suite *AnteTestSuite) TestValidateDepedencies() { require.NoError(suite.T(), err) missing := handlerCtx.MsgValidator().ValidateAccessOperations(depdenencies, cms.GetEvents()) - pp.Default.SetColoringEnabled(false) - suite.Require().Empty(missing) // test decorator skips on recheck diff --git a/go.mod b/go.mod index 1c8fa74557..afaa14c9c3 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/k0kubun/pp/v3 v3.2.0 github.com/pkg/errors v0.9.1 github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.5.0 @@ -89,7 +88,6 @@ require ( github.com/lib/pq v1.10.6 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/magiconair/properties v1.8.6 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -134,7 +132,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.247 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.248 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index 3a99941321..baaa0c9e08 100644 --- a/go.sum +++ b/go.sum @@ -734,8 +734,6 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/k0kubun/pp/v3 v3.2.0 h1:h33hNTZ9nVFNP3u2Fsgz8JXiF5JINoZfFq4SvKJwNcs= -github.com/k0kubun/pp/v3 v3.2.0/go.mod h1:ODtJQbQcIRfAD3N+theGCV1m/CBxweERz2dapdz1EwA= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -802,8 +800,6 @@ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -1104,8 +1100,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.247 h1:g9Ne8UOZwAW5bqxacZ39Gq0Xi6YfhK/ryR+QtyWqiJs= -github.com/sei-protocol/sei-cosmos v0.1.247/go.mod h1:KPV8lFdD2Ki/M2wZTpfX3LCcuMAZnmcUzYJycjbmOYM= +github.com/sei-protocol/sei-cosmos v0.1.248 h1:+T7bjifveX7VWXc6kEdervusCMg9yapZu2X5n18Tm74= +github.com/sei-protocol/sei-cosmos v0.1.248/go.mod h1:KPV8lFdD2Ki/M2wZTpfX3LCcuMAZnmcUzYJycjbmOYM= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From 92ea97ddbe6483c7d6b532556704b3a5b90516aa Mon Sep 17 00:00:00 2001 From: Brandon Weng <18161326+BrandonWeng@users.noreply.github.com> Date: Mon, 31 Oct 2022 23:36:43 -0400 Subject: [PATCH 4/4] undo ante commit --- app/ante_test.go | 15 +++++++++++++-- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/ante_test.go b/app/ante_test.go index ad7b0de8d3..ab333d0a8c 100644 --- a/app/ante_test.go +++ b/app/ante_test.go @@ -97,6 +97,16 @@ func (suite *AnteTestSuite) SetupTest(isCheckTx bool) { suite.anteDepGenerator = anteDepGenerator } +func (suite *AnteTestSuite) AnteHandlerValidateAccessOp(acessOps []sdkacltypes.AccessOperation) error { + for _, accessOp := range acessOps { + err := acltypes.ValidateAccessOp(accessOp) + if err != nil { + return err + } + } + return nil +} + // CreateTestTx is a helper function to create a tx given multiple inputs. func (suite *AnteTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums []uint64, accSeqs []uint64, chainID string) (xauthsigning.Tx, error) { // First round: we gather all the signer infos. We use the "set empty @@ -174,7 +184,8 @@ func (suite *AnteTestSuite) TestValidateDepedencies() { depdenencies, _ := suite.anteDepGenerator([]sdkacltypes.AccessOperation{}, validTx) _, err = suite.anteHandler(handlerCtx, validTx, false) suite.Require().Nil(err, "ValidateBasicDecorator returned error on valid tx. err: %v", err) - err = acltypes.ValidateAccessOps(depdenencies) + err = suite.AnteHandlerValidateAccessOp(depdenencies) + require.NoError(suite.T(), err) missing := handlerCtx.MsgValidator().ValidateAccessOperations(depdenencies, cms.GetEvents()) @@ -189,7 +200,7 @@ func (suite *AnteTestSuite) TestValidateDepedencies() { _, err = suite.anteHandler(handlerCtx, invalidTx, false) missing = handlerCtx.MsgValidator().ValidateAccessOperations(depdenencies, cms.GetEvents()) - err = acltypes.ValidateAccessOps(depdenencies) + err = suite.AnteHandlerValidateAccessOp(depdenencies) require.NoError(suite.T(), err) suite.Require().Empty(missing) diff --git a/go.mod b/go.mod index afaa14c9c3..0f489b49c9 100644 --- a/go.mod +++ b/go.mod @@ -132,7 +132,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.248 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.249 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index baaa0c9e08..777d3e8398 100644 --- a/go.sum +++ b/go.sum @@ -1100,8 +1100,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.248 h1:+T7bjifveX7VWXc6kEdervusCMg9yapZu2X5n18Tm74= -github.com/sei-protocol/sei-cosmos v0.1.248/go.mod h1:KPV8lFdD2Ki/M2wZTpfX3LCcuMAZnmcUzYJycjbmOYM= +github.com/sei-protocol/sei-cosmos v0.1.249 h1:beHuyOOGxDewo1G7l067OPO56BKyfVi1boDiuS8jNfw= +github.com/sei-protocol/sei-cosmos v0.1.249/go.mod h1:KPV8lFdD2Ki/M2wZTpfX3LCcuMAZnmcUzYJycjbmOYM= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=