diff --git a/Cargo.lock b/Cargo.lock index 2ae4d19bac..4eef010247 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -221,6 +221,12 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +[[package]] +name = "ethnum" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0198b9d0078e0f30dedc7acbb21c974e838fc8fae3ee170128658a98cb2c1c04" + [[package]] name = "generic-array" version = "0.14.6" @@ -580,9 +586,10 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "0.0.14" -source = "git+https://github.com/stellar/rs-soroban-env?rev=5695440da452837555d8f7f259cc33341fdf07b0#5695440da452837555d8f7f259cc33341fdf07b0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=a66f0815ba06a2f5328ac420950690fd1642f887#a66f0815ba06a2f5328ac420950690fd1642f887" dependencies = [ "crate-git-revision", + "ethnum", "soroban-env-macros", "soroban-wasmi", "static_assertions", @@ -592,7 +599,7 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "0.0.14" -source = "git+https://github.com/stellar/rs-soroban-env?rev=5695440da452837555d8f7f259cc33341fdf07b0#5695440da452837555d8f7f259cc33341fdf07b0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=a66f0815ba06a2f5328ac420950690fd1642f887#a66f0815ba06a2f5328ac420950690fd1642f887" dependencies = [ "backtrace", "curve25519-dalek", @@ -614,7 +621,7 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "0.0.14" -source = "git+https://github.com/stellar/rs-soroban-env?rev=5695440da452837555d8f7f259cc33341fdf07b0#5695440da452837555d8f7f259cc33341fdf07b0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=a66f0815ba06a2f5328ac420950690fd1642f887#a66f0815ba06a2f5328ac420950690fd1642f887" dependencies = [ "itertools", "proc-macro2", @@ -629,7 +636,7 @@ dependencies = [ [[package]] name = "soroban-native-sdk-macros" version = "0.0.14" -source = "git+https://github.com/stellar/rs-soroban-env?rev=5695440da452837555d8f7f259cc33341fdf07b0#5695440da452837555d8f7f259cc33341fdf07b0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=a66f0815ba06a2f5328ac420950690fd1642f887#a66f0815ba06a2f5328ac420950690fd1642f887" dependencies = [ "itertools", "proc-macro2", @@ -640,7 +647,7 @@ dependencies = [ [[package]] name = "soroban-test-wasms" version = "0.0.14" -source = "git+https://github.com/stellar/rs-soroban-env?rev=5695440da452837555d8f7f259cc33341fdf07b0#5695440da452837555d8f7f259cc33341fdf07b0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=a66f0815ba06a2f5328ac420950690fd1642f887#a66f0815ba06a2f5328ac420950690fd1642f887" [[package]] name = "soroban-wasmi" @@ -692,7 +699,7 @@ dependencies = [ [[package]] name = "stellar-xdr" version = "0.0.14" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=55f47d302a3bbcd34cf32bfcd28abccfaeffc5e0#55f47d302a3bbcd34cf32bfcd28abccfaeffc5e0" +source = "git+https://github.com/stellar/rs-stellar-xdr?rev=74999cea9be22fe20cb030d6e485795ab2269045#74999cea9be22fe20cb030d6e485795ab2269045" dependencies = [ "base64", "crate-git-revision", diff --git a/src/protocol-next/xdr b/src/protocol-next/xdr index df18148747..32718f0a95 160000 --- a/src/protocol-next/xdr +++ b/src/protocol-next/xdr @@ -1 +1 @@ -Subproject commit df18148747e807618acf4639db41c4fd6f0be9fc +Subproject commit 32718f0a958d0ba3172af10fc8a55a5b551398b0 diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index ffc31f70dd..33d1e8f33e 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -18,9 +18,9 @@ rustc-simple-version = "0.1.0" [dependencies.soroban-env-host] version = "0.0.14" git = "https://github.com/stellar/rs-soroban-env" -rev = "5695440da452837555d8f7f259cc33341fdf07b0" +rev = "a66f0815ba06a2f5328ac420950690fd1642f887" features = ["vm"] [dependencies.soroban-test-wasms] git = "https://github.com/stellar/rs-soroban-env" -rev = "5695440da452837555d8f7f259cc33341fdf07b0" +rev = "a66f0815ba06a2f5328ac420950690fd1642f887" diff --git a/src/transactions/InvokeHostFunctionOpFrame.cpp b/src/transactions/InvokeHostFunctionOpFrame.cpp index 4ed9f31f0d..47d5a59744 100644 --- a/src/transactions/InvokeHostFunctionOpFrame.cpp +++ b/src/transactions/InvokeHostFunctionOpFrame.cpp @@ -146,8 +146,8 @@ struct HostFunctionMetrics isCodeKey(LedgerKey const& lk) { return lk.type() == CONTRACT_DATA && - lk.contractData().key.type() == SCValType::SCV_STATIC && - lk.contractData().key.ic() == SCS_LEDGER_KEY_CONTRACT_CODE; + lk.contractData().key.type() == + SCValType::SCV_LEDGER_KEY_CONTRACT_EXECUTABLE; } void diff --git a/src/transactions/test/InvokeHostFunctionTests.cpp b/src/transactions/test/InvokeHostFunctionTests.cpp index b819806251..e83a9b7f6b 100644 --- a/src/transactions/test/InvokeHostFunctionTests.cpp +++ b/src/transactions/test/InvokeHostFunctionTests.cpp @@ -35,9 +35,8 @@ template SCVal makeBinary(T begin, T end) { - SCVal val(SCValType::SCV_OBJECT); - val.obj().activate().type(SCO_BYTES); - val.obj()->bin().assign(begin, end); + SCVal val(SCValType::SCV_BYTES); + val.bytes().assign(begin, end); return val; } @@ -45,11 +44,10 @@ template SCVal makeWasmRefScContractCode(T const& hash) { - SCVal val(SCValType::SCV_OBJECT); - val.obj().activate().type(stellar::SCO_CONTRACT_CODE); - val.obj()->contractCode().type(stellar::SCCONTRACT_CODE_WASM_REF); - std::copy(hash.begin(), hash.end(), - val.obj()->contractCode().wasm_id().begin()); + SCVal val(SCValType::SCV_CONTRACT_EXECUTABLE); + val.exec().type(SCContractExecutableType::SCCONTRACT_EXECUTABLE_WASM_REF); + + std::copy(hash.begin(), hash.end(), val.exec().wasm_id().begin()); return val; } @@ -138,12 +136,11 @@ deployContractWithSourceAccount(Application& app, RustBuf const& contractWasm, createContractArgs.contractID.type(CONTRACT_ID_FROM_SOURCE_ACCOUNT); createContractArgs.contractID.salt() = salt; - createContractArgs.source.type(SCCONTRACT_CODE_WASM_REF); + createContractArgs.source.type(SCCONTRACT_EXECUTABLE_WASM_REF); createContractArgs.source.wasm_id() = contractCodeLedgerKey.contractCode().hash; - SCVal scContractSourceRefKey(SCValType::SCV_STATIC); - scContractSourceRefKey.ic() = SCStatic::SCS_LEDGER_KEY_CONTRACT_CODE; + SCVal scContractSourceRefKey(SCValType::SCV_LEDGER_KEY_CONTRACT_EXECUTABLE); LedgerKey contractSourceRefLedgerKey; contractSourceRefLedgerKey.type(CONTRACT_DATA); @@ -200,7 +197,7 @@ TEST_CASE("invoke host function", "[tx][contract]") ltx.commit(); SCVal resultVal; resultVal.type(stellar::SCV_STATUS); - resultVal.status().type(SCStatusType::SST_UNKNOWN_ERROR); + resultVal.error().type(SCStatusType::SST_UNKNOWN_ERROR); if (tx->getResult().result.code() == txSUCCESS && !tx->getResult().result.results().empty()) { @@ -421,13 +418,9 @@ TEST_CASE("complex contract with preflight", "[tx][contract]") REQUIRE(txm.getXDR().v3().events.size() == 1); REQUIRE(txm.getXDR().v3().events.at(0).events.at(0).type == ContractEventType::CONTRACT); - REQUIRE(txm.getXDR() - .v3() - .events.at(0) - .events.at(0) - .body.v0() - .data.obj() - ->type() == SCO_BYTES); + REQUIRE( + txm.getXDR().v3().events.at(0).events.at(0).body.v0().data.type() == + SCV_BYTES); } SECTION("multiple ops") { @@ -446,7 +439,7 @@ TEST_CASE("complex contract with preflight", "[tx][contract]") for (auto const& e : txm.getXDR().v3().events.at(i).events) { REQUIRE(e.type == ContractEventType::CONTRACT); - REQUIRE(e.body.v0().data.obj()->type() == SCO_BYTES); + REQUIRE(e.body.v0().data.type() == SCV_BYTES); } } }