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

DO_NOT_MERGE Exercise 6 #1879

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

DO_NOT_MERGE Exercise 6 #1879

wants to merge 10 commits into from

Conversation

ashu26jha
Copy link
Contributor

New Sync package using feeder gateway

sync/sync.go Outdated
Comment on lines 336 to 337
getBlockURL := fmt.Sprintf("https://alpha-sepolia.starknet.io/feeder_gateway/get_block?blockNumber=%d", blockNumber)
blockResponse, err := http.Get(getBlockURL)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use the starknetData interface? Adapting the types manually is a good exercise though

sync/sync.go Outdated
default:
s.log.Infow("Fetching from feeder")
blocks, stateUpdate, blockCommitments := s.getBlockNumberDetails(uint64(s.latestBlockHeight))
newClass, _ := s.fetchUnknownClasses(syncCtx, &stateUpdate)
Copy link
Contributor

Choose a reason for hiding this comment

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

You should handle the error

Copy link
Contributor Author

@ashu26jha ashu26jha May 28, 2024

Choose a reason for hiding this comment

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

I will try to fix this through the manually, if it doesn't work I will switch to the starknetdata interface as you mentioned above!

I get it now, stateUpdate is null. That is why the memory leak error

@rianhughes
Copy link
Contributor

Generally it looks pretty good, although I would recommend fixing the tests.

@ashu26jha
Copy link
Contributor Author

ashu26jha commented May 28, 2024

Hey @rianhughes, smoke test (syncing first 100 blocks) are working 🎉, but there are some issues I would like to highlight

  1. Can't fix all the lints as http is not added to ignore (could be fixed by adding //nolint comment)
  2. It only works with mainnet

Should I try fixing these or move on?

PS:

I also added verifier_Task again just to have the sanity checks, this is my logs when synching:

09:08:46.663 29/05/2024 +05:30  INFO    sync/sync.go:174        Fetching from feeder
09:08:49.010 29/05/2024 +05:30  INFO    sync/sync.go:182        Stored Block    {"number": 0, "hash": "0x47c3...e943", "root": "0x2187...dee6"}
09:08:49.010 29/05/2024 +05:30  INFO    sync/sync.go:174        Fetching from feeder
09:08:50.067 29/05/2024 +05:30  INFO    sync/sync.go:182        Stored Block    {"number": 1, "hash": "0x2a70...fdeb", "root": "0x525a...ac32"}
09:08:50.067 29/05/2024 +05:30  INFO    sync/sync.go:174        Fetching from feeder
09:08:51.195 29/05/2024 +05:30  INFO    sync/sync.go:182        Stored Block    {"number": 2, "hash": "0x4e1f...f2f6", "root": "0x3cee...38d9"}
09:08:51.195 29/05/2024 +05:30  INFO    sync/sync.go:174        Fetching from feeder
09:08:52.727 29/05/2024 +05:30  INFO    sync/sync.go:182        Stored Block    {"number": 3, "hash": "0x3dc0...9a74", "root": "0x79ea...6aea"}
09:08:52.727 29/05/2024 +05:30  INFO    sync/sync.go:174        Fetching from feeder
09:08:53.994 29/05/2024 +05:30  INFO    sync/sync.go:182        Stored Block    {"number": 4, "hash": "0x2ab4...5848", "root": "0x4022...3eb7"}
09:08:53.994 29/05/2024 +05:30  INFO    sync/sync.go:174        Fetching from feeder
09:08:55.185 29/05/2024 +05:30  INFO    sync/sync.go:182        Stored Block    {"number": 5, "hash": "0xdcbd...97d3", "root": "0x1193...f17d"}
09:08:55.185 29/05/2024 +05:30  INFO    sync/sync.go:174        Fetching from feeder
09:08:56.309 29/05/2024 +05:30  INFO    sync/sync.go:182        Stored Block    {"number": 6, "hash": "0x680d...f899", "root": "0x418a...1813"}
09:08:56.309 29/05/2024 +05:30  INFO    sync/sync.go:174        Fetching from feeder
^C09:08:56.763 29/05/2024 +05:30        INFO    node/node.go:350        Shutting down Juno...

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.

None yet

2 participants