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
10 changes: 6 additions & 4 deletions crates/dips/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -167,11 +170,10 @@ pub enum DipsError {
InvalidVoucher(String),
}

// TODO: send back messages
#[cfg(feature = "rpc")]
impl From<DipsError> for tonic::Status {
fn from(_val: DipsError) -> Self {
tonic::Status::internal("unknown errr")
fn from(value: DipsError) -> Self {
tonic::Status::internal(format!("{}", value))
}
}

Expand Down
9 changes: 4 additions & 5 deletions crates/dips/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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"));
}

Expand All @@ -93,10 +93,9 @@ impl IndexerDipsService for DipsServer {
&self.allowed_payers,
signed_voucher,
)
.await
.map_err(Into::<tonic::Status>::into)?;
.await?;

Ok(tonic::Response::new(SubmitAgreementProposalResponse {
Ok(Response::new(SubmitAgreementProposalResponse {
response: ProposalResponse::Accept.into(),
}))
}
Expand Down
Loading