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

Add missing protobuf definitions #8600

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Bug Fixes

* Add missing protobuf definitions to be able to decode old block messages
penso marked this conversation as resolved.
Show resolved Hide resolved

### State Breaking

* [#8169](https://github.com/osmosis-labs/osmosis/pull/8169) [#8250](https://github.com/osmosis-labs/osmosis/pull/8250) [#8276](https://github.com/osmosis-labs/osmosis/pull/8276) [#8320](https://github.com/osmosis-labs/osmosis/pull/8320) Support non-pool assets in superfluid staking
Expand Down
93 changes: 93 additions & 0 deletions proto/osmosis/bridge/v1beta1/bridge.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
syntax = "proto3";
package osmosis.bridge.v1beta1;

import "gogoproto/gogo.proto";

option go_package = "github.com/osmosis-labs/osmosis/v24/x/bridge/types";

// Params defines params for x/bridge module.
message Params {
// Signers used to sign inbound and release outbound transactions
repeated string signers = 1 [ (gogoproto.moretags) = "yaml:\"signers\"" ];
// Assets is a list used to create tokenfactory denoms
// for corresponding trading pairs
repeated Asset assets = 2 [
(gogoproto.moretags) = "yaml:\"assets\"",
(gogoproto.nullable) = false
];
// VotesNeeded marks how many signers out of the list of signers need
// to sign until a tx can be considered finalized
uint64 votes_needed = 3 [ (gogoproto.moretags) = "yaml:\"votes_needed\"" ];
// Fee defines a param for fee that go towards the validator set
// signing the incoming/outgoing txs. The fee is measured as a ratio,
// so its value lies between 0 and 1.
string fee = 4 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.moretags) = "yaml:\"fee\"",
(gogoproto.nullable) = false
];
}
penso marked this conversation as resolved.
Show resolved Hide resolved

// AssetID defines a pair of the source chain name and its Osmosis
// representation denoted by denom. AssetID is a primary key for Asset.
message AssetID {
// SourceChain is a source chain name
string source_chain = 1 [ (gogoproto.moretags) = "yaml:\"source_chain\"" ];
// Denom is the Osmosis representation of the SourceChain
string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
}

// Asset is a representation of the asset.
message Asset {
// ID is the asset's primary key
AssetID id = 1
[ (gogoproto.moretags) = "yaml:\"id\"", (gogoproto.nullable) = false ];
// Status is a current status of the asset
AssetStatus status = 2 [ (gogoproto.moretags) = "yaml:\"status\"" ];
// Exponent represents the power of 10 used for coin representation
uint64 exponent = 3 [ (gogoproto.moretags) = "yaml:\"exponent\"" ];
// ExternalConfirmations is a number of the confirmations on the external
// chain needed to consider the transfer confirmed
uint64 external_confirmations = 4
[ (gogoproto.moretags) = "yaml:\"external_confirmations\"" ];
}

enum AssetStatus {
ASSET_STATUS_UNSPECIFIED = 0;
ASSET_STATUS_OK = 1;
ASSET_STATUS_BLOCKED_INBOUND = 2;
ASSET_STATUS_BLOCKED_OUTBOUND = 3;
ASSET_STATUS_BLOCKED_BOTH = 4;
}

