Commit Graph

42 Commits

Author SHA1 Message Date
Roman 23212ffe00
test: prepare to call stream disperse 2024-09-03 18:46:29 +08:00
holisticode 0cb039d806
DA: Sampling service (#705)
* initial

* first iteration, lots of lifetime and trait issues, does not compile

* Daniel/sampling service (#706)

* Implement sampling service

* Implement libp2p adapter listen_to_sampling_messages

* temporary empty backend mod; implement start_sampling

* addressed PR comments; moved random sampling subnet list generation to backend (todo impl)

* addressed PR nitpicks

* remove empty mod which was failing CI due to cargo fmt

* removed unused code

---------

Co-authored-by: holisticode <holistic.computing@gmail.com>
Co-authored-by: Daniel Sanchez <sanchez.quiros.daniel@gmail.com>
2024-08-27 13:42:52 -05:00
gusto d5ceceff9e
DA Network in node (#704)
* DA Network in node

* Use ed25519 curve for peerIds in libp2p
2024-08-27 16:47:14 +03:00
Daniel Sanchez c611319622
Da: Network addresses (#703)
* Crate address book

* Add addressbook on necesary places
Incorporate to sampling test

* fmt happy
2024-08-27 10:15:45 +00:00
Daniel Sanchez 2f6d265aa6
Implement filler with original side replication (#702) 2024-08-26 10:20:47 +02:00
gusto 37c22d23ce
DA: Network service executor (#701)
* Nomos cli executor swarm

* Executor swarm and backend in nomos-cli

* Libp2p executor adapter in nomos cli

* Update nomos-cli/src/da/network/backend.rs

Co-authored-by: Daniel Sanchez <sanchez.quiros.daniel@gmail.com>

* Use FillFromNodeList with executor backend

* Integrate Executor backend into the cli

* Use subnetwork id where appropriate

* Common clone_deserialize_error

* Use thiserror

* Minimal dialing in cli swarm

* Send dispersal messages async

* Remove unused connection id

---------

Co-authored-by: Daniel Sanchez <sanchez.quiros.daniel@gmail.com>
2024-08-26 11:00:34 +03:00
Daniel Sanchez fcb903c14a
Implement filler v1 (#698) 2024-08-23 08:56:10 +00:00
Daniel Sanchez 66de571bfa
Da: network service backend (#695)
* Sketch up types and backend skeleton

* Pipe up sampling events

* Pipe up validation blobs events

* Added docs

* Cargo fmt

* Clippy happy

* Debug log events in validator swarm run method
2024-08-22 10:14:42 +00:00
gusto 3671376691
DA: Store and load multiple columns for the same blob in a single node (#694)
* ColumnIndex type in Blob trait

* Store blob id and column after verification

* Use blob_id+column_idx storage scheme in indexer

* Store and load multiple columns for the same blob

* Add comments
2024-08-21 16:23:36 +03:00
gusto 2ca822e6ec
ColumnIndex in DaBlob (#693)
* ColumnIndex in DaBlob

* Use u16 for column index
2024-08-20 13:15:16 +03:00
Daniel Sanchez 2922e9ce74
Da: validator network behaviour & swarm (#691)
* Build up validator behaviour and swarm

* Refactor modules

* More barebones structure on validator swarm

* Refactor protocols into submodule

* Pipe up events stream into swarm impl

* Clippy happy on tests
2024-08-19 16:17:10 +00:00
gusto c7ba1f56f6
DA: Dispersal in Cli App with mock backend (#690)
* WIP: cli dispersal reenable

* WIP: Nomos da network mock in cli app

* Mock adapter with KzgEncoder in cli

* Send BlobInfo to the mempool

* KzgrsSettings in dispersal cli app

* Dispersal backend mock for executor

* build_attestation_message to build_blob_id refactor

* Pass blob metadata via the cli args
2024-08-19 15:44:55 +03:00
Daniel Sanchez d2c178f33d
Da: Network sampling (#689)
* Fix reading messages state machine

* Improve waker on behaviour

* Rename test

* First sketch

* Implement replication

* Refactor protocols names

* Clippy happy

* expose behaviour

* Return dummy on outbound for validator behaviour

* Implement behaviour, lacks streams handling

* Cleanup

* Implement stream handling

* Add some documentation and comments

* Clippy fixes after rebase

* Move all neighbours to test_utils module

* Executor only outgoing streams

* First assault at testing behaviours

* Add debug instead of traces

* Added more logs

* Bullshitting tests

* Fix outstream handling, offers hook to send new peer streams

* Fix blob dispersal handling

* Refactor test, use new api

* Imports cleanup

* Working test

* Add docs

* Non overlapping test port

* Added sampling protocol

* Sketch up sampling behaviour types

* Implement behaviour

* Added test

* Mid protocol, not working

* Reimplement using streams (just outgoing, incoming missing)

* Implemented with single streams

* Fix unreachable code reachable

* Fix block test

* Clippy happy

* Better docs
2024-08-16 11:12:34 +00:00
Daniel Sanchez 5f0707c276
Da: Network dispersal (#688)
* Fix reading messages state machine

* Improve waker on behaviour

* Rename test

* First sketch

* Implement replication

* Refactor protocols names

* Clippy happy

* expose behaviour

* Return dummy on outbound for validator behaviour

* Implement behaviour, lacks streams handling

* Cleanup

* Implement stream handling

* Add some documentation and comments

* Clippy fixes after rebase

* Move all neighbours to test_utils module

* Executor only outgoing streams

* First assault at testing behaviours

* Add debug instead of traces

* Added more logs

* Bullshitting tests

* Fix outstream handling, offers hook to send new peer streams

* Fix blob dispersal handling

* Refactor test, use new api

* Imports cleanup

* Working test

* Add docs

* Non overlapping test port
2024-08-12 09:12:08 +02:00
Roman Zajic 4150c6514d
chore: Da kzgrs unit tests update (#676)
* test: blst error conversions

* test: compute roots of unity

* test: variant with Toeplitz1Cache value

* test: verify_column error cases

* test: add DaEncoderParams::new case

* fix: reduce code duplicity for test_verify_column

* test: build_certificate error cases

* test: Certificate related methods

* test: VidCertificate related methods
- Index

* fix: revert changes for kzgrs-backend
2024-08-05 17:57:33 +08:00
gusto 9ad4ee7a3c
DA: DispersedBlobInfo trait in nomos-core and kzgrs-backend (#686)
* DispersedBlobData in nomos-core

* Implement BlobInfo in kzgrs-backend

* Fullreplication BlobInfo

* Use block info in da mempool

* Blob info in consensus

* Blob info in da-verifier

* BlobInfo in da indexer

* BlobInfo in nomos-api

* Verifier and Indexer integration tests with BlobInfo

* Blob info in nomos node

* Import DaEncoder trait
2024-08-02 20:01:18 +03:00
Daniel Sanchez e380bf4117
Da: network replication fix connection (#685)
* Fix attempt 1 - nonworking

* Added missing open stream request

* Expand outbound lifecycle to openstream state

* Fix reading messages state machine

* Use tracing

* Remove unnecessary loop

* Use stream style for test

* Send 10 messages

* Use quic in test

* Sends and receives

* cargo update fixed the panic

* Refactor test

* reschedule polls

* Clippy cleanup

* Remove leftover features

* Cargo fmt

* Improve waker on behaviour

* Rename test
2024-08-02 16:21:38 +00:00
Daniel Sanchez 91d3558cb2
Create basic structure of mempool network adapter for da sampling (#683)
* Create basic structure of mempool network adapter for da sampling

* Return blob instead from sample method

* fmt
2024-07-26 08:49:24 +00:00
Daniel Sanchez b9efe1f1ba
Da: network replication core (#680)
* Add core structure
Sketch first version of da network handler

* Added assgination module
Added basic assignation trait

* Added assgination module
Added basic assignation trait

* Refuse connection for non members

* Use proper protocol name

* Split in broadcast/dispersal/sampling modules
Move behaviour and handler to broadcast

* Remove unused broadcast behaviour attributes

* Add basic docs

* Remove unused pending errors on broadcast handler

* Clippy happy

* Refactor Broadcast -> Replication

* Pipe message sending

* Clippy happy

* Clippy fmt

* Refactor outgoing -> outgoing_events

* Pipe out replication

* Include subnetworks id in dispersal and replication messages

* Pipe replication messaging

* fmt

* Fix tests
2024-07-25 17:03:32 +00:00
gusto 9ff90e7d1c
DA: Network message types (#681)
* Split message definitions for broadcast, dispersal and sampling

* Expose dispersal messages via crate

* Create nomos-da-messages crate

* From trait implementations for messages

* Rename broadcast to replication
2024-07-25 12:27:55 +03:00
gusto fcda9a6da8
DA Prost integration (#678)
* Prost crate integration for DA

* Packing and unpacking for protobuf messages

* Minimal helper macro for dispersal message

* Use protoc in gh actions

* Move dispersal related protocol to nomos-da-dispersal
2024-07-23 18:24:21 +03:00
Daniel Sanchez f58c296959
Da: verifier bench (#672)
* Use reference for DaBlob on verify

* Add verifier bench

* Fix missing reference refactor

* Clippy happy
2024-07-23 12:43:54 +00:00
Daniel Sanchez 77e65c96e4
Added const sizes to encoder bench (#671) 2024-07-03 12:55:05 +02:00
gusto c9c94c4e55
DA Http Endpoints (#670)
* Api endpoint to add blob and receive attestation

* Nomos DA Certificate serialization

* Kzgrs verification params provider

* Indexer http api using kzgrs

* Plug da http endpoints into nomos api
2024-07-03 12:37:23 +03:00
Daniel Sanchez 126b0b890b
Da: Missing parallel features (#669)
* Added missing ark parallel features

* Remove unnecessary copy

* Toeplitz3 in place

* Fix blob size in encoder bench
2024-07-01 10:54:48 +02:00
Daniel Sanchez fdc242fa48
Da: cache toeplitz1 (#667)
* Added toeplitz1 cache to fk20

* Added toeplitz1 cache benches

* Use toeplitz cache in encoder

* Use cache in bench

* Clippy happy
2024-06-26 16:30:38 +02:00
Daniel Sanchez 8936c331a6
Da: parallel encoder (#665)
* Added basic parallelization to encoder

* Added encoder benchmarks
2024-06-25 15:39:40 +02:00
Daniel Sanchez 96a8ef6032
Da: fk20 encoder (#664)
* Use fft for rs

* Specify evaluation domains

* Fix domains in verifier, decoder and dispersal

* Fix domains in verifier, decoder and dispersal

* Fix size in verifier to fit tests
2024-06-25 13:16:25 +02:00
Daniel Sanchez 9adfbdddc6
Da: fk20 implementation (#663)
* Implement fft_g1

* Fix ifft_g1
Added fft/ifft g1 test

* Parallelize i/fft

* Add i/fft benches

* Fix parallel feature tagging

* Fix bench

* Fix parallelization

* Implement fk20

* Add compute roots of unity method

* Fix ranges

* Remove innecesary collect in fft_g1

* Use domaın and ark fft

* Remove custom fft

* Add fk20 benches

* Clippy happy

* Use threadcount for parallelization

---------

Co-authored-by: mgonen <mehmet@status.im>
2024-06-21 12:43:17 +02:00
Daniel Sanchez 7b9643f17e
DA Protocol V1 (#626)
* Base cleaning of da to new traits/structure
Added new da protocols and types

* DA: KZG+RS core (#632)

* Removed old kzg rs modules

* Added new kzgrs core module

* Implemented bytes_to_polynomial and tests

* Use coefficient form

* Refactor evaluations into method

* Use domain elements instead of roots of unity in tests

* Fix encoding and test

* Clippy happy

* Add comments

* Implement polynomial commitment

* Implement proof generation

* Sketch fn signature for verification

* implement proof verification

* Implemented verification and tests

* Return evaluations from bytes_to_polynomial as well

* Use modular le bytes

* Implement rs encode/decode

* Implement decoding tests

* Implement decode using lagrange

* Cleanup imports

* Da: v1 encoder (#633)

* Added new kzgrs core module

* Implemented bytes_to_polynomial and tests

* Use coefficient form

* Refactor evaluations into method

* Use domain elements instead of roots of unity in tests

* Fix encoding and test

* Clippy happy

* Add comments

* Implement polynomial commitment

* Implement proof generation

* Sketch fn signature for verification

* implement proof verification

* Implemented verification and tests

* Return evaluations from bytes_to_polynomial as well

* Use modular le bytes

* Implement rs encode/decode

* Implement decoding tests

* Implement decode using lagrange

* Added chunksmatrix

* Implement encoder with chunkify

* Added missing files

* Implement commit row commitments

* Implement compute elements (row) proofs

* Fix lib and types exposures

* Implement encoder main methods

* Implement encode method

* Implement chunkify test
Fix related bugs

* Implement compute row kzg commitments
Fix related bugs

* Implement rs encode rows test
Fix related bugs
Refactored API

* Implement row proofs tests
Fix fieldelement encoding/decoding bug

* Implement aggregated commitment test
Implement aggregated column proofs test

* Cleanup

* Fix deps

* Fix tests

* Fix chunk too big test

* Da: v1 verifier (#635)

* Fix encoding and test

* Implement commit row commitments

* Implemented dablob

* Implement verifier new
Implement verifier check column

* Clippy cleanup

* Implement verifier

* Implemented verify column test

* Implemented full verify test

* DA API Payload to Item in mempool  (#634)

* Base cleaning of da to new traits/structure
Added new da protocols and types

* DA: KZG+RS core (#632)

* Removed old kzg rs modules

* Added new kzgrs core module

* Implemented bytes_to_polynomial and tests

* Use coefficient form

* Refactor evaluations into method

* Use domain elements instead of roots of unity in tests

* Fix encoding and test

* Clippy happy

* Add comments

* Implement polynomial commitment

* Implement proof generation

* Sketch fn signature for verification

* implement proof verification

* Implemented verification and tests

* Return evaluations from bytes_to_polynomial as well

* Use modular le bytes

* Implement rs encode/decode

* Implement decoding tests

* Implement decode using lagrange

* Cleanup imports

* Reduce abstraction for certificate and vid metadata

* Allow payload to mempool as long as it converts into item

* Da Certificate verifier

* Add mock certificate for core tests

* Mempool payload verification

* Integrate mock verifiers for tx and certs

* Detach verification from cert and tx

* Seperate payload and item in mempools

* Mempools in integration tests

* Remove old cert verifier

* Network payload to item constraints in da mempool

* Update nomos-da/full-replication/src/lib.rs

Co-authored-by: Daniel Sanchez <sanchez.quiros.daniel@gmail.com>

* Sort attestations for cert signature

* Update nomos-da/full-replication/src/lib.rs

Co-authored-by: Daniel Sanchez <sanchez.quiros.daniel@gmail.com>

---------

Co-authored-by: danielsanchezq <sanchez.quiros.daniel@gmail.com>

* DA API Certificate verification  (#641)

* Redo certificate verification in mempool

* FullReplication verifier params provider

* Integrate da params provider into the node

* DA API Indexer service (#643)

* Base cleaning of da to new traits/structure
Added new da protocols and types

* Remove da availability crate completely

* Scaffold for da storage service

* Indexer service responsible for storage and blockchain subscription

* Handle index related ops only

* Acquire storage and consensus relays

* Indexer trait

* wip: storage adapter

* Use storage adapter instead of storage

* Add consensus adapter trait for block subscriptions

* Consensus block subscriber adapter

* Use metadata from da core in indexer

* Update nomos-services/data-availability/indexer/src/lib.rs

Co-authored-by: Daniel Sanchez <sanchez.quiros.daniel@gmail.com>

* Update nomos-services/data-availability/indexer/src/lib.rs

Co-authored-by: Daniel Sanchez <sanchez.quiros.daniel@gmail.com>

* Use std::ops::Range for da queries

* Return certificate metadata

* Da storage adapter methods

---------

Co-authored-by: danielsanchezq <sanchez.quiros.daniel@gmail.com>

* Reuse evaluations when computing proofs (#647)

* Reuse precomputed evaluations instead of evaluation polynomial for each proof

* kzgrs benchmarks

* Clippy happy

* DA API indexer implementation (#644)

* Rocksb adapter in da indexer

* Handle da service messages

* Remove indexer trait, use storage directly in the indexer service

* Return unordered indexes range

* Load blob by vid from file

* Use VID in consensus

* Change full replication index type to byte array

* Change payload to cert and item to vid where required

* Service integration tests for indexer

* Feature gate rocksdb backend

* Propagate range response send error

* FRIndex to Index

* VID to VidCertificate

* Pass blobs file dir via settings

* Da v1 multiple proofs bench (#648)

* Parallel proof generation bench

* Added bench comment

* Modify domain to fit exact sizes

* Fix domain in benches

* Force parallelization features in lib

* DA: Implement base structure for verifier service (#627)

* Base cleaning of da to new traits/structure
Added new da protocols and types

* Implement base structure for verifier service

* Added comments and todo!

* Cleanup imports

* Size of VidCert in full replication

* Nomos Da Verifier service crate

* Extension replaced with metadata

* Fix DaIndexer service name

* Storage adapter trait in verifier

* Manage lifecycle and messages in verifier

* Blob trait in core

* Common nomos da storage crate

* Use updated nomos da storage in indexer

* Verifier storage adapter

* Libp2p adaper for verifier

* Kzgrs backend in verifier service

* Fix fmt

* Clippy happy

---------

Co-authored-by: Gusto <bacvinka@gmail.com>

* DA Verifier service integration tests (#650)

* Base cleaning of da to new traits/structure
Added new da protocols and types

* Implement base structure for verifier service

* Added comments and todo!

* Cleanup imports

* Size of VidCert in full replication

* Nomos Da Verifier service crate

* Extension replaced with metadata

* Storage adapter trait in verifier

* Manage lifecycle and messages in verifier

* Common nomos da storage crate

* Use updated nomos da storage in indexer

* Verifier storage adapter

* Libp2p adaper for verifier

* Kzgrs backend in verifier service

* Fix fmt

* Data availability tests module

* Return attestation in service msg response

* Common definitions for da tests

* Serde for kzgrs proofs and commitments

* Da verifier integration test

* WIP nomos-core in kzgrs backend

* Kzgrs blob to common module

* Add client zone to verifier test and check if attestations are created

* Cleanup and comments

* Use libp2p only for verifier and indexer service tests

* Lint in da tests

* Simplify da blob serialization

* Remove attester from nomos-core attestation

* Verifier backend error

---------

Co-authored-by: danielsanchezq <sanchez.quiros.daniel@gmail.com>

* DA Kzgrs Backend Certificate implementation (#651)

* Kzgrs backend certificate definition

* Encoded data to certificate test

* Nomos da domain specific tag

* Handle errors in da certificate creation

* Add nomos core traits to da cert

* Derive ordering traits for da index

* Add failure test cases to kzgrs certificate

* Da v1 benches expand (#658)

* Update benches with more cases

* Expand benches

* Added parallel feature

* Fix test comment

Co-authored-by: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com>

* Remove outdated comment

---------

Co-authored-by: Gusto <bacvinka@gmail.com>
Co-authored-by: gusto <bacv@users.noreply.github.com>
Co-authored-by: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com>
2024-06-13 11:23:11 +03:00
Youngjoon Lee acd15a4ed5
Update code related to rust-kzg according to its latest ver (#538) 2023-11-28 17:55:55 +09:00
Al Liu c3422c196c
New http api to nomos-node integration (#490)
* Integrate new http api to nomos-node
2023-11-08 16:55:47 +08:00
Youngjoon Lee c3478cf6a6
Set voter to DA attestation (#498) 2023-11-02 18:44:31 +09:00
Al Liu ba90ed1b55
Nomos http API (#476)
* Info api

* Da blob api (#487)

* Add storage api for new http backend (#488)

* Mempool add APIs (#489)
2023-11-01 17:14:58 +08:00
Al Liu 9b3c675b3a
Metrics api (#466)
* Add metrics API
2023-10-31 17:20:04 +08:00
Giacomo Pasini e50561839d
Remove block contents from mempool (#485)
* Add Hash type param to Attestation and Certificate

* remove block contents from mempool
2023-10-30 12:38:04 +01:00
Al Liu dbac7d7597
fix clippy and check warnings (#452) 2023-10-06 15:08:52 +08:00
Giacomo Pasini f9c446e48c
Add a canonical way to get an id for Attestation and Certificate (#448)
* add hash() method on Attestation and Certificate

* clippy
2023-10-02 15:59:57 +02:00
Daniel Sanchez 95618c0a72
Use selection for blob certificates (#427)
* Use selection for blob certificates

* Fix bin imports

* Fix rebase

* Missing blobs -> certificates refactor

* Fix attestation and certificate as_bytes

* More naming refactors
2023-09-25 15:34:05 +02:00
Giacomo Pasini 5e194922c6
Add da service to nomos node (#404)
* Make  the data availability service work with multiple protocols

* Add a generic way to instantiate DaProtocol

Add settings type and a new `new(Self::Settings)` method to
build a new DaProtocol instance

* Add data availability service to node

* fix tests

* fix imports
2023-09-18 11:43:24 +02:00
Giacomo Pasini d72e54f9be
Add full replication implementation for DA (#396)
Add an initial simple but functional implementation for a data
availability protocol.
Full replication simply encodes bytes in a single blob which is
replicated in all nodes.
2023-09-13 11:01:20 +02:00
Daniel Sanchez 8da13f7012
Da nomos core (#390)
* Refactor da modules
Include da core module in nomos-core

* Include attestation trait

* Added initial approach for Da protocol

* Added empty certificate trait

* Added certificate dispersal method

* Rename validate method to validate attestation

* Clippy happy

* Add validate certificate method
2023-09-11 17:44:26 +02:00