Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up Msgs and Codecs. #1957

Merged
merged 43 commits into from
May 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f80182b
[1760]: Rename all the msg.go files (and their relatives) to msgs.go.
SpicyLemon Apr 25, 2024
2acde49
[1760]: Standardize all the msg and codec definition to use a public …
SpicyLemon Apr 25, 2024
c97e0ba
[1760]: Create RunGetSignersTests to standardize checking signers-rel…
SpicyLemon Apr 25, 2024
3915c4f
[1760]: Switch the exchange GetSigners test over to the new RunGetSig…
SpicyLemon Apr 25, 2024
6084f42
[1760]: Switch the metadata GetSigners test over to the new RunGetSig…
SpicyLemon Apr 25, 2024
55c63e8
[1760]: For the legacy test runner, just make sure the panic contains…
SpicyLemon Apr 25, 2024
ca22068
[1760]: Add GetSigners tests to the attribute module.
SpicyLemon Apr 25, 2024
754144b
[1760]: Streamline the exchange GetSigners maker definitions.
SpicyLemon Apr 25, 2024
1ad68dc
[1760]: Change ExpPanic fields to ExpInErr since the new stuff isn't …
SpicyLemon Apr 25, 2024
cd2c8eb
[1760]: Add a GetSigners tests to the ibchooks module, and fix the Ms…
SpicyLemon Apr 25, 2024
aeb142b
[1760]: Add GetSigners tests to the ibcratelimit module.
SpicyLemon Apr 25, 2024
de5cc29
[1760]: GetSigners Tests on all the marker Msgs, and fix MsgCancelReq…
SpicyLemon Apr 25, 2024
c45b90d
[1760]: Switch to RunGetSignersTests in the msgfees module.
SpicyLemon Apr 25, 2024
11e303e
[1760]: Switch to RunGetSignersTests in the name module.
SpicyLemon Apr 26, 2024
5c7bd21
[1760]: Switch to RunGetSignersTests in the oracle module.
SpicyLemon Apr 26, 2024
6f2829d
[1760]: Switch to RunGetSignersTests for the quarantine module.
SpicyLemon Apr 26, 2024
9586b7b
[1760]: Switch to RunGetSignersTests for the sanction module.
SpicyLemon Apr 26, 2024
297cb5d
[1760]: Switch to RunGetSignersTests for the trigger module.
SpicyLemon Apr 26, 2024
fc26552
[1760]: Get rid of most of the GetSigners methods (the ones that were…
SpicyLemon Apr 26, 2024
ff4bac0
[1760]: Remove the marker module's GetSigners methods, and update the…
SpicyLemon Apr 26, 2024
91bf74a
[1760]: Remove the GetSigners() methods from the metadata module.
SpicyLemon Apr 26, 2024
8bfd5d1
[1760]: Get rid of some ibchooks msg methods that used to be required…
SpicyLemon Apr 26, 2024
f68ee9b
[1760]: Reorder the stuff in marker/types/msgs.go to match the order …
SpicyLemon Apr 26, 2024
32e5701
[1760]: Reorder the stuff in names msgs.go to match the proto ordering.
SpicyLemon Apr 26, 2024
eda386a
[1760]: Reorganize the metadata msgs.go stuff.
SpicyLemon Apr 26, 2024
1631742
[1760]: Clean up the attribute and ibchooks protos a little.
SpicyLemon Apr 26, 2024
f9c9574
[1760]: Get rid of most of the yaml tags from the protos. Only ones l…
SpicyLemon Apr 26, 2024
0591d78
Merge branch 'main' into dwedul/1760-get-signers
SpicyLemon May 6, 2024
04b6482
[1760]: Remove the rest of the uses of gogoproto.moretags.
SpicyLemon May 6, 2024
8df46bd
[1760]: Clean up some unneeded gogoproto.goproto_stringer options fro…
SpicyLemon May 6, 2024
98bf7a0
[1760]: Update all the Coins fields in the protos to match the same o…
SpicyLemon May 6, 2024
3c6c635
[1760]: Remove all uses of any ModuleCdc variables, and delete them all.
SpicyLemon May 6, 2024
4da9f03
[1760]: In GetFeePayerUsingFeeGrant, cast the feePayer and feeGranter…
SpicyLemon May 6, 2024
7d40bf5
[1760]: Get rid of all the String() methods that just do yaml convers…
SpicyLemon May 7, 2024
06aaf93
[1760]: Refactor the MetadataAddress.Format method to handle more cas…
SpicyLemon May 7, 2024
10694a8
Merge branch 'main' into dwedul/1760-get-signers
SpicyLemon May 7, 2024
f56953a
[1760]: Remove a private unused function: stringsToAccAddresses
SpicyLemon May 7, 2024
7c14061
[1760]: Switch to sigs.k8s.io/yaml (from gopkg.in/yaml.v2) in the las…
SpicyLemon May 7, 2024
7208658
[1760]: Move DefineCustomGetSigners to the top of the file.
SpicyLemon May 7, 2024
c582371
[1760]: Add changelog entries.
SpicyLemon May 7, 2024
378c796
[1760]: Move now-indirect require of gopkg.in/yaml.v2 to the indirect…
SpicyLemon May 8, 2024
cd11009
[1760]: Tweak the MetadataAddress.Format method: add some comments an…
SpicyLemon May 8, 2024
004bc00
Merge branch 'main' into dwedul/1760-get-signers
SpicyLemon May 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[1760]: Add GetSigners tests to the ibcratelimit module.
SpicyLemon committed Apr 25, 2024
commit aeb142b3a91061f92b25e3daa83155e1b926cbcf
66 changes: 18 additions & 48 deletions x/ibcratelimit/msgs_test.go
Original file line number Diff line number Diff line change
@@ -3,18 +3,29 @@ package ibcratelimit_test
import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/provenance-io/provenance/testutil/assertions"
"github.com/provenance-io/provenance/x/ibcratelimit"
"github.com/stretchr/testify/assert"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/provenance-io/provenance/testutil"

. "github.com/provenance-io/provenance/x/ibcratelimit"
)

