From e0d91b212af6aab4c6deb1fdd335423163f03d97 Mon Sep 17 00:00:00 2001 From: Nina Barbakadze Date: Mon, 3 Jun 2024 23:59:57 +0200 Subject: [PATCH] style: more cleaning up --- app/test/non_determinism_test.go | 8 ++++---- app/test/prepare_proposal_test.go | 4 +++- app/test/process_proposal_test.go | 1 + test/util/blobfactory/payforblob_factory.go | 3 ++- test/util/direct_tx_gen.go | 4 +++- test/util/genesis/document.go | 1 - test/util/genesis/genesis.go | 1 - 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/test/non_determinism_test.go b/app/test/non_determinism_test.go index 35ba0f62ee..0c76f0be3c 100644 --- a/app/test/non_determinism_test.go +++ b/app/test/non_determinism_test.go @@ -29,16 +29,16 @@ func TestNonDeterminismBetweenMainAndV1(t *testing.T) { expectedAppHash := []byte{100, 237, 125, 126, 116, 10, 189, 82, 156, 116, 176, 136, 169, 92, 185, 12, 72, 134, 254, 175, 234, 13, 159, 90, 139, 192, 190, 248, 67, 9, 32, 217} - // initialize testApp + // Initialize testApp testApp := testutil.NewTestApp() enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) - // create deterministic keys + // Create deterministic keys kr, pubKeys := DeterministicKeyRing(enc.Codec) - var addresses []string recs, err := kr.List() require.NoError(t, err) + addresses := make([]string, len(recs)) // Get the name of the records for _, rec := range recs { @@ -66,7 +66,7 @@ func TestNonDeterminismBetweenMainAndV1(t *testing.T) { // Create a set of 5 deterministic blob transactions blobTxs := blobfactory.ManyMultiBlobTx(t, enc.TxConfig, kr, testutil.ChainID, addresses[numBlobTxs+1:], accinfos[numBlobTxs+1:], testfactory.Repeat([]*blob.Blob{ blob.New(DeterministicNamespace(), []byte{1}, appconsts.DefaultShareVersion), - }, numBlobTxs)) + }, numBlobTxs), app.DefaultInitialConsensusParams().Version.AppVersion) // Deliver sdk txs for _, tx := range normalTxs { diff --git a/app/test/prepare_proposal_test.go b/app/test/prepare_proposal_test.go index 04b925e365..2da3d79286 100644 --- a/app/test/prepare_proposal_test.go +++ b/app/test/prepare_proposal_test.go @@ -40,6 +40,7 @@ func TestPrepareProposalPutsPFBsAtEnd(t *testing.T) { testfactory.Repeat([]*blob.Blob{ blob.New(appns.RandomBlobNamespace(), []byte{1}, appconsts.DefaultShareVersion), }, numBlobTxs), + app.DefaultConsensusParams().Version.AppVersion, ) normalTxs := testutil.SendTxsWithAccounts( @@ -97,6 +98,7 @@ func TestPrepareProposalFiltering(t *testing.T) { testfactory.RandomBlobNamespaces(tmrand.NewRand(), 3), [][]int{{100}, {1000}, {420}}, ), + app.DefaultConsensusParams().Version.AppVersion, ) // create 3 MsgSend transactions that are signed with valid account numbers @@ -136,7 +138,7 @@ func TestPrepareProposalFiltering(t *testing.T) { nilAccount := "carmon san diego" _, _, err := kr.NewMnemonic(nilAccount, keyring.English, "", "", hd.Secp256k1) require.NoError(t, err) - noAccountTx := []byte(testutil.SendTxWithManualSequence(t, encConf.TxConfig, kr, nilAccount, accounts[0], 1000, "", 0, 6)) + noAccountTx := []byte(testutil.SendTxWithManualSequence(t, encConf.TxConfig, kr, nilAccount, accounts[0], 1000, "", 0, app.DefaultConsensusParams().Version.AppVersion, 6)) type test struct { name string diff --git a/app/test/process_proposal_test.go b/app/test/process_proposal_test.go index fd52936322..9acaec6d99 100644 --- a/app/test/process_proposal_test.go +++ b/app/test/process_proposal_test.go @@ -47,6 +47,7 @@ func TestProcessProposal(t *testing.T) { testfactory.RandomBlobNamespaces(tmrand.NewRand(), 4), [][]int{{100}, {1000}, {420}, {300}}, ), + app.DefaultConsensusParams().Version.AppVersion, ) // create 3 MsgSend transactions that are signed with valid account numbers diff --git a/test/util/blobfactory/payforblob_factory.go b/test/util/blobfactory/payforblob_factory.go index b0ab9706bb..0db4cbca79 100644 --- a/test/util/blobfactory/payforblob_factory.go +++ b/test/util/blobfactory/payforblob_factory.go @@ -222,12 +222,13 @@ func ManyMultiBlobTx( accounts []string, accInfos []AccountInfo, blobs [][]*blob.Blob, + appVersion uint64, ) [][]byte { t.Helper() txs := make([][]byte, len(accounts)) opts := DefaultTxOpts() for i, acc := range accounts { - signer, err := user.NewSigner(kr, enc, chainid, 1, user.NewAccount(acc, accInfos[i].AccountNum, accInfos[i].Sequence)) + signer, err := user.NewSigner(kr, enc, chainid, appVersion, user.NewAccount(acc, accInfos[i].AccountNum, accInfos[i].Sequence)) require.NoError(t, err) txs[i], _, err = signer.CreatePayForBlobs(acc, blobs[i], opts...) require.NoError(t, err) diff --git a/test/util/direct_tx_gen.go b/test/util/direct_tx_gen.go index f9416d1d47..902dc1baf5 100644 --- a/test/util/direct_tx_gen.go +++ b/test/util/direct_tx_gen.go @@ -192,6 +192,7 @@ func SendTxsWithAccounts( chainid, acc.GetSequence(), acc.GetAccountNumber(), + appconsts.LatestVersion, opts..., ) } @@ -209,10 +210,11 @@ func SendTxWithManualSequence( amount uint64, chainid string, sequence, accountNum uint64, + appVersion uint64, opts ...user.TxOption, ) coretypes.Tx { fromAddr, toAddr := getAddress(fromAcc, kr), getAddress(toAcc, kr) - signer, err := user.NewSigner(kr, cfg, chainid, 1, user.NewAccount(fromAcc, accountNum, sequence)) + signer, err := user.NewSigner(kr, cfg, chainid, appVersion, user.NewAccount(fromAcc, accountNum, sequence)) require.NoError(t, err) msg := banktypes.NewMsgSend(fromAddr, toAddr, sdk.NewCoins(sdk.NewCoin(app.BondDenom, sdk.NewIntFromUint64(amount)))) diff --git a/test/util/genesis/document.go b/test/util/genesis/document.go index 8f9a0b3201..842bb92770 100644 --- a/test/util/genesis/document.go +++ b/test/util/genesis/document.go @@ -57,7 +57,6 @@ func Document( } state := app.ModuleBasics.DefaultGenesis(ecfg.Codec) - // fmt.Println(state, "state") state[authtypes.ModuleName] = ecfg.Codec.MustMarshalJSON(authGenState) state[banktypes.ModuleName] = ecfg.Codec.MustMarshalJSON(bankGenState) state[genutiltypes.ModuleName] = ecfg.Codec.MustMarshalJSON(genutilGenState) diff --git a/test/util/genesis/genesis.go b/test/util/genesis/genesis.go index 9472fc0958..ab2e8a93eb 100644 --- a/test/util/genesis/genesis.go +++ b/test/util/genesis/genesis.go @@ -11,7 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/crypto/ed25519" tmrand "github.com/tendermint/tendermint/libs/rand" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" coretypes "github.com/tendermint/tendermint/types"