Skip to content

Commit

Permalink
style: cleanup and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ninabarbakadze committed Jun 7, 2024
1 parent a1262da commit 563ab6a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 21 deletions.
20 changes: 8 additions & 12 deletions app/apphash_test.go → app/consistent_apphash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@ import (
"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
"github.com/celestiaorg/celestia-app/pkg/appconsts"
appns "github.com/celestiaorg/celestia-app/pkg/namespace"
"github.com/celestiaorg/celestia-app/pkg/user"
testutil "github.com/celestiaorg/celestia-app/test/util"
"github.com/celestiaorg/celestia-app/test/util/blobfactory"

// "github.com/celestiaorg/celestia-app/v2/test/util/blobfactory"
// "github.com/celestiaorg/celestia-app/v2/test/util/testfactory"
// "github.com/celestiaorg/go-square/blob"
appns "github.com/celestiaorg/celestia-app/pkg/namespace"
"github.com/cosmos/cosmos-sdk/codec"
hd "github.com/cosmos/cosmos-sdk/crypto/hd"
keyring "github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/stretchr/testify/require"

"github.com/celestiaorg/celestia-app/pkg/user"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/proto/tendermint/version"
Expand Down Expand Up @@ -71,7 +66,7 @@ func TestConsistentAppHash(t *testing.T) {
accountInfos := queryAccountInfo(testApp, accountNames, kr)

// Create accounts for the signer
var accounts []*user.Account
accounts := make([]*user.Account, 0, len(accountInfos))
for i, accountInfo := range accountInfos {
account := user.NewAccount(accountNames[i], accountInfo.AccountNum, accountInfo.Sequence)
accounts = append(accounts, account)
Expand All @@ -88,7 +83,8 @@ func TestConsistentAppHash(t *testing.T) {
sdkMsgs: []sdk.Msg{
banktypes.NewMsgSend(signer.Account(accountNames[0]).Address(),
signer.Account(accountNames[1]).Address(),
amount)},
amount),
},
txOptions: blobfactory.DefaultTxOpts(),
}

Expand Down
2 changes: 1 addition & 1 deletion test/util/genesis/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ func (v *Validator) GenTx(ecfg encoding.Config, kr keyring.Keyring, chainID stri
}

return txBuilder.GetTx(), nil
}
}
2 changes: 1 addition & 1 deletion test/util/genesis/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ func (ga Account) ValidateBasic() error {
return fmt.Errorf("balance must be greater than 0")
}
return nil
}
}
2 changes: 1 addition & 1 deletion test/util/genesis/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ func InitFiles(
}

return basePath, nil
}
}
2 changes: 1 addition & 1 deletion test/util/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,4 @@ func (g *Genesis) Validator(i int) (Validator, bool) {
return g.validators[i], true
}
return Validator{}, false
}
}
2 changes: 1 addition & 1 deletion test/util/genesis/modifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ func FundAccounts(codec codec.Codec, addresses []sdk.AccAddress, balance sdk.Coi
state[banktypes.ModuleName] = codec.MustMarshalJSON(&bankGenState)
return state
}
}
}
2 changes: 1 addition & 1 deletion test/util/genesis/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ func NewSeed(r *mrand.Rand) []byte {

func GenerateEd25519(seed []byte) crypto.PrivKey {
return ed25519.GenPrivKeyFromSecret(seed)
}
}
4 changes: 1 addition & 3 deletions test/util/test_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func (ao EmptyAppOptions) Get(_ string) interface{} {
func NewTestApp() *app.App {
// EmptyAppOptions is a stub implementing AppOptions
emptyOpts := EmptyAppOptions{}
// var anteOpt = func(bapp *baseapp.BaseApp) { bapp.SetAnteHandler(nil) }
db := dbm.NewMemDB()

encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...)
Expand All @@ -75,7 +74,7 @@ func NewTestApp() *app.App {

// ApplyGenesisState applies genesis with a specified state on initialized testApp.
func ApplyGenesisState(testApp *app.App, pubKeys []cryptotypes.PubKey, balance int64, cparams *tmproto.ConsensusParams) (keyring.Keyring, []genesis.Account, error) {
// Create genesis
// Create default genesis state
gen := genesis.NewDefaultGenesis().WithChainID(ChainID).WithConsensusParams(cparams).WithGenesisTime(time.Date(2023, 1, 1, 1, 1, 1, 1, time.UTC).UTC())

// Add accounts to the genesis state
Expand Down Expand Up @@ -127,7 +126,6 @@ func ApplyGenesisState(testApp *app.App, pubKeys []cryptotypes.PubKey, balance i
}

// Init chain will set the validator set and initialize the genesis accounts
// TODO: Understand why genDoc.GenesisTime is getting reset
testApp.InitChain(
abci.RequestInitChain{
Time: gen.GenesisTime,
Expand Down

0 comments on commit 563ab6a

Please sign in to comment.