func TestAllMsgsGetSigners(t *testing.T) {
msgMakers := []testutil.MsgMaker{
func(signer string) sdk.Msg { return &MsgGovUpdateParamsRequest{Authority: signer} },
}

testutil.RunGetSignersTests(t, AllRequestMsgs, msgMakers, nil)
}

func TestNewMsgGovUpdateParamsRequest(t *testing.T) {
expected := &ibcratelimit.MsgGovUpdateParamsRequest{
expected := &MsgGovUpdateParamsRequest{
Authority: "authority",
Params: ibcratelimit.NewParams("contract"),
Params: NewParams("contract"),
}
event := ibcratelimit.NewMsgGovUpdateParamsRequest(expected.Authority, expected.Params.ContractAddress)
event := NewMsgGovUpdateParamsRequest(expected.Authority, expected.Params.ContractAddress)
assert.Equal(t, expected, event, "should create the correct with correct content")
}

@@ -51,7 +62,7 @@ func TestNewMsgGovUpdateParamsValidateBasic(t *testing.T) {

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
msg := ibcratelimit.NewMsgGovUpdateParamsRequest(tc.authority, tc.contract)
msg := NewMsgGovUpdateParamsRequest(tc.authority, tc.contract)
err := msg.ValidateBasic()

if len(tc.err) > 0 {
@@ -62,44 +73,3 @@ func TestNewMsgGovUpdateParamsValidateBasic(t *testing.T) {
})
}
}

func TestMsgGovUpdateParamsRequestGetSigners(t *testing.T) {
tests := []struct {
name string
authority string
err string
}{
{
name: "success - valid signer",
authority: "cosmos1qm0hhug8kszhcp9f3ryuecz5yw8s3e5v0n2ckd",
},
{
name: "failure - missing signer",
authority: "",
err: "empty address string is not allowed",
},
{
name: "failure - invalid signer",
authority: "authority",
err: "decoding bech32 failed: invalid separator index -1",
},
}

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
msg := ibcratelimit.NewMsgGovUpdateParamsRequest(tc.authority, "contract")

if len(tc.err) > 0 {
assertions.RequirePanicEquals(t, func() {
msg.GetSigners()
}, tc.err, "should panic with correct message")
} else {
signers := make([]sdk.AccAddress, 1)
assert.NotPanics(t, func() {
signers = msg.GetSigners()
}, "should not panic")
assert.Equal(t, signers[0].String(), tc.authority)
}
})
}
}