Skip to content

Commit 1b232e4

Browse files
committed
fix!: update rav attributes to camel case
Signed-off-by: Gustavo Inacio <[email protected]>
1 parent b16f23d commit 1b232e4

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

tap_aggregator/src/aggregator.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub async fn check_and_aggregate_receipts(
5555

5656
// Check that the rav has the correct allocation id
5757
if let Some(previous_rav) = &previous_rav {
58-
let prev_id = previous_rav.message.allocation_id;
58+
let prev_id = previous_rav.message.allocationId;
5959
if prev_id != allocation_id {
6060
return Err(tap_core::Error::RavAllocationIdMismatch {
6161
prev_id: format!("{prev_id:#X}"),
@@ -117,9 +117,9 @@ fn check_receipt_timestamps(
117117
if let Some(previous_rav) = &previous_rav {
118118
for receipt in receipts.iter() {
119119
let receipt = &receipt.message;
120-
if previous_rav.message.timestamp_ns >= receipt.timestamp_ns {
120+
if previous_rav.message.timestampNs >= receipt.timestamp_ns {
121121
return Err(tap_core::Error::ReceiptTimestampLowerThanRav {
122-
rav_ts: previous_rav.message.timestamp_ns,
122+
rav_ts: previous_rav.message.timestampNs,
123123
receipt_ts: receipt.timestamp_ns,
124124
}
125125
.into());
@@ -256,9 +256,9 @@ mod tests {
256256
let rav = EIP712SignedMessage::new(
257257
&domain_separator,
258258
tap_core::receipt_aggregate_voucher::ReceiptAggregateVoucher {
259-
allocation_id: allocation_ids[0],
260-
timestamp_ns: receipt_timestamp_range.clone().min().unwrap() - 1,
261-
value_aggregate: 42,
259+
allocationId: allocation_ids[0],
260+
timestampNs: receipt_timestamp_range.clone().min().unwrap() - 1,
261+
valueAggregate: 42,
262262
},
263263
&keys.0,
264264
)
@@ -271,9 +271,9 @@ mod tests {
271271
let rav = EIP712SignedMessage::new(
272272
&domain_separator,
273273
tap_core::receipt_aggregate_voucher::ReceiptAggregateVoucher {
274-
allocation_id: allocation_ids[0],
275-
timestamp_ns: receipt_timestamp_range.clone().min().unwrap(),
276-
value_aggregate: 42,
274+
allocationId: allocation_ids[0],
275+
timestampNs: receipt_timestamp_range.clone().min().unwrap(),
276+
valueAggregate: 42,
277277
},
278278
&keys.0,
279279
)
@@ -286,9 +286,9 @@ mod tests {
286286
let rav = EIP712SignedMessage::new(
287287
&domain_separator,
288288
tap_core::receipt_aggregate_voucher::ReceiptAggregateVoucher {
289-
allocation_id: allocation_ids[0],
290-
timestamp_ns: receipt_timestamp_range.clone().max().unwrap() + 1,
291-
value_aggregate: 42,
289+
allocationId: allocation_ids[0],
290+
timestampNs: receipt_timestamp_range.clone().max().unwrap() + 1,
291+
valueAggregate: 42,
292292
},
293293
&keys.0,
294294
)

tap_aggregator/src/server.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ mod tests {
431431
ReceiptAggregateVoucher::aggregate_receipts(allocation_ids[0], &receipts, None)
432432
.unwrap();
433433

434-
assert!(remote_rav.message.allocation_id == local_rav.allocation_id);
435-
assert!(remote_rav.message.timestamp_ns == local_rav.timestamp_ns);
436-
assert!(remote_rav.message.value_aggregate == local_rav.value_aggregate);
434+
assert!(remote_rav.message.allocationId == local_rav.allocationId);
435+
assert!(remote_rav.message.timestampNs == local_rav.timestampNs);
436+
assert!(remote_rav.message.valueAggregate == local_rav.valueAggregate);
437437

438438
assert!(remote_rav.recover_signer(&domain_separator).unwrap() == keys_main.address);
439439

tap_core/src/receipt_aggregate_voucher.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ sol! {
2222
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
2323
struct ReceiptAggregateVoucher {
2424
/// Unique allocation id this RAV belongs to
25-
address allocation_id;
25+
address allocationId;
2626
/// Unix Epoch timestamp in nanoseconds (Truncated to 64-bits)
2727
/// corresponding to max timestamp from receipt batch aggregated
28-
uint64 timestamp_ns;
28+
uint64 timestampNs;
2929
/// Aggregated GRT value from receipt batch and any previous RAV provided (truncate to lower bits)
30-
uint128 value_aggregate;
30+
uint128 valueAggregate;
3131
}
3232
}
3333

@@ -49,8 +49,8 @@ impl ReceiptAggregateVoucher {
4949
let mut value_aggregate = 0u128;
5050

5151
if let Some(prev_rav) = previous_rav {
52-
timestamp_max = prev_rav.message.timestamp_ns;
53-
value_aggregate = prev_rav.message.value_aggregate;
52+
timestamp_max = prev_rav.message.timestampNs;
53+
value_aggregate = prev_rav.message.valueAggregate;
5454
}
5555

5656
for receipt in receipts {
@@ -62,9 +62,9 @@ impl ReceiptAggregateVoucher {
6262
}
6363

6464
Ok(Self {
65-
allocation_id,
66-
timestamp_ns: timestamp_max,
67-
value_aggregate,
65+
allocationId: allocation_id,
66+
timestampNs: timestamp_max,
67+
valueAggregate: value_aggregate,
6868
})
6969
}
7070
}

tap_core/src/tap_manager/manager.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ where
198198
let previous_rav = self.get_previous_rav().await?;
199199
let min_timestamp_ns = previous_rav
200200
.as_ref()
201-
.map(|rav| rav.message.timestamp_ns + 1)
201+
.map(|rav| rav.message.timestampNs + 1)
202202
.unwrap_or(0);
203203

204204
let (valid_receipts, invalid_receipts) = self
@@ -208,7 +208,7 @@ where
208208
let expected_rav = Self::generate_expected_rav(&valid_receipts, previous_rav.clone())?;
209209

210210
self.receipt_auditor
211-
.update_min_timestamp_ns(expected_rav.timestamp_ns)
211+
.update_min_timestamp_ns(expected_rav.timestampNs)
212212
.await;
213213
let valid_receipts = valid_receipts
214214
.into_iter()
@@ -260,7 +260,7 @@ where
260260
match self.get_previous_rav().await? {
261261
Some(last_rav) => {
262262
self.executor
263-
.remove_receipts_in_timestamp_range(..=last_rav.message.timestamp_ns)
263+
.remove_receipts_in_timestamp_range(..=last_rav.message.timestampNs)
264264
.await
265265
.map_err(|err| Error::AdapterError {
266266
source_error: anyhow::Error::new(err),

tap_core/src/tap_manager/test/manager_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ mod manager_unit_test {
286286
assert_eq!(rav_request.invalid_receipts.len(), 0);
287287
// accumulated value is correct
288288
assert_eq!(
289-
rav_request.expected_rav.value_aggregate,
289+
rav_request.expected_rav.valueAggregate,
290290
expected_accumulated_value
291291
);
292292
// no previous rav
@@ -335,7 +335,7 @@ mod manager_unit_test {
335335
assert_eq!(rav_request.invalid_receipts.len(), 0);
336336
// accumulated value is correct
337337
assert_eq!(
338-
rav_request.expected_rav.value_aggregate,
338+
rav_request.expected_rav.valueAggregate,
339339
expected_accumulated_value
340340
);
341341
// Verify there is a previous rav
@@ -415,7 +415,7 @@ mod manager_unit_test {
415415
assert_eq!(rav_request_1.invalid_receipts.len(), 0);
416416
// accumulated value is correct
417417
assert_eq!(
418-
rav_request_1.expected_rav.value_aggregate,
418+
rav_request_1.expected_rav.valueAggregate,
419419
expected_accumulated_value
420420
);
421421
// no previous rav
@@ -481,7 +481,7 @@ mod manager_unit_test {
481481
assert_eq!(rav_request_2.invalid_receipts.len(), 0);
482482
// accumulated value is correct
483483
assert_eq!(
484-
rav_request_2.expected_rav.value_aggregate,
484+
rav_request_2.expected_rav.valueAggregate,
485485
expected_accumulated_value
486486
);
487487
// Verify there is a previous rav

tap_integration_tests/tests/showcase.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ async fn test_tap_aggregator_rav_timestamp_cuttoff(
876876
for (receipt, _) in first_batch.iter().chain(second_batch.iter()) {
877877
expected_value += receipt.message.value;
878878
}
879-
assert!(expected_value == second_rav_response.data.message.value_aggregate);
879+
assert!(expected_value == second_rav_response.data.message.valueAggregate);
880880

881881
sender_handle.stop()?;
882882
Ok(())

0 commit comments

Comments
 (0)