Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Piper/add chain.mine block api#103

Merged
pipermerriam merged 9 commits intomasterfrom
piper/add-Chain.mine_block-api
Sep 28, 2017
Merged

Piper/add chain.mine block api#103
pipermerriam merged 9 commits intomasterfrom
piper/add-Chain.mine_block-api

Conversation

@pipermerriam
Copy link
Member

@pipermerriam pipermerriam commented Sep 27, 2017

What was wrong?

  • The Chain.ensure_blocks_are_equal seemed to only exist because it needed to be overridden in some tests.
  • Needed a Chain.mine_block() function for non-import based blockchain advancement. This is needed in Implement MainnetTesterChain #92
  • The configure_homestead_header function delegated to the configure_frontier_header function, but only to perform the validation of the header_params.

How was it fixed?

  • Modified the test fixture that needed this override and moved this to a utility function.
  • Added a Chain.mine_block() API
  • Moved the header_params validation to a stand-alone function and decoupled the two frontier and homestead functions.

Cute Animal Picture

put a cute animal picture here.

@pipermerriam
Copy link
Member Author

@gsalgado Can you give this a look? It's technically three things. All small. If you'd prefer I separate them into individual PRs I will.

}


def validate_header_parames_for_configuration(header_params):
Copy link
Contributor

Choose a reason for hiding this comment

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

s/parames/params?

if chain.should_be_canonical_chain_head(imported_block):
chain.add_to_canonical_chain_head(imported_block)

return imported_block
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit worried about duplicating the whole import_block() method here as there's nothing to ensure both implementations are identical. It could lead to tests that pass just because we're not exercising the actual production code. That's not an issue when we simply make the validation method a no-op

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to use the kwarg approach we talked about.

@pipermerriam
Copy link
Member Author

@gsalgado Addressed your comments. going to merge when green unless I hear otherwise.

@pipermerriam pipermerriam merged commit 50e2734 into master Sep 28, 2017
@pipermerriam pipermerriam deleted the piper/add-Chain.mine_block-api branch January 25, 2018 22:42
pacrob added a commit to pacrob/py-evm that referenced this pull request Dec 18, 2023
* add pre-commit

* run pre-commit

* skip lint on README.md as it breaks template filling
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants