Skip to content

Commit

Permalink
feat(node): Add shwap data types (#169)
Browse files Browse the repository at this point in the history
* Add shwap data types

* Align with celestia protocol updates

* Add docs, fix tests

* fmt

* temp fix

* sort out EDS

* cleanup

* rework a bit after review

* cleanup

* NamespacedData unittest

* Sad return to Vec<u8>

* Update types/src/share.rs

Co-authored-by: Maciej Zwoliński <mac.zwolinski@gmail.com>
Signed-off-by: Mikołaj Florkiewicz <mikolaj@florkiewicz.me>

* you got me docs

* Last of the Missing Documentations

* Final fix tests

* fix throwing out half the data

* Update types/src/namespaced_data.rs

Co-authored-by: Maciej Zwoliński <mac.zwolinski@gmail.com>
Signed-off-by: Mikołaj Florkiewicz <mikolaj@florkiewicz.me>

* Update types/src/namespaced_data.rs

Co-authored-by: Maciej Zwoliński <mac.zwolinski@gmail.com>
Signed-off-by: Mikołaj Florkiewicz <mikolaj@florkiewicz.me>

* remove leftover, add row unitttest

---------

Signed-off-by: Mikołaj Florkiewicz <mikolaj@florkiewicz.me>
Co-authored-by: Maciej Zwoliński <mac.zwolinski@gmail.com>
  • Loading branch information
fl0rek and zvolin authored Jan 12, 2024
1 parent a07d875 commit b87fad2
Show file tree
Hide file tree
Showing 21 changed files with 1,058 additions and 489 deletions.
4 changes: 4 additions & 0 deletions proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ static CUSTOM_TYPE_ATTRIBUTES: &[(&str, &str)] = &[
(".share.eds.byzantine.pb.Share", SERIALIZED),
(".proof.pb.Proof", SERIALIZED),
(".share.p2p.shrex.nd.NamespaceRowResponse", SERIALIZED),
(".share.p2p.shwap.Row", SERIALIZED),
(".share.p2p.shwap.Sample", SERIALIZED),
(".share.p2p.shwap.Data", SERIALIZED),
];

#[rustfmt::skip]
Expand Down Expand Up @@ -83,6 +86,7 @@ fn main() -> Result<()> {
"vendor/celestia/blob/v1/tx.proto",
"vendor/header/pb/extended_header.proto",
"vendor/share/p2p/shrexnd/pb/share.proto",
"vendor/share/p2p/shwap/pb/shwap.proto",
"vendor/share/eds/byzantine/pb/share.proto",
"vendor/cosmos/base/v1beta1/coin.proto",
"vendor/cosmos/base/abci/v1beta1/abci.proto",
Expand Down
28 changes: 28 additions & 0 deletions proto/vendor/share/p2p/shwap/pb/shwap.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
syntax = "proto3";

// TODO: current celestia-node PR doesn't specify the package, we might want to align on it
package share.p2p.shwap;
import "pb/proof.proto"; // celestiaorg/nmt/pb/proof.proto

message Row {
bytes row_id = 1;
repeated bytes row_half = 2;
}

enum SampleProofType {
RowSampleProofType = 0;
ColSampleProofType = 1;
}

message Sample {
bytes sample_id = 1;
SampleProofType sample_type = 2;
bytes sample_share = 3;
proof.pb.Proof sample_proof = 4;
}

message Data {
bytes data_id = 1;
repeated bytes data_shares = 2;
proof.pb.Proof data_proof = 3;
}
10 changes: 9 additions & 1 deletion tools/update-proto-vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ extract_urls ../target/proto-vendor-src \
https://github.com/cosmos/cosmos-proto/archive/refs/tags/v1.0.0-alpha4.tar.gz \
https://github.com/cosmos/gogoproto/archive/refs/tags/v1.4.11.tar.gz \
https://github.com/celestiaorg/go-header/archive/refs/heads/main.tar.gz \
https://github.com/googleapis/googleapis/archive/refs/heads/master.tar.gz
https://github.com/googleapis/googleapis/archive/refs/heads/master.tar.gz \
https://codeload.github.com/celestiaorg/celestia-node/zip/refs/heads/hlib/v2-prototype

mkdir -p vendor

Expand Down Expand Up @@ -70,6 +71,13 @@ for pb_dir in ../target/proto-vendor-src/celestia-node-main/share/*/*/pb; do
cp -r "$pb_dir" "$out_dir"
done

# TODO: replace with version from main, once it is merged
# https://github.com/celestiaorg/celestia-node/pull/2675
rm -rf vendor/share/p2p/shwap
mkdir -p vendor/share/p2p/shwap/pb
cp ../target/proto-vendor-src/celestia-node-hlib-v2-prototype/share/shwap/pb/shwap_pb.proto \
vendor/share/p2p/shwap/pb/shwap.proto

rm -rf vendor/tendermint
cp -r ../target/proto-vendor-src/celestia-core-0.34.x-celestia/proto/tendermint vendor

Expand Down
Loading

0 comments on commit b87fad2

Please sign in to comment.