Skip to content

Commit

Permalink
Fix indexer get checkpoint e2e (MystenLabs#9843)
Browse files Browse the repository at this point in the history
## Description 

Looks like Checkpoint sequence number is a `BigInt` now

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
wlmyng authored Mar 24, 2023
1 parent a49609f commit 31f3182
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions crates/sui-indexer/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,14 +1063,14 @@ pub mod pg_integration_test {
// Allow indexer to sync
wait_until_next_checkpoint(&store).await;
let current_epoch = store.get_current_epoch().unwrap();
let cp = store.get_latest_checkpoint_sequence_number().unwrap();
let cp = store.get_latest_checkpoint_sequence_number().unwrap() as u64;
let first_checkpoint = indexer_rpc_client
.get_checkpoint(CheckpointId::SequenceNumber(cp.try_into().unwrap()))
.await
.unwrap();

assert_eq!(first_checkpoint.epoch, current_epoch.epoch);
assert_eq!(first_checkpoint.sequence_number, 0);
assert_eq!(u64::from(first_checkpoint.sequence_number), 0);
assert_eq!(first_checkpoint.network_total_transactions, 1);
assert_eq!(first_checkpoint.previous_digest, None);
assert_eq!(first_checkpoint.transactions.len(), 1);
Expand All @@ -1089,22 +1089,28 @@ pub mod pg_integration_test {
.await?;
let next_cp = tx_response.checkpoint.unwrap();
let next_checkpoint = indexer_rpc_client
.get_checkpoint(CheckpointId::SequenceNumber(next_cp))
.get_checkpoint(CheckpointId::SequenceNumber(next_cp.try_into().unwrap()))
.await?;
let current_epoch = store.get_current_epoch().unwrap();

assert_eq!(next_checkpoint.epoch, current_epoch.epoch);
assert!(next_checkpoint.sequence_number > first_checkpoint.sequence_number);
assert!(
u64::from(next_checkpoint.sequence_number)
> u64::from(first_checkpoint.sequence_number)
);
assert!(
next_checkpoint.network_total_transactions
> first_checkpoint.network_total_transactions
);
assert!(next_checkpoint.transactions.contains(&tx_response.digest));

let mut curr_checkpoint = next_checkpoint;
for i in (first_checkpoint.sequence_number..curr_checkpoint.sequence_number).rev() {
for i in (u64::from(first_checkpoint.sequence_number)
..u64::from(curr_checkpoint.sequence_number))
.rev()
{
let prev_checkpoint = indexer_rpc_client
.get_checkpoint(CheckpointId::SequenceNumber(i))
.get_checkpoint(CheckpointId::SequenceNumber(i.try_into().unwrap()))
.await?;
assert_eq!(
curr_checkpoint.previous_digest,
Expand Down

0 comments on commit 31f3182

Please sign in to comment.