-
Notifications
You must be signed in to change notification settings - Fork 62
fix: use MiningChain #398
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
base: master
Are you sure you want to change the base?
fix: use MiningChain #398
Conversation
as of py-evm 0.12.x, MainnetChain behaves differently (doesn't have all the header fields filled in). use MiningChain as going forward it will apparently be more future-proof
I am getting a fix in for that I can't speak to the integration test failures here but this is the recommended way to instantiate the chain. I suggested another approach that can likely make things more modular for future iterations and allow you to control what VM you are at rather than relying on the changing |
@@ -565,13 +565,13 @@ def get_storage_slot(self, address: Address, slot: int) -> bytes: | |||
return data.to_bytes(32, "big") | |||
|
|||
|
|||
GENESIS_PARAMS = {"difficulty": constants.GENESIS_DIFFICULTY, "gas_limit": int(1e8)} | |||
GENESIS_PARAMS = {"gas_limit": int(1e8)} | |||
|
|||
|
|||
# TODO make fork configurable - ex. "latest", "frontier", "berlin" | |||
# TODO make genesis params+state configurable | |||
def _make_chain(): | |||
# TODO should we use MiningChain? is there a perf difference? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can probably go now.
|
||
|
||
# TODO make fork configurable - ex. "latest", "frontier", "berlin" | ||
# TODO make genesis params+state configurable | ||
def _make_chain(): | ||
# TODO should we use MiningChain? is there a perf difference? | ||
# TODO debug why `fork_at()` cannot accept 0 as block num | ||
_Chain = chain.build(MainnetChain, chain.latest_mainnet_at(1)) | ||
_Chain = chain.build(MiningChain, chain.latest_mainnet_at(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would definitely recommend using MiningChain
over MainnetChain
for stability and your own control. Alternatively, you can configure the chain directly:
_Chain = MiningChain.configure(chain_id=1, vm_configuration=[(0, PragueVM)])
Seeing as one of the comments above has a goal to make this configurable, you could eventually configure it as, for example, Cancun to Prague at 5:
vm_configuration=[(0, CancunVM), (5, PragueVM)])
@@ -565,13 +565,13 @@ def get_storage_slot(self, address: Address, slot: int) -> bytes: | |||
return data.to_bytes(32, "big") | |||
|
|||
|
|||
GENESIS_PARAMS = {"difficulty": constants.GENESIS_DIFFICULTY, "gas_limit": int(1e8)} | |||
GENESIS_PARAMS = {"gas_limit": int(1e8)} | |||
|
|||
|
|||
# TODO make fork configurable - ex. "latest", "frontier", "berlin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See suggestion below.
i suspect the test failures have to do with changing the start block from
|
as of py-evm 0.12.x, MainnetChain behaves differently (doesn't have all the header fields filled in). use MiningChain as going forward it will apparently be more future-proof
What I did
fix for #397
How I did it
How to verify it
Description for the changelog
Cute Animal Picture