refactor(levm): improve and simplify some db functions#2651
Conversation
Lines of code reportTotal lines added: Detailed view |
Benchmark Results ComparisonPR ResultsBenchmark Results: Factorial
Benchmark Results: Factorial - Recursive
Benchmark Results: Fibonacci
Benchmark Results: ManyHashes
Benchmark Results: BubbleSort
Benchmark Results: ERC20 - Transfer
Benchmark Results: ERC20 - Mint
Benchmark Results: ERC20 - Approval
Main ResultsBenchmark Results: Factorial
Benchmark Results: Factorial - Recursive
Benchmark Results: Fibonacci
Benchmark Results: ManyHashes
Benchmark Results: BubbleSort
Benchmark Results: ERC20 - Transfer
Benchmark Results: ERC20 - Mint
Benchmark Results: ERC20 - Approval
|
EF Tests Comparison
|
rodrigo-o
left a comment
There was a problem hiding this comment.
LGTM. Just a brief question, the _no_push_cache version was just needed because of the account_exists? that's what I infer from the desc but wanted to be sure.
| // https://eips.ethereum.org/EIPS/eip-161 change the definition of empty address | ||
| let value_to_empty_account = if (!address_exists && fork < Fork::SpuriousDragon) | ||
| || address_is_empty && !value_to_transfer.is_zero() && fork >= Fork::SpuriousDragon | ||
| { |
There was a problem hiding this comment.
Nit: Probably worth mentioning in the description that we were able to remove this due to stop supporting pre-merge forks.
There was a problem hiding this comment.
You are right. I should've mentioned that
Yes, we were actually doing some weird things with |
) **Motivation** <!-- Why does this pull request exist? What are its goals? --> - Try to remove `account_exists` if possible because it adds complexity and unnecessary checks to the DB. - Try to finally remove `get_account_no_push_cache`, which is related to the previous thing too. **Description** - We now ignore a specific test because [EIP-7702 spec has changed](ethereum/EIPs#9710) and we no longer need to check if the account exists in the trie. - Remove `Option` from `specific_tests` - Remove `get_account_no_push_cache` and the usage of `account_exists` in LEVM. This method is not deleted from the Database because it's used in `get_state_transitions`, and even here it could be removed but I think it is better to keep it in this PR and maybe decide later what to do with this function. (If we remove it it wouldn't make a difference to the state though). - We were able to remove a SpuriousDragon check because we don't support pre-merge forks now Note: `account_exists` hasn't been completely removed from `Database` because we use it in `get_state_transitions` but that is going to change soon and we'll be able to remove it. <!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 --> Closes #issue_number
Motivation
account_existsif possible because it adds complexity and unnecessary checks to the DB.get_account_no_push_cache, which is related to the previous thing too.Description
Optionfromspecific_testsget_account_no_push_cacheand the usage ofaccount_existsin LEVM. This method is not deleted from the Database because it's used inget_state_transitions, and even here it could be removed but I think it is better to keep it in this PR and maybe decide later what to do with this function. (If we remove it it wouldn't make a difference to the state though).Note:
account_existshasn't been completely removed fromDatabasebecause we use it inget_state_transitionsbut that is going to change soon and we'll be able to remove it.Closes #issue_number