Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: size 1 anchor trees #565

Merged
merged 3 commits into from
Oct 22, 2024
Merged

fix: size 1 anchor trees #565

merged 3 commits into from
Oct 22, 2024

Conversation

AaronGoldman
Copy link
Contributor

No description provided.

@AaronGoldman AaronGoldman requested a review from a team as a code owner October 18, 2024 23:03
@AaronGoldman AaronGoldman requested review from ukstv and removed request for a team October 18, 2024 23:03
@@ -75,7 +75,7 @@ impl Store for MockAnchorEventService {
highwater: i64,
limit: i64,
) -> Result<Vec<AnchorRequest>> {
let ints = ((highwater as u64)..self.anchor_req_count).take(limit as usize);
let ints = ((highwater as u64 + 1)..=self.anchor_req_count).take(limit as usize);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is why all the test vectors channged

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment why we are adding 1 to the water mark?

@AaronGoldman AaronGoldman changed the title Size 1 anchor trees fix: size 1 anchor trees Oct 21, 2024
Copy link
Collaborator

@nathanielc nathanielc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a comment explaing the off by one.

@@ -75,7 +75,7 @@ impl Store for MockAnchorEventService {
highwater: i64,
limit: i64,
) -> Result<Vec<AnchorRequest>> {
let ints = ((highwater as u64)..self.anchor_req_count).take(limit as usize);
let ints = ((highwater as u64 + 1)..=self.anchor_req_count).take(limit as usize);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment why we are adding 1 to the water mark?

Copy link
Collaborator

@stbrody stbrody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we know why we didn't see this issue triggered in our integration tests? Specifically this test of single-event anchor batches? https://github.com/3box/ceramic-tests/blob/main/suite/src/__tests__/correctness/slow/ceramic-cas-integration.test.ts#L30

@AaronGoldman
Copy link
Contributor Author

The integration tests didn't have an event with high water mark 0

@AaronGoldman AaronGoldman added this pull request to the merge queue Oct 22, 2024
"0" => merkle_node[0].context("missing left node")?,
"1" => merkle_node[1].context("missing right node")?,
_ => return Err(anyhow!("invalid path part in time event path: {}", part)),
if !path.is_empty() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, your answer to my question about the integration tests makes me think I don't actually understand what the bug was. Wasn't this change here the actual bug fix? What does the high water mark have to do with this?

Merged via the queue into main with commit af3c6f0 Oct 22, 2024
5 checks passed
@AaronGoldman AaronGoldman deleted the feat/size-1-anchor-trees branch October 22, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants