Skip to content

op-wheel: geth db cheats logic#4285

Merged
mslipper merged 1 commit intodevelopfrom
op-wheel-cheats
Dec 8, 2022
Merged

op-wheel: geth db cheats logic#4285
mslipper merged 1 commit intodevelopfrom
op-wheel-cheats

Conversation

@protolambda
Copy link
Contributor

@protolambda protolambda commented Dec 7, 2022

Description

This PR adds a cheats package to op-wheel with all the backend logic for the cheating commands: a common pattern to open the database, open a blockchain/state around that, and to modify the head block with state mutations, and several state modifications that we later expose with commands.

Second PR in a stack of 4: base, cheats-logic, engine-logic, commands-frontend:

Tests

This is a testing tool used in the migration testing. I'm open to testing the backend functionality in CI somewhere, but don't like to cascade the testing with testing of the testing.

Metadata

Fix ENG-3078

@changeset-bot
Copy link

changeset-bot bot commented Dec 7, 2022

⚠️ No Changeset found

Latest commit: c030d85

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mslipper
Copy link
Contributor

mslipper commented Dec 7, 2022

Adding mergify ignore so @trianglesphere can take a look

Copy link
Contributor

@trianglesphere trianglesphere left a comment

Choose a reason for hiding this comment

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

One worry about db handles, but otherwise looks good


func OpenGethRawDB(dataDirPath string, readOnly bool) (ethdb.Database, error) {
// don't use readonly mode in actual DB, it doesn't work with Geth.
db, err := rawdb.NewLevelDBDatabaseWithFreezer(dataDirPath, 2048, 500, filepath.Join(dataDirPath, "ancient"), "", readOnly)
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a pretty high number of db handles and I think it's over the default limit on mac osx. I also don't think you get much more performance by having so many.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps using the default values of what geth uses makes sense

Copy link
Contributor

Choose a reason for hiding this comment

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

Geth uses MakeDatabaseHandles to actually request more handles.

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 found the 500 as default somewhere in geth, but in other places it's dynamic yes. I'll see if I can adjust it, or make geth pick the number.

Copy link
Contributor

Choose a reason for hiding this comment

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

On macs you can raise the limit to almost anything IIRC, but the default limit is like 256

@mslipper mslipper merged commit b6ed101 into develop Dec 8, 2022
@mslipper
Copy link
Contributor

mslipper commented Dec 8, 2022

Geth issue is an unrelated flake. Merging.

@mslipper mslipper deleted the op-wheel-cheats branch December 8, 2022 03:13
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.

4 participants