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

client: Snap Sync Scenario Improvements #3200

Merged
merged 18 commits into from Feb 20, 2024
Merged

client: Snap Sync Scenario Improvements #3200

merged 18 commits into from Feb 20, 2024

Conversation

scorbajio
Copy link
Contributor

The goal of this PR is to debug the current snap sync implementation and verify that the following scenarios from @g11tech are handled as expected:

  1. eoa state inflated pre-sync with post sync all kind of txs
  2. storage state inflated pre-sync with post sync all kind of txs
  3. bytecode inflated pre-sync with post sync all kind of txs
  4. Static snap sync with all of the above inflated pre-sync with post sync all kind of txs
  5. Moving state snap sync with continuous eoa txs
  6. Moving state snap sync with continuous contract storage txs
  7. Moving state snap sync with continuous code deployment txs

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Attention: 29 lines in your changes are missing coverage. Please review.

Comparison is base (5fb1cef) 86.92% compared to head (8c9d1c8) 86.91%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.34% <ø> (ø)
blockchain 91.61% <ø> (ø)
client 84.65% <60.81%> (-0.04%) ⬇️
common 98.25% <ø> (ø)
devp2p 82.12% <ø> (ø)
ethash ∅ <ø> (∅)
evm 74.33% <ø> (ø)
genesis 99.98% <ø> (ø)
rlp ∅ <ø> (?)
statemanager 77.02% <ø> (ø)
trie 89.29% <ø> (+0.03%) ⬆️
tx 95.45% <ø> (ø)
util 89.13% <ø> (ø)
vm 80.20% <ø> (ø)
wallet 88.35% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@holgerd77
Copy link
Member

Updated this via UI.

@scorbajio what is the status of this PR?

@scorbajio
Copy link
Contributor Author

scorbajio commented Feb 15, 2024

Updated this via UI.

@scorbajio what is the status of this PR?

This is ready for review.

cc @g11tech

@@ -27,7 +27,7 @@ import type { Job, SnapFetcherDoneFlags } from './types'
import type { Debugger } from 'debug'
const { debug: createDebugLogger } = debugDefault

const TOTAL_RANGE_END = BIGINT_2 ** BIGINT_256 - BIGINT_1
const TOTAL_RANGE_END = BigInt(BIGINT_2 ** BIGINT_256 - BIGINT_1)
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't this be bigint anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think this was something I did while debugging and forgot to clean up. Fixed.


if (task.multi === true) {
// peer does not respect origin or limit for multi-account storage fetch
return setLengthLeft(bigIntToBytes(BIGINT_0), 32)
Copy link
Contributor

@g11tech g11tech Feb 15, 2024

Choose a reason for hiding this comment

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

even if peer doesn't respect the origin or limit, but if we provide it, does it give an issue (just curious)

Copy link
Contributor Author

@scorbajio scorbajio Feb 16, 2024

Choose a reason for hiding this comment

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

It seems like origin/limit is still used while servicing the request, but it's a bit open ended (see https://github.com/ethereum/go-ethereum/blob/a193bb0c730e413db56424a084cc172892c68dd5/eth/protocols/snap/handler.go#L346). I just use the max range if it's a multi-account request to be safe.

origin = bigIntToBytes(first + BIGINT_1)
let origin: Uint8Array

try {
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add a comment to code which particular error scenario motivated you to put this in try/catch

Copy link
Contributor Author

@scorbajio scorbajio Feb 16, 2024

Choose a reason for hiding this comment

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

The parsing of partialResult was resulting in indexing and undefined errors since lastSlot was an array in certain instances instead of a slot object. I may need to rethink some of the typing we are doing in the fetchers, that's why it was necessary to use ts-ignore. I will add a comment about it to the code.

@holgerd77
Copy link
Member

Updated this via UI

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Seems all review comments from @g11tech are adressed.

Will merge.

@holgerd77 holgerd77 merged commit 6e9cc95 into master Feb 20, 2024
45 of 46 checks passed
@holgerd77 holgerd77 deleted the snap-sync-debugging branch February 20, 2024 11:07
@holgerd77 holgerd77 changed the title client: Snap Sync Debugging client: Snap Sync Scenario Improvements Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants