From b8d182a716b4939ef29b9a03d1896ed9b90bcb27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Thu, 21 Jul 2022 09:56:18 +0200 Subject: [PATCH] Bump `bee-block` and improve vendoring (#88) * Better vendoring * Bump `bee-block` * Bump version * Temp fix CI --- .github/workflows/rust.yml | 4 +++- rust/.gitignore | 12 ------------ rust/Cargo.toml | 4 ++-- rust/build.rs | 6 +++--- rust/src/types/tangle.rs | 14 +++++++------- rust/vendor/.gitignore | 3 +++ rust/vendor/README.md | 2 ++ 7 files changed, 20 insertions(+), 25 deletions(-) delete mode 100644 rust/.gitignore create mode 100644 rust/vendor/.gitignore create mode 100644 rust/vendor/README.md diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0d417d5..0c10bf0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,7 +25,9 @@ jobs: strategy: matrix: rust: [stable] - os: [ubuntu-latest, macos-latest, windows-latest] + # os: [ubuntu-latest, macos-latest, windows-latest] + # Skip windows for now + os: [ubuntu-latest, macos-latest] experimental: [false] steps: diff --git a/rust/.gitignore b/rust/.gitignore deleted file mode 100644 index 09fdce4..0000000 --- a/rust/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -# Generated by Cargo -# Will have compiled files and executables -target/ - -# This is a library, so we ignore the lockfile. -Cargo.lock - -# macOS -.DS_Store - -# vscode -**/.vscode/ diff --git a/rust/Cargo.toml b/rust/Cargo.toml index d2e10eb..56a6931 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "inx" -version = "1.0.0-beta.1" +version = "1.0.0-beta.2" authors = [ "IOTA Stiftung" ] edition = "2021" description = "Rust bindings for IOTA node extensions (INX)" @@ -16,7 +16,7 @@ tonic = { version = "0.7", default-features = false, features = [ "codegen", "pr thiserror = { version = "1.0", default-features = false } # optional -bee-block-stardust = { package = "bee-block", version = "1.0.0-beta.1", default-features = false, features = [ "std" ], optional = true } +bee-block-stardust = { package = "bee-block", version = "1.0.0-beta.2", default-features = false, features = [ "std" ], optional = true } packable = { version = "0.5", default-features = false, optional = true } [build-dependencies] diff --git a/rust/build.rs b/rust/build.rs index 77ce3bc..8dd8295 100644 --- a/rust/build.rs +++ b/rust/build.rs @@ -4,12 +4,12 @@ use std::env; fn main() -> Result<(), std::io::Error> { - let out_dir = env::var("OUT_DIR").unwrap(); let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); + std::fs::copy( format!("{manifest_dir}/../proto/inx.proto"), - format!("{out_dir}/inx.proto"), + format!("{manifest_dir}/vendor/inx.proto"), )?; - tonic_build::compile_protos(format!("{out_dir}/inx.proto"))?; + tonic_build::compile_protos(format!("{manifest_dir}/vendor/inx.proto"))?; Ok(()) } diff --git a/rust/src/types/tangle.rs b/rust/src/types/tangle.rs index 02e0287..96b1067 100644 --- a/rust/src/types/tangle.rs +++ b/rust/src/types/tangle.rs @@ -4,14 +4,14 @@ use super::Error; use crate::proto; use bee_block_stardust as stardust; -use stardust::output::ByteCostConfigBuilder; +use stardust::output::RentStructureBuilder; -impl From for stardust::output::ByteCostConfig { +impl From for stardust::output::RentStructure { fn from(value: proto::RentStructure) -> Self { - ByteCostConfigBuilder::new() - .byte_cost(value.v_byte_cost as u64) - .data_factor(value.v_byte_factor_data as u64) - .key_factor(value.v_byte_factor_key as u64) + RentStructureBuilder::new() + .byte_cost(value.v_byte_cost as u32) + .data_factor(value.v_byte_factor_data as u8) + .key_factor(value.v_byte_factor_key as u8) .finish() } } @@ -30,7 +30,7 @@ pub struct ProtocolParameters { /// The below max depth (BMD) parameter of the tip selection algorithm. pub below_max_depth: u32, /// Defines the parameters for the byte cost calculation - pub rent_structure: stardust::output::ByteCostConfig, + pub rent_structure: stardust::output::RentStructure, /// The overall token supply. pub token_supply: u64, } diff --git a/rust/vendor/.gitignore b/rust/vendor/.gitignore new file mode 100644 index 0000000..ac6c313 --- /dev/null +++ b/rust/vendor/.gitignore @@ -0,0 +1,3 @@ +** +!.gitignore +!README.md diff --git a/rust/vendor/README.md b/rust/vendor/README.md new file mode 100644 index 0000000..977c026 --- /dev/null +++ b/rust/vendor/README.md @@ -0,0 +1,2 @@ +This folder is a target for vendored files. All contains will be generated +automatically and should not be changed manually.