// InboundTransfer is a representation of the inbound transfer.
message InboundTransfer {
// ExternalId is a unique ID of the transfer coming from outside.
// Serves the purpose of uniquely identifying the transfer in another chain
// (e.g., this might be the BTC tx hash).
string external_id = 1 [ (gogoproto.moretags) = "yaml:\"external_id\"" ];
// ExternalHeight is the height at which the transfer occurred in the external
// chain
uint64 external_height = 2
[ (gogoproto.moretags) = "yaml:\"external_height\"" ];
// DestAddr is a destination Osmosis address
string dest_addr = 3 [ (gogoproto.moretags) = "yaml:\"dest_addr\"" ];
// AssetID is the ID of the asset being transferred
AssetID asset_id = 4 [
(gogoproto.moretags) = "yaml:\"asset_id\"",
(gogoproto.nullable) = false
];
// Amount of coins to transfer
string amount = 5 [
(gogoproto.moretags) = "yaml:\"amount\"",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
// Voters is a list of validators signed this transfer
repeated string voters = 6 [ (gogoproto.moretags) = "yaml:\"voters\"" ];
// Finalized indicates whether the transfer needs more votes or has
// already accumulated a sufficient number. The finalised flag is set
// to true as soon as length(voters) is greater than or equal to
// the module's param votes_needed.
bool finalized = 7 [ (gogoproto.moretags) = "yaml:\"finalized\"" ];
}
58 changes: 58 additions & 0 deletions proto/osmosis/bridge/v1beta1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
syntax = "proto3";
package osmosis.bridge.v1beta1;

import "gogoproto/gogo.proto";
import "osmosis/bridge/v1beta1/bridge.proto";

option go_package = "github.com/osmosis-labs/osmosis/v24/x/bridge/types";

message EventInboundTransfer {
// Sender is a sender's address
string sender = 1;
// DestAddr is a destination Osmosis address
string dest_addr = 2;
// AssetID is the ID of the asset being transferred
AssetID asset_id = 3 [ (gogoproto.nullable) = false ];
// Amount of coins to transfer
string amount = 4 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

message EventOutboundTransfer {
// Sender is a sender's address
string sender = 1;
// DestAddr is a destination Osmosis address
string dest_addr = 2;
// AssetID is the ID of the asset being transferred
AssetID asset_id = 3 [ (gogoproto.nullable) = false ];
// Amount of coins to transfer
string amount = 4 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

message EventUpdateParams {
repeated string new_signers = 1;
repeated string created_signers = 2;
repeated string deleted_signers = 3;

repeated Asset new_assets = 4 [ (gogoproto.nullable) = false ];
repeated Asset created_assets = 5 [ (gogoproto.nullable) = false ];
repeated Asset deleted_assets = 6 [ (gogoproto.nullable) = false ];

uint64 new_votes_needed = 7;
string new_fee = 8 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];
}

message EventChangeAssetStatus {
string sender = 1;
AssetID asset_id = 2 [ (gogoproto.nullable) = false ];
AssetStatus old_status = 3;
AssetStatus new_status = 4;
}
13 changes: 13 additions & 0 deletions proto/osmosis/bridge/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package osmosis.bridge.v1beta1;

import "gogoproto/gogo.proto";
import "osmosis/bridge/v1beta1/bridge.proto";

option go_package = "github.com/osmosis-labs/osmosis/v24/x/bridge/types";

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

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "osmosis/bridge/v1beta1/bridge.proto";

option go_package = "github.com/osmosis-labs/osmosis/v24/x/bridge/types";

// Query provides defines the gRPC querier service.
service Query {
// Params returns x/bridge module params.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/osmosis/bridge/v1beta1/params";
}

// LastTransferHeight returns the height of the external chain at which
// the last transfer with the given asset was successfully completed
// (finalized).
rpc LastTransferHeight(LastTransferHeightRequest)
returns (LastTransferHeightResponse) {
option (google.api.http).get =
"/osmosis/bridge/v1beta1/last-transfer-height";
}
}

// 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 params = 1 [
(gogoproto.moretags) = "yaml:\"params\"",
(gogoproto.nullable) = false
];
}

// LastTransferHeightRequest is the request type for the
// Query/LastTransferHeight RPC method.
message LastTransferHeightRequest {
AssetID asset_id = 1 [
(gogoproto.moretags) = "yaml:\"asset_id\"",
(gogoproto.nullable) = false
];
}

// LastTransferHeightResponse is the response type for the
// Query/LastTransferHeight RPC method.
message LastTransferHeightResponse {
uint64 last_transfer_height = 1
[ (gogoproto.moretags) = "yaml:\"last_transfer_height\"" ];
}
125 changes: 125 additions & 0 deletions proto/osmosis/bridge/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
syntax = "proto3";
package osmosis.bridge.v1beta1;

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

option go_package = "github.com/osmosis-labs/osmosis/v24/x/bridge/types";

