Skip to content

Mutable BlockchainConfig in TestNode#1038

Merged
jvdp merged 24 commits intodevelopfrom
refactor/ETCM-966-uncake-blockchain-config
Jul 16, 2021
Merged

Mutable BlockchainConfig in TestNode#1038
jvdp merged 24 commits intodevelopfrom
refactor/ETCM-966-uncake-blockchain-config

Conversation

@jvdp
Copy link
Copy Markdown
Contributor

@jvdp jvdp commented Jul 6, 2021

This to fix some issues with test mode where (parts of) BlockchainConfig can change at run time, and also try out a refactoring to deal with issues stemming from the cake pattern:

  • actors and RPC-service classes get an instance to the node (via the BlockchainConfigBuilder trait in this case) instead of the BlockchainConfig directly. This preserves the laziness in build initialization order (as provided by the cake) and configurability for tests. And also adds mutability, which is convenient for test mode.
  • service (strategy pattern) classes such as BlockExecution are now not constructed with the BlockchainConfig dependency as a parameter but get it as implicit parameter instead. By using the implicit, impact on code is minimized and this refactoring is entirely mechanical in only a few places (the builder trait, the service class itself and test setup.)

Comment thread src/main/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSync.scala Outdated
Comment thread src/main/scala/io/iohk/ethereum/testmode/TestModeComponentsProvider.scala Outdated
Comment thread src/test/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSyncSpec.scala Outdated
@jvdp jvdp force-pushed the refactor/ETCM-966-uncake-blockchain-config branch from 6214093 to 6586c4d Compare July 7, 2021 19:21
Comment thread src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockImporter.scala Outdated
Comment thread src/main/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSync.scala Outdated
Comment thread src/main/scala/io/iohk/ethereum/jsonrpc/EthMiningService.scala
@jvdp jvdp marked this pull request as ready for review July 9, 2021 07:38
@jvdp jvdp merged commit 1fafffd into develop Jul 16, 2021
@jvdp jvdp deleted the refactor/ETCM-966-uncake-blockchain-config branch July 16, 2021 14:41
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