Skip to content

Commit

Permalink
Merge branch 'master' into api-routing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell authored Jun 18, 2023
2 parents 268c2b4 + b921261 commit 705dda1
Show file tree
Hide file tree
Showing 28 changed files with 39 additions and 48 deletions.
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ linters:
- unconvert
- unused
- unparam
- misspell

linters-settings:
gosec:
Expand Down
6 changes: 5 additions & 1 deletion app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ func TestAppImportExport(t *testing.T) {

t.Log("importing genesis...")

_, newDB, newDir, _, _, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2")
simConfig, newDB, newDir, simLogger, simFlag, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2")
require.NoError(t, err, "simulation setup failed")

_ = simConfig
_ = simLogger
_ = simFlag

defer func() {
newDB.Close()
require.NoError(t, os.RemoveAll(newDir))
Expand Down
5 changes: 1 addition & 4 deletions x/filetree/client/cli/tx_post_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ func CmdPostFile() *cobra.Command {
return err
}

fromAddress, err := getCallerAddress(clientCtx, cmd)
if err != nil {
return err
}
fromAddress := getCallerAddress(clientCtx)

if argKeys == "" {
return filetypes.ErrMissingAESKey
Expand Down
5 changes: 2 additions & 3 deletions x/filetree/client/cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ func encryptFileAESKey(cmd *cobra.Command, key string, argKeys string) ([]byte,
return encrypted, nil
}

func getCallerAddress(ctx client.Context, cmd *cobra.Command) (*string, error) {
_ = cmd
func getCallerAddress(ctx client.Context) *string {
fromAddress := ctx.GetFromAddress().String()
return &fromAddress, nil
return &fromAddress
}

func JSONMarshalViewersAndEditors(viewers map[string]string, editors map[string]string) ([]byte, []byte, error) {
Expand Down
4 changes: 2 additions & 2 deletions x/filetree/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func (suite *KeeperTestSuite) reset() {
suite.msgSrvr = keeper.NewMsgServerImpl(*suite.filetreeKeeper)
}

func setupMsgServer(suite *KeeperTestSuite) (types.MsgServer, keeper.Keeper, gocontext.Context) {
func setupMsgServer(suite *KeeperTestSuite) (types.MsgServer, gocontext.Context) {
k := suite.filetreeKeeper
filetree.InitGenesis(suite.ctx, *k, *types.DefaultGenesis())
ctx := sdk.WrapSDKContext(suite.ctx)
return keeper.NewMsgServerImpl(*k), *k, ctx
return keeper.NewMsgServerImpl(*k), ctx
}

func TestFiletreeTestSuite(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/marshalling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

func (suite *KeeperTestSuite) TestJSONMarshalling() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 2)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_add_editors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func (suite *KeeperTestSuite) TestMsgAddEditors() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 2)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_add_viewers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

func (suite *KeeperTestSuite) TestMsgAddViewers() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 2)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_change_owner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func (suite *KeeperTestSuite) TestMsgChangeOwners() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 3)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_delete_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func (suite *KeeperTestSuite) TestMsgDeleteFile() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 2)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_make_root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func (suite *KeeperTestSuite) TestMsgMakeRoot() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 1)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_post_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func (suite *KeeperTestSuite) TestMsgPostFile() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 2)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_post_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func (suite *KeeperTestSuite) TestMsgPostKey() {
suite.SetupSuite()

msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 1)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_remove_editors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func (suite *KeeperTestSuite) TestMsgRemoveEditors() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 3)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_remove_viewers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func (suite *KeeperTestSuite) TestMsgRemoveViewers() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 3)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_reset_editors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func (suite *KeeperTestSuite) TestMsgResetEditors() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 3)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/filetree/keeper/msg_server_reset_viewers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func (suite *KeeperTestSuite) TestMsgResetViewers() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 3)
suite.Require().NoError(err)
Expand Down
4 changes: 2 additions & 2 deletions x/notifications/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func (suite *KeeperTestSuite) reset() {
suite.msgSrvr = keeper.NewMsgServerImpl(*suite.notificationsKeeper)
}

