Sitelet https://web.archive.org/web/20210601184420/https://github.com/ethereum/eth2.0-specs/pull/2104
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

Make state_transition not return post-state #2104

Merged
merged 2 commits into from Nov 3, 2020
Merged

Conversation

@hwwhww
Copy link
Contributor

@hwwhww hwwhww commented Oct 15, 2020 •

Issue

  1. It's arguable that the mutability side effect is smell (see #1932 discussion). Although I personally want to remove the side effect, we decide to keep it for now for the code concision and stability.
  2. What worse than the mutability side effect is that the state_transition provides two patterns: (i) it mutates the given state and also (ii) returns the post-state. We're using (i) in the whole specs and (ii) only exists in state_transition.

How did I fix it

Make state_transition not return post-state. The given pre-state should have been mutated to post-state.

@djrtwo
djrtwo approved these changes Nov 3, 2020
Copy link
Contributor

@djrtwo djrtwo left a comment

taking back my approval. going to make sure this isn't used in any unexpected way in tests/test-gen

@djrtwo
djrtwo approved these changes Nov 3, 2020
@djrtwo djrtwo merged commit 6b44f63 into v1.0-candidate Nov 3, 2020
10 checks passed
10 checks passed
ci/circleci: build_deposit_contract Your tests passed on CircleCI!
Details
ci/circleci: checkout_specs Your tests passed on CircleCI!
Details
ci/circleci: codespell Your tests passed on CircleCI!
Details
ci/circleci: install_deposit_contract_web3_tester Your tests passed on CircleCI!
Details
ci/circleci: install_pyspec_test Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: table_of_contents Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
ci/circleci: test_deposit_contract Your tests passed on CircleCI!
Details
ci/circleci: test_deposit_contract_web3_tests Your tests passed on CircleCI!
Details
@djrtwo djrtwo deleted the state_transition_patch branch Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants