Skip to content

Commit

Permalink
Fix all lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
neitdung committed Jan 10, 2024
1 parent ba7052f commit e08281b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ run:
tests: true
timeout: 15m
sort-results: true
exclude-dir: testing/simapp
skip-files:
- server/grpc/gogoreflection/fix_registration.go
- "fix_registration.go"
Expand Down
10 changes: 8 additions & 2 deletions testing/simapp/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ func TestAppImportExport(t *testing.T) {

fmt.Printf("importing genesis...\n")

_, newDB, newDir, _, _, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2")
_, newDB, newDir, _, skip, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2")
if skip {
t.Skip("skipping application import/export simulation")
}
require.NoError(t, err, "simulation setup failed")

defer func() {
Expand Down Expand Up @@ -246,7 +249,10 @@ func TestAppSimulationAfterImport(t *testing.T) {

fmt.Printf("importing genesis...\n")

_, newDB, newDir, _, _, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2")
_, newDB, newDir, _, skip, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2")
if skip {
t.Skip("skipping application import/export simulation")
}
require.NoError(t, err, "simulation setup failed")

defer func() {
Expand Down
23 changes: 19 additions & 4 deletions testing/simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,15 @@ func createIncrementalAccounts(accNum int) []sdk.AccAddress {
// start at 100 so we can make up to 999 test addresses with valid test addresses
for i := 100; i < (accNum + 100); i++ {
numString := strconv.Itoa(i)
buffer.WriteString("A58856F0FD53BF058B4909A21AEC019107BA6") // base address string
_, err := buffer.WriteString("A58856F0FD53BF058B4909A21AEC019107BA6") // base address string
if err != nil {
panic(err)
}

buffer.WriteString(numString) // adding on final two digits to make addresses unique
_, err = buffer.WriteString(numString) // adding on final two digits to make addresses unique
if err != nil {
panic(err)
}
res, _ := sdk.AccAddressFromHexUnsafe(buffer.String())
bech := res.String()
addr, _ := TestAddr(buffer.String(), bech)
Expand Down Expand Up @@ -328,6 +334,7 @@ func TestAddr(addr string, bech string) (sdk.AccAddress, error) {

// CheckBalance checks the balance of an account.
func CheckBalance(t *testing.T, app *SimApp, addr sdk.AccAddress, balances sdk.Coins) {
t.Helper()
ctxCheck := app.BaseApp.NewContext(true, tmproto.Header{})
require.True(t, balances.IsEqual(app.BankKeeper.GetAllBalances(ctxCheck, addr)))
}
Expand All @@ -340,6 +347,7 @@ func SignAndDeliver(
t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg,
chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey,
) (sdk.GasInfo, *sdk.Result, error) {
t.Helper()
tx, err := helpers.GenTx(
txCfg,
msgs,
Expand Down Expand Up @@ -406,8 +414,15 @@ func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey {
// start at 10 to avoid changing 1 to 01, 2 to 02, etc
for i := 100; i < (numPubKeys + 100); i++ {
numString := strconv.Itoa(i)
buffer.WriteString("0B485CFC0EECC619440448436F8FC9DF40566F2369E72400281454CB552AF") // base pubkey string
buffer.WriteString(numString) // adding on final two digits to make pubkeys unique

_, err := buffer.WriteString("0B485CFC0EECC619440448436F8FC9DF40566F2369E72400281454CB552AF") // base pubkey string
if err != nil {
panic(err)
}
_, err = buffer.WriteString(numString) // adding on final two digits to make pubkeys unique
if err != nil {
panic(err)
}
publicKeys = append(publicKeys, NewPubKeyFromHex(buffer.String()))
buffer.Reset()
}
Expand Down

0 comments on commit e08281b

Please sign in to comment.