-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core-api): add weaver protocol buffer definitions #1523
Adding the .proto definitions from here as discussed earlier with @VRamakrishna To-do: I skipped the fabric driver proto due to an error on account of the Fabric peer definitions not being present (unresolved import error). Fixes #1523 Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
- Loading branch information
Showing
31 changed files
with
3,566 additions
and
1 deletion.
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
8 changes: 8 additions & 0 deletions
8
packages/cactus-core-api/src/main/proto/weaver/common/protos/README.md
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,8 @@ | ||
<!-- | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: CC-BY-4.0 | ||
--> | ||
## protos | ||
|
||
This repository contains the grpc service and protocol buffer definitions for the relay, drivers and other interop modules. protos |
21 changes: 21 additions & 0 deletions
21
packages/cactus-core-api/src/main/proto/weaver/common/protos/common/access_control.proto
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,21 @@ | ||
syntax = "proto3"; | ||
|
||
package common.access_control; | ||
|
||
option java_package = "com.weaver.protos.common.access_control"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/common"; | ||
|
||
// AccessControlPolicy specifies a set of data that can be accessed by some | ||
// SecurityGroup | ||
message AccessControlPolicy { | ||
string securityDomain = 1; | ||
repeated Rule rules = 2; | ||
} | ||
|
||
// Rule represents a single data access rule for the AccessControlPolicy | ||
message Rule { | ||
string principal = 1; | ||
string principalType = 2; | ||
string resource = 3; | ||
bool read = 4; | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/cactus-core-api/src/main/proto/weaver/common/protos/common/ack.proto
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,21 @@ | ||
syntax = "proto3"; | ||
|
||
package common.ack; | ||
|
||
option java_package = "com.weaver.protos.common.ack"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/common"; | ||
|
||
// This message respresents "ACKs" sent between relay-relay, | ||
// relay-driver and relay-network | ||
message Ack { | ||
enum STATUS { | ||
OK = 0; | ||
ERROR = 1; | ||
}; | ||
STATUS status = 2; | ||
string request_id = 3; | ||
// an error can have an associated string | ||
// this is the best way to represent this in protobuf | ||
string message = 4; | ||
} | ||
|
62 changes: 62 additions & 0 deletions
62
packages/cactus-core-api/src/main/proto/weaver/common/protos/common/asset_locks.proto
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,62 @@ | ||
syntax = "proto3"; | ||
|
||
package common.asset_locks; | ||
|
||
option java_package = "com.weaver.protos.common.asset_locks"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/common"; | ||
|
||
enum LockMechanism { | ||
HTLC = 0; | ||
} | ||
|
||
message AssetLock { | ||
LockMechanism lockMechanism = 1; | ||
bytes lockInfo = 2; | ||
} | ||
|
||
message AssetClaim { | ||
LockMechanism lockMechanism = 1; | ||
bytes claimInfo = 2; | ||
} | ||
|
||
message AssetLockHTLC { | ||
bytes hashBase64 = 1; | ||
uint64 expiryTimeSecs = 2; | ||
enum TimeSpec { | ||
EPOCH = 0; | ||
DURATION = 1; | ||
} | ||
TimeSpec timeSpec = 3; | ||
} | ||
|
||
message AssetClaimHTLC { | ||
bytes hashPreimageBase64 = 1; | ||
} | ||
|
||
message AssetExchangeAgreement { | ||
string type = 1; | ||
string id = 2; | ||
string locker = 3; | ||
string recipient = 4; | ||
} | ||
|
||
message FungibleAssetExchangeAgreement { | ||
string type = 1; | ||
uint64 numUnits = 2; | ||
string locker = 3; | ||
string recipient = 4; | ||
} | ||
|
||
message AssetContractHTLC { | ||
string contractId = 1; | ||
AssetExchangeAgreement agreement = 2; | ||
AssetLockHTLC lock = 3; | ||
AssetClaimHTLC claim = 4; | ||
} | ||
|
||
message FungibleAssetContractHTLC { | ||
string contractId = 1; | ||
FungibleAssetExchangeAgreement agreement = 2; | ||
AssetLockHTLC lock = 3; | ||
AssetClaimHTLC claim = 4; | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/cactus-core-api/src/main/proto/weaver/common/protos/common/interop_payload.proto
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,11 @@ | ||
syntax = "proto3"; | ||
|
||
package common.interop_payload; | ||
|
||
option java_package = "com.weaver.protos.common.interop_payload"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/common"; | ||
|
||
message InteropPayload { | ||
bytes payload = 1; | ||
string address = 2; | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/cactus-core-api/src/main/proto/weaver/common/protos/common/membership.proto
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,21 @@ | ||
syntax = "proto3"; | ||
|
||
package common.membership; | ||
|
||
option java_package = "com.weaver.protos.common.membership"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/common"; | ||
|
||
// Membership captures the members of an external entity such as a thing, | ||
// person, organization or groups of entities such as networks | ||
message Membership { | ||
string securityDomain = 1; | ||
map<string, Member> members = 2; | ||
} | ||
|
||
// Member of a security group is represented by a set of public keys, | ||
// certificates or certificate authorities | ||
message Member { | ||
string value = 1; | ||
string type = 2; | ||
repeated string chain = 3; | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/cactus-core-api/src/main/proto/weaver/common/protos/common/proofs.proto
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,12 @@ | ||
syntax = "proto3"; | ||
|
||
package common.proofs; | ||
option java_package = "com.weaver.protos.common.proofs"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/common"; | ||
|
||
message Proof { | ||
string signature = 1; | ||
string certificate = 2; | ||
} | ||
|
||
message Proofs { repeated Proof proofs = 1; } |
18 changes: 18 additions & 0 deletions
18
packages/cactus-core-api/src/main/proto/weaver/common/protos/common/query.proto
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,18 @@ | ||
syntax = "proto3"; | ||
|
||
package common.query; | ||
option java_package = "com.weaver.protos.common.query"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/common"; | ||
|
||
// the payload to define the data that is being requested | ||
message Query { | ||
repeated string policy = 1; | ||
string address = 2; | ||
string requesting_relay = 3; | ||
string requesting_network = 4; | ||
string certificate = 5; | ||
string requestor_signature = 6; | ||
string nonce = 7; | ||
string request_id = 8; | ||
string requesting_org = 9; | ||
} |
62 changes: 62 additions & 0 deletions
62
packages/cactus-core-api/src/main/proto/weaver/common/protos/common/state.proto
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,62 @@ | ||
syntax = "proto3"; | ||
|
||
package common.state; | ||
option java_package = "com.weaver.protos.common.state"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/common"; | ||
|
||
// Metadata for a View | ||
message Meta { | ||
enum Protocol { | ||
BITCOIN = 0; | ||
ETHEREUM = 1; | ||
FABRIC = 3; | ||
CORDA = 4; | ||
} | ||
// Underlying distributed ledger protocol. | ||
Protocol protocol = 1; | ||
// What notion of time? | ||
// If the observer and network are synchronizing on a global clock | ||
// there won't be a need to distinguish between static and dynamic views. | ||
string timestamp = 2; | ||
// Notorization, SPV, ZKP, etc. Possibly enum | ||
string proof_type = 3; | ||
// The data field's serialization format (e.g. JSON, XML, Protobuf) | ||
string serialization_format = 4; | ||
} | ||
|
||
message View { | ||
Meta meta = 1; | ||
// Represents the data playload of this view. | ||
// The representation of Fabric, Corda etc will be captured elsewhere. | ||
// For some protocols, like Bitcoin, the structure of an SPV proof is well known. | ||
bytes data = 2; | ||
} | ||
|
||
// View represents the response from a remote network | ||
message ViewPayload { | ||
string request_id = 1; | ||
oneof state { | ||
View view = 2; | ||
string error = 3; | ||
}; | ||
} | ||
|
||
// the payload that is used for the communication between the requesting relay | ||
// and its network | ||
message RequestState { | ||
enum STATUS { | ||
// pending ACK from remote relay | ||
PENDING_ACK = 0; | ||
// Received ACK, waiting for data to be sent from remote relay | ||
PENDING = 1; | ||
ERROR = 2; | ||
COMPLETED = 3; | ||
}; | ||
string request_id = 1; | ||
STATUS status = 2; | ||
oneof state { | ||
View view = 3; | ||
string error = 4; | ||
}; | ||
} | ||
|
29 changes: 29 additions & 0 deletions
29
...ages/cactus-core-api/src/main/proto/weaver/common/protos/common/verification_policy.proto
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,29 @@ | ||
syntax = "proto3"; | ||
|
||
package common.verification_policy; | ||
|
||
option java_package = "com.weaver.protos.common.verification_policy"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/common"; | ||
|
||
// VerificationPolicy stores the rules around which parties from a foreign | ||
// network need to provide proof of a view in order for it to be deemed valid by | ||
// the Fabric network | ||
message VerificationPolicy { | ||
string securityDomain = 1; | ||
repeated Identifier identifiers = 2; | ||
} | ||
|
||
// The Policy captures the list of parties that are required to provide proofs | ||
// of a view in order for the Fabric network to accept the view as valid. | ||
message Policy { | ||
string type = 1; | ||
repeated string criteria = 2; | ||
} | ||
|
||
// List of identifiers for the VerificationPolicy | ||
message Identifier { | ||
// pattern defines the view/views that this rule applies to | ||
// A rule may contain a "*" at the end of the pattern | ||
string pattern = 1; | ||
Policy policy = 2; | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/cactus-core-api/src/main/proto/weaver/common/protos/corda/view_data.proto
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,17 @@ | ||
syntax = "proto3"; | ||
|
||
package corda; | ||
|
||
option java_package = "com.weaver.protos.corda"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/corda"; | ||
|
||
message ViewData { | ||
message Notarization { | ||
string signature = 1; | ||
string certificate = 2; | ||
string id = 3; | ||
} | ||
repeated Notarization notarizations = 1; | ||
// Bytes of InteropPayload | ||
bytes payload = 2; | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/cactus-core-api/src/main/proto/weaver/common/protos/driver/driver.proto
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,15 @@ | ||
syntax = "proto3"; | ||
|
||
package driver.driver; | ||
|
||
import "common/ack.proto"; | ||
import "common/query.proto"; | ||
|
||
option java_package = "com.weaver.protos.driver.driver"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/driver"; | ||
|
||
service DriverCommunication { | ||
// the remote relay sends a RequestDriverState request to its driver with a | ||
// query defining the data it wants to receive | ||
rpc RequestDriverState(common.query.Query) returns (common.ack.Ack) {} | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/cactus-core-api/src/main/proto/weaver/common/protos/fabric/view_data.proto
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,24 @@ | ||
syntax = "proto3"; | ||
|
||
package fabric.view_data; | ||
|
||
option java_package = "com.weaver.protos.fabric.view_data"; | ||
option go_package = "github.com/hyperledger-labs/weaver-dlt-interoperability/common/protos-go/fabric"; | ||
|
||
import "peer/proposal_response.proto"; | ||
|
||
message FabricView { | ||
// `Response` from the peers | ||
// https://github.com/hyperledger/fabric-protos-go/blob/main/peer/proposal_response.pb.go#L113 | ||
// We only need the `Payload` field though. | ||
protos.Response response = 1; | ||
// `ProposalResponsePayload` is the output produced by each peer and signed as a serialized blob | ||
// https://github.com/hyperledger/fabric-protos-go/blob/main/peer/proposal_response.pb.go#L176 | ||
// `ProposalResponsePayload` contains an `Extension` field which is of type `ChaincodeAction` | ||
// https://github.com/hyperledger/fabric-protos-go/blob/main/peer/proposal.pb.go#L280 | ||
// We only need the `ProposalHash`, `ChaincodeId` and `Response` fields. | ||
protos.ProposalResponsePayload proposal_response_payload = 3; | ||
// Each `Endorsement` is an identity coupled with a signature | ||
// https://github.com/hyperledger/fabric-protos-go/blob/main/peer/proposal_response.pb.go#L242 | ||
repeated protos.Endorsement endorsements = 4; | ||
} |
Oops, something went wrong.