Commit Graph

250 Commits

Author SHA1 Message Date
Csaba Kiraly 8a76817b76
port: serialization should use the backend as well
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-26 15:48:56 +02:00
Csaba Kiraly f45ec3c23c
fixup: remove remaining direct references to blst from por
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-26 15:48:06 +02:00
Csaba Kiraly 8264de6d10
fix blst_backend: use func instead of simple let
With let, there was the following error:
Error: 'generateAuthenticatorNaive' is not GC-safe as it accesses 'ec_p1_mult' which is a global using GC'ed memory
Fix is to use func, which also defines the interface much better.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-26 14:56:45 +02:00
Csaba Kiraly 1c08b33a66
Merge remote-tracking branch 'origin/main' into por-backends
fixing merge conflicts between por-serialize and por-backends

# Conflicts:
#	codex/storageproofs/backends/backend_blst.nim
#	codex/storageproofs/backends/backend_constantine.nim
#	codex/storageproofs/por/por.nim
#	dagger/por/README.md

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-26 14:51:27 +02:00
Dmitriy Ryajov 6ce7e23767
Upload authenticators (#108)
* initial implementation of storage proofs upload

* make sure proof verifies with after deserializing

* add por store

* rename por store to stp store

* rename porstore to stpstore

* add support for host discovery to discovery mock

* add tags upload network tests
2022-05-25 20:29:31 -06:00
Dmitriy Ryajov 738738c3c6
Adding storage proofs store (#109)
* add por store

* rename por store to stp store

* add stp tests
2022-05-24 18:42:49 -06:00
Csaba Kiraly 71a1dc6375
por: select backend and curve using defines
The implementation supports two backends:
 - BLST (default)
 - Constantine (-d:por_backend_constantine)

The implementation supports PoR over the following curves:
 - BLS12-381 (default)
 - BN254_Starks (use -d:por_backend_constantine -d:por_curve_bn254)

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-24 14:27:32 +02:00
Dmitriy Ryajov 56b80d6f6d
Por serialize (#106)
* move por into storage proofs

* use SeekableStream

* adding serialization for por

* remove leftovers

* add empty block support

* add basic por test

* rename block exchange for consistency

* add storageproofstests

* moving timing to storageproofs

* fix imports

* fix imports

* fix imports

* add top level exports

* move delete blocks helper to helpers

* more import/export fixes

* cleanup

* more import fixes

* fix unused warnings

* detect corrupt blocks tests

* add serialization tests

* move init method around

* bump asynctest

* fix CID version

* get rid of warning

* wip: fix CI

* increase CI timeout
2022-05-23 23:24:15 -06:00
Dmitriy Ryajov 6ad7a6bb96
Batched blocks (#105)
* remove sleep

* throttle prefetch

* break loop if conn closed

* logging

* prefetch blocks in batches

* add blocks batch constant
2022-05-20 10:53:34 -06:00
Dmitriy Ryajov d4f3ebc867
reorg engine directory structure (#104) 2022-05-19 16:28:53 -06:00
Michael Bradley 209343087c
Change every dagger to codex (#102) 2022-05-19 13:56:03 -06:00
Mark Spanbroek a3f10f7f20 [ci] disable pull-request comments by codecov 2022-05-19 15:23:35 +02:00
Csaba Kiraly c05f0552a1
por: use multipairings for BN254 curve as well
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 14:00:06 +02:00
Csaba Kiraly d6dbd19865
por: bump Constantine version to include BN254 multipairings
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 13:59:55 +02:00
Csaba Kiraly 45848527ca
por: add description for backend selection
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:54:31 +02:00
Csaba Kiraly 9cc4f449f7
enabling PoR over BN254 curves
To enable the use of BN254, change the value of
`C` in backend_constantine.nim to `BN254_Snarks`

This also requires https://github.com/mratsim/constantine/pull/193

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:49:18 +02:00
Csaba Kiraly ce566d2548
switching back role of G1/G2
newly implemented Constantine feature allows us to use
G1 for authenticators and G2 for the PoS public key.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:49:18 +02:00
Csaba Kiraly 7d8f2f9944
fixup: bad return value for signature deserialize
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:49:17 +02:00
Csaba Kiraly 35688c9b3a
fix debug printing of Constantine BigInt values 2022-05-19 11:49:17 +02:00
Csaba Kiraly d47376f267
bumping Constantine verison to include Hash-to-Curve BLS12-381 G1
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:49:17 +02:00
Csaba Kiraly 9767390018
fix isOnCurve check
this needs to be changed as well when switching between G1 and G2

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:49:17 +02:00
Csaba Kiraly d2cd79a754
remove unused generics to ease compilation
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:49:17 +02:00
Csaba Kiraly aa4596310a
faster verifyPairings
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:49:17 +02:00
Csaba Kiraly ddb613249a
fix verifyPairings implementation
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:49:16 +02:00
Csaba Kiraly 9cc92f117f
WIP: adding constantine backend
This is WIP, not compiling yet
test with
  cd dagger/storageproofs
  ../../env.sh nim c -r testbls.nim
2022-05-19 11:49:06 +02:00
Csaba Kiraly 31d7e712e5
por: separating BLST backend
WIP: func and proc names might be improved later.
2022-05-19 11:46:48 +02:00
Csaba Kiraly bad8186939
storegeproofs: update README
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:44:57 +02:00
Csaba Kiraly 17d802a2f0
use more inplace procs 2022-05-19 11:44:56 +02:00
Csaba Kiraly aec9a6eb92 enable build on Mac M1
- On Mac, -march=native is only supported in newest Clang versions,
better disable it for now.

- Bumping Leopard version to one that support arm64

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-05-19 11:34:49 +02:00
Mark Spanbroek 15a571387f [test] Give integration test a bit more time to complete
For slow windows CI runners.
2022-05-19 10:38:19 +02:00
Mark Spanbroek 49e60d6a5c [clock] Fix test failure when sleepAsync takes a bit longer than expected 2022-05-19 10:38:19 +02:00
Mark Spanbroek d6393de324 [test] Add integration test for sales and purchasing 2022-05-19 10:38:19 +02:00
Mark Spanbroek a87986cdd6 [purchasing] add expiry to storage request via REST API 2022-05-19 10:38:19 +02:00
Mark Spanbroek 8086dda3f2 [purchasing] set selected offer on purchase 2022-05-19 10:38:19 +02:00
Mark Spanbroek d8ef633fb0 [proving] Do not log error when cancelling 2022-05-19 10:38:19 +02:00
Mark Spanbroek cdcab43590 [proving] Use clock instead of getPeriod() and waitUntilPeriod() 2022-05-19 10:38:19 +02:00
Mark Spanbroek 09a7aa3eed [clock] Replace Market.waitUntil() with Clock.waitUntil() 2022-05-19 10:38:19 +02:00
Mark Spanbroek 2992229c3a [ci] limit CI runs to 40 minutes 2022-05-19 10:38:19 +02:00
Mark Spanbroek dcf3d485c4 [tests] Ensure that tests don't hang on closing process 2022-05-19 10:38:19 +02:00
Mark Spanbroek 83522e459c [clock] Avoid crash when getBlock fails 2022-05-19 10:38:19 +02:00
Mark Spanbroek 3a8ce485e4 [sales] Use Clock instead of getTime() 2022-05-19 10:38:19 +02:00
Mark Spanbroek 1e44ed5fd3 [purchasing] Use Clock instead of getTime() 2022-05-19 10:38:19 +02:00
Mark Spanbroek 4210cca6e7 [proving] Use Clock instead of getTime() 2022-05-19 10:38:19 +02:00
Mark Spanbroek 8d19476a4c [sales] Ensure that Sales is completely stopped 2022-05-19 10:38:19 +02:00
Mark Spanbroek 3f627790f8 [proving] Ensure that proving is completely stopped 2022-05-19 10:38:19 +02:00
Mark Spanbroek ea72d99798 [clock] Add Clock interface that abstracts away ethereum details 2022-05-19 10:38:19 +02:00
Mark Spanbroek fa84861d86 [contracts] Add Clock that synchronizes time with EVM 2022-05-19 10:38:19 +02:00
Mark Spanbroek ce38a38849 Update nim-ethers to version 0.1.6 2022-05-19 10:38:19 +02:00
Mark Spanbroek 1848c0334d [purchasing] add purchase status to json output 2022-05-19 10:38:19 +02:00
Mark Spanbroek 43c0a48245 [tests] move node management into separate module
And add a debug option that writes the output of
the node during integration tests to stdout.
2022-05-19 10:38:19 +02:00