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

[NIT-2479] - pathdb support for full nodes #2324

Merged
merged 43 commits into from
Jul 23, 2024
Merged

[NIT-2479] - pathdb support for full nodes #2324

merged 43 commits into from
Jul 23, 2024

Conversation

diegoximenes
Copy link
Contributor

@diegoximenes diegoximenes commented May 21, 2024

pathdb support for full nodes.

There are two steps for running tests default tests and race tests, one to run with HashScheme, and other with PathScheme.

Nodes gracefully shutdown if the provided scheme is not compatible with stored scheme:

Usage of /usr/local/bin/nitro:
ERROR[05-20|22:53:16.690] error initializing database err="incompatible state scheme, stored: hash, provided: path"

@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label May 21, 2024
@diegoximenes diegoximenes marked this pull request as ready for review May 21, 2024 19:06
@diegoximenes diegoximenes marked this pull request as draft May 23, 2024 00:14
@diegoximenes diegoximenes force-pushed the pathdb_fullnode branch 3 times, most recently from f06ff8e to 3a21f0f Compare May 24, 2024 23:49
@diegoximenes diegoximenes marked this pull request as ready for review May 27, 2024 19:40
Copy link
Contributor

@magicxyyz magicxyyz left a comment

Choose a reason for hiding this comment

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

great work! I left some comments, mainly considering tests. We still need to discuss StateHistory default value.

cmd/nitro/nitro.go Outdated Show resolved Hide resolved
util/testhelpers/stackconfig.go Outdated Show resolved Hide resolved
arbos/arbosState/arbosstate.go Outdated Show resolved Hide resolved
arbos/storage/storage.go Show resolved Hide resolved
arbos/arbosState/initialization_test.go Outdated Show resolved Hide resolved
execution/gethexec/blockchain.go Outdated Show resolved Hide resolved
execution/gethexec/blockchain.go Outdated Show resolved Hide resolved
execution/gethexec/blockchain.go Outdated Show resolved Hide resolved
execution/gethexec/blockchain.go Outdated Show resolved Hide resolved
execution/gethexec/blockchain.go Outdated Show resolved Hide resolved
Tristan-Wilson
Tristan-Wilson previously approved these changes Jun 14, 2024
Copy link
Member

@Tristan-Wilson Tristan-Wilson left a comment

Choose a reason for hiding this comment

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

LGTM pending resolving @magicxyyz's comments.

I didn't know this area of the code well before so it was interesting to read through it.

Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

still a lot left to review.. but look in my comments about defaults for testing

arbos/arbosState/arbosstate.go Outdated Show resolved Hide resolved
arbos/arbosState/initialization_test.go Outdated Show resolved Hide resolved
arbos/arbosState/arbosstate.go Outdated Show resolved Hide resolved
cmd/nitro/init_test.go Show resolved Hide resolved
Copy link
Contributor

@magicxyyz magicxyyz left a comment

Choose a reason for hiding this comment

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

I am still for inlining the unique errors instead of defining new variables, but we might need a third opinion to resolve that.

Otherwise looks good :)

arbos/arbosState/initialize.go Outdated Show resolved Hide resolved
cmd/nitro/nitro.go Outdated Show resolved Hide resolved
execution/gethexec/blockchain.go Outdated Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

Good job.
Small comments + Mostly need to solve conflicts vs the builder.

arbos/arbosState/initialize.go Outdated Show resolved Hide resolved
execution/gethexec/blockchain.go Outdated Show resolved Hide resolved
util/env/env.go Outdated

// There are two CI steps, one to run tests using the path state scheme, and one to run tests using the hash state scheme.
// An environment variable controls that behavior.
func GetTestStateScheme() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

this function is only used for testing, so fits better in a "testhelpers" package (could be testhelpers/env.. but probably not worth it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved to "github.com/offchainlabs/nitro/util/testhelpers/env" package.

It will be not straightforward to move this file to be part of the "github.com/offchainlabs/nitro/util/testhelpers" package.
replay depends indirectly on testhelpers, and GetTestStateScheme indirectly depends on "github.com/gofrs/flock".
wasm doens't support some syscalls required by flock:

~/Documents/offchain/git/nitro pathdb_fullnode⇣⇡* ❯ make test-go                                                                                           52s
mkdir -p `dirname [target/machines/latest/replay.wasm](http://target/machines/latest/replay.wasm)`
GOOS=wasip1 GOARCH=wasm go build -o [target/machines/latest/replay.wasm](http://target/machines/latest/replay.wasm) ./cmd/replay/...
# [github.com/gofrs/flock](http://github.com/gofrs/flock)
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:28:30: undefined: syscall.LOCK_EX
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:39:30: undefined: syscall.LOCK_SH
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:57:20: undefined: syscall.Flock
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:67:20: undefined: syscall.Flock
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:97:20: undefined: syscall.Flock
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:97:50: undefined: syscall.LOCK_UN
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:119:29: undefined: syscall.LOCK_EX
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:131:29: undefined: syscall.LOCK_SH
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:151:17: undefined: syscall.Flock
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:151:52: undefined: syscall.LOCK_NB
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/gofrs/[email protected]/flock_unix.go:151:52: too many errors
# [github.com/syndtr/goleveldb/leveldb/storage](http://github.com/syndtr/goleveldb/leveldb/storage)
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/syndtr/[email protected]/leveldb/storage/file_storage.go:107:16: undefined: newFileLock
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/syndtr/[email protected]/leveldb/storage/file_storage.go:192:3: undefined: rename
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/syndtr/[email protected]/leveldb/storage/file_storage.go:267:12: undefined: rename
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/syndtr/[email protected]/leveldb/storage/file_storage.go:272:12: undefined: syncDir
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/syndtr/[email protected]/leveldb/storage/file_storage.go:555:9: undefined: rename
/home/diego/.gvm/pkgsets/go1.21/global/pkg/mod/github.com/syndtr/[email protected]/leveldb/storage/file_storage.go:591:13: undefined: syncDir
make: *** [Makefile:273: [target/machines/latest/replay.wasm](http://target/machines/latest/replay.wasm)] Error 1

system_tests/recreatestate_rpc_test.go Outdated Show resolved Hide resolved
@diegoximenes diegoximenes marked this pull request as draft July 20, 2024 02:12
@diegoximenes diegoximenes marked this pull request as ready for review July 22, 2024 19:28
@diegoximenes diegoximenes requested a review from tsahee July 22, 2024 19:28
tsahee
tsahee previously approved these changes Jul 23, 2024
Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

LGTM

@tsahee tsahee dismissed magicxyyz’s stale review July 23, 2024 02:10

required changes done

@tsahee tsahee enabled auto-merge July 23, 2024 02:10
Copy link
Contributor

@magicxyyz magicxyyz left a comment

Choose a reason for hiding this comment

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

LGTM

@tsahee tsahee merged commit 3778d98 into master Jul 23, 2024
13 checks passed
@tsahee tsahee deleted the pathdb_fullnode branch July 23, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-approved s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants