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

Eth indexer not require start block env variable #116

Merged
merged 4 commits into from
Jan 17, 2025

Conversation

ppca
Copy link
Contributor

@ppca ppca commented Jan 16, 2025

  • this will enable the eth indexer to start from block_number = latest_block from rpc call - 15 if the last_processed_block was empty or too far behind.
  • Also added 2 metrics: eth sign request count and eth indexed block height

@ppca ppca changed the title Eth indexer not require start block Eth indexer not require start block env variable Jan 16, 2025
@ppca ppca marked this pull request as ready for review January 17, 2025 00:12
@ppca ppca requested a review from ailisp January 17, 2025 00:12
if latest_block - latest_handled_block < MAX_DELAYED_BLOCKS {
latest_handled_block + 1
} else {
latest_block.saturating_sub(MAX_DELAYED_BLOCKS) + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Great optimization!
Due to current rate limit failure rate, there is a small issue. I notice due to frequent rate limit hit, sometimes it can be 5-10 blocks delayed, so there is a small chance of >15 block delayed. If that happens, some block would be skipped.

Therefore, I suggest doing this check only once, when there is no last handled block.

Copy link
Contributor Author

@ppca ppca Jan 17, 2025

Choose a reason for hiding this comment

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

I'll increase the delay to 100 blocks. I also want this fix to help the case where a node goes back online after being offline for a while, in that case we don't want the node to start way back.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

Copy link
Contributor

Choose a reason for hiding this comment

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

@ppca I think we should apply the same logic (use the same function) that is used in the NEAR Indexer. I do not think there is a need to differentiate,

@ppca ppca merged commit ac30699 into develop Jan 17, 2025
2 of 3 checks passed
@ppca ppca deleted the xiangyi/eth_indexer_not_require_start_block branch January 17, 2025 01:53
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