-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dwedul/1760-make-sims-pass
- Loading branch information
Showing
28 changed files
with
2,036 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Buf setup action | ||
uses: bufbuild/[email protected].1 | ||
uses: bufbuild/[email protected].2 | ||
- name: Buf push 'third_party/proto' | ||
uses: bufbuild/buf-push-action@v1 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ jobs: | |
fi | ||
echo "Setting output: base-branch=$branch" | ||
echo "base-branch=$branch" >> "$GITHUB_OUTPUT" | ||
- uses: bufbuild/[email protected].1 | ||
- uses: bufbuild/[email protected].2 | ||
- uses: bufbuild/[email protected] | ||
if: always() | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,7 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Buf setup action | ||
uses: bufbuild/[email protected].1 | ||
uses: bufbuild/[email protected].2 | ||
- name: Buf push 'proto/' | ||
uses: bufbuild/buf-push-action@v1 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
syntax = "proto3"; | ||
package provenance.ibchooks.v1; | ||
|
||
option go_package = "github.com/provenance-io/provenance/x/ibchooks/types"; | ||
|
||
option java_package = "io.provenance.ibchooks.v1"; | ||
option java_multiple_files = true; | ||
|
||
// EventIBCHooksParamsUpdated defines the event emitted after updating ibchooks parameters. | ||
message EventIBCHooksParamsUpdated { | ||
repeated string allowed_async_ack_contracts = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
syntax = "proto3"; | ||
package provenance.ibchooks.v1; | ||
|
||
option go_package = "github.com/provenance-io/provenance/x/ibchooks/types"; | ||
|
||
option java_package = "io.provenance.ibchooks.v1"; | ||
option java_multiple_files = true; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "provenance/ibchooks/v1/params.proto"; | ||
|
||
// Query defines the gRPC querier service for attribute module. | ||
service Query { | ||
// Params queries params of the ihchooks module. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { | ||
option (google.api.http).get = "/provenance/ibchooks/v1/params"; | ||
} | ||
} | ||
|
||
// QueryParamsRequest is the request type for the Query/Params RPC method. | ||
message QueryParamsRequest {} | ||
|
||
// QueryParamsResponse is the response type for the Query/Params RPC method. | ||
message QueryParamsResponse { | ||
// params defines the parameters of the module. | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package cli_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
|
||
cmtcli "github.com/cometbft/cometbft/libs/cli" | ||
|
||
sdkmath "cosmossdk.io/math" | ||
|
||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" | ||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" | ||
"github.com/cosmos/cosmos-sdk/testutil/network" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" | ||
|
||
"github.com/provenance-io/provenance/internal/antewrapper" | ||
"github.com/provenance-io/provenance/internal/pioconfig" | ||
"github.com/provenance-io/provenance/testutil" | ||
testcli "github.com/provenance-io/provenance/testutil/cli" | ||
ibchookscli "github.com/provenance-io/provenance/x/ibchooks/client/cli" | ||
"github.com/provenance-io/provenance/x/ibchooks/types" | ||
) | ||
|
||
type IntegrationTestSuite struct { | ||
suite.Suite | ||
|
||
cfg network.Config | ||
testnet *network.Network | ||
accountAddr sdk.AccAddress | ||
accountKey *secp256k1.PrivKey | ||
} | ||
|
||
func TestIntegrationTestSuite(t *testing.T) { | ||
suite.Run(t, new(IntegrationTestSuite)) | ||
} | ||
|
||
func (s *IntegrationTestSuite) SetupSuite() { | ||
s.T().Log("setting up integration test suite") | ||
pioconfig.SetProvenanceConfig("", 0) | ||
govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() | ||
s.accountKey = secp256k1.GenPrivKeyFromSecret([]byte("acc2")) | ||
addr, err := sdk.AccAddressFromHexUnsafe(s.accountKey.PubKey().Address().String()) | ||
s.Require().NoError(err) | ||
s.accountAddr = addr | ||
|
||
s.cfg = testutil.DefaultTestNetworkConfig() | ||
genesisState := s.cfg.GenesisState | ||
|
||
s.cfg.NumValidators = 1 | ||
|
||
testutil.MutateGenesisState(s.T(), &s.cfg, types.ModuleName, &types.GenesisState{}, func(ibchooks *types.GenesisState) *types.GenesisState { | ||
ibchooksParams := types.DefaultParams() | ||
ibchooksGenesis := &types.GenesisState{Params: ibchooksParams} | ||
return ibchooksGenesis | ||
}) | ||
|
||
s.cfg.GenesisState = genesisState | ||
|
||
s.cfg.ChainID = antewrapper.SimAppChainID | ||
|
||
s.testnet, err = network.New(s.T(), s.T().TempDir(), s.cfg) | ||
s.Require().NoError(err, "network.New") | ||
|
||
_, err = testutil.WaitForHeight(s.testnet, 6) | ||
s.Require().NoError(err, "WaitForHeight") | ||
} | ||
|
||
func (s *IntegrationTestSuite) TearDownSuite() { | ||
testutil.Cleanup(s.testnet, s.T()) | ||
} | ||
|
||
func (s *IntegrationTestSuite) TestQueryParams() { | ||
clientCtx := s.testnet.Validators[0].ClientCtx | ||
cmd := ibchookscli.GetCmdQueryParams() | ||
|
||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}) | ||
s.Require().NoError(err) | ||
|
||
var response types.QueryParamsResponse | ||
s.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)) | ||
expectedParams := types.DefaultParams() | ||
s.Equal(expectedParams, response.Params, "should have the default params") | ||
} | ||
|
||
func (s *IntegrationTestSuite) TestUpdateParamsCmd() { | ||
testCases := []struct { | ||
name string | ||
args []string | ||
expectErrMsg string | ||
expectedCode uint32 | ||
}{ | ||
{ | ||
name: "success - update allowed async ack contracts", | ||
args: []string{fmt.Sprintf("%v,%v", s.accountAddr.String(), sdk.AccAddress("input111111111111111").String())}, | ||
expectedCode: 0, | ||
}, | ||
{ | ||
name: "failure - invalid args", | ||
args: []string{"contract1"}, | ||
expectErrMsg: `invalid contract address: "contract1": decoding bech32 failed: invalid separator index 8`, | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
s.Run(tc.name, func() { | ||
cmd := ibchookscli.NewUpdateParamsCmd() | ||
tc.args = append(tc.args, | ||
"--title", fmt.Sprintf("title: %v", tc.name), | ||
"--summary", fmt.Sprintf("summary: %v", tc.name), | ||
"--deposit=1000000stake", | ||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), | ||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), | ||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), | ||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), | ||
fmt.Sprintf("--%s=json", cmtcli.OutputFlag), | ||
) | ||
|
||
testcli.NewTxExecutor(cmd, tc.args). | ||
WithExpErrMsg(tc.expectErrMsg). | ||
WithExpCode(tc.expectedCode). | ||
Execute(s.T(), s.testnet) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.