-
Notifications
You must be signed in to change notification settings - Fork 220
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
Goerli support and genesis changes #593
Conversation
The `nonce` field is `0x42` referencing Douglas Adams' "HitchHiker's Guide | ||
to the Galaxy". | ||
|
||
The `extra_data` field contains the hash of block `1028201` on | ||
the pre-launch Olympus testnet. The creation of block `1028201` on Olympus | ||
marked the "starting gun" for Ethereum block creation. Including its hash | ||
in the genesis block ensured a fair launch of the Ethereum mining process. |
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.
Since these values come from the genesis
parameter, I'm not sure these paragraphs make sense for all inputs (ex. goerli.json
looks like it has a nonce of zero.)
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.
@petertdavies where'd we land on this?
On testnets the genesis configuration usually allocates 1 wei to addresses | ||
`0x00` to `0xFF` to avoid edgecases around precompiles being created or | ||
cleared (by EIP 161). |
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'm not sure how I feel about this. It's certainly a useful and interesting tidbit, but it isn't relevant for mainnet, and isn't a strict requirement for testnets. Feel free to ignore this comment!
src/ethereum/utils/hexadecimal.py
Outdated
|
||
Returns | ||
------- | ||
20_byte_stream : `bytes` |
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.
20_byte_stream : `bytes` | |
20_byte_stream : `Bytes20` |
1fb46e7
to
4afec05
Compare
This module contains code and configuration information enabling the | ||
specification to be used with Ethereum testnets. | ||
|
||
This module does not form part of the Ethereum specification. |
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.
Would this make sense as a separate module, like src/ethereum_testnets/...
or is that not possible?
Clique | ||
^^^^^^ |
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.
Might be nice to expand the heading a bit for people not familiar with clique?
Clique | |
^^^^^^ | |
Clique Consensus | |
^^^^^^^^^^^^^^^^ |
pay_rewards_backup = hardfork.module("spec").pay_rewards | ||
hardfork.module("spec").pay_rewards = dont_pay_rewards | ||
|
||
( | ||
gas_used, | ||
transactions_root, | ||
receipt_root, | ||
block_logs_bloom, | ||
state, | ||
) = hardfork.module("spec").apply_body( | ||
chain.state, | ||
hardfork.module("spec").get_last_256_block_hashes(chain), | ||
signer_address, | ||
block.header.number, | ||
block.header.gas_limit, | ||
block.header.timestamp, | ||
block.header.difficulty, | ||
block.transactions, | ||
block.ommers, | ||
chain.chain_id, | ||
) | ||
|
||
hardfork.module("spec").pay_rewards = pay_rewards_backup |
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.
This answer has an interesting way to import a module under a different handle, such that items from one handle are separate from items from the other:
import sys
import importlib.util
SPEC_OS = importlib.util.find_spec('os')
os1 = importlib.util.module_from_spec(SPEC_OS)
SPEC_OS.loader.exec_module(os1)
sys.modules['os1'] = os1
os2 = importlib.util.module_from_spec(SPEC_OS)
SPEC_OS.loader.exec_module(os2)
sys.modules['os2'] = os2
del SPEC_OS
assert os1 is not os2, \
"Module `os` instancing failed"
I tried it out, and it seems to work for monkey patching (so we could create entirely separate modules clique_frontier
, clique_homestead
, and so on.)
Thoughts?
Closing. This will be superseded by several upcoming PRs. |
This PR adds support for Goerli. I have made two structural changes to achieve this:
src/ethereum/hardfork.py
.src/ethereum/genesis.py
. The genesis hardfork is configurable so that Sepolia genesis (which has abaseFeePerGas
) can be handled cleanly.We should consider whether we should get rid of
MAINNET_FORK_BLOCK
variables, but I have not done this.Cute Animal Picture