Skip to content

Commit

Permalink
style: more cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
ninabarbakadze committed Jun 3, 2024
1 parent 60edfd3 commit e0d91b2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions app/test/non_determinism_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion app/test/prepare_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/test/process_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/util/blobfactory/payforblob_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion test/util/direct_tx_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func SendTxsWithAccounts(
chainid,
acc.GetSequence(),
acc.GetAccountNumber(),
appconsts.LatestVersion,
opts...,
)
}
Expand All @@ -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))))
Expand Down
1 change: 0 additions & 1 deletion test/util/genesis/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion test/util/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e0d91b2

Please sign in to comment.