// Msg defines the bridge module's gRPC message service.
service Msg {
// InboundTransfer is used for inbound transfers (<other_chain> -> OSMO).
rpc InboundTransfer(MsgInboundTransfer) returns (MsgInboundTransferResponse);

// OutboundTransfer is used for outbound transfers (OSMO -> <other_chain>).
rpc OutboundTransfer(MsgOutboundTransfer)
returns (MsgOutboundTransferResponse);

// UpdateParams is used for updating module params.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);

// ChangeAssetStatus will change the provided asset's status.
rpc ChangeAssetStatus(MsgChangeAssetStatus)
returns (MsgChangeAssetStatusResponse);
}

// MsgInboundTransfer defines the message structure for the InboundTransfer gRPC
// service method. It allows a sender to perform an inbound cross-chain
// transfer, i.e., to transfer their tokens from the source chain to Osmosis and
// get the equivalent amount of the corresponding token (specified in subdenom)
// on Osmosis in return. The tokens are minted through the x/tokenfactory module
// to the destination address.
message MsgInboundTransfer {
option (amino.name) = "osmosis/bridge/inbound-transfer";

// ExternalId is a unique ID of the transfer coming from outside.
// Serves the purpose of uniquely identifying the transfer in another chain
// (e.g., this might be the BTC tx hash)
string external_id = 1 [ (gogoproto.moretags) = "yaml:\"external_id\"" ];
// ExternalHeight is the height at which the transfer occurred in the external
// chain
uint64 external_height = 2
[ (gogoproto.moretags) = "yaml:\"external_height\"" ];
// Sender is a sender's address
string sender = 3 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// DestAddr is a destination Osmosis address
string dest_addr = 4 [ (gogoproto.moretags) = "yaml:\"dest_addr\"" ];
// AssetID is the ID of the asset being transferred
AssetID asset_id = 5 [
(gogoproto.moretags) = "yaml:\"asset_id\"",
(gogoproto.nullable) = false
];
// Amount of coins to transfer
string amount = 6 [
(gogoproto.moretags) = "yaml:\"amount\"",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

message MsgInboundTransferResponse {}

// MsgOutboundTransfer defines the message structure for the OutboundTransfer
// gRPC service method. It allows a sender to perform an outbound cross-chain
// transfer, i.e., to transfer their tokens from Osmosis to the destination
// chain. The tokens are burned through the x/tokenfactory module from the
// sender's address.
message MsgOutboundTransfer {
option (amino.name) = "osmosis/bridge/outbound-transfer";

// Sender is a sender's Osmosis address
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// DestAddr is a destination address
string dest_addr = 2 [ (gogoproto.moretags) = "yaml:\"dest_addr\"" ];
// AssetID is the ID of the asset being transferred
AssetID asset_id = 3 [
(gogoproto.moretags) = "yaml:\"asset_id\"",
(gogoproto.nullable) = false
];
// Amount of coins to transfer
string amount = 4 [
(gogoproto.moretags) = "yaml:\"amount\"",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

message MsgOutboundTransferResponse {}

// MsgUpdateParams allows to update module params. It contains UpdateParams
// instead of just Params to forbid status updating using this method.
// All new assets introduced with this method have ASSET_STATUS_BLOCKED_BOTH
// status by default.
message MsgUpdateParams {
option (amino.name) = "osmosis/bridge/update-params";

// Sender is a sender's address
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// NewParams should be fully populated
Params new_params = 2 [
(gogoproto.moretags) = "yaml:\"new_params\"",
(gogoproto.nullable) = false
];
}

message MsgUpdateParamsResponse {}

// MsgChangeAssetStatus changes the status of the provided asset.
message MsgChangeAssetStatus {
option (amino.name) = "osmosis/bridge/change-asset-status";

// Sender is a sender's address
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// AssetID is the ID of the asset to update.
// The asset should be known; otherwise, the method will failed.
AssetID asset_id = 2 [
(gogoproto.moretags) = "yaml:\"asset_id\"",
(gogoproto.nullable) = false
];
// NewStatus is a new asset's status.
AssetStatus new_status = 3 [ (gogoproto.moretags) = "yaml:\"new_status\"" ];
}

message MsgChangeAssetStatusResponse {}
Loading