Skip to content

Commit

Permalink
fix: tidy up x/foundation (#597)
Browse files Browse the repository at this point in the history
* chore: use handy functions on errors

* refactor: call string implicitly

* lint: lint

* fix: remove legacy amino

* docs: fix format of the example

* test: add a begin blocker test

* fix: change some errors to panic

* docs: update CHANGELOG.md
  • Loading branch information
0Tech authored Jul 19, 2022
1 parent 6331b66 commit aef879d
Show file tree
Hide file tree
Showing 31 changed files with 642 additions and 652 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (refactor) [\#493](https://github.com/line/lbm-sdk/pull/493) restructure x/consortium
* (server/grpc) [\#526](https://github.com/line/lbm-sdk/pull/526) add index field into TxResponse
* (cli) [\#535](https://github.com/line/lbm-sdk/pull/536) updated ostracon to v1.0.5; `unsafe-reset-all` command has been moved to the `ostracon` sub-command.
* (x/foundation) [\#597](https://github.com/line/lbm-sdk/pull/597) tidy up x/foundation

### Bug Fixes
* (x/wasm) [\#453](https://github.com/line/lbm-sdk/pull/453) modify wasm grpc query api path
Expand Down
10 changes: 5 additions & 5 deletions x/foundation/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
)

func TestReceiveFromTreasuryAuthorization(t *testing.T) {
testCases := map[string]struct{
msg sdk.Msg
valid bool
testCases := map[string]struct {
msg sdk.Msg
valid bool
accept bool
}{
"valid": {
msg: &foundation.MsgWithdrawFromTreasury{},
valid: true,
msg: &foundation.MsgWithdrawFromTreasury{},
valid: true,
accept: true,
},
"msg mismatch": {
Expand Down
2 changes: 1 addition & 1 deletion x/foundation/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ Example of the content of policy-json:
"threshold": "10",
"windows": {
"voting_period": "24h",
"min_execution_period": "0s",
"min_execution_period": "0s"
}
}
`,
Expand Down
4 changes: 2 additions & 2 deletions x/foundation/client/testutil/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (s *IntegrationTestSuite) TestNewQueryCmdParams() {
s.Require().NoError(err)

var actual foundation.QueryParamsResponse
s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), &actual), out.String())
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &actual), out.String())
s.Require().Equal(tc.expected, &actual)
})
}
Expand Down Expand Up @@ -525,7 +525,7 @@ func (s *IntegrationTestSuite) TestNewQueryCmdGrants() {
s.Require().NoError(err)

var actual foundation.QueryGrantsResponse
s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), &actual), out.String())
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &actual), out.String())
s.Require().Equal(tc.expected, len(actual.Authorizations))
})
}
Expand Down
4 changes: 2 additions & 2 deletions x/foundation/client/testutil/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type IntegrationTestSuite struct {
var commonArgs = []string{
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))).String()),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100)))),
}

func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite {
Expand Down Expand Up @@ -185,7 +185,7 @@ func (s *IntegrationTestSuite) submitProposal(msg sdk.Msg, try bool) uint64 {
for _, e := range events {
if e.Type == proposalEvent.Type {
var proposal foundation.Proposal
err := s.cfg.Codec.UnmarshalJSON([]byte(e.Attributes[0].Value), &proposal)
err := val.ClientCtx.Codec.UnmarshalJSON([]byte(e.Attributes[0].Value), &proposal)
s.Require().NoError(err)

return proposal.Id
Expand Down
Loading

0 comments on commit aef879d

Please sign in to comment.