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: some skeleton improvements from observations on devnet syncs #3014

Merged
merged 8 commits into from
Sep 14, 2023

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Sep 5, 2023

some improvements for more robust backfill + beacon sync sim

@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Merging #3014 (e6457eb) into master (d2261ea) will increase coverage by 0.03%.
The diff coverage is 51.28%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.73% <ø> (ø)
blockchain 92.58% <ø> (ø)
client 87.36% <51.28%> (+0.08%) ⬆️
common 98.18% <ø> (ø)
ethash ∅ <ø> (∅)
evm 71.70% <ø> (ø)
rlp ?
statemanager 89.91% <ø> (ø)
trie 90.18% <ø> (ø)
tx 96.38% <ø> (ø)
util 86.78% <ø> (ø)
vm 80.42% <ø> (ø)

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

Copy link
Contributor

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

Left a couple of small spelling nits on comments (for clarity's sake) but looks good so far. A few of the skeleton tests are now failing though I'm assuming this is due to the logic changes around backstepping and adjusting subchains.

edited = true
}
// If the old subchain is an extension of the new one, merge the two
// and let the skeleton syncer restart (to clean internal state)

const subChain1Head = await this.getBlock(this.status.progress.subchains[1].head)
// subchains are useful is subChain1Head is in skeleton only and its tail correct
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// subchains are useful is subChain1Head is in skeleton only and its tail correct
// subchains are useful if subChain1Head is in skeleton only and its tail correct

subChain1Tail === undefined ||
!equalsBytes(subChain1Tail.header.parentHash, this.status.progress.subchains[1].next)
) {
// if subChain1Head is not in the skeleton that all previous subchains are not useful
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// if subChain1Head is not in the skeleton that all previous subchains are not useful
// if subChain1Head is not in the skeleton then all previous subchains are not useful

@holgerd77
Copy link
Member

This is still WIP, right?

@g11tech g11tech force-pushed the skeleon-improvs-sep5 branch from 0bbcefb to e7fedfd Compare September 11, 2023 19:01
@g11tech
Copy link
Contributor Author

g11tech commented Sep 11, 2023

This is still WIP, right?

yes was buried into building a beacon sync sim test that i plan to extend to do beacon engine api updates along side snapsync (in a speparate PR)

sim is mostly done, need to fix resolution of the synced promise to close out the test

@@ -48,26 +51,30 @@ describe('simple mainnet test run', async () => {

const blockHashes: string[] = []
// ------------Sanity checks--------------------------------
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rest of the changes in this file are mostly because of formatting triggered by adding sim run timelimit

@@ -25,6 +25,9 @@ export async function runTx(data: string, to?: string, value?: bigint) {
}

describe('simple mainnet test run', async () => {
if (process.env.EXTRA_CL_PARAMS === undefined) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

shifted the genesis to run from shanghai, this does the same for CL

@g11tech
Copy link
Contributor Author

g11tech commented Sep 13, 2023

should be merge ready cc @holgerd77 @acolytec3
hopefully all checks pass 🙂

Copy link
Contributor

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

Left a few suggestions/questions. The code looks good and working to get the new beacon sync test running now.

assert.fail('could not complete beacon sync in 8 minutes')
}
} else {
assert.fail('ethereumjs client not setup properly for snap sync')
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this error referencing? Is snap sync somehow being tested here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry copied over from snapsyncspec , will cleanup


import type { Common } from '@ethereumjs/common'
import type { TransactionType, TxData, TxOptions } from '@ethereumjs/tx'
import type { ChildProcessWithoutNullStreams } from 'child_process'
import type { Client } from 'jayson/promise'

export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
// This function switches between the native web implementation and a nodejs implemnetation
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// This function switches between the native web implementation and a nodejs implemnetation
// This function switches between the native web implementation and a nodejs implementation

Comment on lines 35 to 36
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (globalThis.EventSource) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why disable this and not just add gloablThis.EventSource !== undefined? I know it's a nit but is there a good reason to fight the linter here?

eventSource.addEventListener(topics[0], (async (_event: MessageEvent) => {
if (syncState === 'PAUSED') return
try {
// just fetch finalized updated, it has all relevant hashesh to fcU
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// just fetch finalized updated, it has all relevant hashesh to fcU
// just fetch finalized updated, it has all relevant hashes to fcU


## Prerequisites

1. Bash terminal
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
1. Bash terminal
1. ZSH terminal

3. `jq` & `curl` installed
4. `ethereumjs-monorepo` codebase build via `npm i` (for e.g. at `/usr/app/ethereumjs`)

You may pre-download docker images for lodestar (`docker pull chainsafe/lodestar:latest`) and geth (`docker pull ethereum/client-go:v1.11.6`) to avoid any test timeout issues.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be using get 1.11.6 or 1.12.2 like the test looks for?

Copy link
Contributor

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

Passing. Nice work!

@g11tech g11tech force-pushed the skeleon-improvs-sep5 branch from c755763 to e6457eb Compare September 14, 2023 15:49
@g11tech g11tech merged commit 04aa4da into master Sep 14, 2023
@holgerd77 holgerd77 deleted the skeleon-improvs-sep5 branch September 14, 2023 19:27
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.

3 participants