From 21115a25dccb3e9b2ef61ae280cfd0c7f1ff6487 Mon Sep 17 00:00:00 2001 From: Philip Su Date: Wed, 27 Dec 2023 15:56:41 -0800 Subject: [PATCH] Revert "Revert "Seqno config disable (#354)" (#364)" This reverts commit 1c5a372beead38a92950cf55e131d13ee40250f8. --- baseapp/block_gas_test.go | 2 +- proto/cosmos/auth/v1beta1/auth.proto | 1 + x/auth/ante/ante_test.go | 58 ++++++++++++ x/auth/ante/batch_sigverify.go | 13 ++- x/auth/ante/sigverify.go | 11 ++- x/auth/legacy/v040/migrate_test.go | 1 + x/auth/types/auth.pb.go | 133 ++++++++++++++++++--------- x/auth/types/params.go | 2 + 8 files changed, 167 insertions(+), 54 deletions(-) diff --git a/baseapp/block_gas_test.go b/baseapp/block_gas_test.go index 7d9e02c7b..2d154709c 100644 --- a/baseapp/block_gas_test.go +++ b/baseapp/block_gas_test.go @@ -125,7 +125,7 @@ func TestBaseApp_BlockGas(t *testing.T) { } // check block gas is always consumed - this value may change if we update the logic for // how gas is consumed - baseGas := uint64(58406) // baseGas is the gas consumed before tx msg + baseGas := uint64(62766) // baseGas is the gas consumed before tx msg expGasConsumed := addUint64Saturating(tc.gasToConsume, baseGas) if expGasConsumed > txtypes.MaxGasWanted { // capped by gasLimit diff --git a/proto/cosmos/auth/v1beta1/auth.proto b/proto/cosmos/auth/v1beta1/auth.proto index 72e1d9ec2..6c7e863b7 100644 --- a/proto/cosmos/auth/v1beta1/auth.proto +++ b/proto/cosmos/auth/v1beta1/auth.proto @@ -47,4 +47,5 @@ message Params { [(gogoproto.customname) = "SigVerifyCostED25519", (gogoproto.moretags) = "yaml:\"sig_verify_cost_ed25519\""]; uint64 sig_verify_cost_secp256k1 = 5 [(gogoproto.customname) = "SigVerifyCostSecp256k1", (gogoproto.moretags) = "yaml:\"sig_verify_cost_secp256k1\""]; + bool disable_seqno_check = 6; } diff --git a/x/auth/ante/ante_test.go b/x/auth/ante/ante_test.go index 4e6462c16..2f1717f17 100644 --- a/x/auth/ante/ante_test.go +++ b/x/auth/ante/ante_test.go @@ -1152,3 +1152,61 @@ func (suite *AnteTestSuite) TestAnteHandlerReCheck() { _, err = suite.anteHandler(suite.ctx, tx, false) suite.Require().NotNil(err, "antehandler on recheck did not fail once feePayer no longer has sufficient funds") } + +func (suite *AnteTestSuite) TestDisableSeqNo() { + suite.SetupTest(false) // setup + authParams := types.Params{ + MaxMemoCharacters: types.DefaultMaxMemoCharacters, + TxSigLimit: types.DefaultTxSigLimit, + TxSizeCostPerByte: types.DefaultTxSizeCostPerByte, + SigVerifyCostED25519: types.DefaultSigVerifyCostED25519, + SigVerifyCostSecp256k1: types.DefaultSigVerifyCostSecp256k1, + DisableSeqnoCheck: true, + } + suite.app.AccountKeeper.SetParams(suite.ctx, authParams) + + // Same data for every test cases + accounts := suite.CreateTestAccounts(1) + feeAmount := testdata.NewTestFeeAmount() + gasLimit := testdata.NewTestGasLimit() + + // Variable data per test case + var ( + accNums []uint64 + msgs []sdk.Msg + privs []cryptotypes.PrivKey + accSeqs []uint64 + ) + + testCases := []TestCase{ + { + "good tx from one signer", + func() { + msg := testdata.NewTestMsg(accounts[0].acc.GetAddress()) + msgs = []sdk.Msg{msg} + + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{0}, []uint64{0} + }, + false, + true, + nil, + }, + { + "test sending it again succeeds (disable seqno check is true)", + func() { + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{0}, []uint64{0} + }, + false, + true, + nil, + }, + } + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { + suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() + tc.malleate() + + suite.RunTestCase(privs, msgs, feeAmount, gasLimit, accNums, accSeqs, suite.ctx.ChainID(), tc) + }) + } +} diff --git a/x/auth/ante/batch_sigverify.go b/x/auth/ante/batch_sigverify.go index ec9c7e325..399a0ef56 100644 --- a/x/auth/ante/batch_sigverify.go +++ b/x/auth/ante/batch_sigverify.go @@ -132,11 +132,14 @@ func (v *SR25519BatchVerifier) VerifyTxs(ctx sdk.Context, txs []sdk.Tx) { sig := sigsList[i][j] if sig.Sequence != seqNum { - v.errors[i] = sdkerrors.Wrapf( - sdkerrors.ErrWrongSequence, - "account sequence mismatch, expected %d, got %d", acc.GetSequence(), sig.Sequence, - ) - continue + params := v.ak.GetParams(ctx) + if !params.GetDisableSeqnoCheck() { + v.errors[i] = sdkerrors.Wrapf( + sdkerrors.ErrWrongSequence, + "account sequence mismatch, expected %d, got %d", acc.GetSequence(), sig.Sequence, + ) + continue + } } switch data := sig.Data.(type) { diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index 3df25abb0..503d7dbef 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -268,10 +268,13 @@ func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simul // Check account sequence number. if sig.Sequence != acc.GetSequence() { - return ctx, sdkerrors.Wrapf( - sdkerrors.ErrWrongSequence, - "account sequence mismatch, expected %d, got %d", acc.GetSequence(), sig.Sequence, - ) + params := svd.ak.GetParams(ctx) + if !params.GetDisableSeqnoCheck() { + return ctx, sdkerrors.Wrapf( + sdkerrors.ErrWrongSequence, + "account sequence mismatch, expected %d, got %d", acc.GetSequence(), sig.Sequence, + ) + } } // retrieve signer data diff --git a/x/auth/legacy/v040/migrate_test.go b/x/auth/legacy/v040/migrate_test.go index b1e12ffce..2e391a226 100644 --- a/x/auth/legacy/v040/migrate_test.go +++ b/x/auth/legacy/v040/migrate_test.go @@ -241,6 +241,7 @@ func TestMigrate(t *testing.T) { } ], "params": { + "disable_seqno_check": false, "max_memo_characters": "10", "sig_verify_cost_ed25519": "40", "sig_verify_cost_secp256k1": "50", diff --git a/x/auth/types/auth.pb.go b/x/auth/types/auth.pb.go index fa52ac5a8..c13ed7a46 100644 --- a/x/auth/types/auth.pb.go +++ b/x/auth/types/auth.pb.go @@ -113,6 +113,7 @@ type Params struct { TxSizeCostPerByte uint64 `protobuf:"varint,3,opt,name=tx_size_cost_per_byte,json=txSizeCostPerByte,proto3" json:"tx_size_cost_per_byte,omitempty" yaml:"tx_size_cost_per_byte"` SigVerifyCostED25519 uint64 `protobuf:"varint,4,opt,name=sig_verify_cost_ed25519,json=sigVerifyCostEd25519,proto3" json:"sig_verify_cost_ed25519,omitempty" yaml:"sig_verify_cost_ed25519"` SigVerifyCostSecp256k1 uint64 `protobuf:"varint,5,opt,name=sig_verify_cost_secp256k1,json=sigVerifyCostSecp256k1,proto3" json:"sig_verify_cost_secp256k1,omitempty" yaml:"sig_verify_cost_secp256k1"` + DisableSeqnoCheck bool `protobuf:"varint,6,opt,name=disable_seqno_check,json=disableSeqnoCheck,proto3" json:"disable_seqno_check,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -182,6 +183,13 @@ func (m *Params) GetSigVerifyCostSecp256k1() uint64 { return 0 } +func (m *Params) GetDisableSeqnoCheck() bool { + if m != nil { + return m.DisableSeqnoCheck + } + return false +} + func init() { proto.RegisterType((*BaseAccount)(nil), "cosmos.auth.v1beta1.BaseAccount") proto.RegisterType((*ModuleAccount)(nil), "cosmos.auth.v1beta1.ModuleAccount") @@ -191,50 +199,51 @@ func init() { func init() { proto.RegisterFile("cosmos/auth/v1beta1/auth.proto", fileDescriptor_7e1f7e915d020d2d) } var fileDescriptor_7e1f7e915d020d2d = []byte{ - // 674 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0x4d, 0x4f, 0xdb, 0x4a, - 0x14, 0x8d, 0x5f, 0xf2, 0xf8, 0x98, 0x00, 0x12, 0x26, 0x80, 0x93, 0xf7, 0x64, 0x5b, 0x5e, 0xe5, - 0x49, 0x2f, 0x8e, 0x92, 0x8a, 0x4a, 0x64, 0x51, 0x15, 0xd3, 0x2e, 0x50, 0x0b, 0x42, 0x46, 0xea, - 0xa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 0x2f, 0x3b, 0x31, 0x31, 0xec, 0x2d, 0x3a, 0x37, 0xb7, 0xb3, 0x94, 0xff, 0x67, 0x25, 0x6b, - 0xff, 0xcb, 0x50, 0x95, 0x6e, 0x87, 0xaa, 0xf4, 0x7d, 0xa8, 0x4a, 0x1f, 0xef, 0xd5, 0xc2, 0xed, - 0xbd, 0x5a, 0xf8, 0x7a, 0xaf, 0x16, 0xde, 0xfe, 0xe7, 0x07, 0xec, 0x2c, 0x76, 0x4d, 0x8f, 0xe0, - 0xfc, 0x2d, 0xc8, 0x7f, 0x1a, 0xb4, 0x7b, 0xde, 0x1c, 0x88, 0xa7, 0x85, 0x25, 0x21, 0xa2, 0xee, - 0x02, 0xff, 0x52, 0x9f, 0xfc, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x49, 0x90, 0x16, 0xd9, 0x76, 0x04, - 0x00, 0x00, + // 704 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0xc1, 0x6e, 0xda, 0x4a, + 0x14, 0xc5, 0x2f, 0x3c, 0x42, 0x86, 0x24, 0x12, 0x86, 0x24, 0x86, 0xf7, 0x64, 0x5b, 0x5e, 0xf1, + 0xa4, 0x87, 0x11, 0x54, 0xa9, 0x14, 0x16, 0x55, 0x63, 0xda, 0x45, 0xd4, 0x26, 0x8a, 0x8c, 0xd4, + 0x45, 0x55, 0xc9, 0x1d, 0x9b, 0x89, 0x63, 0x81, 0x3d, 0x8e, 0x67, 0x1c, 0xe1, 0x7c, 0x41, 0x77, + 0xed, 0xb2, 0xcb, 0x7c, 0x44, 0xfe, 0xa0, 0x9b, 0x2e, 0xa3, 0xac, 0xba, 0xb2, 0x2a, 0xb2, 0xa9, + 0xba, 0x64, 0x5f, 0xa9, 0xb2, 0xc7, 0x10, 0x88, 0xe8, 0x8a, 0xb9, 0xe7, 0x9c, 0x7b, 0xee, 0x9d, + 0x7b, 0xf1, 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, 0x22, 0xf7, 0xe9, 0x5e, 0xcc, 0xdd, 0xde, 0x8b, 0xb9, + 0x6f, 0xf7, 0x62, 0xee, 0xed, 0x7f, 0xb6, 0x43, 0xcf, 0x43, 0x53, 0xb5, 0xb0, 0x9b, 0xbd, 0x1d, + 0xd9, 0x4f, 0x93, 0x0c, 0x86, 0xad, 0x31, 0x7b, 0x8a, 0x68, 0xe4, 0x23, 0x62, 0x16, 0xd2, 0x2f, + 0xfb, 0xc9, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xbd, 0x76, 0x46, 0xa6, 0x04, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -271,6 +280,9 @@ func (this *Params) Equal(that interface{}) bool { if this.SigVerifyCostSecp256k1 != that1.SigVerifyCostSecp256k1 { return false } + if this.DisableSeqnoCheck != that1.DisableSeqnoCheck { + return false + } return true } func (m *BaseAccount) Marshal() (dAtA []byte, err error) { @@ -396,6 +408,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.DisableSeqnoCheck { + i-- + if m.DisableSeqnoCheck { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } if m.SigVerifyCostSecp256k1 != 0 { i = encodeVarintAuth(dAtA, i, uint64(m.SigVerifyCostSecp256k1)) i-- @@ -502,6 +524,9 @@ func (m *Params) Size() (n int) { if m.SigVerifyCostSecp256k1 != 0 { n += 1 + sovAuth(uint64(m.SigVerifyCostSecp256k1)) } + if m.DisableSeqnoCheck { + n += 2 + } return n } @@ -941,6 +966,26 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableSeqnoCheck", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableSeqnoCheck = bool(v != 0) default: iNdEx = preIndex skippy, err := skipAuth(dAtA[iNdEx:]) diff --git a/x/auth/types/params.go b/x/auth/types/params.go index dbe41ac0e..865f8bf3c 100644 --- a/x/auth/types/params.go +++ b/x/auth/types/params.go @@ -24,6 +24,7 @@ var ( KeyTxSizeCostPerByte = []byte("TxSizeCostPerByte") KeySigVerifyCostED25519 = []byte("SigVerifyCostED25519") KeySigVerifyCostSecp256k1 = []byte("SigVerifyCostSecp256k1") + KeyDisableSeqnoCheck = []byte("KeyDisableSeqnoCheck") ) var _ paramtypes.ParamSet = &Params{} @@ -55,6 +56,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyTxSizeCostPerByte, &p.TxSizeCostPerByte, validateTxSizeCostPerByte), paramtypes.NewParamSetPair(KeySigVerifyCostED25519, &p.SigVerifyCostED25519, validateSigVerifyCostED25519), paramtypes.NewParamSetPair(KeySigVerifyCostSecp256k1, &p.SigVerifyCostSecp256k1, validateSigVerifyCostSecp256k1), + paramtypes.NewParamSetPair(KeyDisableSeqnoCheck, &p.DisableSeqnoCheck, func(i interface{}) error { return nil }), } }