besu icon indicating copy to clipboard operation
besu copied to clipboard

Solved Add db reset for Ephemery network on restart #8180

Open ojuschugh1 opened this issue 7 months ago • 4 comments

PR description

Fixed Issue(s)

Solved issue -: https://github.com/hyperledger/besu/issues/8180

Created a unit test case to check it is working properly or not as well-:

Try -: gradlew.bat :besu:test --tests "org.hyperledger.besu.util.EphemeryDatabaseResetTest"

or

./gradlew :besu:test --tests 'org.hyperledger.besu.util.EphemeryDatabaseResetTest'

Thanks for sending a pull request! Have you done the following?

  • [X] Checked out our contribution guidelines?
  • [ ] Considered documentation and added the doc-change-required label to this PR if updates are required.
  • [ ] Considered the changelog and included an update if required.
  • [ ] For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • [X] spotless: ./gradlew spotlessApply
  • [X] unit tests: ./gradlew build
  • [X] acceptance tests: ./gradlew acceptanceTest
  • [X] integration tests: ./gradlew integrationTest
  • [X] reference tests: ./gradlew ethereum:referenceTests:referenceTests

ojuschugh1 avatar May 09 '25 19:05 ojuschugh1

Tagging @macfarla for the review. Thanks!

ojuschugh1 avatar May 09 '25 19:05 ojuschugh1

here's what I did to test this

gco main
gw installDist

// use --genesis file to start with existing ephemery genesis even though it's out of date
besu --genesis-file=./config/src/main/resources/ephemery.json

# Configuration:                                                                                   #
# Network: Custom genesis file                                                                     #
# /Users/sallymacfarlane/workspace/b2/./config/src/main/resources/ephemery.json                     #
# Network Id: 39438135                                                                             #
...

// verify that it doesn't auto-update when using main branch
besu --network=ephemery

2025-05-19 13:44:30.406+10:00 | main | ERROR | Besu | Failed to start Besu: Supplied genesis block does not match chain data stored in /Users/sallymacfarlane/workspace/b2/build/install/besu.
Please specify a different data directory with --data-path, specify the original genesis file with --genesis-file or supply a testnet/mainnet option with --network.
Supplied genesis block does not match chain data stored in /Users/sallymacfarlane/workspace/b2/build/install/besu.
Please specify a different data directory with --data-path, specify the original genesis file with --genesis-file or supply a testnet/mainnet option with --network.

// switch to this pr
gh pr checkout 8618
gw installDist
besu --network=ephemery
...

# Configuration:                                                                                   #
# Network: Ephemery                                                                                #
# Network Id: 39438146

It feels a bit weird to have your database silently nuked. Even though it is by definition ephemeral.

At very least a log message that indicates your db is starting again from scratch would be nice.

Is this how other clients (geth, nethermind etc) deal with the ephemery network? Would be nice to be consistent

macfarla avatar May 19 '25 03:05 macfarla

This pr is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 19 '25 02:06 github-actions[bot]

@ojuschugh1 I added some comments and questions above, please take a look

macfarla avatar Jun 24 '25 08:06 macfarla

This pr is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jul 25 '25 02:07 github-actions[bot]

This pr was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Aug 08 '25 02:08 github-actions[bot]