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

Remove codeContractAddress from Enforcer, Verifier, implement EVMCode #137

Closed
wants to merge 25 commits into from

Conversation

peara
Copy link
Member

@peara peara commented Jun 16, 2019

#117
Changes:

  • EVMCode:
    • Support query for code (can be 1 byte or 32 bytes) at a specific pc. Return 0xfe if not known.
    • Support query for arbitrary code length for CODECOPY
  • Enforcer: drop codeContractAddress
  • Verifier:
    • drop codeContractAddress
    • submitProof will require codes with proofs. At most 2 Merkle proofs are need. 1 for the opcode at current pc. 1 for the data as in PUSH or for another opcode as in JUMP.
  • EVMRuntime: in run, revert if encounter unknown code.
  • Fix tests:
    • Merkelizer should support code proof
    • SubmitProof should submit required code and proofs
    • Verifier, Enforcer, disputes, i.e. a lots 😄

@codecov-io
Copy link

codecov-io commented Jun 19, 2019

Codecov Report

Merging #137 into master will decrease coverage by 3.15%.
The diff coverage is 87.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #137      +/-   ##
=========================================
- Coverage   96.86%   93.7%   -3.16%     
=========================================
  Files           7       7              
  Lines        1306    1303       -3     
  Branches      223     224       +1     
=========================================
- Hits         1265    1221      -44     
- Misses         16      57      +41     
  Partials       25      25
Impacted Files Coverage Δ
contracts/PlasmaVerifier.sol 18.75% <ø> (-71.05%) ⬇️
contracts/EthereumRuntime.sol 100% <100%> (ø) ⬆️
contracts/EVMRuntime.sol 98.02% <100%> (-0.6%) ⬇️
contracts/Verifier.sol 85.12% <83.33%> (-1.06%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ddf2cc...cead43b. Read the comment docs.

@peara peara changed the title [WIP] Remove codeContractAddress from Enforcer, Verifier, basic impl for EVMCode Remove codeContractAddress from Enforcer, Verifier, implement EVMCode Jun 26, 2019
pinkiebell added a commit that referenced this pull request Jul 4, 2019
This includes a few changes to the original PR.
Notably:
- remove fragLength
- fix that out of bounds code reads return zero(es)
Also:
- fix CODECOPY opcode as driveby (out of bounds reads are ZERO) and not
  an error
pinkiebell added a commit that referenced this pull request Jul 5, 2019
* Import first part of #137

This includes a few changes to the original PR.
Notably:
- remove fragLength
- fix that out of bounds code reads return zero(es)
Also:
- fix CODECOPY opcode as driveby (out of bounds reads are ZERO) and not
  an error

* pos >= self.length !
@@ -32,6 +16,81 @@ module.exports = class Merkelizer extends AbstractMerkleTree {
return res;
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Next partial PR I would say. We can extend AbstractMerkleTree and get a own class for a general 'word-sized'-merkle tree. So we can re-use this for calldata and so on 🙂

pinkiebell added a commit that referenced this pull request Jul 9, 2019
The `FragmentTree` does not follow orignal code hashing.
A fragment leaf consists of `value`, `slot` and `byteLength`.
`byteLength` is the orignal length of any given bytes.
pinkiebell added a commit that referenced this pull request Jul 11, 2019
The `FragmentTree` does not follow orignal code hashing.
A fragment leaf consists of `value`, `slot` and `byteLength`.
`byteLength` is the orignal length of any given bytes.
pinkiebell added a commit that referenced this pull request Jul 11, 2019
pinkiebell added a commit that referenced this pull request Jul 11, 2019
@pinkiebell
Copy link
Contributor

Linking #143 #147 #148

pinkiebell added a commit that referenced this pull request Jul 13, 2019
pinkiebell added a commit that referenced this pull request Jul 15, 2019
@pinkiebell
Copy link
Contributor

🎉 🎉 🎉

Good work @peara

Integrated via #143 #147 #148

@pinkiebell pinkiebell closed this Jul 15, 2019
@pinkiebell pinkiebell deleted the feat-117 branch July 28, 2019 02:11
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.

3 participants