Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
45 changes: 40 additions & 5 deletions proto/cross/core/atomic/simple/AtomicSimple.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ syntax = "proto3";
import "gogoproto/gogo.proto";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built with reference to the proto of the cross repository

import "google/protobuf/any.proto";
import "cross/core/auth/Auth.proto";
import "cross/core/tx/Tx.proto";
import "cross/core/xcc/XCC.proto";

message PacketData {
option (gogoproto.goproto_getters) = false;
Expand All @@ -27,7 +29,7 @@ message HeaderField {
}

message PacketDataCall {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;

message ResolvedContractTransaction {
option (gogoproto.equal) = false;
Expand All @@ -44,11 +46,11 @@ message PacketDataCall {
}

message PacketAcknowledgementCall {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;

enum CommitStatus {
option (gogoproto.goproto_enum_prefix) = false;

COMMIT_STATUS_UNKNOWN = 0;
COMMIT_STATUS_OK = 1;
COMMIT_STATUS_FAILED = 2;
Expand All @@ -57,6 +59,39 @@ message PacketAcknowledgementCall {
CommitStatus status = 1;
}

message ReturnValue {
bytes value = 1;
message QueryCoordinatorStateRequest {
bytes tx_id = 1 [(gogoproto.casttype) = "github.com/datachainlab/cross/x/core/types.TxID"];
}

message QueryCoordinatorStateResponse {
CoordinatorState coodinator_state = 1 [(gogoproto.nullable) = false];
}

message CoordinatorState {
option (gogoproto.equal) = false;

Tx.CommitProtocol commit_protocol = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original proto, the field was named type, but since type is a reserved word in Solidity, replaced it with commit_protocol.

repeated ChannelInfo channels = 2 [(gogoproto.nullable) = false];

enum CoordinatorPhase {
option (gogoproto.goproto_enum_prefix) = false;

COORDINATOR_PHASE_UNKNOWN = 0;
COORDINATOR_PHASE_PREPARE = 1;
COORDINATOR_PHASE_COMMIT = 2;
}

CoordinatorPhase phase = 3;

enum CoordinatorDecision {
option (gogoproto.goproto_enum_prefix) = false;

COORDINATOR_DECISION_UNKNOWN = 0;
COORDINATOR_DECISION_COMMIT = 1;
COORDINATOR_DECISION_ABORT = 2;
}

CoordinatorDecision decision = 4;
repeated uint32 confirmed_txs = 5 [(gogoproto.casttype) = "github.com/datachainlab/cross/x/core/types.TxIndex"];
repeated uint32 acks = 6 [(gogoproto.casttype) = "github.com/datachainlab/cross/x/core/types.TxIndex"];
}
11 changes: 11 additions & 0 deletions proto/cross/core/xcc/XCC.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built with reference to the proto of the cross repository


import "gogoproto/gogo.proto";

option go_package = "github.com/datachainlab/cross/x/core/xcc/types";
option (gogoproto.goproto_getters_all) = false;

message ChannelInfo {
string port = 1;
string channel = 2;
}
14 changes: 14 additions & 0 deletions src/core/ICoordinator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;

import {
QueryCoordinatorStateRequest,
QueryCoordinatorStateResponse
} from "src/proto/cross/core/atomic/simple/AtomicSimple.sol";

interface ICoordinator {
function coordinatorState(QueryCoordinatorStateRequest.Data calldata req)
external
view
returns (QueryCoordinatorStateResponse.Data memory);
}
Loading