diff --git a/crates/dips/src/lib.rs b/crates/dips/src/lib.rs index cf1f0088b..5a0144221 100644 --- a/crates/dips/src/lib.rs +++ b/crates/dips/src/lib.rs @@ -34,6 +34,9 @@ const CHAIN_ID_ARBITRUM_ONE: ChainId = 0xa4b1; // 42161 const EIP712_DOMAIN_SALT: B256 = b256!("b4632c657c26dce5d4d7da1d65bda185b14ff8f905ddbb03ea0382ed06c5ef28"); +/// DIPs Protocol version +pub const PROTOCOL_VERSION: u64 = 1; // MVP + /// Create an EIP-712 domain given a chain ID and dispute manager address. pub fn dips_agreement_eip712_domain() -> Eip712Domain { eip712_domain! { @@ -132,7 +135,7 @@ sol! { #[derive(Error, Debug)] pub enum DipsError { - // agreement cration + // agreement creation #[error("signature is not valid, error: {0}")] InvalidSignature(String), #[error("payer {0} not authorised")] @@ -167,11 +170,10 @@ pub enum DipsError { InvalidVoucher(String), } -// TODO: send back messages #[cfg(feature = "rpc")] impl From for tonic::Status { - fn from(_val: DipsError) -> Self { - tonic::Status::internal("unknown errr") + fn from(value: DipsError) -> Self { + tonic::Status::internal(format!("{}", value)) } } diff --git a/crates/dips/src/server.rs b/crates/dips/src/server.rs index f5bb30ad0..4ded0d580 100644 --- a/crates/dips/src/server.rs +++ b/crates/dips/src/server.rs @@ -19,7 +19,7 @@ use crate::{ }, signers::SignerValidator, store::AgreementStore, - validate_and_cancel_agreement, validate_and_create_agreement, + validate_and_cancel_agreement, validate_and_create_agreement, PROTOCOL_VERSION, }; #[derive(Debug)] @@ -78,7 +78,7 @@ impl IndexerDipsService for DipsServer { } = request.into_inner(); // Ensure the version is 1 - if version != 1 { + if version != PROTOCOL_VERSION { return Err(Status::invalid_argument("invalid version")); } @@ -93,10 +93,9 @@ impl IndexerDipsService for DipsServer { &self.allowed_payers, signed_voucher, ) - .await - .map_err(Into::::into)?; + .await?; - Ok(tonic::Response::new(SubmitAgreementProposalResponse { + Ok(Response::new(SubmitAgreementProposalResponse { response: ProposalResponse::Accept.into(), })) }