Skip to content
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

Implement MainnetTesterChain #92

Merged
merged 5 commits into from Sep 28, 2017
Merged

Conversation

pipermerriam
Copy link
Member

@pipermerriam pipermerriam commented Sep 8, 2017

Blocker for: ethereum/eth-tester#14

What was wrong?

Py-EVM needs a tester chain that can be used with testing. Primary features needed are:

  • bypass POW validation
  • easy configuration for starting blocks for the various hard forks
  • easy initialization of the chain with custom state

How was it fixed?

Added a new Chain subclass under evm.vm.flavors.tester with these properties.

Cute Animal Picture

531652_15a5d09296b0674673641d8e449a26d5_large

@pipermerriam
Copy link
Member Author

This is just going to track my progress. I'm developing this concurrently with this branch in the ethereum-tester library: ethereum/eth-tester#14

@pipermerriam pipermerriam force-pushed the piper/implement-mainnet-tester branch 5 times, most recently from a3aa9cb to 51e7faf Compare September 26, 2017 22:43
@pipermerriam pipermerriam changed the title stub out MainnetTesterChain Implement MainnetTesterChain Sep 28, 2017
parent_header,
**assoc(header_params, 'gas_limit', parent_header.gas_limit)
)
return create_tester_header_from_parent
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't it make more sense to wrap it with classmethod() here?

Creates and initializes a new block header from the provided
`parent_header`.
"""
return parent_class.create_header_from_parent(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why we want to ignore the class on which the method was called (vm_class) and instead always use parent_class? Maybe it deserves a comment?



@reversed_return
def _generate_vm_configuration(homestead=None, dao=None, anti_dos=None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

It took me a while to realize what values the arguments here could take. Maybe add a _start_block suffix to them, or a docstring?

"""
pass

def configure_forks(self, homestead=None, dao=None, anti_dos=0):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here about the args names

@pipermerriam
Copy link
Member Author

@gsalgado I believe I've addressed all of your comments. Merging when green unless I hear otherwise.


class MaintainGasLimitMixin(object):
@classmethod
def create_tester_header_from_parent(cls, parent_header, **header_params):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be create_header_from_parent?

Copy link
Member Author

Choose a reason for hiding this comment

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

YES! good catch.

@pipermerriam
Copy link
Member Author

fixing test failure here: https://github.com/pipermerriam/py-evm/pull/105

@pipermerriam pipermerriam merged commit 8ef30f5 into master Sep 28, 2017
@pipermerriam pipermerriam deleted the piper/implement-mainnet-tester branch September 28, 2017 20:38
pacrob added a commit to pacrob/py-evm that referenced this pull request Dec 18, 2023
minor formatting updates, remove additional docs to separate pr
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.

None yet

2 participants