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

feat: Helper to resolve the block number for a fill #488

Merged
merged 7 commits into from
Jan 5, 2024
Merged

Conversation

pxrl
Copy link
Contributor

@pxrl pxrl commented Jan 4, 2024

Given the valid relayData that can be constructed from a Deposit, resolve whether the deposit was ever filled on the destination chain without relying on events. This can be used as a sanity check on RPC responses that sometimes drop logs.

The "left-most" variant of a binary search is implemented. The logic is very simple and has been repeatedly tested to resolve in ~20 iterations with a fill made randomly within a range of 1M blocks. This can be verified locally by adjusting the nBlocks variable within the accompanying test case (remember also to bump the test timeout via this.timeout(ms) in the relevant test case).

The criteria for determining when the fill was made is the block at which is was considered complete. This effectively ignores partial fills entirely, but that's fortunately forwards-compatible with the direction of Across.

Given the valid relayData that can be constructed from a Deposit,
resolve whether the deposit was ever filled on the destination chain
without relying on events. This can be used as a sanity check on RPC
responses that sometimes drop logs.

The "left-most" variant of a binary search is implemented. The logic is
very simple and has been repeatedly tested to resolve in ~20 iterations
with a fill made randomly within a range of 1M blocks. This can be
verified locally by adjusting the _nBlocks_ variable within the
accompanying test case (remember also to bump the test timeout via
`this.timeout(ms)` in the relevant test case).

The criteria for determining when the fill was made is the block at
which is was considered complete. This effectively ignores partial fills
entirely, but that's fortunately forwards-compatible with the direction
of Across.
@pxrl pxrl merged commit 043690f into master Jan 5, 2024
3 checks passed
@pxrl pxrl deleted the pxrl/fillSearch branch January 5, 2024 12:55
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.

2 participants