Skip to content

Commit

Permalink
feat(ampd): integrate ampd queued broadcaster with the axelar batch r…
Browse files Browse the repository at this point in the history
…equest (#554)
  • Loading branch information
fish-sammy authored Aug 10, 2024
1 parent 9781e1c commit 8644f88
Show file tree
Hide file tree
Showing 202 changed files with 15,999 additions and 202 deletions.
8 changes: 8 additions & 0 deletions ampd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.build_client(true)
.compile(&["proto/ampd.proto"], &["proto"])?;

tonic_build::configure()
.build_server(false)
.build_client(false)
.compile(
&["proto/axelar/auxiliary/v1beta1/tx.proto"],
&["proto", "proto/third_party"],
)?;

Ok(())
}
11 changes: 11 additions & 0 deletions ampd/proto/axelar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Axelar Protobufs

This folder defines protobufs used by Axelar specific Cosmos SDK msg, event, and query types.

## REST API

The REST API (LCD) gets generated automatically from the gRPC service definitions.
The request/response types are defined in `query.proto` for the respective modules, and the query is defined in the `service.proto`.

Note: The request types cannot make use of custom types encoded as bytes as that would be awkward
for REST-based calls. Instead, primitive types such as string is used (for e.g. when specifying addresses, instead of using sdk.AccAddress).
12 changes: 12 additions & 0 deletions ampd/proto/axelar/auxiliary/v1beta1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package axelar.auxiliary.v1beta1;

option go_package = "github.com/axelarnetwork/axelar-core/x/auxiliary/types";
option (gogoproto.messagename_all) = true;

import "gogoproto/gogo.proto";

message BatchedMessageFailed {
int32 index = 1;
string error = 2;
}
11 changes: 11 additions & 0 deletions ampd/proto/axelar/auxiliary/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";
package axelar.auxiliary.v1beta1;

option go_package = "github.com/axelarnetwork/axelar-core/x/auxiliary/types";

import "gogoproto/gogo.proto";

option (gogoproto.goproto_getters_all) = false;

// GenesisState represents the genesis state
message GenesisState {}
20 changes: 20 additions & 0 deletions ampd/proto/axelar/auxiliary/v1beta1/service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";
package axelar.auxiliary.v1beta1;

option go_package = "github.com/axelarnetwork/axelar-core/x/auxiliary/types";

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "axelar/auxiliary/v1beta1/tx.proto";

option (gogoproto.goproto_registration) = true;

// Msg defines the nexus Msg service.
service MsgService {
rpc Batch(BatchRequest) returns (BatchResponse) {
option (google.api.http) = {
post : "/axelar/auxiliary/batch"
body : "*"
};
}
}
30 changes: 30 additions & 0 deletions ampd/proto/axelar/auxiliary/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
syntax = "proto3";
package axelar.auxiliary.v1beta1;

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

import "axelar/permission/exported/v1beta1/types.proto";
import "cosmos/base/abci/v1beta1/abci.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/axelarnetwork/axelar-core/x/auxiliary/types";

message BatchRequest {
option (permission.exported.v1beta1.permission_role) = ROLE_UNRESTRICTED;

bytes sender = 1 [ (gogoproto.casttype) =
"github.com/cosmos/cosmos-sdk/types.AccAddress" ];
repeated google.protobuf.Any messages = 2
[ (gogoproto.nullable) = false, (cosmos_proto.accepts_interface) = "cosmos.base.v1beta1.Msg" ];
}

message BatchResponse {
message Response {
oneof res {
cosmos.base.abci.v1beta1.Result result = 1;
string err = 2;
}
}
repeated Response responses = 1 [ (gogoproto.nullable) = false ];
}
131 changes: 131 additions & 0 deletions ampd/proto/axelar/axelarnet/v1beta1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
syntax = "proto3";
package axelar.axelarnet.v1beta1;

option go_package = "github.com/axelarnetwork/axelar-core/x/axelarnet/types";

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

option (gogoproto.messagename_all) = true;

