Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix breaking changes in latest stable and nightly rust #1375

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup install nightly
# TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed.
- run: rustup install nightly-2024-10-10
- uses: stellar/binaries@v15
with:
name: cargo-fuzz
Expand All @@ -143,15 +144,17 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup install nightly
# TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed.
- run: rustup install nightly-2024-10-10
- run: make doc

readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup install nightly
# TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed.
- run: rustup install nightly-2024-10-10
- run: make readme
- run: git add -N . && git diff HEAD --exit-code

Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ CARGO_DOC_ARGS?=--open

doc: fmt
cargo test --doc -p soroban-sdk -p soroban-sdk-macros --features testutils,hazmat
# TODO: Upgrade to latest nightly after problem that was introduced in nightly-2024-02-05 (https://github.com/dalek-cryptography/curve25519-dalek/issues/618) is resolved.
cargo +nightly doc -p soroban-sdk --no-deps --all-features $(CARGO_DOC_ARGS)
# TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed.
cargo +nightly-2024-10-10 doc -p soroban-sdk --no-deps --all-features $(CARGO_DOC_ARGS)

test: fmt build
cargo hack --feature-powerset --ignore-unknown-features --features testutils --exclude-features docs test
Expand All @@ -24,20 +24,22 @@ check: build fmt
cargo hack check --release --target wasm32-unknown-unknown

build-fuzz:
cd tests/fuzz/fuzz && cargo +nightly fuzz check
# TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed.
cd tests/fuzz/fuzz && cargo +nightly-2024-10-10 fuzz check

readme:
# TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed.
cd soroban-sdk \
&& cargo +nightly rustdoc -- -Zunstable-options -wjson \
&& cargo +nightly-2024-10-10 rustdoc -- -Zunstable-options -wjson \
&& cat ../target/doc/soroban_sdk.json \
| jq -r '.index[.root].docs' \
| jq -r '.index[.root|tostring].docs' \
> README.md

watch:
cargo watch --clear --watch-when-idle --shell '$(MAKE)'

watch-doc:
cargo +nightly watch --clear --watch-when-idle --shell '$(MAKE) doc CARGO_DOC_ARGS='
cargo +nightly-2024-10-10 watch --clear --watch-when-idle --shell '$(MAKE) doc CARGO_DOC_ARGS='

fmt:
cargo fmt --all
Expand Down
5 changes: 3 additions & 2 deletions soroban-sdk/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
};

pub mod bls12_381;
/// A BytesN<N> generated by a cryptographic hash function.
/// A `BytesN<N>` generated by a cryptographic hash function.
///
/// The `Hash<N>` type contains a `BytesN<N>` and can only be constructed in
/// contexts where the value has been generated by a secure cryptographic
Expand Down Expand Up @@ -177,7 +177,8 @@ impl Crypto {
CryptoHazmat::new(env).secp256r1_verify(public_key, &message_digest.0, signature)
}

/// Get a [Bls12_381] for accessing the bls12-381 functions.
/// Get a [Bls12_381][bls12_381::Bls12_381] for accessing the bls12-381
/// functions.
pub fn bls12_381(&self) -> bls12_381::Bls12_381 {
bls12_381::Bls12_381::new(self.env())
}
Expand Down
4 changes: 2 additions & 2 deletions soroban-sdk/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{env::internal, unwrap::UnwrapInfallible, BytesN, Env, TryIntoVal};
/// Ledger retrieves information about the current ledger.
///
/// For more details about the ledger and the ledger header that the values in the Ledger are derived from, see:
/// - https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/ledger-headers
/// - <https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/ledger-headers>
///
/// ### Examples
///
Expand Down Expand Up @@ -83,7 +83,7 @@ impl Ledger {
/// 00:00:00 UTC.
///
/// For more details see:
/// - https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/ledger-headers#close-time
/// - <https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/ledger-headers#close-time>
pub fn timestamp(&self) -> u64 {
internal::Env::get_ledger_timestamp(self.env())
.unwrap_infallible()
Expand Down
Loading
Loading