func setupMsgServer(suite *KeeperTestSuite) (types.MsgServer, keeper.Keeper, gocontext.Context) {
func setupMsgServer(suite *KeeperTestSuite) (types.MsgServer, gocontext.Context) {
k := suite.notificationsKeeper
notifications.InitGenesis(suite.ctx, *k, *types.DefaultGenesis())
ctx := sdk.WrapSDKContext(suite.ctx)
return keeper.NewMsgServerImpl(*k), *k, ctx
return keeper.NewMsgServerImpl(*k), ctx
}

func TestNotificationsTestSuite(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/notifications/keeper/msg_server_block_senders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func (suite *KeeperTestSuite) TestMsgBlockSenders() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 3)
suite.Require().NoError(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func (suite *KeeperTestSuite) TestMsgCreateNotifications() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 3)
suite.Require().NoError(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func (suite *KeeperTestSuite) TestMsgDeleteNotifications() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 2)
suite.Require().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion x/notifications/keeper/msg_server_set_counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func (suite *KeeperTestSuite) TestMsgSetCounter() {
suite.SetupSuite()
msgSrvr, _, context := setupMsgServer(suite)
msgSrvr, context := setupMsgServer(suite)

testAddresses, err := testutil.CreateTestAddresses("cosmos", 2)
suite.Require().NoError(err)
Expand Down
4 changes: 2 additions & 2 deletions x/oracle/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ func (suite *KeeperTestSuite) reset() {
suite.testAccs = CreateRandomAccounts(3)
}

func setupMsgServer(suite *KeeperTestSuite) (types.MsgServer, keeper.Keeper, gocontext.Context) {
func setupMsgServer(suite *KeeperTestSuite) (types.MsgServer, gocontext.Context) {
k := suite.oracleKeeper
oracle.InitGenesis(suite.ctx, *k, *types.DefaultGenesis())
ctx := sdk.WrapSDKContext(suite.ctx)
return keeper.NewMsgServerImpl(*k), *k, ctx
return keeper.NewMsgServerImpl(*k), ctx
}

func CreateRandomAccounts(numAccs int) []sdk.AccAddress {
Expand Down
4 changes: 2 additions & 2 deletions x/oracle/keeper/msg_server_feeds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (suite *KeeperTestSuite) TestCreateFeed() {
for name, tc := range cases {
suite.Run(name, func() {
suite.SetupSuite()
msgSrvr, _, _ := setupMsgServer(suite)
msgSrvr, _ := setupMsgServer(suite)
suite.oracleKeeper.SetFeed(suite.ctx, genesisFeed)

// TODO: setup simulation and use that instead
Expand Down Expand Up @@ -111,7 +111,7 @@ func (suite *KeeperTestSuite) TestUpdateFeed() {
suite.Run(name, func() {
suite.reset()
suite.oracleKeeper.SetFeed(suite.ctx, genesisFeed)
msgSrvr, _, wctx := setupMsgServer(suite)
msgSrvr, wctx := setupMsgServer(suite)

result, err := msgSrvr.UpdateFeed(wctx, &types.MsgUpdateFeed{
Name: tc.name,
Expand Down
9 changes: 3 additions & 6 deletions x/rns/keeper/bidding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ const TestName = "test.jkl"

func (suite *KeeperTestSuite) TestMsgAcceptBid() {
suite.SetupSuite()
err := suite.setupNames()
suite.Require().NoError(err)
suite.setupNames()

testAddresses, err := testutil.CreateTestAddresses("cosmos", 2)
suite.Require().NoError(err)
Expand Down Expand Up @@ -76,8 +75,7 @@ func (suite *KeeperTestSuite) TestMsgAcceptBid() {

func (suite *KeeperTestSuite) TestMsgMakeBid() {
suite.SetupSuite()
err := suite.setupNames()
suite.Require().NoError(err)
suite.setupNames()

testAddresses, err := testutil.CreateTestAddresses("cosmos", 1)
suite.Require().NoError(err)
Expand Down Expand Up @@ -115,8 +113,7 @@ func (suite *KeeperTestSuite) TestMsgMakeBid() {

func (suite *KeeperTestSuite) TestMsgCancelBid() {
suite.SetupSuite()
err := suite.setupNames()
suite.Require().NoError(err)
suite.setupNames()

testAddresses, err := testutil.CreateTestAddresses("cosmos", 1)
suite.Require().NoError(err)
Expand Down
7 changes: 2 additions & 5 deletions x/rns/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func setupMsgServer(suite *KeeperTestSuite) (types.MsgServer, keeper.Keeper, goc
return keeper.NewMsgServerImpl(*k), *k, ctx
}

func (suite *KeeperTestSuite) setupNames() error {
func (suite *KeeperTestSuite) setupNames() {
testAddresses, err := testutil.CreateTestAddresses("cosmos", 1)
suite.Require().NoError(err)

Expand All @@ -84,14 +84,11 @@ func (suite *KeeperTestSuite) setupNames() error {

suite.rnsKeeper.SetNames(suite.ctx, name)
}

return nil
}

func (suite *KeeperTestSuite) TestMakeBid() {
suite.SetupSuite()
err := suite.setupNames()
suite.Require().NoError(err)
suite.setupNames()

testAddresses, err := testutil.CreateTestAddresses("cosmos", 1)
suite.Require().NoError(err)
Expand Down
3 changes: 1 addition & 2 deletions x/rns/keeper/register_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import (

func (suite *KeeperTestSuite) TestMsgRegisterName() {
suite.SetupSuite()
err := suite.setupNames()
suite.Require().NoError(err)
suite.setupNames()

testAddresses, err := testutil.CreateTestAddresses("cosmos", 1)
suite.Require().NoError(err)
Expand Down
3 changes: 1 addition & 2 deletions x/rns/keeper/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import (

func (suite *KeeperTestSuite) TestMsgTransfer() {
suite.SetupSuite()
err := suite.setupNames()
suite.Require().NoError(err)
suite.setupNames()

testAddresses, err := testutil.CreateTestAddresses("cosmos", 2)
suite.Require().NoError(err)
Expand Down

0 comments on commit 705dda1

Please sign in to comment.