Skip to content

Conversation

garyschulte
Copy link
Contributor

@garyschulte garyschulte commented Apr 8, 2025

PR description

Adds plugin service manager to protocol context. The specific motivation is to have plugin services available to AbstractBlockProcessor (in a subsequent PR), but generally this is a logical and convenient way to surface plugin services in the besu codebase.

The scope of the code change is minimal, but there are a lot of test fixture changes. Also, the ProtocolContext constructor is now protected so we do not have to plumb a bunch of unnecessary items into it for unit tests which directly construct a test protocol context.

Fixed Issue(s)

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

@garyschulte garyschulte force-pushed the feature/serviceManager-in-protocol-context branch 9 times, most recently from 238fb8e to b5244a8 Compare April 9, 2025 05:55
@garyschulte garyschulte marked this pull request as ready for review April 9, 2025 06:24
@garyschulte garyschulte requested a review from jflo April 9, 2025 06:25
@garyschulte garyschulte force-pushed the feature/serviceManager-in-protocol-context branch 2 times, most recently from bcd1ac8 to c3285d6 Compare April 9, 2025 06:57
@@ -52,4 +54,22 @@ public interface ServiceManager {
* is unavailable
*/
<T extends BesuService> Optional<T> getService(Class<T> serviceType);

/** A toy implementation of ServiceManager, suitable for test and mocks. */
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this live in the test packages instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Protocol context builder is using it for the default/unset service manager. I might need to revisit that comment to reflect that

Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
…y their concerns

Signed-off-by: garyschulte <garyschulte@gmail.com>
… base class

Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte force-pushed the feature/serviceManager-in-protocol-context branch from c3285d6 to 2ca8869 Compare April 9, 2025 14:39
@garyschulte garyschulte merged commit dfc585f into hyperledger:main Apr 9, 2025
43 checks passed
@garyschulte garyschulte deleted the feature/serviceManager-in-protocol-context branch April 9, 2025 16:31
@@ -52,4 +54,22 @@ public interface ServiceManager {
* is unavailable
*/
<T extends BesuService> Optional<T> getService(Class<T> serviceType);

/** A basic implementation of ServiceManager, suitable for tests. */
class SimpleServiceManager implements ServiceManager {
Copy link
Contributor

Choose a reason for hiding this comment

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

personal pref: break this out to its own class, possibly in a test path.

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