Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed Sep 5, 2024
2 parents b4a0eb6 + 444ea0d commit dc39df3
Show file tree
Hide file tree
Showing 66 changed files with 1,375 additions and 541 deletions.
2 changes: 1 addition & 1 deletion demo/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func NewMeshApp(
keys[meshsecprovtypes.StoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
app.BankKeeper,
app.WasmKeeper,
&app.WasmKeeper,
app.StakingKeeper,
)

Expand Down
18 changes: 18 additions & 0 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## Table of Contents

- [osmosis/meshsecurity/v1beta1/meshsecurity.proto](#osmosis/meshsecurity/v1beta1/meshsecurity.proto)
- [Delegation](#osmosis.meshsecurity.v1beta1.Delegation)
- [Params](#osmosis.meshsecurity.v1beta1.Params)
- [VirtualStakingMaxCapInfo](#osmosis.meshsecurity.v1beta1.VirtualStakingMaxCapInfo)

Expand Down Expand Up @@ -41,6 +42,23 @@



<a name="osmosis.meshsecurity.v1beta1.Delegation"></a>

### Delegation
Delegation represents the bond with tokens held by an account.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `delegator_address` | [string](#string) | | delegator_address is the bech32-encoded address of the delegator. |
| `validator_address` | [string](#string) | | validator_address is the bech32-encoded address of the validator. |
| `amount` | [string](#string) | | amount define the delegation amount. |






<a name="osmosis.meshsecurity.v1beta1.Params"></a>

### Params
Expand Down
15 changes: 15 additions & 0 deletions proto/osmosis/meshsecurity/v1beta1/meshsecurity.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ message VirtualStakingMaxCapInfo {
cosmos.base.v1beta1.Coin cap = 3 [ (gogoproto.nullable) = false ];
}

// Delegation represents the bond with tokens held by an account.
message Delegation {
option (gogoproto.equal) = false;

// delegator_address is the bech32-encoded address of the delegator.
string delegator_address = 1;
// validator_address is the bech32-encoded address of the validator.
string validator_address = 2;
// amount define the delegation amount.
string amount = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

// Params defines the parameters for the x/meshsecurity module.
message Params {
option (amino.name) = "meshsecurity/Params";
Expand Down
8 changes: 0 additions & 8 deletions proto/osmosis/meshsecurity/v1beta1/scheduler.proto
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
syntax = "proto3";
package osmosis.meshsecurity.v1beta1;

// import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";
// import "amino/amino.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurity/types";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = false;

//
message ScheduledWork {
bool repeat = 1;
}


// ValidatorAddress payload data to be used with the scheduler
message ValidatorAddress {
// Address is the ValAddress bech32 string
Expand Down
19 changes: 19 additions & 0 deletions proto/osmosis/meshsecurityprovider/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";
package osmosis.meshsecurityprovider;

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider/types";

message Params {
string vault_address = 1 [ (gogoproto.moretags) = "yaml:\"vault_address\"" ];
string native_staking_address = 2 [ (gogoproto.moretags) = "yaml:\"native_staking_address\"" ];
}

// GenesisState defines the meshsecurityprovider module's genesis state.
message GenesisState {
// params is the container of meshsecurityprovider parameters.
Params params = 1 [ (gogoproto.nullable) = false ];
}
19 changes: 19 additions & 0 deletions proto/osmosis/meshsecurityprovider/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";
package osmosis.meshsecurityprovider;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "osmosis/meshsecurityprovider/genesis.proto";
import "osmosis/meshsecurityprovider/tx.proto";

option go_package = "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider/types";

service Query {
rpc Params(ParamsRequest) returns (ParamsResponse) {
option (google.api.http).get = "/osmosis/meshsecurityprovider/Params";
}
}

//=============================== Params
message ParamsRequest {}
message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; }
31 changes: 31 additions & 0 deletions proto/osmosis/meshsecurityprovider/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";
package osmosis.meshsecurityprovider;

import "amino/amino.proto";
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "osmosis/meshsecurityprovider/genesis.proto";

option go_package = "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider/types";
option (gogoproto.goproto_getters_all) = false;

service Msg {
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}

// MsgUpdateParams updates meshsecurityprovider module 's params
message MsgUpdateParams {
option (amino.name) = "meshsecurityprovider/MsgUpdateParams";
option (cosmos.msg.v1.signer) = "authority";

// Authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1;

// params defines the x/meshsecurityprovider parameters to update.
Params params = 2 [ (gogoproto.nullable) = false ];

}

message MsgUpdateParamsResponse {}
7 changes: 3 additions & 4 deletions tests/e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# End-To-End Tests

Multi-chain system tests that run against the demo app.

Run them with:

Run them with:
```shell
make test
```


```
25 changes: 13 additions & 12 deletions tests/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"path/filepath"
"testing"

"github.com/CosmWasm/wasmd/x/wasm"
"github.com/CosmWasm/wasmd/x/wasm/ibctesting"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
Expand Down Expand Up @@ -38,14 +37,14 @@ func buildPathToWasm(fileName string) string {
// NewIBCCoordinator initializes Coordinator with N meshd TestChain instances
func NewIBCCoordinator(t *testing.T, n int, opts ...[]wasmkeeper.Option) *ibctesting.Coordinator {
return ibctesting.NewCoordinatorX(t, n,
func(t *testing.T, valSet *types.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasm.Option, balances ...banktypes.Balance) ibctesting.ChainApp {
func(t *testing.T, valSet *types.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) ibctesting.ChainApp {
return app.SetupWithGenesisValSet(t, valSet, genAccs, chainID, opts, balances...)
},
opts...,
)
}

func submitGovProposal(t *testing.T, chain *ibctesting.TestChain, msgs ...sdk.Msg) uint64 {
func submitGovProposal(t *testing.T, chain *TestChain, msgs ...sdk.Msg) uint64 {
chainApp := chain.App.(*app.MeshApp)
govParams := chainApp.GovKeeper.GetParams(chain.GetContext())
govMsg, err := govv1.NewMsgSubmitProposal(msgs, govParams.MinDeposit, chain.SenderAccount.GetAddress().String(), "", "my title", "my summary")
Expand All @@ -57,7 +56,7 @@ func submitGovProposal(t *testing.T, chain *ibctesting.TestChain, msgs ...sdk.Ms
return id
}

func voteAndPassGovProposal(t *testing.T, chain *ibctesting.TestChain, proposalID uint64) {
func voteAndPassGovProposal(t *testing.T, chain *TestChain, proposalID uint64) {
vote := govv1.NewMsgVote(chain.SenderAccount.GetAddress(), proposalID, govv1.OptionYes, "testing")
_, err := chain.SendMsgs(vote)
require.NoError(t, err)
Expand All @@ -67,14 +66,14 @@ func voteAndPassGovProposal(t *testing.T, chain *ibctesting.TestChain, proposalI

coord := chain.Coordinator
coord.IncrementTimeBy(*govParams.VotingPeriod)
coord.CommitBlock(chain)
coord.CommitBlock(chain.IBCTestChain())

rsp, err := chainApp.GovKeeper.Proposal(sdk.WrapSDKContext(chain.GetContext()), &govv1.QueryProposalRequest{ProposalId: proposalID})
require.NoError(t, err)
require.Equal(t, rsp.Proposal.Status, govv1.ProposalStatus_PROPOSAL_STATUS_PASSED)
}

func InstantiateContract(t *testing.T, chain *ibctesting.TestChain, codeID uint64, initMsg []byte, funds ...sdk.Coin) sdk.AccAddress {
func InstantiateContract(t *testing.T, chain *TestChain, codeID uint64, initMsg []byte, funds ...sdk.Coin) sdk.AccAddress {
instantiateMsg := &wasmtypes.MsgInstantiateContract{
Sender: chain.SenderAccount.GetAddress().String(),
Admin: chain.SenderAccount.GetAddress().String(),
Expand All @@ -96,14 +95,15 @@ func InstantiateContract(t *testing.T, chain *ibctesting.TestChain, codeID uint6

type example struct {
Coordinator *ibctesting.Coordinator
ConsumerChain *ibctesting.TestChain
ProviderChain *ibctesting.TestChain
ConsumerChain *TestChain
ProviderChain *TestChain
ConsumerApp *app.MeshApp
ProviderApp *app.MeshApp
IbcPath *ibctesting.Path
ProviderDenom string
ConsumerDenom string
MyProvChainActor string
MaxRetrieve uint16
}

func setupExampleChains(t *testing.T) example {
Expand All @@ -112,14 +112,15 @@ func setupExampleChains(t *testing.T) example {
consChain := coord.GetChain(ibctesting2.GetChainID(2))
return example{
Coordinator: coord,
ConsumerChain: consChain,
ProviderChain: provChain,
ConsumerChain: NewTestChain(t, consChain),
ProviderChain: NewTestChain(t, provChain),
ConsumerApp: consChain.App.(*app.MeshApp),
ProviderApp: provChain.App.(*app.MeshApp),
IbcPath: ibctesting.NewPath(consChain, provChain),
ProviderDenom: sdk.DefaultBondDenom,
ConsumerDenom: sdk.DefaultBondDenom,
MyProvChainActor: provChain.SenderAccount.GetAddress().String(),
MaxRetrieve: 50,
}
}

Expand All @@ -128,7 +129,7 @@ func setupMeshSecurity(t *testing.T, x example) (*TestConsumerClient, ConsumerCo

// setup contracts on both chains
consumerCli := NewConsumerClient(t, x.ConsumerChain)
consumerContracts := consumerCli.BootstrapContracts()
consumerContracts := consumerCli.BootstrapContracts(x)
converterPortID := wasmkeeper.PortIDForContract(consumerContracts.converter)
// add some fees so that we can distribute something
x.ConsumerChain.DefaultMsgFees = sdk.NewCoins(sdk.NewCoin(x.ConsumerDenom, math.NewInt(1_000_000)))
Expand All @@ -138,7 +139,7 @@ func setupMeshSecurity(t *testing.T, x example) (*TestConsumerClient, ConsumerCo

// setup ibc control path: consumer -> provider (direction matters)
x.IbcPath.EndpointB.ChannelConfig = &ibctesting2.ChannelConfig{
PortID: wasmkeeper.PortIDForContract(providerContracts.externalStaking),
PortID: wasmkeeper.PortIDForContract(providerContracts.ExternalStaking),
Order: types2.UNORDERED,
}
x.IbcPath.EndpointA.ChannelConfig = &ibctesting2.ChannelConfig{
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/mvp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func TestMVP(t *testing.T) {
// ...
x := setupExampleChains(t)
consumerCli, consumerContracts, providerCli := setupMeshSecurity(t, x)

// then the active set should be stored in the ext staking contract
// and contain all active validator addresses
qRsp := providerCli.QueryExtStaking(Query{"list_active_validators": {}})
Expand Down
Loading

0 comments on commit dc39df3

Please sign in to comment.