forked from dymensionxyz/dymint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(da): added interchain-da proto contracts (dymensionxyz#932)
- Loading branch information
Showing
13 changed files
with
3,235 additions
and
4 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
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
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,43 @@ | ||
syntax = "proto3"; | ||
package cosmos.base.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/types"; | ||
option (gogoproto.goproto_stringer_all) = false; | ||
option (gogoproto.stringer_all) = false; | ||
|
||
// Coin defines a token with a denomination and an amount. | ||
// | ||
// NOTE: The amount field is an Int which implements the custom method | ||
// signatures required by gogoproto. | ||
message Coin { | ||
option (gogoproto.equal) = true; | ||
|
||
string denom = 1; | ||
string amount = 2 | ||
[(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; | ||
} | ||
|
||
// DecCoin defines a token with a denomination and a decimal amount. | ||
// | ||
// NOTE: The amount field is an Dec which implements the custom method | ||
// signatures required by gogoproto. | ||
message DecCoin { | ||
option (gogoproto.equal) = true; | ||
|
||
string denom = 1; | ||
string amount = 2 | ||
[(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; | ||
} | ||
|
||
// IntProto defines a Protobuf wrapper around an Int object. | ||
message IntProto { | ||
string int = 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; | ||
} | ||
|
||
// DecProto defines a Protobuf wrapper around a Dec object. | ||
message DecProto { | ||
string dec = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
syntax = "proto3"; | ||
|
||
package cosmos.msg.v1; | ||
|
||
import "google/protobuf/descriptor.proto"; | ||
|
||
// TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated. | ||
// We need this right now because gogoproto codegen needs to import the extension. | ||
option go_package = "github.com/cosmos/cosmos-sdk/types/msgservice"; | ||
|
||
extend google.protobuf.MessageOptions { | ||
// signer must be used in cosmos messages in order | ||
// to signal to external clients which fields in a | ||
// given cosmos message must be filled with signer | ||
// information (address). | ||
// The field must be the protobuf name of the message | ||
// field extended with this MessageOption. | ||
// The field must either be of string kind, or of message | ||
// kind in case the signer information is contained within | ||
// a message inside the cosmos message. | ||
repeated string signer = 11110000; | ||
} |
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,45 @@ | ||
// This file is a modified copy of the interchain-da module proto contract. Source: | ||
// https://github.com/dymensionxyz/interchain-da/blob/main/proto/dymension/interchain_da/da.proto. | ||
|
||
syntax = "proto3"; | ||
package dymension.interchain_da; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "types/cosmos/base/v1beta1/coin.proto"; | ||
import "types/tendermint/crypto/proof.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymint/types/pb/interchain_da"; | ||
|
||
message Params { | ||
// CostPerByte defines the coin cost to store each byte of the blob. This | ||
// allows for multidimensional gas pricing on different resources of the | ||
// network. | ||
cosmos.base.v1beta1.Coin cost_per_byte = 1 [ (gogoproto.nullable) = false ]; | ||
// MaxBlobSize is the hard cap of how many bytes a blob can be. | ||
uint32 max_blob_size = 2; | ||
// DisputePeriod is the number of blocks the blob is stored for. In the | ||
// current implementation, the dispute period equals the store time. Meaning, | ||
// a dispute can't be submitted after the dispute period is over because both | ||
// the blob and the metadata are pruned. | ||
uint64 dispute_period = 3; | ||
} | ||
|
||
// BlobMetadata holds blob metadata, which is stored in the state. | ||
message BlobMetadata { | ||
// BlobHash is the hash of the submitted blob. | ||
string blob_hash = 1; | ||
} | ||
|
||
// Commitment defines the commitment type used by the InterchainDALayer. | ||
message Commitment { | ||
// ClientID identifies the client_id of the DA chain where the blob was posted. | ||
string client_id = 1; | ||
// BlobHeight identifies the height at which the blob was posted. | ||
uint64 blob_height = 2; | ||
// BlobHash is the hash of the submitted blob. | ||
string blob_hash = 3; | ||
// BlobID is the unique ID of the blob. | ||
uint64 blob_id = 4; | ||
// MerkleProof is a merkle inclusion proof of the blob. | ||
tendermint.crypto.ProofOps merkle_proof = 5; | ||
} |
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,42 @@ | ||
// This file is a modified copy of the interchain-da module proto contract. Source: | ||
// https://github.com/dymensionxyz/interchain-da/blob/main/proto/dymension/interchain_da/query.proto. | ||
|
||
syntax = "proto3"; | ||
package dymension.interchain_da; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "types/interchain_da/da.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymint/types/pb/interchain_da"; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// Param queries the parameters of the module. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {} | ||
|
||
// Blob queries the blob by the provided BlobID. | ||
rpc Blob(QueryBlobRequest) returns (QueryBlobResponse) {} | ||
} | ||
|
||
// 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.nullable) = false ]; | ||
} | ||
|
||
// QueryBlobRequest is the request type for the Query/Blob RPC method. | ||
message QueryBlobRequest { | ||
// BlobID is a unique sequential ID of the blob. | ||
uint64 blob_id = 1; | ||
} | ||
|
||
// QueryBlobResponse is the response type for the Query/Blob RPC method. | ||
message QueryBlobResponse { | ||
// BlobMetadata stores stateful blob metadata. | ||
BlobMetadata blob_metadata = 1 [ (gogoproto.nullable) = false ]; | ||
// Blob is the actual blob. May be empty if the dispute period is over. | ||
bytes blob = 2; | ||
} |
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,44 @@ | ||
// This file is a modified copy of the interchain-da module proto contract. Source: | ||
// https://github.com/dymensionxyz/interchain-da/blob/main/proto/dymension/interchain_da/tx.proto. | ||
// It contains only message definitions but without the Msg service. | ||
|
||
syntax = "proto3"; | ||
package dymension.interchain_da; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "types/cosmos/base/v1beta1/coin.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "types/cosmos/msg/v1/msg.proto"; | ||
import "types/interchain_da/da.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymint/types/pb/interchain_da"; | ||
|
||
// MsgUpdateParams allows to update module params. | ||
message MsgUpdateParams { | ||
// Authority is the address that controls the module. | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
|
||
// NewParams should be fully populated. | ||
Params new_params = 2 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message MsgUpdateParamsResponse {} | ||
|
||
// MsgSubmitBlob submits a new blob to the host chain. | ||
message MsgSubmitBlob { | ||
// Creator is the bech32 encoded address of the sequencer sending the update. | ||
option (cosmos.msg.v1.signer) = "creator"; | ||
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
// Blob that is sent. | ||
bytes blob = 2; | ||
// Fees defines the storage fees sent. | ||
cosmos.base.v1beta1.Coin fees = 3 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message MsgSubmitBlobResponse { | ||
// BlobID is a unique sequential ID of the submitted blob. | ||
uint64 blob_id = 1; | ||
// BlobHash is the hash of the submitted blob. | ||
string blob_hash = 2; | ||
} |
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,112 @@ | ||
syntax = "proto3"; | ||
package cosmos_proto; | ||
|
||
import "google/protobuf/descriptor.proto"; | ||
|
||
option go_package = "github.com/cosmos/cosmos-proto;cosmos_proto"; | ||
|
||
extend google.protobuf.MethodOptions { | ||
|
||
// method_added_in is used to indicate from which version the method was added. | ||
string method_added_in = 93001; | ||
} | ||
|
||
extend google.protobuf.MessageOptions { | ||
|
||
// implements_interface is used to indicate the type name of the interface | ||
// that a message implements so that it can be used in google.protobuf.Any | ||
// fields that accept that interface. A message can implement multiple | ||
// interfaces. Interfaces should be declared using a declare_interface | ||
// file option. | ||
repeated string implements_interface = 93001; | ||
|
||
// message_added_in is used to indicate from which version the message was added. | ||
string message_added_in = 93002; | ||
} | ||
|
||
extend google.protobuf.FieldOptions { | ||
|
||
// accepts_interface is used to annotate that a google.protobuf.Any | ||
// field accepts messages that implement the specified interface. | ||
// Interfaces should be declared using a declare_interface file option. | ||
string accepts_interface = 93001; | ||
|
||
// scalar is used to indicate that this field follows the formatting defined | ||
// by the named scalar which should be declared with declare_scalar. Code | ||
// generators may choose to use this information to map this field to a | ||
// language-specific type representing the scalar. | ||
string scalar = 93002; | ||
|
||
// field_added_in is used to indicate from which version the field was added. | ||
string field_added_in = 93003; | ||
} | ||
|
||
extend google.protobuf.FileOptions { | ||
|
||
// declare_interface declares an interface type to be used with | ||
// accepts_interface and implements_interface. Interface names are | ||
// expected to follow the following convention such that their declaration | ||
// can be discovered by tools: for a given interface type a.b.C, it is | ||
// expected that the declaration will be found in a protobuf file named | ||
// a/b/interfaces.proto in the file descriptor set. | ||
repeated InterfaceDescriptor declare_interface = 793021; | ||
|
||
// declare_scalar declares a scalar type to be used with | ||
// the scalar field option. Scalar names are | ||
// expected to follow the following convention such that their declaration | ||
// can be discovered by tools: for a given scalar type a.b.C, it is | ||
// expected that the declaration will be found in a protobuf file named | ||
// a/b/scalars.proto in the file descriptor set. | ||
repeated ScalarDescriptor declare_scalar = 793022; | ||
|
||
// file_added_in is used to indicate from which the version the file was added. | ||
string file_added_in = 793023; | ||
} | ||
|
||
// InterfaceDescriptor describes an interface type to be used with | ||
// accepts_interface and implements_interface and declared by declare_interface. | ||
message InterfaceDescriptor { | ||
|
||
// name is the name of the interface. It should be a short-name (without | ||
// a period) such that the fully qualified name of the interface will be | ||
// package.name, ex. for the package a.b and interface named C, the | ||
// fully-qualified name will be a.b.C. | ||
string name = 1; | ||
|
||
// description is a human-readable description of the interface and its | ||
// purpose. | ||
string description = 2; | ||
} | ||
|
||
// ScalarDescriptor describes an scalar type to be used with | ||
// the scalar field option and declared by declare_scalar. | ||
// Scalars extend simple protobuf built-in types with additional | ||
// syntax and semantics, for instance to represent big integers. | ||
// Scalars should ideally define an encoding such that there is only one | ||
// valid syntactical representation for a given semantic meaning, | ||
// i.e. the encoding should be deterministic. | ||
message ScalarDescriptor { | ||
|
||
// name is the name of the scalar. It should be a short-name (without | ||
// a period) such that the fully qualified name of the scalar will be | ||
// package.name, ex. for the package a.b and scalar named C, the | ||
// fully-qualified name will be a.b.C. | ||
string name = 1; | ||
|
||
// description is a human-readable description of the scalar and its | ||
// encoding format. For instance a big integer or decimal scalar should | ||
// specify precisely the expected encoding format. | ||
string description = 2; | ||
|
||
// field_type is the type of field with which this scalar can be used. | ||
// Scalars can be used with one and only one type of field so that | ||
// encoding standards and simple and clear. Currently only string and | ||
// bytes fields are supported for scalars. | ||
repeated ScalarType field_type = 3; | ||
} | ||
|
||
enum ScalarType { | ||
SCALAR_TYPE_UNSPECIFIED = 0; | ||
SCALAR_TYPE_STRING = 1; | ||
SCALAR_TYPE_BYTES = 2; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.