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
53 changes: 35 additions & 18 deletions crates/dips/proto/indexer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,51 @@ message SubmitAgreementProposalRequest {
/**
* A response to a request to propose a new _indexing agreement_ to an _indexer_.
*
* The outcome is either `accepted` or `rejected` -- exactly one is set. A
* rejection carries a `RejectReason` plus an optional free-text detail.
*
* See the `DipsService.SubmitAgreementProposal` method.
*/
message SubmitAgreementProposalResponse {
ProposalResponse response = 1; /// The response to the agreement proposal.
RejectReason reject_reason = 2; /// Only set when response = REJECT.
oneof outcome {
Accepted accepted = 1; /// Set when the proposal was accepted.
Rejected rejected = 2; /// Set when the proposal was rejected.
}
}

/**
* The response to an _indexing agreement_ proposal.
* An accepted _indexing agreement_ proposal. Empty for now; accept-only fields
* can be added later without disturbing the reject path.
*/
message Accepted {}

/**
* A rejected _indexing agreement_ proposal.
*/
enum ProposalResponse {
ACCEPT = 0; /// The agreement proposal was accepted.
REJECT = 1; /// The agreement proposal was rejected.
message Rejected {
RejectReason reason = 1; /// Why the proposal was rejected.
string detail = 2; /// Optional human-readable detail; may be empty.
}

/**
* The reason for rejecting an _indexing agreement_ proposal.
* Only meaningful when ProposalResponse = REJECT.
* The reason an _indexer_ rejected an _indexing agreement_ proposal. Values may
* be added over time; an older reader should treat an unrecognised reason as
* UNSPECIFIED (the catch-all).
*/
enum RejectReason {
REJECT_REASON_UNSPECIFIED = 0; /// Default / not set (used for ACCEPT responses).
REJECT_REASON_PRICE_TOO_LOW = 1; /// The offered price is below the indexer's minimum.
REJECT_REASON_OTHER = 2; /// Any other reason (bad signature, etc.).
REJECT_REASON_SIGNER_NOT_AUTHORISED = 3; /// The proposal signer is not authorised on the escrow contract.
REJECT_REASON_DEADLINE_EXPIRED = 4; /// The proposal deadline has already passed.
REJECT_REASON_UNSUPPORTED_NETWORK = 5; /// The subgraph's network is not supported by this indexer.
REJECT_REASON_SUBGRAPH_MANIFEST_UNAVAILABLE = 6; /// The subgraph manifest could not be fetched from IPFS.
REJECT_REASON_UNEXPECTED_SERVICE_PROVIDER = 7; /// The RCA service provider does not match this indexer.
REJECT_REASON_AGREEMENT_EXPIRED = 8; /// The agreement end time has already passed.
REJECT_REASON_UNSUPPORTED_METADATA_VERSION = 9; /// The metadata version is not supported.
REJECT_REASON_UNSPECIFIED = 0; /// Rejected for a reason not covered below (the catch-all).
REJECT_REASON_PRICE_TOO_LOW = 1; /// The offered price is below the indexer's minimum.
REJECT_REASON_DEADLINE_EXPIRED = 2; /// The proposal deadline has already passed.
REJECT_REASON_UNSUPPORTED_NETWORK = 3; /// The subgraph's network is not supported by this indexer.
REJECT_REASON_SUBGRAPH_MANIFEST_UNAVAILABLE = 4; /// The subgraph manifest could not be fetched from IPFS.
REJECT_REASON_UNEXPECTED_SERVICE_PROVIDER = 5; /// The RCA names a different indexer as service provider.
REJECT_REASON_AGREEMENT_EXPIRED = 6; /// The agreement end time has already passed.
REJECT_REASON_UNSUPPORTED_METADATA_VERSION = 7; /// The agreement metadata version is not supported.
REJECT_REASON_INVALID_SIGNATURE = 8; /// The proposal's signature failed to verify.
REJECT_REASON_SENDER_NOT_TRUSTED = 9; /// The signer is not an authorised agreement manager.
REJECT_REASON_CAPACITY_EXCEEDED = 10; /// The indexer is at its DIPs capacity; may resolve later.
REJECT_REASON_MANIFEST_TOO_LARGE = 11; /// The subgraph manifest exceeds the indexer's size cap.
REJECT_REASON_REPLAY_DETECTED = 12; /// A different proposal reuses an already-seen agreement id.
REJECT_REASON_INSUFFICIENT_ESCROW = 13; /// The payer has insufficient escrow to back the agreement.
REJECT_REASON_INDEXER_UNAVAILABLE = 14; /// A transient internal error; the proposal may be resent.
}
127 changes: 73 additions & 54 deletions crates/dips/src/proto/graphprotocol.indexer.dips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,74 +16,83 @@ pub struct SubmitAgreementProposalRequest {
///
/// A response to a request to propose a new *indexing agreement* to an *indexer*.
///
/// The outcome is either `accepted` or `rejected` -- exactly one is set. A
/// rejection carries a `RejectReason` plus an optional free-text detail.
///
/// See the `DipsService.SubmitAgreementProposal` method.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SubmitAgreementProposalResponse {
/// / The response to the agreement proposal.
#[prost(enumeration = "ProposalResponse", tag = "1")]
pub response: i32,
/// / Only set when response = REJECT.
#[prost(enumeration = "RejectReason", tag = "2")]
pub reject_reason: i32,
#[prost(oneof = "submit_agreement_proposal_response::Outcome", tags = "1, 2")]
pub outcome: ::core::option::Option<submit_agreement_proposal_response::Outcome>,
}
/// Nested message and enum types in `SubmitAgreementProposalResponse`.
pub mod submit_agreement_proposal_response {
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum Outcome {
/// / Set when the proposal was accepted.
#[prost(message, tag = "1")]
Accepted(super::Accepted),
/// / Set when the proposal was rejected.
#[prost(message, tag = "2")]
Rejected(super::Rejected),
}
}
/// *
///
/// The response to an *indexing agreement* proposal.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ProposalResponse {
/// / The agreement proposal was accepted.
Accept = 0,
/// / The agreement proposal was rejected.
Reject = 1,
}
impl ProposalResponse {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Accept => "ACCEPT",
Self::Reject => "REJECT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ACCEPT" => Some(Self::Accept),
"REJECT" => Some(Self::Reject),
_ => None,
}
}
/// An accepted *indexing agreement* proposal. Empty for now; accept-only fields
/// can be added later without disturbing the reject path.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Accepted {}
/// *
///
/// A rejected *indexing agreement* proposal.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Rejected {
/// / Why the proposal was rejected.
#[prost(enumeration = "RejectReason", tag = "1")]
pub reason: i32,
/// / Optional human-readable detail; may be empty.
#[prost(string, tag = "2")]
pub detail: ::prost::alloc::string::String,
}
/// *
///
/// The reason for rejecting an *indexing agreement* proposal.
/// Only meaningful when ProposalResponse = REJECT.
/// The reason an *indexer* rejected an *indexing agreement* proposal. Values may
/// be added over time; an older reader should treat an unrecognised reason as
/// UNSPECIFIED (the catch-all).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RejectReason {
/// / Default / not set (used for ACCEPT responses).
/// / Rejected for a reason not covered below (the catch-all).
Unspecified = 0,
/// / The offered price is below the indexer's minimum.
PriceTooLow = 1,
/// / Any other reason (bad signature, etc.).
Other = 2,
/// / The proposal signer is not authorised on the escrow contract.
SignerNotAuthorised = 3,
/// / The proposal deadline has already passed.
DeadlineExpired = 4,
DeadlineExpired = 2,
/// / The subgraph's network is not supported by this indexer.
UnsupportedNetwork = 5,
UnsupportedNetwork = 3,
/// / The subgraph manifest could not be fetched from IPFS.
SubgraphManifestUnavailable = 6,
/// / The RCA service provider does not match this indexer.
UnexpectedServiceProvider = 7,
SubgraphManifestUnavailable = 4,
/// / The RCA names a different indexer as service provider.
UnexpectedServiceProvider = 5,
/// / The agreement end time has already passed.
AgreementExpired = 8,
/// / The metadata version is not supported.
UnsupportedMetadataVersion = 9,
AgreementExpired = 6,
/// / The agreement metadata version is not supported.
UnsupportedMetadataVersion = 7,
/// / The proposal's signature failed to verify.
InvalidSignature = 8,
/// / The signer is not an authorised agreement manager.
SenderNotTrusted = 9,
/// / The indexer is at its DIPs capacity; may resolve later.
CapacityExceeded = 10,
/// / The subgraph manifest exceeds the indexer's size cap.
ManifestTooLarge = 11,
/// / A different proposal reuses an already-seen agreement id.
ReplayDetected = 12,
/// / The payer has insufficient escrow to back the agreement.
InsufficientEscrow = 13,
/// / A transient internal error; the proposal may be resent.
IndexerUnavailable = 14,
}
impl RejectReason {
/// String value of the enum field names used in the ProtoBuf definition.
Expand All @@ -94,8 +103,6 @@ impl RejectReason {
match self {
Self::Unspecified => "REJECT_REASON_UNSPECIFIED",
Self::PriceTooLow => "REJECT_REASON_PRICE_TOO_LOW",
Self::Other => "REJECT_REASON_OTHER",
Self::SignerNotAuthorised => "REJECT_REASON_SIGNER_NOT_AUTHORISED",
Self::DeadlineExpired => "REJECT_REASON_DEADLINE_EXPIRED",
Self::UnsupportedNetwork => "REJECT_REASON_UNSUPPORTED_NETWORK",
Self::SubgraphManifestUnavailable => {
Expand All @@ -108,15 +115,20 @@ impl RejectReason {
Self::UnsupportedMetadataVersion => {
"REJECT_REASON_UNSUPPORTED_METADATA_VERSION"
}
Self::InvalidSignature => "REJECT_REASON_INVALID_SIGNATURE",
Self::SenderNotTrusted => "REJECT_REASON_SENDER_NOT_TRUSTED",
Self::CapacityExceeded => "REJECT_REASON_CAPACITY_EXCEEDED",
Self::ManifestTooLarge => "REJECT_REASON_MANIFEST_TOO_LARGE",
Self::ReplayDetected => "REJECT_REASON_REPLAY_DETECTED",
Self::InsufficientEscrow => "REJECT_REASON_INSUFFICIENT_ESCROW",
Self::IndexerUnavailable => "REJECT_REASON_INDEXER_UNAVAILABLE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"REJECT_REASON_UNSPECIFIED" => Some(Self::Unspecified),
"REJECT_REASON_PRICE_TOO_LOW" => Some(Self::PriceTooLow),
"REJECT_REASON_OTHER" => Some(Self::Other),
"REJECT_REASON_SIGNER_NOT_AUTHORISED" => Some(Self::SignerNotAuthorised),
"REJECT_REASON_DEADLINE_EXPIRED" => Some(Self::DeadlineExpired),
"REJECT_REASON_UNSUPPORTED_NETWORK" => Some(Self::UnsupportedNetwork),
"REJECT_REASON_SUBGRAPH_MANIFEST_UNAVAILABLE" => {
Expand All @@ -129,6 +141,13 @@ impl RejectReason {
"REJECT_REASON_UNSUPPORTED_METADATA_VERSION" => {
Some(Self::UnsupportedMetadataVersion)
}
"REJECT_REASON_INVALID_SIGNATURE" => Some(Self::InvalidSignature),
"REJECT_REASON_SENDER_NOT_TRUSTED" => Some(Self::SenderNotTrusted),
"REJECT_REASON_CAPACITY_EXCEEDED" => Some(Self::CapacityExceeded),
"REJECT_REASON_MANIFEST_TOO_LARGE" => Some(Self::ManifestTooLarge),
"REJECT_REASON_REPLAY_DETECTED" => Some(Self::ReplayDetected),
"REJECT_REASON_INSUFFICIENT_ESCROW" => Some(Self::InsufficientEscrow),
"REJECT_REASON_INDEXER_UNAVAILABLE" => Some(Self::IndexerUnavailable),
_ => None,
}
}
Expand Down
Loading
Loading