Skip to content

Turned PostMergeContext to be a regular class instead of a singleton.…#8248

Closed
Filter94 wants to merge 1 commit intobesu-eth:mainfrom
Filter94:fixing-post-merge-context-singleton
Closed

Turned PostMergeContext to be a regular class instead of a singleton.…#8248
Filter94 wants to merge 1 commit intobesu-eth:mainfrom
Filter94:fixing-post-merge-context-singleton

Conversation

@Filter94
Copy link
Copy Markdown
Contributor

@Filter94 Filter94 commented Feb 4, 2025

… Addded some other improvements to the acceptance tests DSL

PR description

Fixed Issue(s)

This fix allows ThreadBesuNodeRunner to spin up and tear down Besu instances multiple times during process's lifecycle.

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

  • 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:

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

final WorldStateArchive worldStateArchive,
final ProtocolSchedule protocolSchedule) {
preMergeBesuControllerBuilder.postMergeContext(postMergeContext);
mergeBesuControllerBuilder.postMergeContext(postMergeContext);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Please note this change. I couldn't find a better way to get around this and I wonder if there's a better way

… Addded some other improvements to the acceptance tests DSL

Signed-off-by: Roman <4833306+Filter94@users.noreply.github.com>
@Filter94 Filter94 force-pushed the fixing-post-merge-context-singleton branch from 5e4027e to 8aabfa4 Compare February 4, 2025 20:29
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I need a tip on this part. ThreadBesuNodeRunner can only create a Besu instance that doesn't have persistence, meaning it's losing all the state after restart. In-memory KeyValueStorageProvider is provided by BesuControllerModule::provideKeyValueStorageProvider called by dagger. I wonder if there's a non invasive way to invert this dependency and provide a different key value storage, namely I'd like to set it to a persistent version for my testing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jflo thoughts on dependency nuances here?

@macfarla macfarla requested a review from jflo February 4, 2025 23:02
Copy link
Copy Markdown
Contributor

@jframe jframe left a comment

Choose a reason for hiding this comment

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

Overall I think the PR can be simpler by just reusing the consensusContext from the MergeBesuControllerBuilder.

I had a go at doing this by creating it up front in the MergeBesuControllerBuilder and exposing a getter for the TransitionControllerBuilder still a bit ugly but it hides the details in the controller builders.

Here's my attempt if you want to take a look #8253

.cacheLastBlocks(numberOfblocksToCache)
.genesisStateHashCacheEnabled(genesisStateHashCacheEnabled)
.apiConfiguration(apiConfigurationSupplier.get())
.postMergeContext(new PostMergeContext())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this can be simpler. There is no need to expose the PostMergeContext as a method in the BesuControllerBuilder as we are already building this in the createContext method

@Filter94
Copy link
Copy Markdown
Contributor Author

Filter94 commented Feb 5, 2025

Consumed by this PR

@Filter94 Filter94 closed this Feb 5, 2025
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.

3 participants