Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(auth): refactor auth/tx to use x/tx #19224

Merged
merged 40 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d2b76b9
move x/auth/tx to use x/tx
testinginprod Jan 24, 2024
07484e1
checkpoint
testinginprod Jan 24, 2024
48b9733
more fixes
testinginprod Jan 24, 2024
9bf545d
more fixes2
testinginprod Jan 24, 2024
ec74255
add more fixes
testinginprod Jan 24, 2024
d9eaa3c
apply fix
testinginprod Jan 24, 2024
25b909e
fix e2e with gov changes
testinginprod Jan 24, 2024
4769b4c
more tests adjustments
testinginprod Jan 24, 2024
0a635cc
yet another fix
testinginprod Jan 24, 2024
a96c267
closer
testinginprod Jan 24, 2024
3b59cad
yet another fix
testinginprod Jan 24, 2024
09dfb53
we keep rocking
testinginprod Jan 24, 2024
fccfb9c
we keep rocking part2
testinginprod Jan 24, 2024
33af7d9
another test fix
testinginprod Jan 24, 2024
0365de7
another test fix2
testinginprod Jan 24, 2024
1609e38
another test fix3
testinginprod Jan 24, 2024
3a558ae
remove redundant test
testinginprod Jan 24, 2024
42fb249
change textual e2e to match latest updates in API
testinginprod Jan 24, 2024
2dc646f
another one bites the dust
testinginprod Jan 24, 2024
fb32826
tmp commit
testinginprod Jan 25, 2024
3a8e81e
another galaxy brain fix
testinginprod Jan 25, 2024
093748a
fix decoding fuzz testing
testinginprod Jan 25, 2024
9f1512f
fix
testinginprod Jan 25, 2024
7ef2dec
fix slashing test
testinginprod Jan 25, 2024
73c7664
gg
testinginprod Jan 25, 2024
5851942
Merge branch 'main' into tip/auth/use_x_tx
testinginprod Jan 25, 2024
7ff9dd9
thanks @julienrbrt
testinginprod Jan 25, 2024
77d7111
lint
testinginprod Jan 25, 2024
e0fda8e
fix service_test.go
testinginprod Jan 25, 2024
98a42e8
revert lint
testinginprod Jan 25, 2024
a298c74
lint happy again
testinginprod Jan 25, 2024
2227e7d
fix conflicts
facundomedica Feb 14, 2024
6bbcdcd
remove MergedProtoRegistry (#19484)
kocubinski Feb 20, 2024
9fed787
fix
facundomedica Feb 20, 2024
e879571
Merge branch 'main' into tip/auth/use_x_tx
facundomedica Feb 20, 2024
944ed5b
fix
facundomedica Feb 20, 2024
d725e5f
Merge branch 'tip/auth/use_x_tx' of https://github.com/cosmos/cosmos-…
facundomedica Feb 20, 2024
fb47eac
go mod tidy all
facundomedica Feb 20, 2024
4c0d6c7
more fixes
facundomedica Feb 20, 2024
fe91f3a
skip aux test
facundomedica Feb 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions baseapp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -930,19 +930,6 @@ func TestABCI_InvalidTransaction(t *testing.T) {
require.EqualValues(t, sdkerrors.ErrUnknownRequest.Codespace(), space, err)
require.EqualValues(t, sdkerrors.ErrUnknownRequest.ABCICode(), code, err)
}

// Transaction with an unregistered message
{
txBuilder := suite.txConfig.NewTxBuilder()
err = txBuilder.SetMsgs(&testdata.MsgCreateDog{})
require.NoError(t, err)
tx := txBuilder.GetTx()

_, _, err := suite.baseApp.SimDeliver(suite.txConfig.TxEncoder(), tx)
space, code, _ := errorsmod.ABCIInfo(err, false)
require.EqualValues(t, sdkerrors.ErrTxDecode.ABCICode(), code)
require.EqualValues(t, sdkerrors.ErrTxDecode.Codespace(), space)
}
}

func TestABCI_TxGasLimits(t *testing.T) {
Expand Down
36 changes: 21 additions & 15 deletions baseapp/abci_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,15 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_PriorityNonceMempoolTxSe
testTxs[i].size = int(cmttypes.ComputeProtoSizeForTxs([]cmttypes.Tx{bz}))
}

