-
Notifications
You must be signed in to change notification settings - Fork 67
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
Conversation
There was a problem hiding this 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.
LGTM |
There was a problem hiding this 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.
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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]>
7019ae7
to
75e9b78
Compare
Read the NewClaimToHistory event from the History contract instead of calling the getClaim method from the Authority contract.