Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds support for the Starknet network to the block‐fetching utilities, refactors the cache helpers to use the new util, and provides integration tests plus a dedicated test script.
- Introduce
getBlockNumber/interpretResultwith Starknet‐specific field mapping - Refactor
getBlock/getRangeincache.tsto leveragegetBlockNumber - Add integration tests for
getBlockNumberand atest:integrationnpm script
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/integration/helpers/utils.test.ts | New integration tests for getBlockNumber, including Starknet |
| src/helpers/utils.ts | Implements getBlockNumber and interpretResult logic |
| src/helpers/cache.ts | Refactors cache functions to call getBlockNumber |
| package.json | Adds test:integration script and updates the main test command |
Comments suppressed due to low confidence (3)
test/integration/helpers/utils.test.ts:44
- Only the first Starknet network ID is tested. Add a case for the second ID (
0x534e5f5345504f4c4941) to ensure full Starknet coverage.
it('should handle starknet specific block', async () => {
src/helpers/cache.ts:5
- [nitpick] The name
startsis vague. Consider renaming tostartBlockByNetworkfor clarity.
const starts: Record<string, number> = {};
src/helpers/cache.ts:10
- [nitpick]
blockscould be misread. Rename toblockCacheor similar to reflect its purpose as a timestamp‐indexed cache.
const blocks: Record<string, Record<string, number>> = {};
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ChaituVR
reviewed
Jun 27, 2025
Contributor
Author
|
Will wait for snapshot-labs/snapshot.js#1165 |
Member
|
Updated blockfinder #484 |
Member
|
Something weird in my local, i tried above request but it give me |
Member
Contributor
Author
Contributor
Author
|
After a few refresh, it finally returns a block number, it can take up to 1 min |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Toward https://github.com/snapshot-labs/workflow/issues/562
This PR will add support for starknet network.
Tests
This should return
{ "data": { "blocks": [ { "network": "1", "number": 13841761 }, { "network": "0x534e5f4d41494e", "number": 407 } ] } }It is returning blocks, matching the timestamp (Monday, December 20, 2021 11:33:20 AM)
Note
Depends on snapshot-labs/snapshot.js#1155