Skip to content

Commit 30dada4

Browse files
committed
dips grpc update
1 parent 496968b commit 30dada4

File tree

12 files changed

+622
-498
lines changed

12 files changed

+622
-498
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ rstest = "0.23.0"
7777
wiremock = "0.6.1"
7878
typed-builder = "0.20.0"
7979
tonic = { version = "0.12.3", features = ["tls-roots", "gzip"] }
80-
tonic-build = { version = "0.12.3", features = ["prost"] }
81-
prost = "0.13.3"
80+
prost = "0.13.4"
8281
prost-types = "0.13.3"
82+
dipper-rpc = { git = "https://github.com/edgeandnode/dipper/", rev = "c8700e2", default-features = false }
83+
tonic-build = "0.12.3"

crates/dips/build.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@ fn main() {
55
println!("cargo:rerun-if-changed=proto");
66
tonic_build::configure()
77
.out_dir("src/proto")
8-
.include_file("mod.rs")
8+
.include_file("indexer.rs")
9+
.build_client(false)
910
.protoc_arg("--experimental_allow_proto3_optional")
10-
.compile_protos(&["proto/dips.proto"], &["proto"])
11-
.expect("Failed to compile dips proto(s)");
11+
.compile_protos(&["proto/indexer.proto"], &["proto/"])
12+
.expect("Failed to compile DIPs indexer RPC proto(s)");
13+
14+
tonic_build::configure()
15+
.out_dir("src/proto")
16+
.include_file("gateway.rs")
17+
.build_server(false)
18+
.protoc_arg("--experimental_allow_proto3_optional")
19+
.compile_protos(&["proto/gateway.proto"], &["proto"])
20+
.expect("Failed to compile DIPs gateway RPC proto(s)");
1221
}

crates/dips/proto/dips.proto

Lines changed: 0 additions & 59 deletions
This file was deleted.

crates/dips/proto/gateway.proto

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
syntax = "proto3";
2+
3+
package graphprotocol.gateway.dips;
4+
5+
service DipsService {
6+
/**
7+
* Cancel an _indexing agreement_.
8+
*
9+
* This method allows the indexer to notify the DIPs gateway that the agreement
10+
* should be canceled.
11+
*/
12+
rpc CancelAgreement(CancelAgreementRequest) returns (CancelAgreementResponse);
13+
14+
/**
15+
* Report the progress of an _indexing agreement_.
16+
*
17+
* This method allows the indexer to report the work completed to the DIPs gateway
18+
* and receive payment for the indexing work done.
19+
*/
20+
rpc ReportProgress(ReportProgressRequest) returns (ReportProgressResponse);
21+
}
22+
23+
24+
/**
25+
* A request to cancel an _indexing agreement_.
26+
*
27+
* See the `DipsService.CancelAgreement` method.
28+
*/
29+
message CancelAgreementRequest {
30+
bytes agreement_id = 1; /// The ID of the agreement to cancel.
31+
reserved 2 to 20; /// Reserved for future use.
32+
33+
bytes signature = 99; /// The signature of the message.
34+
}
35+
36+
/**
37+
* A response to a request to cancel an _indexing agreement_.
38+
*
39+
* See the `DipsService.CancelAgreement` method.
40+
*/
41+
message CancelAgreementResponse {
42+
// Empty message
43+
}
44+
45+
46+
/**
47+
* A request to report the progress of an _indexing agreement_.
48+
*
49+
* See the `DipsService.ReportProgress` method.
50+
*/
51+
message ReportProgressRequest {
52+
bytes agreement_id = 1; /// The ID of the agreement to report progress for.
53+
// TODO(LNSD): Add fields to the message
54+
55+
bytes signature = 99; /// The signature of the message.
56+
}
57+
58+
/**
59+
* A response to a request to report the progress of an _indexing agreement_.
60+
*
61+
* See the `DipsService.ReportProgress` method.
62+
*/
63+
message ReportProgressResponse {
64+
// TODO(LNSD): Add fields to the message
65+
}
66+