s.Require().Equal(testTxs[0].size, 111)
s.Require().Equal(testTxs[1].size, 121)
s.Require().Equal(testTxs[2].size, 112)
s.Require().Equal(testTxs[3].size, 112)
s.Require().Equal(testTxs[4].size, 195)
s.Require().Equal(testTxs[5].size, 205)
s.Require().Equal(testTxs[6].size, 196)
s.Require().Equal(testTxs[7].size, 196)
s.Require().Equal(testTxs[8].size, 196)
s.Require().Equal(180, testTxs[0].size)
s.Require().Equal(190, testTxs[1].size)
s.Require().Equal(181, testTxs[2].size)
s.Require().Equal(181, testTxs[3].size)
s.Require().Equal(263, testTxs[4].size)
s.Require().Equal(273, testTxs[5].size)
s.Require().Equal(264, testTxs[6].size)
s.Require().Equal(264, testTxs[7].size)
s.Require().Equal(264, testTxs[8].size)

testCases := map[string]struct {
ctx sdk.Context
Expand All @@ -490,15 +490,15 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_PriorityNonceMempoolTxSe
ctx: s.ctx,
txInputs: []testTx{testTxs[0], testTxs[1], testTxs[2], testTxs[3]},
req: &abci.RequestPrepareProposal{
MaxTxBytes: 111 + 112,
MaxTxBytes: 180 + 181,
},
expectedTxs: []int{0, 3},
},
"skip multi-signers msg non-sequential sequence": {
ctx: s.ctx,
txInputs: []testTx{testTxs[4], testTxs[5], testTxs[6], testTxs[7], testTxs[8]},
req: &abci.RequestPrepareProposal{
MaxTxBytes: 195 + 196,
MaxTxBytes: 263 + 264,
},
expectedTxs: []int{4, 8},
},
Expand All @@ -507,7 +507,7 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_PriorityNonceMempoolTxSe
ctx: s.ctx,
txInputs: []testTx{testTxs[9], testTxs[10], testTxs[11]},
req: &abci.RequestPrepareProposal{
MaxTxBytes: 195 + 196,
MaxTxBytes: 263 + 264,
},
expectedTxs: []int{9},
},
Expand Down Expand Up @@ -571,9 +571,7 @@ func marshalDelimitedFn(msg proto.Message) ([]byte, error) {
func buildMsg(t *testing.T, txConfig client.TxConfig, value []byte, secrets [][]byte, nonces []uint64) sdk.Tx {
t.Helper()
builder := txConfig.NewTxBuilder()
_ = builder.SetMsgs(
&baseapptestutil.MsgKeyValue{Value: value},
)

require.Equal(t, len(secrets), len(nonces))
signatures := make([]signingtypes.SignatureV2, 0)
for index, secret := range secrets {
Expand All @@ -586,6 +584,14 @@ func buildMsg(t *testing.T, txConfig client.TxConfig, value []byte, secrets [][]
Data: &signingtypes.SingleSignatureData{},
})
}

_ = builder.SetMsgs(
&baseapptestutil.MsgKeyValue{
Signer: sdk.AccAddress(signatures[0].PubKey.Bytes()).String(),
Value: value,
},
)

setTxSignatureWithSecret(t, builder, signatures...)
return builder.GetTx()
}
Expand Down
5 changes: 4 additions & 1 deletion baseapp/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ func setFailOnHandler(t *testing.T, cfg client.TxConfig, tx signing.Tx, fail boo
msgs[i] = &baseapptestutil.MsgCounter{
Counter: msg.(*baseapptestutil.MsgCounter).Counter,
FailOnHandler: fail,
Signer: sdk.AccAddress("addr").String(),
}
}

Expand All @@ -367,7 +368,9 @@ func wonkyMsg(t *testing.T, cfg client.TxConfig, tx signing.Tx) signing.Tx {
builder.SetMemo(tx.GetMemo())

msgs := tx.GetMsgs()
msgs = append(msgs, &baseapptestutil.MsgCounter2{})
msgs = append(msgs, &baseapptestutil.MsgCounter2{
Signer: sdk.AccAddress("wonky").String(),
})

err := builder.SetMsgs(msgs...)
require.NoError(t, err)
Expand Down
6 changes: 4 additions & 2 deletions client/tx/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,16 @@ func TestPreprocessHook(t *testing.T) {
err = txfDirect.PreprocessTx(from, txb)
requireT.NoError(err)

hasExtOptsTx, ok := txb.(ante.HasExtensionOptionsTx)
tx := txb.GetTx()
hasExtOptsTx, ok := tx.(ante.HasExtensionOptionsTx)
requireT.True(ok)

hasOneExt := len(hasExtOptsTx.GetExtensionOptions()) == 1
requireT.True(hasOneExt)

opt := hasExtOptsTx.GetExtensionOptions()[0]
requireT.Equal(opt, extAny)
requireT.Equal(opt.TypeUrl, extAny.TypeUrl)
requireT.Equal(opt.Value, extAny.Value)
}

func testSigners(require *require.Assertions, tr signing.Tx, pks ...cryptotypes.PubKey) []signingtypes.SignatureV2 {
Expand Down
Loading
Loading