Skip to content

ETCM 944 Extract instantiation of InMemoryWorldStateProxy from Blockchain class #1025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 28, 2021

Conversation

leo-bogastry
Copy link
Contributor

@leo-bogastry leo-bogastry commented Jun 23, 2021

Description

On of the things Blockchain class is doing is providing an instantiation of InMemoryWorldStateProxy class. I think is because this class needs a few storages and they are available in Blockchain (because Blockchain is hoarding everything).

Two flavours of InMemoryWorldStateProxy were provided (a normal one and a readonly one). These were merged into one constructor added to InMemoryWorldStateProxy, and it's up to the class instantiating InMemoryWorldStateProxy to pass the normal or readonly mptStorage.

The biggest impact of this refactoring is in the tests.
Access to the RocksDB became a problem and was conflicting a lot.
I'm adding a few comments to the code as well

@leo-bogastry leo-bogastry changed the title Etcm 944 Extract instantiation of InMemoryWorldStateProxy from Blockchain class ETCM 944 Extract instantiation of InMemoryWorldStateProxy from Blockchain class Jun 23, 2021
.getBlockHeaderByHash(block.header.parentHash)
.toRight(MissingParentError) // Should not never occur because validated earlier
execResult <- executeBlockTransactions(block, parent)
initialWorld = InMemoryWorldStateProxy(
Copy link
Contributor Author

@leo-bogastry leo-bogastry Jun 23, 2021

Choose a reason for hiding this comment

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

I moved the creation of the initialWorld here because it made the method executeBlockTransactions more testable.

@leo-bogastry leo-bogastry force-pushed the refactor/ETCM-944-InMemoryWorldStateProxy branch 2 times, most recently from 7e80892 to a30a28c Compare June 25, 2021 08:44
@@ -386,7 +386,7 @@ mantis {
nodes-per-request = 384

# Minimum number of peers required to start fast-sync (by determining the pivot block)
min-peers-to-choose-pivot-block = 3
min-peers-to-choose-pivot-block = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep this change ? Or was it just for testing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ups... that was me testing. I will rollback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@leo-bogastry leo-bogastry force-pushed the refactor/ETCM-944-InMemoryWorldStateProxy branch from 405e2a5 to ce5fe8c Compare June 25, 2021 13:20
@leo-bogastry leo-bogastry merged commit 67d7870 into develop Jun 28, 2021
@leo-bogastry leo-bogastry deleted the refactor/ETCM-944-InMemoryWorldStateProxy branch June 28, 2021 07:09
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