Git Product home page Git Product logo

popow's People

Contributors

amiller avatar dionyziz avatar gglou avatar gtklocker avatar sdaveas avatar solegga avatar

Watchers

 avatar

popow's Issues

Provide regression tests for submitting contesting proofs

Operation from Proof-of-sidechains, Algorithm 1, line 10 is missing from contractNipopow.sol:331

---------+---x1---->  Ca
         |
         +--->        Cb

and

---------+-------->   Ca
         |
         +--x2->      Cb

  • Create chains Ca and Cb which have a common ancestor block
  • Only Ca contains block x1 and only Cb contains x2
  • Execute the following:
    1.|Ca| > |Cb|: Execute submit_event_proof(Ca, x1) and submit_contesting_proof(Cb, x1)
    2.|Ca| > |Cb|: Execute submit_event_proof(Cb, x2) and submit_contesting_proof(Ca, x2)

Update

Pn denotes the proof that was generated for chain Cn

x0 contained in Pa and Pb

---x0---+-------->  Ca
        |
        +--->       Cb
test case expected output reason received output
submit_event_proof(Pa, x0) TRUE x0 in Ca TRUE
submit_contest_proof(Pb, x0) FALSE |Cb| < |Ca|; existing proof is stronger FALSE
--
submit_event_proof(Pb, x0) TRUE x0 in Cb TRUE
submit_contest_proof(Pa, x0) FALSE FALSE

x1 contained in Pa but not in Pb

--------+---x1--->  Ca
        |
        +--->       Cb
test case expected output reason received output
submit_event_proof(Pa, x1) TRUE x1 in Ca TRUE
submit_contest_proof(Pb, x1) FALSE |Cb| < |Ca|; existing proof is stronger FALSE
--
submit_event_proof(Pb, x1) FALSE x1 not in Cb FALSE
submit_contest_proof(Pa, x1) FALSE event x1 is not mapped yet FALSE

x2 contained in Pb but not in Pb

--------+---------->  Ca
        |
        +--x2-->      Cb
test case expected output reason received output
submit_event_proof(Ca, x2) FALSE x2 not in Ca FALSE
submit_contest_proof(Cb, x2) FALSE event x2 is not mapped yet FALSE
--
submit_event_proof(Cb, x2) TRUE x2 in Cb TRUE
submit_contest_proof(Ca, x2) TRUE |Ca| > |Cb| and x2 not in Ca; honest chain does not include 'x2' TRUE

Add value in function call

Value has not been added to the function call of Web3. Due to this fact, the value of collateral to pay z in the contract manually becomes 0.

Test issue

This issue was opened from the terminal!

Provide regression tests for submitting contesting proofs vol. 2

Issue #9 did some high level testing but there are more some case to be addressed.
This will close #2 as well

Check if nipopowContract.sol works correctly under in the following cases:

  1. The interlinks are invalid
    1. Inclusion fail (wrong Merkle Tree) (see #13 (comment))
    2. Block(s) indicated by some interlink at some level is missing (see #13 (comment))
    3. Leaf of Merkle Tree does not point to the previous block
  2. Proof succeeds at all cases regarding different μ s
    1. μ1 = μ2
    2. μ1 < μ2
    3. μ1 > μ2
  3. Chain does not start from genesis (see #13 (comment))
  4. Less collateral than needed is provided (see (#13 (comment)))
  5. Check if each block has the difficulty of genesis target
    1. Contract should fail calling submit with insufficient funds
    2. Refund collateral to honest caller

Check if some of the attributes of Nipopow struct can be excluded

struct Nipopow consists of various attributes, some of which are used only locally in functions. Check if they can be removed from the struct and used as local variables. This will save storage gas.

  // Nipopow proof.
  struct Nipopow {
    mapping (bytes32 => bool) curProofMap;       // <--- This one
    mapping (uint => uint) levelCounter;         // <--- This one
    mapping (bytes32 => mapping(bytes32 => bool)) blockPrecedence;
    mapping (bytes32 => bytes32[]) blockDAG;
    mapping (bytes32 => bool) visitedBlock;
    bytes32[] traversal_stack;
    bytes32[] ancestors;
    bytes32[] best_proof;
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.