Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarranzav committed Feb 5, 2025
1 parent 1a4c74b commit 6dfcc4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions crates/dips/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ pub async fn validate_and_create_agreement(
allowed_payers: impl AsRef<[Address]>,
voucher: Vec<u8>,
) -> Result<Uuid, DipsError> {
let voucher = SignedIndexingAgreementVoucher::abi_decode(&mut voucher.as_ref(), true)
let voucher = SignedIndexingAgreementVoucher::abi_decode(voucher.as_ref(), true)
.map_err(|e| DipsError::AbiDecoding(e.to_string()))?;
let metadata =
SubgraphIndexingVoucherMetadata::abi_decode(&mut voucher.voucher.metadata.as_ref(), true)
SubgraphIndexingVoucherMetadata::abi_decode(voucher.voucher.metadata.as_ref(), true)
.map_err(|e| DipsError::AbiDecoding(e.to_string()))?;

voucher.validate(domain, expected_payee, allowed_payers)?;
Expand All @@ -293,7 +293,7 @@ pub async fn validate_and_cancel_agreement(
domain: &Eip712Domain,
cancellation_request: Vec<u8>,
) -> Result<Uuid, DipsError> {
let request = SignedCancellationRequest::abi_decode(&mut cancellation_request.as_ref(), true)
let request = SignedCancellationRequest::abi_decode(cancellation_request.as_ref(), true)
.map_err(|e| DipsError::AbiDecoding(e.to_string()))?;

let result = store
Expand Down Expand Up @@ -554,7 +554,7 @@ mod test {
maxEpochsPerCollection: 10,
deadline: (SystemTime::now() + Duration::from_secs(3600))
.duration_since(UNIX_EPOCH)?
.as_secs() as u64,
.as_secs(),
metadata: metadata.abi_encode().into(),
};

Expand Down
14 changes: 7 additions & 7 deletions crates/service/src/database/dips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn uint256_to_bigdecimal(uint256: &uint256) -> BigDecimal {
}

fn uint32_to_i64(uint32: u32) -> i64 {
uint32.try_into().unwrap()
uint32.into()
}

#[async_trait]
Expand All @@ -45,7 +45,7 @@ impl AgreementStore for PsqlAgreementStore {
};

let signed =
SignedIndexingAgreementVoucher::abi_decode(&mut item.signed_payload.as_ref(), true)?;
SignedIndexingAgreementVoucher::abi_decode(item.signed_payload.as_ref(), true)?;
let cancelled = item.cancelled_at.is_some();
Ok(Some((signed, cancelled)))
}
Expand Down Expand Up @@ -133,7 +133,7 @@ pub(crate) mod test {

#[sqlx::test(migrations = "../../migrations")]
async fn test_store_agreement(pool: PgPool) {
let store = Arc::new(PsqlAgreementStore { pool: pool });
let store = Arc::new(PsqlAgreementStore { pool });
let id = Uuid::now_v7();

// Create metadata first
Expand Down Expand Up @@ -184,7 +184,7 @@ pub(crate) mod test {

#[sqlx::test(migrations = "../../migrations")]
async fn test_get_agreement_by_id(pool: PgPool) {
let store = Arc::new(PsqlAgreementStore { pool: pool });
let store = Arc::new(PsqlAgreementStore { pool });
let id = Uuid::parse_str("a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d9").unwrap();

// Create metadata first
Expand Down Expand Up @@ -227,7 +227,7 @@ pub(crate) mod test {
let cancelled = retrieved.1;
let retrieved_metadata =
<indexer_dips::SubgraphIndexingVoucherMetadata as SolType>::abi_decode(
&mut retrieved_voucher.metadata.as_ref(),
retrieved_voucher.metadata.as_ref(),
true,
)
.unwrap();
Expand Down Expand Up @@ -262,12 +262,12 @@ pub(crate) mod test {
retrieved_voucher.minEpochsPerCollection,
agreement.voucher.minEpochsPerCollection
);
assert_eq!(cancelled, false);
assert!(!cancelled);
}

#[sqlx::test(migrations = "../../migrations")]
async fn test_cancel_agreement(pool: PgPool) {
let store = Arc::new(PsqlAgreementStore { pool: pool });
let store = Arc::new(PsqlAgreementStore { pool });
let id = Uuid::parse_str("a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7e9").unwrap();

// Create metadata first
Expand Down

0 comments on commit 6dfcc4d

Please sign in to comment.