message IBCTransferSent {
uint64 id = 1 [
(gogoproto.customname) = "ID",
(gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.TransferID"
];
string receipient = 2 [ deprecated = true ];
cosmos.base.v1beta1.Coin asset = 3 [ (gogoproto.nullable) = false ];
uint64 sequence = 4;
string port_id = 5 [ (gogoproto.customname) = "PortID" ];
string channel_id = 6 [ (gogoproto.customname) = "ChannelID" ];
string recipient = 7;
}

message IBCTransferCompleted {
uint64 id = 1 [
(gogoproto.customname) = "ID",
(gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.TransferID"
];
uint64 sequence = 2;
string port_id = 3 [ (gogoproto.customname) = "PortID" ];
string channel_id = 4 [ (gogoproto.customname) = "ChannelID" ];
}

message IBCTransferFailed {
uint64 id = 1 [
(gogoproto.customname) = "ID",
(gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.TransferID"
];
uint64 sequence = 2;
string port_id = 3 [ (gogoproto.customname) = "PortID" ];
string channel_id = 4 [ (gogoproto.customname) = "ChannelID" ];
}

message IBCTransferRetried {
uint64 id = 1 [
(gogoproto.customname) = "ID",
(gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.TransferID"
];
string receipient = 2 [ deprecated = true ];
cosmos.base.v1beta1.Coin asset = 3 [ (gogoproto.nullable) = false ];
uint64 sequence = 4;
string port_id = 5 [ (gogoproto.customname) = "PortID" ];
string channel_id = 6 [ (gogoproto.customname) = "ChannelID" ];
string recipient = 7;
}

message AxelarTransferCompleted {
uint64 id = 1 [
(gogoproto.customname) = "ID",
(gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.TransferID"
];
string receipient = 2 [ deprecated = true ];
cosmos.base.v1beta1.Coin asset = 3 [ (gogoproto.nullable) = false ];
string recipient = 4;
}

message FeeCollected {
bytes collector = 1 [ (gogoproto.casttype) =
"github.com/cosmos/cosmos-sdk/types.AccAddress" ];
cosmos.base.v1beta1.Coin fee = 2 [ (gogoproto.nullable) = false ];
}

message FeePaid {
string message_id = 1 [ (gogoproto.customname) = "MessageID" ];
bytes recipient = 2 [ (gogoproto.casttype) =
"github.com/cosmos/cosmos-sdk/types.AccAddress" ];
cosmos.base.v1beta1.Coin fee = 3 [ (gogoproto.nullable) = false ];
string refund_recipient = 4;
string asset = 5; // registered asset name in nexus
}

message ContractCallSubmitted {
string message_id = 1 [ (gogoproto.customname) = "MessageID" ];
string sender = 2;
string source_chain = 3
[ (gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ];
string destination_chain = 4
[ (gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ];
string contract_address = 5;
bytes payload = 6;
bytes payload_hash = 7;
}

message ContractCallWithTokenSubmitted {
string message_id = 1 [ (gogoproto.customname) = "MessageID" ];
string sender = 2;
string source_chain = 3
[ (gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ];
string destination_chain = 4
[ (gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ];
string contract_address = 5;
bytes payload = 6;
bytes payload_hash = 7;
cosmos.base.v1beta1.Coin asset = 8 [ (gogoproto.nullable) = false ];
}

message TokenSent {
uint64 transfer_id = 1 [
(gogoproto.customname) = "TransferID",
(gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.TransferID"
];
string sender = 2;
string source_chain = 3
[ (gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ];
string destination_chain = 4
[ (gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ];
string destination_address = 5;
cosmos.base.v1beta1.Coin asset = 6 [ (gogoproto.nullable) = false ];
}
27 changes: 27 additions & 0 deletions ampd/proto/axelar/axelarnet/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax = "proto3";
package axelar.axelarnet.v1beta1;
option go_package = "github.com/axelarnetwork/axelar-core/x/axelarnet/types";

import "gogoproto/gogo.proto";
import "axelar/axelarnet/v1beta1/params.proto";
import "axelar/axelarnet/v1beta1/types.proto";
import "axelar/utils/v1beta1/queuer.proto";

option (gogoproto.goproto_getters_all) = false;

message GenesisState {
option (gogoproto.stable_marshaler) = true;

Params params = 1 [ (gogoproto.nullable) = false ];
bytes collector_address = 2
[ (gogoproto.casttype) =
"github.com/cosmos/cosmos-sdk/types.AccAddress" ];
repeated CosmosChain chains = 3 [ (gogoproto.nullable) = false ];
reserved 4; // pending_transfers was removed in v0.20
utils.v1beta1.QueueState transfer_queue = 5 [ (gogoproto.nullable) = false ];
reserved 6; // failed_transfers was removed in v0.22
repeated IBCTransfer ibc_transfers = 7
[ (gogoproto.nullable) = false, (gogoproto.customname) = "IBCTransfers" ];
map<string, uint64> seq_id_mapping = 8
[ (gogoproto.nullable) = false, (gogoproto.customname) = "SeqIDMapping" ];
}
33 changes: 33 additions & 0 deletions ampd/proto/axelar/axelarnet/v1beta1/params.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";
package axelar.axelarnet.v1beta1;
option go_package = "github.com/axelarnetwork/axelar-core/x/axelarnet/types";

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

option (gogoproto.goproto_getters_all) = false;

// Params represent the genesis parameters for the module
message Params {
// IBC packet route timeout window
uint64 route_timeout_window = 1;
reserved 2; // transaction_fee_rate was removed in v0.15
uint64 transfer_limit = 3;
uint64 end_blocker_limit = 4;
repeated CallContractProposalMinDeposit call_contracts_proposal_min_deposits =
5 [
(gogoproto.castrepeated) = "CallContractProposalMinDeposits",
(gogoproto.nullable) = false
];
}

message CallContractProposalMinDeposit {
string chain = 1
[ (gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ];
string contract_address = 2;
repeated cosmos.base.v1beta1.Coin min_deposits = 3 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false
];
}
29 changes: 29 additions & 0 deletions ampd/proto/axelar/axelarnet/v1beta1/proposal.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";

package axelar.axelarnet.v1beta1;

import "gogoproto/gogo.proto";
import "axelar/nexus/exported/v1beta1/types.proto";

option go_package = "github.com/axelarnetwork/axelar-core/x/axelarnet/types";
option (gogoproto.goproto_getters_all) = false;

// CallContractsProposal is a gov Content type for calling contracts on other
// chains
message CallContractsProposal {
option (gogoproto.goproto_stringer) = false;

string title = 1;
string description = 2;
repeated ContractCall contract_calls = 3 [ (gogoproto.nullable) = false ];
}

message ContractCall {
option (gogoproto.goproto_stringer) = false;

string chain = 1
[ (gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ];
string contract_address = 2;
bytes payload = 3;
}
39 changes: 39 additions & 0 deletions ampd/proto/axelar/axelarnet/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
syntax = "proto3";
package axelar.axelarnet.v1beta1;

option go_package = "github.com/axelarnetwork/axelar-core/x/axelarnet/types";

import "gogoproto/gogo.proto";
import "axelar/axelarnet/v1beta1/types.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "axelar/nexus/v1beta1/query.proto";
import "axelar/axelarnet/v1beta1/params.proto";

option (gogoproto.goproto_getters_all) = false;

message PendingIBCTransferCountRequest {}

message PendingIBCTransferCountResponse {
map<string, uint32> transfers_by_chain = 1 [ (gogoproto.nullable) = false ];
}

// ParamsRequest represents a message that queries the params
message ParamsRequest {}

message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; }

// IBCPathRequest represents a message that queries the IBC path registered for
// a given chain
message IBCPathRequest { string chain = 1; }

message IBCPathResponse { string ibc_path = 1 [ (gogoproto.customname) = "IBCPath" ]; }

// ChainByIBCPathRequest represents a message that queries the chain that an IBC
// path is registered to
message ChainByIBCPathRequest { string ibc_path = 1; }

message ChainByIBCPathResponse {
string chain = 1
[ (gogoproto.casttype) =
"github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ];
}
Loading

0 comments on commit 8644f88

Please sign in to comment.