Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

fix: skip codehash check when the code has been deleted in the evm state #1320

Merged
merged 9 commits into from
Oct 19, 2022

Conversation

JayT106
Copy link
Contributor

@JayT106 JayT106 commented Aug 31, 2022

Closes: #1319

just ignores the codehash check when the evm account code is empty.


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Merging #1320 (6523d81) into main (236ca33) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1320      +/-   ##
==========================================
+ Coverage   55.86%   55.88%   +0.01%     
==========================================
  Files         108      108              
  Lines       10017    10021       +4     
==========================================
+ Hits         5596     5600       +4     
  Misses       4140     4140              
  Partials      281      281              
Impacted Files Coverage Δ
x/evm/genesis.go 56.66% <100.00%> (+3.09%) ⬆️

x/evm/genesis.go Outdated Show resolved Hide resolved
x/evm/genesis.go Outdated Show resolved Hide resolved
x/evm/genesis.go Outdated Show resolved Hide resolved
@JayT106 JayT106 force-pushed the genesis-codehash-check branch from 007a950 to 8877d1f Compare September 20, 2022 01:11
@JayT106 JayT106 requested a review from a team as a code owner September 20, 2022 01:11
Copy link
Contributor

@yihuang yihuang left a comment

Choose a reason for hiding this comment

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

LGTM

x/evm/genesis.go Outdated Show resolved Hide resolved
@JayT106 JayT106 force-pushed the genesis-codehash-check branch from 89ede35 to 162b5d2 Compare September 20, 2022 23:51
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

LGTM. Can you also add a unit test case with the empty code hash here?

x/evm/genesis.go Show resolved Hide resolved
@fedekunze fedekunze requested a review from facs95 September 21, 2022 09:29
@JayT106 JayT106 force-pushed the genesis-codehash-check branch from 0ccb7ad to 823735f Compare September 21, 2022 21:50
@JayT106 JayT106 force-pushed the genesis-codehash-check branch from 95cb3f0 to b178f89 Compare September 22, 2022 14:57
@yihuang
Copy link
Contributor

yihuang commented Sep 27, 2022

there seems to be conflicts with main?

@JayT106 JayT106 force-pushed the genesis-codehash-check branch from 0f2f151 to e7ad23a Compare September 27, 2022 15:23
@yihuang
Copy link
Contributor

yihuang commented Sep 28, 2022

LGTM, can we merge this now @fedekunze ?

@danburck
Copy link
Contributor

@yihuang isn't the test with empty code hash still missing?

emptyCodeHash := crypto.Keccak256(nil)
codeHash := common.BytesToHash(emptyCodeHash).String()

@yihuang
Copy link
Contributor

yihuang commented Sep 30, 2022

@yihuang isn't the test with empty code hash still missing?

emptyCodeHash := crypto.Keccak256(nil)
codeHash := common.BytesToHash(emptyCodeHash).String()

Which specific case do you have in mind, the default account has the empty code hash, so the previous test cases tested that.

@JayT106 JayT106 force-pushed the genesis-codehash-check branch from 6f760fc to 2049057 Compare October 17, 2022 15:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

codehash mismatched when initgenesis with exported the evm genesis state
5 participants