diff --git a/flake.lock b/flake.lock index 376e99b..898be9c 100644 --- a/flake.lock +++ b/flake.lock @@ -1582,17 +1582,17 @@ "rust-rapidsnark": "rust-rapidsnark" }, "locked": { - "lastModified": 1782310268, - "narHash": "sha256-tIIIO+V+w/C/KLtKnLIv8O8/GoJ4PzgJSWrlQCXJ2P4=", + "lastModified": 1782428741, + "narHash": "sha256-ltLcysXUdVUXAe25Tl8x7e7ZsTzj1sHlyS3glp97TAo=", "owner": "logos-blockchain", "repo": "logos-execution-zone", - "rev": "fb8cbac40e0bda4f152415ff4f181cdc6bca6d4a", + "rev": "e37876a64028a335eb693198a1ed6a0e875ec5b4", "type": "github" }, "original": { "owner": "logos-blockchain", "repo": "logos-execution-zone", - "rev": "fb8cbac40e0bda4f152415ff4f181cdc6bca6d4a", + "rev": "e37876a64028a335eb693198a1ed6a0e875ec5b4", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 1b1679b..b35fc50 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,7 @@ inputs = { logos-module-builder.url = "github:logos-co/logos-module-builder"; nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx"; - logos-execution-zone.url = "github:logos-blockchain/logos-execution-zone?rev=fb8cbac40e0bda4f152415ff4f181cdc6bca6d4a"; # lez-core-v0.2.0 + logos-execution-zone.url = "github:logos-blockchain/logos-execution-zone?rev=e37876a64028a335eb693198a1ed6a0e875ec5b4"; # v0.2.0-rc6 }; outputs = inputs@{ logos-module-builder, ... }: diff --git a/src/logos_execution_zone_wallet_module.cpp b/src/logos_execution_zone_wallet_module.cpp index 9ca42d6..0eadbc2 100644 --- a/src/logos_execution_zone_wallet_module.cpp +++ b/src/logos_execution_zone_wallet_module.cpp @@ -969,10 +969,9 @@ std::vector LogosExecutionZoneWalletModule::authenticated_transfer_elf( std::string LogosExecutionZoneWalletModule::send_generic_public_transaction( const std::vector& account_ids, - const std::vector& signing_requirements, + const std::vector& signing_requirements, const std::vector& instruction, - const std::vector& program_elf, - const std::vector>& program_dependencies + const std::string& program_id_hex ) { std::vector identities_resolved; identities_resolved.reserve(account_ids.size()); @@ -1000,47 +999,23 @@ std::string LogosExecutionZoneWalletModule::send_generic_public_transaction( const uint32_t* input_instruction_data = instruction.data(); uintptr_t input_instruction_data_size = static_cast(instruction.size()); - FfiProgram main_program {}; - - const uint8_t *program_elf_data = program_elf.data(); - uintptr_t program_elf_size = static_cast(program_elf.size()); - - main_program.elf_data = program_elf_data; - main_program.elf_size = program_elf_size; - - std::vector ffi_program_dependencies; - ffi_program_dependencies.reserve(program_dependencies.size()); - - for (int i = 0; i < program_dependencies.size(); ++i) { - FfiProgram program{}; - - const uint8_t *program_elf_data = program_dependencies[i].data(); - uintptr_t program_elf_size = static_cast(program_dependencies[i].size()); - - program.elf_data = program_elf_data; - program.elf_size = program_elf_size; - - ffi_program_dependencies.push_back(program); + std::vector program_id_bytes; + if (!hexToBytes(program_id_hex, program_id_bytes, 32)) { + fprintf(stderr, "send_generic_public_transaction: invalid program_id_hex"); + return transferResultToJson(nullptr, std::string("send_generic_public_transaction: invalid program_id_hex")); } - - const FfiProgram *dependencies_data = ffi_program_dependencies.data(); - uintptr_t dependencies_size = static_cast(ffi_program_dependencies.size()); - - FfiProgramWithDependencies program_with_dependencies {}; - - program_with_dependencies.program = main_program; - program_with_dependencies.deps = dependencies_data; - program_with_dependencies.deps_size = dependencies_size; + FfiProgramId program_id{}; + memcpy(program_id.data, program_id_bytes.data(), 32); FfiTransactionResult result {}; const WalletFfiError error = wallet_ffi_send_generic_public_transaction( - walletHandle, + walletHandle, account_identities, account_identities_size, - input_instruction_data, + input_instruction_data, input_instruction_data_size, - &program_with_dependencies, + program_id, &result ); diff --git a/src/logos_execution_zone_wallet_module.h b/src/logos_execution_zone_wallet_module.h index 9b2273d..0a05bd8 100644 --- a/src/logos_execution_zone_wallet_module.h +++ b/src/logos_execution_zone_wallet_module.h @@ -77,13 +77,7 @@ public: std::vector amm_elf(); std::vector ata_elf(); - std::string send_generic_public_transaction( - const std::vector& account_ids, - const std::vector& signing_requirements, - const std::vector& instruction, - const std::vector& program_elf, - const std::vector>& program_dependencies - ); + std::string send_generic_public_transaction(const std::vector& account_ids, const std::vector& signing_requirements, const std::vector& instruction, const std::string& program_id_hex); std::string send_generic_private_transaction( const std::vector& account_ids, const std::vector& instruction, diff --git a/tests/mocks/mock_wallet_ffi.cpp b/tests/mocks/mock_wallet_ffi.cpp index ab66149..a466ed0 100644 --- a/tests/mocks/mock_wallet_ffi.cpp +++ b/tests/mocks/mock_wallet_ffi.cpp @@ -472,7 +472,7 @@ void wallet_ffi_free_ffi_program(FfiProgram *ffi_program) { WalletFfiError wallet_ffi_send_generic_public_transaction(WalletHandle *handle, const FfiAccountIdentity *account_identities, uintptr_t account_identities_size, const uint32_t *instruction_words, uintptr_t instruction_words_size, -const FfiProgramWithDependencies *program_with_dependencies, FfiTransactionResult *out_result) { +FfiProgramId program_id, FfiTransactionResult *out_result) { LOGOS_CMOCK_RECORD("wallet_ffi_send_generic_public_transaction"); return fillTransactionResult("wallet_ffi_send_generic_public_transaction", out_result); } diff --git a/tests/stubs/wallet_ffi.h b/tests/stubs/wallet_ffi.h index c1e5ca0..f90f5c0 100644 --- a/tests/stubs/wallet_ffi.h +++ b/tests/stubs/wallet_ffi.h @@ -31,6 +31,11 @@ typedef struct FfiBytes32 { uint8_t data[32]; } FfiBytes32; +// Program ID - 8 u32 values (32 bytes total). +typedef struct FfiProgramId { + uint32_t data[8]; +} FfiProgramId; + // 16-byte value (balance / nonce, little-endian u128). typedef struct FfiBytes16 { uint8_t data[16]; @@ -43,7 +48,7 @@ typedef struct FfiU128 { // Full account record. typedef struct FfiAccount { - FfiBytes32 program_owner; + FfiProgramId program_owner; FfiBytes16 balance; FfiBytes16 nonce; uint8_t* data; @@ -266,7 +271,7 @@ WalletFfiError wallet_ffi_send_generic_public_transaction(WalletHandle *handle, uintptr_t account_identities_size, const uint32_t *instruction_words, uintptr_t instruction_words_size, - const FfiProgramWithDependencies *program_with_dependencies, + FfiProgramId program_id, FfiTransactionResult *out_result); WalletFfiError wallet_ffi_send_generic_private_transaction(WalletHandle *handle,