sdaveas / popow

Research and implementation for non-interactive blockchain proofs of proofs of work
0 stars 0 forks source link

Provide regression tests for submitting contesting proofs vol. 2 #13

Open sdaveas opened 4 years ago

sdaveas commented 4 years ago

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 https://github.com/sdaveas/popow/issues/13#issuecomment-594869725) 2) Block(s) indicated by some interlink at some level is missing (see https://github.com/sdaveas/popow/issues/13#issuecomment-594869725) 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 https://github.com/sdaveas/popow/issues/13#issuecomment-594105833) 4) Less collateral than needed is provided (see (https://github.com/sdaveas/popow/issues/13#issuecomment-594871285)) 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

sdaveas commented 4 years ago

Case 3 fails. Contract needs to know hash of the genesis block. We have to provide that upon instantiation of is there any way to avoid that? Client should be able use the contract for different blockchains as well.

sdaveas commented 4 years ago

Case 1i and 1ii works, see 32aa8482beb390a923aac2d4aaf154986a139199

sdaveas commented 4 years ago

Case 4 works, see 837069a3ed04c9d6053f342798b215120b9beab7