crates/dips/proto/indexer.proto

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
syntax = "proto3";
2+
3+
package graphprotocol.indexer.dips;
4+
5+
service DipsService {
6+
/**
7+
* Propose a new _indexing agreement_ to an _indexer_.
8+
*
9+
* The _indexer_ can `ACCEPT` or `REJECT` the agreement.
10+
*/
11+
rpc SubmitAgreementProposal(SubmitAgreementProposalRequest) returns (SubmitAgreementProposalResponse);
12+
13+
/**
14+
* Request to cancel an existing _indexing agreement_.
15+
*/
16+
rpc CancelAgreement(CancelAgreementRequest) returns (CancelAgreementResponse);
17+
}
18+
19+
/**
20+
* A request to propose a new _indexing agreement_ to an _indexer_.
21+
*
22+
* See the `DipsService.SubmitAgreementProposal` method.
23+
*/
24+
message SubmitAgreementProposalRequest {
25+
bytes agreementId = 1; /// The ID of the agreement to register.
26+
reserved 2 to 19; /// Reserved for future use.
27+
28+
Voucher voucher = 20; /// The voucher of the agreement.
29+
30+
bytes signature = 99; /// The signature of the message.
31+
}
32+
33+
/**
34+
* A voucher of an _indexing agreement_.
35+
*/
36+
message Voucher {
37+
bytes payer = 1; /// The agreement payer.
38+
bytes recipient = 2; /// The voucher recipient address.
39+
bytes service = 3; /// Service address that will initiate the payment collection.
40+
reserved 4 to 9; /// Reserved for future use.
41+
42+
uint32 durationEpochs = 10; /// The duration of the agreement in epochs.
43+
reserved 11 to 19; /// Reserved for future use.
44+
45+
bytes maxInitialAmount = 20; /// The maximum amount, in _wei GRT_, that can be collected for the initial subgraph sync.
46+
bytes minOngoingAmountPerEpoch = 21; /// The maximum amount, in _wei GRT_, that can be collected per epoch (after the initial sync).
47+
reserved 22 to 29; /// Reserved for future use.
48+
49+
uint32 maxEpochsPerCollection = 30; /// The maximum number of epochs that can be collected at once.
50+
uint32 minEpochsPerCollection = 31; /// The minimum number of epochs that can be collected at once.
51+
reserved 32 to 39; /// Reserved for future use.
52+
53+
VoucherMetadata metadata = 50; /// The voucher metadata.
54+
}
55+
56+
57+
/**
58+
* The indexing agreement voucher metadata.
59+
*/
60+
message VoucherMetadata {
61+
bytes deploymentId = 1; /// The Subgraph deployment ID to index.
62+
reserved 2 to 19; /// Reserved for future use.
63+
64+
bytes pricePerBlock = 20; /// The amount to pay per indexed block in _wei GRT per block_.
65+
bytes pricePerEntityPerEpoch = 21; /// The amount to pay per indexed and stored entity in _wei GRT per entity per epoch_.
66+
}
67+
68+
/**
69+
* A response to a request to propose a new _indexing agreement_ to an _indexer_.
70+
*
71+
* See the `DipsService.SubmitAgreementProposal` method.
72+
*/
73+
message SubmitAgreementProposalResponse {
74+
ProposalResponse response = 1; /// The response to the agreement proposal.
75+
}
76+
77+
/**
78+
* The response to an _indexing agreement_ proposal.
79+
*/
80+
enum ProposalResponse {
81+
ACCEPT = 0; /// The agreement proposal was accepted.
82+
REJECT = 1; /// The agreement proposal was rejected.
83+
}
84+
85+
/**
86+
* A request to cancel an existing _indexing agreement_.
87+
*
88+
* See the `DipsService.CancelAgreement` method.
89+
*/
90+
message CancelAgreementRequest {
91+
bytes agreementId = 1; /// The ID of the agreement to cancel.
92+
reserved 2 to 20; /// Reserved for future use.
93+
94+
bytes signature = 99; /// The signature of the message.
95+
}
96+
97+
/**
98+
* A response to a request to cancel an existing _indexing agreement_.
99+
*
100+
* See the `DipsService.CancelAgreement` method.
101+
*/
102+
message CancelAgreementResponse {
103+
// Empty message
104+
}

crates/dips/src/proto/gateway.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is @generated by prost-build.
2+
pub mod graphprotocol {
3+
pub mod gateway {
4+
pub mod dips {
5+
include!("graphprotocol.gateway.dips.rs");
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)