Eric Mastro
9241899044
WIP: rebase, add tests, update tests
...
Add correct proof in tests, but it’s not pairing correctly. Needs investigation.
Add tests to test for input reverts for proof verification.
Update verifyproof to test for equal array bounds in proof inputs.
Fix _isOnCurve parameter order.
2022-06-15 17:29:47 +10:00
Eric Mastro
fcd5da0e67
WIP: add further curve checks, compiler optimiser
...
- Add require checks for curve parameters and relevant tests.
- Add compiler optimisation to prevent Storage.sol from being too large to deploy.
2022-06-08 15:17:35 +10:00
Eric Mastro
f684b9a1c0
WiP: more test cases added for BN254
...
Just need real proof test cases to be included.
2022-06-08 15:16:58 +10:00
Eric Mastro
c0be4e9b1d
WIP: reorg curves, use witnet as base
...
Now that curve ops are transactions, need to change up tests so that we can verify the result somehow? https://docs.ethers.io/v5/api/contract/contract/#Contract--write
2022-06-08 15:16:08 +10:00
Eric Mastro
32ff556691
WIP: Add test for verifier
...
Needs valid values to test points that exist on the curve as well as a valid proof. Waiting on https://github.com/status-im/nim-codex/pull/101 to get valid values.
TODO: Convert Bn254.sol contract to a generic witnet EllipticCurve.sol contract and fill in values as needed for the Bn254 curve.
2022-06-08 15:15:05 +10:00
Eric Mastro
976ae66cab
WIP: reorg to allow for more curves
...
Current tests are failing because ECMUL is not a valid opcode in hardhat. Exploring alternatives.
2022-06-08 15:15:05 +10:00
Eric Mastro
98c2555036
chore: clean up
...
- Move bulk of verification to curves/Bn254Proofs.sol
- remove all unneeded structs and add Proof struct
- bring in point `isOnCurve` check so that we can use solidity compiler 0.8.x
- remove all other Bn254 library deps
- changed proof type from bool to Proof
- add Bn254 test file (uncalled yet)
TODO:
- update Proofs test such that verifyProof test is called (need to generate proof using https://github.com/status-im/nim-codex/pull/76 )
- call Bn254 tests from test harness
2022-06-08 15:06:53 +10:00
Eric Mastro
b03a415fb9
WIP: cleanup
2022-06-08 15:04:59 +10:00
Eric Mastro
cbe4024c6f
WIP: Change to passing PublicKey.key in sig verification
2022-06-08 15:04:59 +10:00
Eric Mastro
36c84f58b6
WIP: Swap over to AltBn254 solidity lib
...
Still need to figure out how to stringify TauZero and verify the signature.
2022-06-08 15:04:59 +10:00
Eric Mastro
1d4f9729b0
WIP: Got further without pairings
...
Likely use a diff lib to have a better solidity api
2022-06-08 15:04:59 +10:00
Eric Mastro
aa9d976dd4
WIP: more work but still not finished
2022-06-08 15:04:59 +10:00
Eric Mastro
c0969815a1
WIP: type conversions, start moving verifyProof
...
- Add type conversions from BLS12-381 to BN254
- start moving verifyProof over to BN254 in solidity
2022-06-08 15:04:58 +10:00
Mark Spanbroek
2bf01da728
[proofs] Submitting proof emits event containing proof
2022-04-12 09:04:29 +02:00
Mark Spanbroek
6aa2894521
[marketplace] Use dynamically sized arrays for PoR
...
ABI encoding sometimes fails on large byte arrays of fixed size.
2022-04-11 12:10:57 +02:00
Mark Spanbroek
b145e66a68
[storage] add getRequest() and getOffer()
2022-04-11 12:10:57 +02:00
Mark Spanbroek
b8ce6c3682
[marketplace] Add erasure coding and PoR attributes to request
2022-04-11 12:10:57 +02:00
Mark Spanbroek
29b5775951
[proofs] willProofBeRequired() predicts proof requirement
2022-04-05 11:36:31 +02:00
Mark Spanbroek
81c7dcd25a
Disallow finishing of contract that wasn't started
2022-03-22 12:41:13 +01:00
Mark Spanbroek
c606b455d6
Disallow starting an offer that was not selected
2022-03-22 12:41:13 +01:00
Mark Spanbroek
3fd7c756d9
Fix flaky tests
...
By ensuring that there's enough blocks left
for submitting a proof.
2022-03-15 10:01:12 +01:00
Mark Spanbroek
f8ddc4a2f6
Add getChallenge() to Storage contract
2022-03-15 10:01:12 +01:00
Mark Spanbroek
fd55afcc5a
Make pointer downtime configurable
2022-03-15 10:01:12 +01:00
Mark Spanbroek
476956c4d5
Replace pointer duos with pointer downtime design
2022-03-15 10:01:12 +01:00
Mark Spanbroek
6d726fc2cc
Require a block height of at least 256
2022-03-15 10:01:12 +01:00
Mark Spanbroek
07d0e33789
Disable solhint about relying on timestamp
2022-03-15 10:01:12 +01:00
Mark Spanbroek
78eaaa7812
Replace Proof implementation with new design
...
More info: https://github.com/status-im/dagger-research/pull/66
2022-03-15 10:01:12 +01:00
Mark Spanbroek
ee4683e50c
Add proof probability to Request
2022-03-15 10:01:12 +01:00
Mark Spanbroek
036a214427
Proof period and proof timeout are network constants now
2022-03-15 10:01:12 +01:00
Mark Spanbroek
e818d70b85
Remove Contracts in favor of Marketplace
2022-03-15 10:01:12 +01:00
Mark Spanbroek
7e7134b99d
Allow events to be filtered by request id
2022-03-15 10:01:12 +01:00
Mark Spanbroek
c835ac1cc4
Emit event when offer is selected
2022-03-15 10:01:12 +01:00
Mark Spanbroek
05fbd244e2
Formatting
2022-03-15 10:01:12 +01:00
Mark Spanbroek
6e6cc1a230
Reject offer for expired request
2022-03-15 10:01:12 +01:00
Mark Spanbroek
85b212c703
Select a storage offer
2022-03-15 10:01:12 +01:00
Mark Spanbroek
cc57155792
Lock collateral of host that offers storage
2022-03-15 10:01:12 +01:00
Mark Spanbroek
980e2343ed
Add expiry to storage requests
2022-03-15 10:01:12 +01:00
Mark Spanbroek
18e667bf19
Use client/host address to check for duplicates
...
Removes the need for the extra correctness checks
on request size and offer expiry, since these are
no longer used to check for duplicates.
2022-03-15 10:01:12 +01:00
Mark Spanbroek
ae92f63987
Add host address to offers
2022-03-15 10:01:12 +01:00
Mark Spanbroek
51e2d65596
Add client address to requests
2022-03-15 10:01:12 +01:00
Mark Spanbroek
b349b76ab7
Offer storage using Marketplace contract
2022-03-15 10:01:12 +01:00
Mark Spanbroek
f9cc73d62f
Rename invariants to avoid name clashes
2022-03-15 10:01:12 +01:00
Mark Spanbroek
e1ef2a2216
Request storage using Marketplace contract
2022-03-15 10:01:12 +01:00
Mark Spanbroek
e963a25c94
Replace Stakes with Collateral
...
Removes the old Stakes implementation in favor of the
new Collateral implementation.
2022-03-01 09:38:53 +01:00
Mark Spanbroek
1f01704afd
Document the account locking design
2022-03-01 09:38:53 +01:00
Mark Spanbroek
91a976a007
Prevent withdrawal of locked collateral
2022-03-01 09:38:53 +01:00
Mark Spanbroek
c5fab40535
Account locking
2022-03-01 09:38:53 +01:00
Mark Spanbroek
ab38473688
Slash collateral
2022-03-01 09:38:53 +01:00
Mark Spanbroek
2f59927b30
Check result of ERC20 transferFrom call
2022-03-01 09:38:53 +01:00
Mark Spanbroek
9e0d05965d
Update collateral totals and balance at the same time
2022-03-01 09:38:53 +01:00