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 duplicate checker verification #150

Merged
merged 1 commit into from
Nov 16, 2023
Merged

Conversation

GMKrieger
Copy link
Contributor

Read the NewClaimToHistory event from the History contract instead of calling the getClaim method from the Authority contract.

@GMKrieger GMKrieger requested a review from a team November 14, 2023 19:44
@gligneul gligneul added the no changelog PRs that don't require changes in changelog label Nov 14, 2023
@gligneul gligneul requested a review from renan061 November 14, 2023 20:22
Copy link
Contributor

@gligneul gligneul left a comment

Choose a reason for hiding this comment

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

Looks good. Let's wait for @renan061 review.

@marcelstanley
Copy link
Contributor

LGTM

Copy link
Contributor

@renan061 renan061 left a comment

Choose a reason for hiding this comment

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

We need to look into the duplicates issue.

Comment on lines 114 to 131
let current_block = self
.provider
.get_block_number()
.await
{
// If there's any response, the claim already exists
Ok(_response) => Ok(true),
Err(e) => {
// If there's an InvalidClaimIndex error, we're asking for an index
// bigger than the current one, which means it's a new claim
if e.to_string().contains("InvalidClaimIndex()") {
Ok(false)
} else {
info!("{:?}", e);
Err(e).context(ContractSnafu)
}
}
.context(ProviderSnafu)?
.as_u64();
Copy link
Contributor

Choose a reason for hiding this comment

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

This will not work properly if a reorg happens. With the state-fold code, we looked N blocks behind to be sure. We should do the same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just pushed a fix that should solve this issue

Read the NewClaimToHistory event from the History contract instead of
calling the getClaim method from the Authority contract.

Co-authored-by: Gabriel de Quadros Ligneul <[email protected]>
@GMKrieger GMKrieger force-pushed the feature/fix-duplicate-checker branch from 7019ae7 to 75e9b78 Compare November 16, 2023 14:15
@GMKrieger GMKrieger merged commit 34b0851 into main Nov 16, 2023
6 checks passed
@GMKrieger GMKrieger deleted the feature/fix-duplicate-checker branch November 16, 2023 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog PRs that don't require changes in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants