Skip to content

Commit

Permalink
feat(proto,types,rpc)!: celestia node v0.20.4 upgrade (#469)
Browse files Browse the repository at this point in the history
Co-authored-by: Mikołaj Florkiewicz <[email protected]>
Co-authored-by: Yiannis Marangos <[email protected]>
Signed-off-by: Yiannis Marangos <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2024
1 parent 61ef061 commit 87fe149
Show file tree
Hide file tree
Showing 18 changed files with 122 additions and 114 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,31 @@ jobs:
target: wasm32-unknown-unknown

- name: Run clippy for native
run: cargo clippy --all --all-targets -- -D warnings -D missing-docs
run: cargo clippy --all --all-targets -- -D warnings

- name: Run clippy for wasm32
run: cargo clippy --all --all-targets --target=wasm32-unknown-unknown -- -D warnings -D missing-docs
run: cargo clippy --all --all-targets --target=wasm32-unknown-unknown -- -D warnings


docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Install toolchain
- name: Install wasm Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
target: wasm32-unknown-unknown

- name: Missing docs for native
run: cargo clippy --all -- -D missing-docs

- name: Missing docs for wasm32
run: cargo clippy --all --target=wasm32-unknown-unknown -- -D missing-docs

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Run rustdoc check
Expand Down
4 changes: 2 additions & 2 deletions ci/Dockerfile.bridge
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ FROM docker.io/alpine:3.19.1
RUN apk update && apk add --no-cache bash jq dasel

# Copy in the binary
COPY --from=ghcr.io/celestiaorg/celestia-node:v0.18.3-mocha /bin/celestia /bin/celestia
COPY --from=ghcr.io/celestiaorg/celestia-node:v0.18.3-mocha /bin/cel-key /bin/cel-key
COPY --from=ghcr.io/celestiaorg/celestia-node:v0.20.4 /bin/celestia /bin/celestia
COPY --from=ghcr.io/celestiaorg/celestia-node:v0.20.4 /bin/cel-key /bin/cel-key

COPY ./run-bridge.sh /opt/entrypoint.sh

Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile.validator
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV CELESTIA_HOME=/root
RUN apk update && apk add --no-cache bash jq

# Copy in the binary
COPY --from=ghcr.io/celestiaorg/celestia-app:v2.3.0 /bin/celestia-appd /bin/celestia-appd
COPY --from=ghcr.io/celestiaorg/celestia-app:v3.0.2 /bin/celestia-appd /bin/celestia-appd

COPY ./run-validator.sh /opt/entrypoint.sh

Expand Down
3 changes: 3 additions & 0 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
- NODE_ID=0
# setting SKIP_AUTH to true disables the use of JWT for authentication
- SKIP_AUTH=true
- CELESTIA_ENABLE_QUIC=1
ports:
- 26658:26658
volumes:
Expand All @@ -42,6 +43,7 @@ services:
# provide an id for the bridge node (default: 0)
# each node should have a next natural number starting from 0
- NODE_ID=1
- CELESTIA_ENABLE_QUIC=1
ports:
- 36658:26658
volumes:
Expand All @@ -60,6 +62,7 @@ services:
# # provide an id for the bridge node (default: 0)
# # each node should have a next natural number starting from 0
# - NODE_ID=2
# - CELESTIA_ENABLE_QUIC=1
# ports:
# - 46658:26658
# volumes:
Expand Down
14 changes: 4 additions & 10 deletions ci/run-validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ wait_for_block() {
local block_num="$1"
local block_hash=""

# Wait for the block to be created
# Wait for the block to be created
while [[ -z "$block_hash" ]]; do
# `|| echo` fallbacks to an empty string in case it's not ready
block_hash="$(celestia-appd query block "$block_num" 2>/dev/null | jq '.block_id.hash' || echo)"
Expand Down Expand Up @@ -133,14 +133,8 @@ setup_private_validator() {
# If you encounter: `sed: -I or -i may not be used with stdin` on MacOS you can mitigate by installing gnu-sed
# https://gist.github.com/andre3k1/e3a1a7133fded5de5a9ee99c87c6fa0d?permalink_comment_id=3082272#gistcomment-3082272
sed -i'.bak' 's|"tcp://127.0.0.1:26657"|"tcp://0.0.0.0:26657"|g' "$CONFIG_DIR/config/config.toml"
sed -i'.bak' 's|"null"|"kv"|g' "$CONFIG_DIR/config/config.toml"

# reduce the time of commiting the proposed block
# bringing this value too low results in errors
sed -i'.bak' 's|^timeout_commit.*|timeout_commit = "1s"|g' "$CONFIG_DIR/config/config.toml"

# Set app version to 1
sed -i'.bak' 's|"app_version": "2"|"app_version": "1"|g' "$CONFIG_DIR/config/genesis.json"
# enable transaction indexing
sed -i'.bak' 's|indexer = .*|indexer = "kv"|g' "$CONFIG_DIR/config/config.toml"
}

main() {
Expand All @@ -150,7 +144,7 @@ main() {
provision_bridge_nodes &
# Start the celestia-app
echo "Configuration finished. Running a validator node..."
celestia-appd start --api.enable --grpc.enable
celestia-appd start --api.enable --grpc.enable --force-no-bbr
}

main
File renamed without changes.
2 changes: 1 addition & 1 deletion node/src/block_ranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub(crate) trait BlockRangeExt {

pub(crate) struct BlockRangeDisplay<'a>(&'a RangeInclusive<u64>);

impl<'a> Display for BlockRangeDisplay<'a> {
impl Display for BlockRangeDisplay<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}-{}", self.0.start(), self.0.end())
}
Expand Down
2 changes: 1 addition & 1 deletion node/src/store/indexed_db_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl IndexedDbStore {
}

trait TransactionOperationFn<'a, Arg>:
FnOnce(&'a Transaction, Arg) -> <Self as TransactionOperationFn<Arg>>::Fut
FnOnce(&'a Transaction, Arg) -> <Self as TransactionOperationFn<'a, Arg>>::Fut
{
type Fut: Future<Output = <Self as TransactionOperationFn<'a, Arg>>::Output>;
type Output;
Expand Down
2 changes: 1 addition & 1 deletion node/src/store/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl From<ExtendedHeader> for VerifiedExtendedHeaders {
}
}

impl<'a> From<&'a ExtendedHeader> for VerifiedExtendedHeaders {
impl From<&'_ ExtendedHeader> for VerifiedExtendedHeaders {
fn from(value: &ExtendedHeader) -> Self {
Self(vec![value.to_owned()])
}
Expand Down
5 changes: 3 additions & 2 deletions node/tests/shwap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ async fn shwap_sampling_forward() {
break height;
}
};
let new_head = timeout(Duration::from_secs(2), get_new_head).await.unwrap();
// timeout is double of the block time on CI
let new_head = timeout(Duration::from_secs(9), get_new_head).await.unwrap();

// wait for height to be sampled
let wait_height_sampled = async {
Expand Down Expand Up @@ -86,7 +87,7 @@ async fn shwap_sampling_backward() {
.unwrap();

// take just first N headers because batch size can be big
let mut headers_to_sample: HashSet<_> = (from_height..to_height).rev().take(50).collect();
let mut headers_to_sample: HashSet<_> = (from_height..to_height).rev().take(25).collect();

// wait for all heights to be sampled
timeout(Duration::from_secs(10), async {
Expand Down
3 changes: 2 additions & 1 deletion proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const OPTION_TIMESTAMP: &str = r#"#[serde(with = "crate::serializers::option_tim
const OPTION_PROTOBUF_DURATION: &str =
r#"#[serde(with = "crate::serializers::option_protobuf_duration")]"#;
const NULL_DEFAULT: &str = r#"#[serde(with = "crate::serializers::null_default")]"#;
const VEC_SKIP_IF_EMPTY: &str = r#"#[serde(skip_serializing_if = "::std::vec::Vec::is_empty")]"#;
const BYTES_SKIP_IF_EMPTY: &str = r#"#[serde(skip_serializing_if = "bytes::Bytes::is_empty")]"#;

#[rustfmt::skip]
Expand Down Expand Up @@ -82,6 +83,7 @@ static CUSTOM_FIELD_ATTRIBUTES: &[(&str, &str)] = &[
(".proof.pb.Proof.nodes", VEC_BASE64STRING),
(".proto.blob.v1.BlobProto.data", BASE64STRING),
(".proto.blob.v1.BlobProto.namespace_id", BASE64STRING),
(".proto.blob.v1.BlobProto.signer", VEC_SKIP_IF_EMPTY),
(".proto.blob.v1.BlobProto.signer", BASE64STRING),
(".shwap.RowNamespaceData.shares", NULL_DEFAULT),
(".shwap.Share", BASE64STRING),
Expand Down Expand Up @@ -111,7 +113,6 @@ const PROTO_FILES: &[&str] = &[
"vendor/celestia/blob/v1/params.proto",
"vendor/celestia/blob/v1/query.proto",
"vendor/celestia/blob/v1/tx.proto",
"vendor/celestia/core/v1/blob/blob.proto",
"vendor/celestia/core/v1/da/data_availability_header.proto",
"vendor/celestia/core/v1/proof/proof.proto",
"vendor/cosmos/auth/v1beta1/auth.proto",
Expand Down
24 changes: 0 additions & 24 deletions proto/vendor/celestia/core/v1/blob/blob.proto

This file was deleted.

6 changes: 3 additions & 3 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ celestia-types.workspace = true
prost.workspace = true

async-trait = "0.1.80"
futures = "0.3.31"
jsonrpsee = { version = "0.24.2", features = ["client-core", "macros"] }
serde = { version = "1.0.203", features = ["derive"] }
thiserror = "1.0.61"
Expand All @@ -34,6 +33,9 @@ http = "1.1.0"
jsonrpsee = { version = "0.24.2", features = ["http-client", "ws-client"] }

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
anyhow = "1.0.86"
dotenvy = "0.15.7"
futures = "0.3.31"
libp2p = { workspace = true, features = [
"tokio",
"macros",
Expand All @@ -42,8 +44,6 @@ libp2p = { workspace = true, features = [
"yamux",
] }
nmt-rs.workspace = true
anyhow = "1.0.86"
dotenvy = "0.15.7"
rand = "0.8.5"
tokio = { version = "1.38.0", features = ["rt", "macros"] }
tracing = "0.1.40"
Expand Down
Loading

0 comments on commit 87fe149

Please sign in to comment.