From ead7929db4c13fdebf70038e20fbf88e2babe3bb Mon Sep 17 00:00:00 2001 From: salaheldinsoliman <49910731+salaheldinsoliman@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:48:30 +0100 Subject: [PATCH 1/3] Rust 1.75.0 (#1673) --- .github/workflows/release.yml | 10 +++++----- .github/workflows/test.yml | 18 +++++++++--------- Cargo.toml | 2 +- Dockerfile | 2 +- docs/installing.rst | 2 +- solang-parser/src/helpers/loc.rs | 12 ++++++------ solang-parser/src/lexer.rs | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc9565c3f..dda2a90e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - name: Build run: cargo build --verbose --release - name: Run tests @@ -41,7 +41,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y gcc g++ make - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - name: Get LLVM run: curl -sSL --output llvm16.0-linux-arm64.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-linux-arm64.tar.xz - name: Extract LLVM @@ -74,7 +74,7 @@ jobs: run: unzip c:\llvm.zip -d c:/ - name: Add LLVM to Path run: echo "c:\llvm16.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 with: components: clippy - name: Build @@ -97,7 +97,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - name: Get LLVM run: curl -sSL --output llvm16.0-mac-arm.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-arm.tar.xz - name: Extract LLVM @@ -124,7 +124,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - name: Get LLVM run: wget -q -O llvm16.0-mac-intel.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-intel.tar.xz - name: Extract LLVM diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 220310709..e15928880 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,7 +63,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@master with: - toolchain: 1.74.0 + toolchain: 1.75.0 components: | llvm-tools clippy @@ -120,7 +120,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y gcc g++ make - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - name: Get LLVM run: curl -sSL --output llvm16.0-linux-arm64.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-linux-arm64.tar.xz - name: Extract LLVM @@ -153,7 +153,7 @@ jobs: # Use C:\ as D:\ might run out of space - name: "Use C: for rust temporary files" run: echo "CARGO_TARGET_DIR=C:\target" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 with: components: clippy # We run clippy on Linux in the lint job above, but this does not check #[cfg(windows)] items @@ -179,7 +179,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - name: Get LLVM run: curl -sSL --output llvm16.0-mac-arm.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-arm.tar.xz - name: Extract LLVM @@ -205,7 +205,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - name: Get LLVM run: wget -q -O llvm16.0-mac-intel.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-intel.tar.xz - name: Extract LLVM @@ -267,7 +267,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '16' - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - name: Setup yarn run: npm install -g yarn - uses: actions/download-artifact@v4.1.8 @@ -318,7 +318,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '16' - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - uses: actions/download-artifact@v4.1.8 with: name: solang-linux-x86-64 @@ -360,7 +360,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '16' - - uses: dtolnay/rust-toolchain@1.74.0 + - uses: dtolnay/rust-toolchain@1.75.0 - uses: actions/download-artifact@v4.1.8 with: name: solang-linux-x86-64 @@ -537,7 +537,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@master with: - toolchain: 1.74.0 + toolchain: 1.75.0 components: llvm-tools - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov diff --git a/Cargo.toml b/Cargo.toml index d1a1a2fba..d7de9f87c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" build = "build.rs" description = "Solang Solidity Compiler" keywords = [ "solidity", "compiler", "solana", "polkadot", "substrate" ] -rust-version = "1.74.0" +rust-version = "1.75.0" edition = "2021" exclude = [ "/.*", "/docs", "/examples", "/solana-library", "/tests", "/integration", "/vscode", "/testdata" ] diff --git a/Dockerfile b/Dockerfile index 00df95197..46a9c895d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ COPY . src WORKDIR /src/stdlib/ RUN make -RUN rustup default 1.74.0 +RUN rustup default 1.75.0 WORKDIR /src RUN cargo build --release diff --git a/docs/installing.rst b/docs/installing.rst index aa08bf2bb..b59a46535 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -89,7 +89,7 @@ Option 5: Build Solang from source In order to build Solang from source, you will need: -* Rust version 1.74.0 or higher +* Rust version 1.75.0 or higher * A C++ compiler with support for C++17 * A build of LLVM based on the Solana LLVM tree. There are a few LLVM patches required that are not upstream yet. diff --git a/solang-parser/src/helpers/loc.rs b/solang-parser/src/helpers/loc.rs index e109e6414..701023426 100644 --- a/solang-parser/src/helpers/loc.rs +++ b/solang-parser/src/helpers/loc.rs @@ -48,19 +48,19 @@ impl OptionalCodeLocation for Vec { } } -impl<'a, T: ?Sized + OptionalCodeLocation> OptionalCodeLocation for &'a T { +impl OptionalCodeLocation for &T { fn loc_opt(&self) -> Option { (**self).loc_opt() } } -impl<'a, T: ?Sized + OptionalCodeLocation> OptionalCodeLocation for &'a mut T { +impl OptionalCodeLocation for &mut T { fn loc_opt(&self) -> Option { (**self).loc_opt() } } -impl<'a, T: ?Sized + ToOwned + OptionalCodeLocation> OptionalCodeLocation for Cow<'a, T> { +impl OptionalCodeLocation for Cow<'_, T> { fn loc_opt(&self) -> Option { (**self).loc_opt() } @@ -163,19 +163,19 @@ impl CodeLocation for Loc { } } -impl<'a, T: ?Sized + CodeLocation> CodeLocation for &'a T { +impl CodeLocation for &T { fn loc(&self) -> Loc { (**self).loc() } } -impl<'a, T: ?Sized + CodeLocation> CodeLocation for &'a mut T { +impl CodeLocation for &mut T { fn loc(&self) -> Loc { (**self).loc() } } -impl<'a, T: ?Sized + ToOwned + CodeLocation> CodeLocation for Cow<'a, T> { +impl CodeLocation for Cow<'_, T> { fn loc(&self) -> Loc { (**self).loc() } diff --git a/solang-parser/src/lexer.rs b/solang-parser/src/lexer.rs index 55795eea0..1da4c7954 100644 --- a/solang-parser/src/lexer.rs +++ b/solang-parser/src/lexer.rs @@ -182,7 +182,7 @@ pub enum Token<'input> { Annotation(&'input str), } -impl<'input> fmt::Display for Token<'input> { +impl fmt::Display for Token<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Token::Identifier(id) => write!(f, "{id}"), From ef9e5fd3458d03de4c9a467837f2bf8117094648 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:27:18 +0100 Subject: [PATCH 2/3] chore(deps): relax itertools requirement (#1671) The crates compile on most recent itertools versions, so to reduce itertools duplicates downstream relax the version requirement. Signed-off-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Co-authored-by: Sean Young --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d7de9f87c..bca3307b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ sha2 = "0.10" ripemd = "0.1" bitvec = "1" funty = "2.0" -itertools = "0.12" +itertools = ">=0.10, <=0.13" num-rational = "0.4" indexmap = "2.2" once_cell = "1.19" From de4fc3476eedd368b7e32646311bf6dc782148e9 Mon Sep 17 00:00:00 2001 From: Tarek Elsayed <60650661+tareknaser@users.noreply.github.com> Date: Wed, 27 Nov 2024 23:38:11 +0200 Subject: [PATCH 3/3] Add Constructor Support for Solang Solidity Contracts on Soroban (#1674) --- .github/workflows/release.yml | 10 ++++---- .github/workflows/test.yml | 20 +++++++-------- Cargo.toml | 4 +-- Dockerfile | 2 +- docs/installing.rst | 2 +- integration/soroban/counter.spec.js | 4 --- src/emit/soroban/mod.rs | 38 +++++++++++++++++++---------- tests/soroban.rs | 5 +++- tests/soroban_testcases/print.rs | 6 ----- tests/soroban_testcases/storage.rs | 2 -- 10 files changed, 48 insertions(+), 45 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dda2a90e9..60dc3de49 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - name: Build run: cargo build --verbose --release - name: Run tests @@ -41,7 +41,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y gcc g++ make - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - name: Get LLVM run: curl -sSL --output llvm16.0-linux-arm64.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-linux-arm64.tar.xz - name: Extract LLVM @@ -74,7 +74,7 @@ jobs: run: unzip c:\llvm.zip -d c:/ - name: Add LLVM to Path run: echo "c:\llvm16.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 with: components: clippy - name: Build @@ -97,7 +97,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - name: Get LLVM run: curl -sSL --output llvm16.0-mac-arm.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-arm.tar.xz - name: Extract LLVM @@ -124,7 +124,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - name: Get LLVM run: wget -q -O llvm16.0-mac-intel.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-intel.tar.xz - name: Extract LLVM diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e15928880..7984e494b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,7 +63,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@master with: - toolchain: 1.75.0 + toolchain: 1.81.0 components: | llvm-tools clippy @@ -120,7 +120,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y gcc g++ make - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - name: Get LLVM run: curl -sSL --output llvm16.0-linux-arm64.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-linux-arm64.tar.xz - name: Extract LLVM @@ -153,7 +153,7 @@ jobs: # Use C:\ as D:\ might run out of space - name: "Use C: for rust temporary files" run: echo "CARGO_TARGET_DIR=C:\target" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 with: components: clippy # We run clippy on Linux in the lint job above, but this does not check #[cfg(windows)] items @@ -179,7 +179,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - name: Get LLVM run: curl -sSL --output llvm16.0-mac-arm.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-arm.tar.xz - name: Extract LLVM @@ -205,7 +205,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - name: Get LLVM run: wget -q -O llvm16.0-mac-intel.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-intel.tar.xz - name: Extract LLVM @@ -267,7 +267,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '16' - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - name: Setup yarn run: npm install -g yarn - uses: actions/download-artifact@v4.1.8 @@ -318,7 +318,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '16' - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - uses: actions/download-artifact@v4.1.8 with: name: solang-linux-x86-64 @@ -329,7 +329,7 @@ jobs: echo "$(pwd)/bin" >> $GITHUB_PATH - name: Install Soroban - run: cargo install --locked soroban-cli --version 21.0.0-rc.1 + run: cargo install --locked soroban-cli --version 22.0.0 - name: Add cargo install location to PATH run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH - run: npm install @@ -360,7 +360,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '16' - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.81.0 - uses: actions/download-artifact@v4.1.8 with: name: solang-linux-x86-64 @@ -537,7 +537,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@master with: - toolchain: 1.75.0 + toolchain: 1.81.0 components: llvm-tools - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov diff --git a/Cargo.toml b/Cargo.toml index bca3307b5..fd8e411ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" build = "build.rs" description = "Solang Solidity Compiler" keywords = [ "solidity", "compiler", "solana", "polkadot", "substrate" ] -rust-version = "1.75.0" +rust-version = "1.81.0" edition = "2021" exclude = [ "/.*", "/docs", "/examples", "/solana-library", "/tests", "/integration", "/vscode", "/testdata" ] @@ -71,7 +71,7 @@ forge-fmt = { path = "fmt", optional = true } # We don't use ethers-core directly, but need the correct version for the # build to work. ethers-core = { version = "2.0.10", optional = true } -soroban-sdk = { version = "20.0.0-rc2", features = ["testutils"], optional = true } +soroban-sdk = { version = "22.0.0-rc.3.2", features = ["testutils"], optional = true } [dev-dependencies] num-derive = "0.4" diff --git a/Dockerfile b/Dockerfile index 46a9c895d..f0bb58a00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ COPY . src WORKDIR /src/stdlib/ RUN make -RUN rustup default 1.75.0 +RUN rustup default 1.81.0 WORKDIR /src RUN cargo build --release diff --git a/docs/installing.rst b/docs/installing.rst index b59a46535..eec419601 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -89,7 +89,7 @@ Option 5: Build Solang from source In order to build Solang from source, you will need: -* Rust version 1.75.0 or higher +* Rust version 1.81.0 or higher * A C++ compiler with support for C++17 * A build of LLVM based on the Solana LLVM tree. There are a few LLVM patches required that are not upstream yet. diff --git a/integration/soroban/counter.spec.js b/integration/soroban/counter.spec.js index 53f3ed103..fce1d4b6a 100644 --- a/integration/soroban/counter.spec.js +++ b/integration/soroban/counter.spec.js @@ -30,10 +30,6 @@ describe('Counter', () => { // load contract contract = new StellarSdk.Contract(contractAddr); - - // initialize the contract - await call_contract_function("init", server, keypair, contract); - }); it('get correct initial counter', async () => { diff --git a/src/emit/soroban/mod.rs b/src/emit/soroban/mod.rs index 3b81b5373..71a24a933 100644 --- a/src/emit/soroban/mod.rs +++ b/src/emit/soroban/mod.rs @@ -8,18 +8,23 @@ use crate::codegen::{ use crate::emit::cfg::emit_cfg; use crate::{emit::Binary, sema::ast}; +use funty::Fundamental; use inkwell::{ context::Context, module::{Linkage, Module}, }; use soroban_sdk::xdr::{ - DepthLimitedWrite, ScEnvMetaEntry, ScSpecEntry, ScSpecFunctionInputV0, ScSpecFunctionV0, - ScSpecTypeDef, StringM, WriteXdr, + Limited, Limits, ScEnvMetaEntry, ScEnvMetaEntryInterfaceVersion, ScSpecEntry, + ScSpecFunctionInputV0, ScSpecFunctionV0, ScSpecTypeDef, StringM, WriteXdr, }; use std::ffi::CString; use std::sync; -const SOROBAN_ENV_INTERFACE_VERSION: u64 = 90194313216; +const SOROBAN_ENV_INTERFACE_VERSION: ScEnvMetaEntryInterfaceVersion = + ScEnvMetaEntryInterfaceVersion { + protocol: 22, + pre_release: 0, + }; pub const PUT_CONTRACT_DATA: &str = "l._"; pub const GET_CONTRACT_DATA: &str = "l.1"; pub const LOG_FROM_LINEAR_MEMORY: &str = "x._"; @@ -129,9 +134,15 @@ impl SorobanTarget { } fn emit_env_meta_entries<'a>(context: &'a Context, binary: &mut Binary<'a>, opt: &'a Options) { - let mut meta = DepthLimitedWrite::new(Vec::new(), 10); - let soroban_env_interface_version = - opt.soroban_version.unwrap_or(SOROBAN_ENV_INTERFACE_VERSION); + let mut meta = Limited::new(Vec::new(), Limits::none()); + let soroban_env_interface_version = opt.soroban_version; + let soroban_env_interface_version = match soroban_env_interface_version { + Some(version) => ScEnvMetaEntryInterfaceVersion { + protocol: version.as_u32(), + pre_release: 0, + }, + None => SOROBAN_ENV_INTERFACE_VERSION, + }; ScEnvMetaEntry::ScEnvMetaKindInterfaceVersion(soroban_env_interface_version) .write_xdr(&mut meta) .expect("writing env meta interface version to xdr"); @@ -146,7 +157,7 @@ impl SorobanTarget { ) { if cfg.public && !cfg.is_placeholder() { // TODO: Emit custom type spec entries - let mut spec = DepthLimitedWrite::new(Vec::new(), 10); + let mut spec = Limited::new(Vec::new(), Limits::none()); ScSpecEntry::FunctionV0(ScSpecFunctionV0 { name: name .try_into() @@ -252,13 +263,13 @@ impl SorobanTarget { } fn emit_initializer(binary: &mut Binary, _ns: &ast::Namespace) { - let mut cfg = ControlFlowGraph::new("init".to_string(), ASTFunction::None); + let mut cfg = ControlFlowGraph::new("__constructor".to_string(), ASTFunction::None); cfg.public = true; let void_param = ast::Parameter::new_default(ast::Type::Void); cfg.returns = sync::Arc::new(vec![void_param]); - Self::emit_function_spec_entry(binary.context, &cfg, "init".to_string(), binary); + Self::emit_function_spec_entry(binary.context, &cfg, "__constructor".to_string(), binary); let function_name = CString::new(STORAGE_INITIALIZER).unwrap(); let mut storage_initializers = binary @@ -271,10 +282,11 @@ impl SorobanTarget { assert!(storage_initializers.next().is_none()); let void_type = binary.context.i64_type().fn_type(&[], false); - let init = binary - .module - .add_function("init", void_type, Some(Linkage::External)); - let entry = binary.context.append_basic_block(init, "entry"); + let constructor = + binary + .module + .add_function("__constructor", void_type, Some(Linkage::External)); + let entry = binary.context.append_basic_block(constructor, "entry"); binary.builder.position_at_end(entry); binary diff --git a/tests/soroban.rs b/tests/soroban.rs index fee9e43e8..3492adcd5 100644 --- a/tests/soroban.rs +++ b/tests/soroban.rs @@ -32,7 +32,7 @@ pub fn build_solidity(src: &str) -> SorobanEnv { log_prints: true, #[cfg(feature = "wasm_opt")] wasm_opt: Some(contract_build::OptimizationPasses::Z), - soroban_version: Some(85899345977), + soroban_version: None, ..Default::default() }, std::vec!["unknown".to_string()], @@ -59,6 +59,9 @@ impl SorobanEnv { } pub fn register_contract(&mut self, contract_wasm: Vec) -> Address { + // For now, we keep using `register_contract_wasm`. To use `register`, we have to figure + // out first what to pass for `constructor_args` + #[allow(deprecated)] let addr = self .env .register_contract_wasm(None, contract_wasm.as_slice()); diff --git a/tests/soroban_testcases/print.rs b/tests/soroban_testcases/print.rs index 8dc919906..58b727bd1 100644 --- a/tests/soroban_testcases/print.rs +++ b/tests/soroban_testcases/print.rs @@ -18,8 +18,6 @@ fn log_runtime_error() { let addr = src.contracts.last().unwrap(); - let _res = src.invoke_contract(addr, "init", vec![]); - src.invoke_contract(addr, "decrement", vec![]); let logs = src.invoke_contract_expect_error(addr, "decrement", vec![]); @@ -40,8 +38,6 @@ fn print() { let addr = src.contracts.last().unwrap(); - let _res = src.invoke_contract(addr, "init", vec![]); - src.invoke_contract(addr, "print", vec![]); let logs = src.env.logs().all(); @@ -65,8 +61,6 @@ fn print_then_runtime_error() { let addr = src.contracts.last().unwrap(); - let _res = src.invoke_contract(addr, "init", vec![]); - src.invoke_contract(addr, "decrement", vec![]); let logs = src.invoke_contract_expect_error(addr, "decrement", vec![]); diff --git a/tests/soroban_testcases/storage.rs b/tests/soroban_testcases/storage.rs index d5923a946..b41a9432b 100644 --- a/tests/soroban_testcases/storage.rs +++ b/tests/soroban_testcases/storage.rs @@ -23,8 +23,6 @@ fn counter() { let addr = src.contracts.last().unwrap(); - let _res = src.invoke_contract(addr, "init", vec![]); - let res = src.invoke_contract(addr, "count", vec![]); let expected: Val = 10_u64.into_val(&src.env); assert!(expected.shallow_eq(&res));