From 18b9181a5f8bcb478951990349646dfdea6f054a Mon Sep 17 00:00:00 2001 From: david akor Date: Mon, 23 Feb 2026 14:31:40 -0800 Subject: [PATCH] fix: Resolve Rust contract build errors - Update soroban-sdk version from 20.0.0 to 20.5.0 in both contracts - Fix signature verification method in invoice_nft contract - Add Bytes import for proper type conversion - Convert payload to Bytes type for ed25519_verify compatibility - Resolve to_val() method usage with proper type conversion --- contracts/invoice_nft/Cargo.toml | 6 +++--- contracts/invoice_nft/src/lib.rs | 4 ++-- contracts/lending_pool/Cargo.toml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contracts/invoice_nft/Cargo.toml b/contracts/invoice_nft/Cargo.toml index 9f58e6d..6a86094 100644 --- a/contracts/invoice_nft/Cargo.toml +++ b/contracts/invoice_nft/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -# We pin the SDK to version 20.0.0 exactly to match the CLI and Testnet -soroban-sdk = "20.0.0" +# We pin the SDK to version 20.5.0 to match the build environment +soroban-sdk = "20.5.0" [dev-dependencies] -soroban-sdk = { version = "20.0.0", features = ["testutils"] } +soroban-sdk = { version = "20.5.0", features = ["testutils"] } [profile.release] opt-level = "z" diff --git a/contracts/invoice_nft/src/lib.rs b/contracts/invoice_nft/src/lib.rs index 8a48d00..77d3c14 100644 --- a/contracts/invoice_nft/src/lib.rs +++ b/contracts/invoice_nft/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -use soroban_sdk::{contract, contractimpl, contracttype, Address, Env, Symbol, Vec, BytesN}; +use soroban_sdk::{contract, contractimpl, contracttype, Address, Env, Symbol, Vec, BytesN, Bytes}; mod tests; @@ -57,7 +57,7 @@ impl InvoiceContract { payload.push_back(&amount); payload.push_back(&risk_score); - let message = payload.to_vec(); + let message: Bytes = payload.to_val().try_into().unwrap(); env.crypto().ed25519_verify(&backend_pubkey, &message, signature) } diff --git a/contracts/lending_pool/Cargo.toml b/contracts/lending_pool/Cargo.toml index cb0b381..19afbd4 100644 --- a/contracts/lending_pool/Cargo.toml +++ b/contracts/lending_pool/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -soroban-sdk = "20.0.0" +soroban-sdk = "20.5.0" [dev-dependencies] -soroban-sdk = { version = "20.0.0", features = ["testutils"] } +soroban-sdk = { version = "20.5.0", features = ["testutils"] }