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

London test fixes #111

Merged
merged 16 commits into from
Feb 19, 2024
Merged

London test fixes #111

merged 16 commits into from
Feb 19, 2024

Conversation

goran-ethernal
Copy link
Collaborator

@goran-ethernal goran-ethernal commented Feb 9, 2024

Description

This PR fixes issues in regards to the London (EIP-1559) fork tests.

Bug Fixes

  1. Move access list from runtime.Contract to Transition. This way, access list is only held by one object.
  2. Moving journal from runtime.Contract to Transition. This way, journal is only held by one object. This was necessary, because journals should be aware of the snapshot number as well (journalRevisions). For example, a contract can call another contract, and that other contract can call a third contract, each call creates a new snapshot. If let's say a call to the third contract fails, any slot or address added to the access list in calls of the first two contracts should not be removed from the access list. That is way journal must be aware of the snapshot id, so that it knows to remove only items from the snapshot that failed.
  3. When applying a transaction in the Transition object, and doing a pre-check of the transaction to see if some basic conditions are met, nonce check was not totally complete. Before this fix, it only checked if the passed nonce is equal from the one in state. Now the check is more granular (checks if nonce is lower, higher, or maxed out, and returns a proper error).
  4. When applying a transaction in the Transition object, and doing a pre-check of the transaction to see if account has enough funds to pay for the transaction, the check was not quite complete in case of Dynamic (London) transactions. This is now synced with geth.
  5. Fixed amounts to be refunded after transaction is applied in the Transition object. Refund quotient was the same for Berlin and London forks, which was not correct.
  6. Commented out burning of base fee in the evm. This should not be done in that place. Left a TODO, since this should be revisited in next PRs.
  7. A check if the return code of the transaction starts with 0xEF when London fork is enabled was missing in the case when deploying a new contract.
  8. When opSelfDestruct is executed, a check if London fork is enabled was missing when doing the refund. Only if London is not enabled, self destruct should do refund to the address that is being suicide.
  9. SIGNEXTEND instruction did not have the correct stack size value.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

@goran-ethernal goran-ethernal self-assigned this Feb 9, 2024
@goran-ethernal goran-ethernal changed the title Tests fixes London test fixes Feb 9, 2024
Base automatically changed from berlin-tests-fix to feature/berlin February 9, 2024 19:37
@goran-ethernal goran-ethernal added the bug-fix Fix for a bug label Feb 9, 2024
@goran-ethernal goran-ethernal force-pushed the london-tests-fix branch 2 times, most recently from 39dc35d to ec652f2 Compare February 12, 2024 07:52
@goran-ethernal goran-ethernal marked this pull request as ready for review February 12, 2024 08:09
@goran-ethernal goran-ethernal force-pushed the london-tests-fix branch 2 times, most recently from fb52f9e to 281d1f6 Compare February 12, 2024 13:52
state/txn.go Show resolved Hide resolved
state/transition_test.go Outdated Show resolved Hide resolved
@goran-ethernal goran-ethernal mentioned this pull request Feb 19, 2024
11 tasks
@goran-ethernal goran-ethernal merged commit 28b8ddb into feature/berlin Feb 19, 2024
8 of 9 checks passed
@goran-ethernal goran-ethernal deleted the london-tests-fix branch February 19, 2024 10:17
goran-ethernal added a commit that referenced this pull request Feb 19, 2024
* EIP-2565 Implementation (0xPolygon#1704)

* implemented EIP-2565

* fixed linting error

* fixed linting error

* fixed TestModExpWithEIP2565

* resolved comments

* resolved comments

* resolved merge conflicts

* Eip 2929 (0xPolygon#1748)

* implemented changes for EIP-2929 (access list)

* added missing files

* fixed unit test Test_opCall

* populate access_list with precompiles only if eip-2929 is activated

* added address to access list for Balance opcode

* added test cases and for EIP-2929 and also call stack output

* changed structure of access list and removed some comments

* fixed linting errors

* fixed AddSlot method

* added test cases for access list

* removed call stack output for Test_Transition_EIP2929

* corrected indentation

* fixed linting errors

* fixed linting errors

* fixed Test_opReturnDataCopy

* removed ActivePrecompile Address slice

* changed the const name

* changed the const name in comments

* change the AddAddress function to a variadic function

* refactored

* added test cases for SLOAD opcode

* fixed linting errors

* refactored code

* resolved merge conflicts

* fixed EIP-2929 test

* Rebase fix

* `Berlin` fork implementation (#81)

* Berlin implementation

* Fix tests

* Lint fix

* Lint fix part 2

* Bug fixes

* Lint fix

* Legacy e2e tests fix

* Unmarshal fix

* Tx signer fix

* Use requires instead of Fatalf

* Pass the TestLondonSignerSender

* Cleanup precompile addresses

* TxSigner fix

* Fix precompiles addresses access in unit test

* Order tx types

* Address comments

---------

Co-authored-by: Stefan Negovanović <stefan@ethernal.tech>

* Rebase fix

* Berlin fixes (#86)

* Add journal to contract access list changes

* small fix on journal

* remove access list from state

* Fix build

* Remove commented code

* Add access list to state_test_util

* Include BerlinToLondon tests as well

* Minor change

---------

Co-authored-by: Stefan Negovanović <stefan@ethernal.tech>

* Use `btcec v2` lib for `ECDSA` keys manipulation (#105)

* Use btcec v2 lib for ECDSA keys manipulation

* Fix test

* Remove key from stake manager

* Warning fix (loop variable capture)

* Bump Ethereum tests version (#119)

* Bump Ethereum tests version

* Linter fixes

* Skip loopMul and minor refactoring

* Refactor Ethereum tests files resolution

* Provide EIP 3607 to each fork config

* Audit duration of each test

* Add detailed logging and skip CREATEBlake2f_MaxRounds test

* Remove -v flag

* small fixes

* fix

* Lint fix

---------

Co-authored-by: Goran Rojovic <goran.rojovic@ethernal.tech>

* London test fixes (#111)

* Tests fixes

* SelfDestruct fix

* Rebase fix

* Journaling fix

* Tests fix

* e2e fix

* subGasLimit fix

* Fix

* Skip CheckEIP1559 e2e test

* Remove auxState field from Transition and use NewTransition function

* increase timeout for UT

* Suppress linting warnings

* underflow test fix

* Revert make file

* Remove panic

* Use %d in the error formatting

---------

Co-authored-by: Stefan Negovanović <stefan@ethernal.tech>

---------

Co-authored-by: Rachit Sonthalia <54906134+rachit77@users.noreply.github.com>
Co-authored-by: Goran Rojovic <goran.rojovic@ethernal.tech>
Co-authored-by: Goran Rojovic <100121253+goran-ethernal@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Fix for a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants