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

Resolve block not found issue - Sapphire #793

Merged
merged 15 commits into from
Jan 18, 2024
Merged

Conversation

trizin
Copy link
Contributor

@trizin trizin commented Jan 18, 2024

On January 18th, the active flow failed due to block not found issue originated from Oasis RPC. This PR:

  • Fixes the block not found issue by setting block_timestamp = 0 thus returning a negative value from timeSinceTimestamp so that f(x) != 0
  • Verifies that the identified block number is within a 15-minute range of the target timestamp. Throws an error otherwise.

@trizin trizin closed this Jan 18, 2024
@trizin trizin reopened this Jan 18, 2024
@trizin trizin changed the title Manual trigger rewards Resolve block not found issue - Sapphire Jan 18, 2024
@trizin trizin requested a review from trentmc January 18, 2024 10:39
@trizin trizin marked this pull request as ready for review January 18, 2024 10:39
Comment on lines 154 to 173
if abs(block_timestamp - timestamp) > 60 * 15:
# pylint: disable=line-too-long
print(
"WARNING: timestamp_to_block() is returning a block that is more than 15 minutes away from the target timestamp"
)
print("target timestamp =", timestamp)
print("block timestamp =", block_timestamp)
print("block number =", block_i)
print("delta =", abs(block_timestamp - timestamp))
raise Exception(
"timestamp_to_block() is returning a block that is too far away"
)
print(
"Returning block number",
block_i,
"for timestamp",
timestamp,
"diff",
abs(block_timestamp - timestamp),
)
Copy link
Member

Choose a reason for hiding this comment

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

Does a unit test capture this corner case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not yet, I'll add it, thanks!

Copy link

codeclimate bot commented Jan 18, 2024

Code Climate has analyzed commit 247f2c4 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 90.9% (90% is the threshold).

This pull request will bring the total coverage in the repository to 92.8% (0.0% change).

View more on Code Climate.

@trizin trizin requested a review from trentmc January 18, 2024 13:07
@trizin
Copy link
Contributor Author

trizin commented Jan 18, 2024

Ignore the failing "Dispense Predictoor ROSE Rewards" flow, there's an issue with subgraph

@trizin trizin merged commit 7dfebac into main Jan 18, 2024
6 of 7 checks passed
@trizin trizin deleted the manual-trigger-rewards branch January 18, 2024 14:38
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