Merge pull request #39 from logos-blockchain/Pravdyvy/cleanup

feat!: Repo cleanup
This commit is contained in:
Pravdyvy 2026-07-03 13:28:14 +03:00 committed by GitHub
commit 92dd9e25bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 221 additions and 185 deletions

43
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,43 @@
## 🎯 Purpose
*What problem does this PR solve or what feature does it add? Mention issues related to it*
TO COMPLETE
## ⚙️ Approach
*Describe the core changes introduced by this PR.*
TO COMPLETE
- [ ] Change ...
- [ ] Add ...
- [ ] Fix ...
- [ ] ...
## 🧪 How to Test
*How to verify that this PR works as intended.*
TO COMPLETE
## 🔗 Dependencies
*Link PRs that must be merged before this one.*
TO COMPLETE IF APPLICABLE
## 🔜 Future Work
*List any work intentionally left out of this PR, whether due to scope, prioritization, or pending decisions.*
TO COMPLETE IF APPLICABLE
## 📋 PR Completion Checklist
*Mark only completed items. A complete PR should have all boxes ticked.*
- [ ] Complete PR description
- [ ] Implement the core functionality
- [ ] Add/update tests
- [ ] Add/update documentation and inline comments

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.14)
project(LogosExecutionZone LANGUAGES CXX)
project(LEZCore LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -12,10 +12,10 @@ else()
endif()
logos_module(
NAME logos_execution_zone
NAME lez_core
SOURCES
src/logos_execution_zone_wallet_module.h
src/logos_execution_zone_wallet_module.cpp
src/lez_core_module.h
src/lez_core_module.cpp
EXTERNAL_LIBS
wallet_ffi
)

View File

@ -1,4 +1,4 @@
# Logos Blockchain Module
# Logos Execution Zone Core Module
### Setup

View File

@ -138,8 +138,8 @@ sections:
text: "Scan the directory and confirm the module landed:"
run: "./lgpm/bin/lgpm --modules-dir ./modules list"
expect_contains:
- "logos_execution_zone"
check_file: "modules/logos_execution_zone/manifest.json"
- "lez_core"
check_file: "modules/lez_core/manifest.json"
- title: "Run the daemon and call the module"
step: true
@ -170,18 +170,18 @@ sections:
code_block: "logoscore status"
- title: "List discovered modules"
text: "`logos_execution_zone` should be visible in the scan directory:"
text: "`lez_core` should be visible in the scan directory:"
run: "./logos/bin/logoscore list-modules"
code_block: "logoscore list-modules"
expect_contains:
- "logos_execution_zone"
- "lez_core"
- title: "Load the module"
text: "Load `logos_execution_zone` into the running daemon:"
run: "./logos/bin/logoscore load-module logos_execution_zone"
code_block: "logoscore load-module logos_execution_zone"
text: "Load `lez_core` into the running daemon:"
run: "./logos/bin/logoscore load-module lez_core"
code_block: "logoscore load-module lez_core"
expect_contains:
- "logos_execution_zone"
- "lez_core"
- title: "Confirm the module is loaded"
text: |
@ -190,17 +190,17 @@ sections:
run: "./logos/bin/logoscore status"
code_block: "logoscore status"
expect_contains:
- "logos_execution_zone"
- "lez_core"
- '"status":"loaded"'
- title: "Introspect the module with module-info"
text: |
`module-info` lists the methods the module exposes — the same methods you
can `call`:
run: "./logos/bin/logoscore module-info logos_execution_zone"
code_block: "logoscore module-info logos_execution_zone"
run: "./logos/bin/logoscore module-info lez_core"
code_block: "logoscore module-info lez_core"
expect_contains:
- "logos_execution_zone"
- "lez_core"
- "account_id_to_base58"
- "account_id_from_base58"
@ -208,19 +208,19 @@ sections:
text: |
`name` returns the module's own identifier — the simplest possible
round-trip through the loaded plugin over liblogos' IPC:
run: "./logos/bin/logoscore call logos_execution_zone name"
code_block: "logoscore call logos_execution_zone name"
run: "./logos/bin/logoscore call lez_core name"
code_block: "logoscore call lez_core name"
expect_contains:
- '"result":"logos_execution_zone"'
- '"result":"lez_core"'
- title: "Read the module version"
text: |
`version` returns the module's semantic version (`1.0.0`), matching
`version` returns the module's semantic version (`0.2.0`), matching
`metadata.json`:
run: "./logos/bin/logoscore call logos_execution_zone version"
code_block: "logoscore call logos_execution_zone version"
run: "./logos/bin/logoscore call lez_core version"
code_block: "logoscore call lez_core version"
expect_contains:
- '"result":"1.0.0"'
- '"result":"0.2.0"'
- title: "Encode an account id to base58"
text: |
@ -228,8 +228,8 @@ sections:
and returns its base58 form. This is a pure encoding helper in
`wallet_ffi` — no open wallet and no network required, so it runs
entirely offline:
run: "./logos/bin/logoscore call logos_execution_zone account_id_to_base58 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
code_block: "logoscore call logos_execution_zone account_id_to_base58 aaaaaaaa...aaaa # 64 hex chars"
run: "./logos/bin/logoscore call lez_core account_id_to_base58 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
code_block: "logoscore call lez_core account_id_to_base58 aaaaaaaa...aaaa # 64 hex chars"
expect_contains:
- '"result"'
@ -240,14 +240,14 @@ sections:
decoding the same id and recovering the input is a deterministic,
end-to-end proof that the codec — and the IPC path to this module — work:
run: |
ENC=$(./logos/bin/logoscore call logos_execution_zone account_id_to_base58 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
ENC=$(./logos/bin/logoscore call lez_core account_id_to_base58 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
B58=$(printf '%s' "$ENC" | sed -n 's/.*"result":"\([^"]*\)".*/\1/p')
echo "encoded: $B58"
./logos/bin/logoscore call logos_execution_zone account_id_from_base58 "$B58"
./logos/bin/logoscore call lez_core account_id_from_base58 "$B58"
code_block: |
# Encode, then decode the result back — the round-trip returns the input.
B58=$(logoscore call logos_execution_zone account_id_to_base58 aaaa...aaaa)
logoscore call logos_execution_zone account_id_from_base58 "$B58"
B58=$(logoscore call lez_core account_id_to_base58 aaaa...aaaa)
logoscore call lez_core account_id_from_base58 "$B58"
expect_contains:
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@ -255,8 +255,8 @@ sections:
text: |
Decoding obvious garbage fails cleanly: `account_id_from_base58` returns
an empty result rather than crashing the module or the daemon:
run: "./logos/bin/logoscore call logos_execution_zone account_id_from_base58 '!!!not-base58!!!'"
code_block: "logoscore call logos_execution_zone account_id_from_base58 '!!!not-base58!!!'"
run: "./logos/bin/logoscore call lez_core account_id_from_base58 '!!!not-base58!!!'"
code_block: "logoscore call lez_core account_id_from_base58 '!!!not-base58!!!'"
expect_contains:
- '"result":""'

View File

@ -1,5 +1,5 @@
{
description = "Logos Execution Zone Wallet Module";
description = "Logos Execution Zone Core Module";
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";

View File

@ -3,11 +3,11 @@ default: build
configure:
cmake -S . -B build -G Ninja \
${LOGOS_CORE_ROOT:+-DLOGOS_CORE_ROOT="$LOGOS_CORE_ROOT"} \
${LOGOS_EXECUTION_ZONE_WALLET_LIB:+-DLOGOS_EXECUTION_ZONE_WALLET_LIB="$LOGOS_EXECUTION_ZONE_WALLET_LIB"} \
${LOGOS_EXECUTION_ZONE_WALLET_INCLUDE:+-DLOGOS_EXECUTION_ZONE_WALLET_INCLUDE="$LOGOS_EXECUTION_ZONE_WALLET_INCLUDE"}
${LEZ_CORE_LIB:+-DLEZ_CORE_LIB="$LEZ_CORE_LIB"} \
${LEZ_CORE_INCLUDE:+-DLEZ_CORE_INCLUDE="$LEZ_CORE_INCLUDE"}
build: configure
cmake --build build --parallel --target lez_wallet_module_plugin
cmake --build build --parallel --target lez_core_module_plugin
clean:
rm -rf build result

View File

@ -1,17 +1,17 @@
{
"name": "logos_execution_zone",
"display_name": "LEZ Module",
"version": "1.0.0",
"description": "Logos Execution Zone Module for Logos Core",
"name": "lez_core",
"display_name": "LEZ Core Module",
"version": "0.2.0",
"description": "Logos Execution Zone Core Module for Logos Core",
"author": "Logos Blockchain Team",
"type": "core",
"category": "blockchain",
"interface": "universal",
"codegen": {
"impl_header": "src/logos_execution_zone_wallet_module.h",
"impl_class": "LogosExecutionZoneWalletModule"
"impl_header": "src/lez_core_module.h",
"impl_class": "LEZCoreModule"
},
"main": "logos_execution_zone_plugin",
"main": "lez_core_plugin",
"dependencies": [],
"capabilities": [],
"include": [],

View File

@ -1,4 +1,4 @@
#include "logos_execution_zone_wallet_module.h"
#include "lez_core_module.h"
#include <algorithm>
#include <cstdio>
@ -263,26 +263,26 @@ bool jsonArrayHexToSiblings32(const std::string& json_array_str, std::vector<uin
} // namespace
LogosExecutionZoneWalletModule::LogosExecutionZoneWalletModule() = default;
LEZCoreModule::LEZCoreModule() = default;
LogosExecutionZoneWalletModule::~LogosExecutionZoneWalletModule() {
LEZCoreModule::~LEZCoreModule() {
if (walletHandle) {
wallet_ffi_destroy(walletHandle);
walletHandle = nullptr;
}
}
std::string LogosExecutionZoneWalletModule::name() const {
return "logos_execution_zone";
std::string LEZCoreModule::name() const {
return "lez_core";
}
std::string LogosExecutionZoneWalletModule::version() const {
return "1.0.0";
std::string LEZCoreModule::version() const {
return "0.2.0";
}
// === Account Management ===
std::string LogosExecutionZoneWalletModule::create_account_public() {
std::string LEZCoreModule::create_account_public() {
FfiBytes32 id{};
const WalletFfiError error = wallet_ffi_create_account_public(walletHandle, &id);
if (error != SUCCESS) {
@ -292,7 +292,7 @@ std::string LogosExecutionZoneWalletModule::create_account_public() {
return bytes32ToHex(id);
}
std::string LogosExecutionZoneWalletModule::create_account_private() {
std::string LEZCoreModule::create_account_private() {
FfiBytes32 id{};
const WalletFfiError error = wallet_ffi_create_account_private(walletHandle, &id);
if (error != SUCCESS) {
@ -302,7 +302,7 @@ std::string LogosExecutionZoneWalletModule::create_account_private() {
return bytes32ToHex(id);
}
LogosList LogosExecutionZoneWalletModule::list_accounts() {
LogosList LEZCoreModule::list_accounts() {
LogosList result = nlohmann::json::array();
FfiAccountList list{};
const WalletFfiError error = wallet_ffi_list_accounts(walletHandle, &list);
@ -319,7 +319,7 @@ LogosList LogosExecutionZoneWalletModule::list_accounts() {
// === Account Queries ===
std::string LogosExecutionZoneWalletModule::get_balance(const std::string& account_id_hex, const bool is_public) {
std::string LEZCoreModule::get_balance(const std::string& account_id_hex, const bool is_public) {
FfiBytes32 id{};
if (!hexToBytes32(account_id_hex, &id)) {
fprintf(stderr, "get_balance: invalid account_id_hex\n");
@ -336,7 +336,7 @@ std::string LogosExecutionZoneWalletModule::get_balance(const std::string& accou
return balanceLe16ToDecimalString(balance);
}
std::string LogosExecutionZoneWalletModule::get_account_public(const std::string& account_id_hex) {
std::string LEZCoreModule::get_account_public(const std::string& account_id_hex) {
FfiBytes32 id{};
if (!hexToBytes32(account_id_hex, &id)) {
fprintf(stderr, "get_account_public: invalid account_id_hex\n");
@ -353,7 +353,7 @@ std::string LogosExecutionZoneWalletModule::get_account_public(const std::string
return result;
}
std::string LogosExecutionZoneWalletModule::get_account_private(const std::string& account_id_hex) {
std::string LEZCoreModule::get_account_private(const std::string& account_id_hex) {
FfiBytes32 id{};
if (!hexToBytes32(account_id_hex, &id)) {
fprintf(stderr, "get_account_private: invalid account_id_hex\n");
@ -370,7 +370,7 @@ std::string LogosExecutionZoneWalletModule::get_account_private(const std::strin
return result;
}
std::string LogosExecutionZoneWalletModule::get_public_account_key(const std::string& account_id_hex) {
std::string LEZCoreModule::get_public_account_key(const std::string& account_id_hex) {
FfiBytes32 id{};
if (!hexToBytes32(account_id_hex, &id)) {
fprintf(stderr, "get_public_account_key: invalid account_id_hex\n");
@ -385,7 +385,7 @@ std::string LogosExecutionZoneWalletModule::get_public_account_key(const std::st
return bytes32ToHex(key.public_key);
}
std::string LogosExecutionZoneWalletModule::get_private_account_keys(const std::string& account_id_hex) {
std::string LEZCoreModule::get_private_account_keys(const std::string& account_id_hex) {
FfiBytes32 id{};
if (!hexToBytes32(account_id_hex, &id)) {
fprintf(stderr, "get_private_account_keys: invalid account_id_hex\n");
@ -409,7 +409,7 @@ std::string LogosExecutionZoneWalletModule::get_private_account_keys(const std::
// === Account Encoding ===
std::string LogosExecutionZoneWalletModule::account_id_to_base58(const std::string& account_id_hex) {
std::string LEZCoreModule::account_id_to_base58(const std::string& account_id_hex) {
FfiBytes32 id{};
if (!hexToBytes32(account_id_hex, &id)) {
fprintf(stderr, "account_id_to_base58: invalid account_id_hex\n");
@ -427,7 +427,7 @@ std::string LogosExecutionZoneWalletModule::account_id_to_base58(const std::stri
return value;
}
std::string LogosExecutionZoneWalletModule::account_id_from_base58(const std::string& base58_str) {
std::string LEZCoreModule::account_id_from_base58(const std::string& base58_str) {
FfiBytes32 id{};
const WalletFfiError error = wallet_ffi_account_id_from_base58(base58_str.c_str(), &id);
if (error != SUCCESS) {
@ -439,11 +439,11 @@ std::string LogosExecutionZoneWalletModule::account_id_from_base58(const std::st
// === Blockchain Synchronisation ===
int64_t LogosExecutionZoneWalletModule::sync_to_block(const int64_t block_id) {
int64_t LEZCoreModule::sync_to_block(const int64_t block_id) {
return wallet_ffi_sync_to_block(walletHandle, static_cast<uint64_t>(block_id));
}
int64_t LogosExecutionZoneWalletModule::get_last_synced_block() {
int64_t LEZCoreModule::get_last_synced_block() {
uint64_t block_id = 0;
const WalletFfiError error = wallet_ffi_get_last_synced_block(walletHandle, &block_id);
if (error != SUCCESS) {
@ -453,7 +453,7 @@ int64_t LogosExecutionZoneWalletModule::get_last_synced_block() {
return static_cast<int64_t>(block_id);
}
int64_t LogosExecutionZoneWalletModule::get_current_block_height() {
int64_t LEZCoreModule::get_current_block_height() {
uint64_t block_height = 0;
const WalletFfiError error = wallet_ffi_get_current_block_height(walletHandle, &block_height);
if (error != SUCCESS) {
@ -465,7 +465,7 @@ int64_t LogosExecutionZoneWalletModule::get_current_block_height() {
// === Pinata claiming ===
std::string LogosExecutionZoneWalletModule::claim_pinata(
std::string LEZCoreModule::claim_pinata(
const std::string& pinata_account_id_hex,
const std::string& winner_account_id_hex,
const std::string& solution_le16_hex
@ -491,7 +491,7 @@ std::string LogosExecutionZoneWalletModule::claim_pinata(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::claim_pinata_private_owned_already_initialized(
std::string LEZCoreModule::claim_pinata_private_owned_already_initialized(
const std::string& pinata_account_id_hex,
const std::string& winner_account_id_hex,
const std::string& solution_le16_hex,
@ -541,7 +541,7 @@ std::string LogosExecutionZoneWalletModule::claim_pinata_private_owned_already_i
return resultJson;
}
std::string LogosExecutionZoneWalletModule::claim_pinata_private_owned_not_initialized(
std::string LEZCoreModule::claim_pinata_private_owned_not_initialized(
const std::string& pinata_account_id_hex,
const std::string& winner_account_id_hex,
const std::string& solution_le16_hex
@ -575,7 +575,7 @@ std::string LogosExecutionZoneWalletModule::claim_pinata_private_owned_not_initi
// === Operations ===
std::string LogosExecutionZoneWalletModule::transfer_public(
std::string LEZCoreModule::transfer_public(
const std::string& from_hex,
const std::string& to_hex,
const std::string& amount_le16_hex
@ -603,7 +603,7 @@ std::string LogosExecutionZoneWalletModule::transfer_public(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::transfer_shielded(
std::string LEZCoreModule::transfer_shielded(
const std::string& from_hex,
const std::string& to_keys_json,
const std::string& amount_le16_hex
@ -648,7 +648,7 @@ std::string LogosExecutionZoneWalletModule::transfer_shielded(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::transfer_deshielded(
std::string LEZCoreModule::transfer_deshielded(
const std::string& from_hex,
const std::string& to_hex,
const std::string& amount_le16_hex
@ -676,7 +676,7 @@ std::string LogosExecutionZoneWalletModule::transfer_deshielded(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::transfer_private(
std::string LEZCoreModule::transfer_private(
const std::string& from_hex,
const std::string& to_keys_json,
const std::string& amount_le16_hex
@ -717,7 +717,7 @@ std::string LogosExecutionZoneWalletModule::transfer_private(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::transfer_shielded_owned(
std::string LEZCoreModule::transfer_shielded_owned(
const std::string& from_hex,
const std::string& to_hex,
const std::string& amount_le16_hex
@ -748,7 +748,7 @@ std::string LogosExecutionZoneWalletModule::transfer_shielded_owned(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::transfer_private_owned(
std::string LEZCoreModule::transfer_private_owned(
const std::string& from_hex,
const std::string& to_hex,
const std::string& amount_le16_hex
@ -776,7 +776,7 @@ std::string LogosExecutionZoneWalletModule::transfer_private_owned(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::register_public_account(const std::string& account_id_hex) {
std::string LEZCoreModule::register_public_account(const std::string& account_id_hex) {
FfiBytes32 id{};
if (!hexToBytes32(account_id_hex, &id)) {
fprintf(stderr, "register_public_account: invalid account_id_hex\n");
@ -795,7 +795,7 @@ std::string LogosExecutionZoneWalletModule::register_public_account(const std::s
// === Bridge (L1 Bedrock <-> L2) ===
std::string LogosExecutionZoneWalletModule::bridge_withdraw(
std::string LEZCoreModule::bridge_withdraw(
const std::string& from_hex,
const std::string& bedrock_account_pk_hex,
const uint64_t amount
@ -820,7 +820,7 @@ std::string LogosExecutionZoneWalletModule::bridge_withdraw(
// === Vault claiming ===
std::string LogosExecutionZoneWalletModule::get_vault_balance(const std::string& owner_account_id_hex) {
std::string LEZCoreModule::get_vault_balance(const std::string& owner_account_id_hex) {
FfiBytes32 ownerId{};
if (!hexToBytes32(owner_account_id_hex, &ownerId)) {
fprintf(stderr, "get_vault_balance: invalid owner_account_id_hex\n");
@ -836,7 +836,7 @@ std::string LogosExecutionZoneWalletModule::get_vault_balance(const std::string&
return balanceLe16ToDecimalString(balance);
}
std::string LogosExecutionZoneWalletModule::vault_claim(
std::string LEZCoreModule::vault_claim(
const std::string& owner_account_id_hex,
const std::string& amount_le16_hex
) {
@ -863,7 +863,7 @@ std::string LogosExecutionZoneWalletModule::vault_claim(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::vault_claim_private(
std::string LEZCoreModule::vault_claim_private(
const std::string& owner_account_id_hex,
const std::string& amount_le16_hex
) {
@ -890,7 +890,7 @@ std::string LogosExecutionZoneWalletModule::vault_claim_private(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::register_private_account(const std::string& account_id_hex) {
std::string LEZCoreModule::register_private_account(const std::string& account_id_hex) {
FfiBytes32 id{};
if (!hexToBytes32(account_id_hex, &id)) {
fprintf(stderr, "register_private_account: invalid account_id_hex\n");
@ -907,7 +907,7 @@ std::string LogosExecutionZoneWalletModule::register_private_account(const std::
return resultJson;
}
std::vector<uint8_t> LogosExecutionZoneWalletModule::token_elf() {
std::vector<uint8_t> LEZCoreModule::token_elf() {
FfiProgram ffi_program{};
WalletFfiError error = wallet_ffi_token_elf(&ffi_program);
if (error != SUCCESS) {
@ -922,7 +922,7 @@ std::vector<uint8_t> LogosExecutionZoneWalletModule::token_elf() {
return result;
}
std::vector<uint8_t> LogosExecutionZoneWalletModule::amm_elf() {
std::vector<uint8_t> LEZCoreModule::amm_elf() {
FfiProgram ffi_program{};
WalletFfiError error = wallet_ffi_token_elf(&ffi_program);
if (error != SUCCESS) {
@ -937,7 +937,7 @@ std::vector<uint8_t> LogosExecutionZoneWalletModule::amm_elf() {
return result;
}
std::vector<uint8_t> LogosExecutionZoneWalletModule::ata_elf() {
std::vector<uint8_t> LEZCoreModule::ata_elf() {
FfiProgram ffi_program{};
WalletFfiError error = wallet_ffi_token_elf(&ffi_program);
if (error != SUCCESS) {
@ -952,7 +952,7 @@ std::vector<uint8_t> LogosExecutionZoneWalletModule::ata_elf() {
return result;
}
std::vector<uint8_t> LogosExecutionZoneWalletModule::authenticated_transfer_elf() {
std::vector<uint8_t> LEZCoreModule::authenticated_transfer_elf() {
FfiProgram ffi_program{};
WalletFfiError error = wallet_ffi_token_elf(&ffi_program);
if (error != SUCCESS) {
@ -967,7 +967,7 @@ std::vector<uint8_t> LogosExecutionZoneWalletModule::authenticated_transfer_elf(
return result;
}
std::string LogosExecutionZoneWalletModule::send_generic_public_transaction(
std::string LEZCoreModule::send_generic_public_transaction(
const std::vector<std::string>& account_ids,
const std::vector<bool>& signing_requirements,
const std::vector<uint32_t>& instruction,
@ -1032,7 +1032,7 @@ std::string LogosExecutionZoneWalletModule::send_generic_public_transaction(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::send_generic_private_transaction(
std::string LEZCoreModule::send_generic_private_transaction(
const std::vector<std::string>& account_ids,
const std::vector<uint32_t>& instruction,
const std::vector<uint8_t>& program_elf,
@ -1121,7 +1121,7 @@ std::string LogosExecutionZoneWalletModule::send_generic_private_transaction(
return resultJson;
}
std::string LogosExecutionZoneWalletModule::send_program_deployment_transaction(
std::string LEZCoreModule::send_program_deployment_transaction(
const std::vector<uint8_t>& program_elf
) {
FfiTransactionResult result {};
@ -1147,7 +1147,7 @@ std::string LogosExecutionZoneWalletModule::send_program_deployment_transaction(
// === Wallet Lifecycle ===
std::string LogosExecutionZoneWalletModule::create_new(
std::string LEZCoreModule::create_new(
const std::string& config_path,
const std::string& storage_path,
const std::string& password
@ -1171,7 +1171,7 @@ std::string LogosExecutionZoneWalletModule::create_new(
return mnemonic;
}
int64_t LogosExecutionZoneWalletModule::restore_storage(const std::string& mnemonic, const std::string password, uint32_t depth) {
int64_t LEZCoreModule::restore_storage(const std::string& mnemonic, const std::string password, uint32_t depth) {
const WalletFfiError error = wallet_ffi_restore_data(walletHandle, mnemonic.c_str(), password.c_str(), depth);
if (error != SUCCESS) {
fprintf(stderr, "restore_storage: wallet FFI error %d\n", error);
@ -1181,7 +1181,7 @@ int64_t LogosExecutionZoneWalletModule::restore_storage(const std::string& mnemo
return SUCCESS;
}
int64_t LogosExecutionZoneWalletModule::open(const std::string& config_path, const std::string& storage_path) {
int64_t LEZCoreModule::open(const std::string& config_path, const std::string& storage_path) {
if (walletHandle) {
fprintf(stderr, "open: wallet is already open\n");
return INTERNAL_ERROR;
@ -1196,13 +1196,13 @@ int64_t LogosExecutionZoneWalletModule::open(const std::string& config_path, con
return SUCCESS;
}
int64_t LogosExecutionZoneWalletModule::save() {
int64_t LEZCoreModule::save() {
return wallet_ffi_save(walletHandle);
}
// === Configuration ===
std::string LogosExecutionZoneWalletModule::get_sequencer_addr() {
std::string LEZCoreModule::get_sequencer_addr() {
char* addr = wallet_ffi_get_sequencer_addr(walletHandle);
if (!addr) {
fprintf(stderr, "get_sequencer_addr: wallet_ffi returned null\n");

View File

@ -1,5 +1,5 @@
#ifndef LOGOS_EXECUTION_ZONE_WALLET_MODULE_H
#define LOGOS_EXECUTION_ZONE_WALLET_MODULE_H
#ifndef LEZ_CORE_MODULE_H
#define LEZ_CORE_MODULE_H
#include <cstdint>
#include <string>
@ -10,7 +10,7 @@ extern "C" {
#include <wallet_ffi.h>
}
// Universal (Qt-free) execution-zone wallet module. The Qt glue (provider
// Universal (Qt-free) execution-zone core module. The Qt glue (provider
// object + plugin) is generated from this header by logos-cpp-generator, which
// maps the std return types below to the Qt signatures callers invoke:
// std::string -> QString, int64_t -> int, LogosList -> QVariantList.
@ -18,13 +18,13 @@ extern "C" {
// NOTE: the generator parses this header line-by-line and only recognises a
// method when its declaration ends with ';' on a single line. Keep every
// method declaration on ONE line — multi-line signatures are silently dropped.
class LogosExecutionZoneWalletModule {
class LEZCoreModule {
public:
LogosExecutionZoneWalletModule();
~LogosExecutionZoneWalletModule();
LEZCoreModule();
~LEZCoreModule();
LogosExecutionZoneWalletModule(const LogosExecutionZoneWalletModule&) = delete;
LogosExecutionZoneWalletModule& operator=(const LogosExecutionZoneWalletModule&) = delete;
LEZCoreModule(const LEZCoreModule&) = delete;
LEZCoreModule& operator=(const LEZCoreModule&) = delete;
std::string name() const;
std::string version() const;
@ -78,15 +78,8 @@ public:
std::vector<uint8_t> ata_elf();
std::string send_generic_public_transaction(const std::vector<std::string>& account_ids, const std::vector<bool>& signing_requirements, const std::vector<uint32_t>& instruction, const std::string& program_id_hex);
std::string send_generic_private_transaction(
const std::vector<std::string>& account_ids,
const std::vector<uint32_t>& instruction,
const std::vector<uint8_t>& program_elf,
const std::vector<std::vector<uint8_t>>& program_dependencies
);
std::string send_program_deployment_transaction(
const std::vector<uint8_t>& program_elf
);
std::string send_generic_private_transaction(const std::vector<std::string>& account_ids, const std::vector<uint32_t>& instruction, const std::vector<uint8_t>& program_elf, const std::vector<std::vector<uint8_t>>& program_dependencies);
std::string send_program_deployment_transaction(const std::vector<uint8_t>& program_elf);
// === Bridge (L1 Bedrock <-> L2) ===
std::string bridge_withdraw(const std::string& from_hex, const std::string& bedrock_account_pk_hex, uint64_t amount);
@ -103,4 +96,4 @@ private:
WalletHandle* walletHandle = nullptr;
};
#endif // LOGOS_EXECUTION_ZONE_WALLET_MODULE_H
#endif // LEZ_CORE_MODULE_H

View File

@ -1,17 +1,17 @@
cmake_minimum_required(VERSION 3.14)
project(ExecutionZoneModuleTests LANGUAGES CXX)
project(LEZCoreTests LANGUAGES CXX)
include(LogosTest)
# Unit tests (mocked wallet_ffi)
logos_test(
NAME execution_zone_module_tests
NAME lez_core_module_tests
MODULE_SOURCES
../src/logos_execution_zone_wallet_module.cpp
../src/lez_core_module.cpp
TEST_SOURCES
main.cpp
test_execution_zone.cpp
test_lez_core.cpp
MOCK_C_SOURCES
mocks/mock_wallet_ffi.cpp
EXTRA_INCLUDES
@ -19,7 +19,7 @@ logos_test(
)
# The module targets C++20 (uses __uint128_t); LogosTest.cmake defaults to C++17.
set_target_properties(execution_zone_module_tests PROPERTIES CXX_STANDARD 20)
set_target_properties(lez_core_module_tests PROPERTIES CXX_STANDARD 20)
# Integration tests (real wallet_ffi library)
@ -29,27 +29,27 @@ find_library(WALLET_FFI_PATH
NO_DEFAULT_PATH)
if(WALLET_FFI_PATH)
message(STATUS "[ExecutionZoneTests] wallet_ffi found: ${WALLET_FFI_PATH} - building integration tests")
message(STATUS "[LEZCoreTests] wallet_ffi found: ${WALLET_FFI_PATH} - building integration tests")
logos_test(
NAME execution_zone_module_integration_tests
NAME lez_core_module_integration_tests
MODULE_SOURCES
../src/logos_execution_zone_wallet_module.cpp
../src/lez_core_module.cpp
TEST_SOURCES
main.cpp
test_execution_zone_integration.cpp
test_lez_core_integration.cpp
EXTRA_INCLUDES
../lib
EXTRA_LINK_LIBS
${WALLET_FFI_PATH}
)
set_target_properties(execution_zone_module_integration_tests PROPERTIES CXX_STANDARD 20)
set_target_properties(lez_core_module_integration_tests PROPERTIES CXX_STANDARD 20)
get_filename_component(WALLET_FFI_DIR "${WALLET_FFI_PATH}" DIRECTORY)
set_target_properties(execution_zone_module_integration_tests PROPERTIES
set_target_properties(lez_core_module_integration_tests PROPERTIES
BUILD_RPATH "${WALLET_FFI_DIR}"
)
else()
message(STATUS "[ExecutionZoneTests] wallet_ffi not found in ../lib - skipping integration tests")
message(STATUS "[LEZCoreTests] wallet_ffi not found in ../lib - skipping integration tests")
endif()

View File

@ -1,8 +1,8 @@
// Unit tests for LogosExecutionZoneWalletModule.
// Unit tests for LEZCoreModule.
// All wallet_ffi C functions are mocked at link time via mock_wallet_ffi.cpp.
#include <logos_test.h>
#include "logos_execution_zone_wallet_module.h"
#include "lez_core_module.h"
#include "mocks/mock_wallet_ffi_capture.h"
#include <cstring>
@ -27,9 +27,9 @@ static nlohmann::json parseObject(const std::string& json) {
// ============================================================================
LOGOS_TEST(name_and_version) {
LogosExecutionZoneWalletModule module;
LOGOS_ASSERT_EQ(module.name(), std::string("logos_execution_zone"));
LOGOS_ASSERT_EQ(module.version(), std::string("1.0.0"));
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.name(), std::string("lez_core"));
LOGOS_ASSERT_EQ(module.version(), std::string("0.2.0"));
}
// ============================================================================
@ -38,7 +38,7 @@ LOGOS_TEST(name_and_version) {
LOGOS_TEST(create_account_public_returns_hex_on_success) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string id = module.create_account_public();
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_create_account_public"));
@ -51,14 +51,14 @@ LOGOS_TEST(create_account_public_returns_hex_on_success) {
LOGOS_TEST(create_account_public_returns_empty_on_error) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_create_account_public").returns(static_cast<int>(INTERNAL_ERROR));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(module.create_account_public().empty());
}
LOGOS_TEST(create_account_private_returns_hex_on_success) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string id = module.create_account_private();
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_create_account_private"));
@ -70,7 +70,7 @@ LOGOS_TEST(create_account_private_returns_hex_on_success) {
LOGOS_TEST(list_accounts_maps_entries) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("list_accounts_count").returns(3);
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const LogosList accounts = module.list_accounts();
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_list_accounts"));
@ -87,7 +87,7 @@ LOGOS_TEST(list_accounts_maps_entries) {
LOGOS_TEST(list_accounts_empty_on_error) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_list_accounts").returns(static_cast<int>(INTERNAL_ERROR));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(static_cast<int>(module.list_accounts().size()), 0);
}
@ -98,7 +98,7 @@ LOGOS_TEST(list_accounts_empty_on_error) {
LOGOS_TEST(get_balance_invalid_hex_returns_empty) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(module.get_balance("not-hex", true).empty());
LOGOS_ASSERT_FALSE(t.cFunctionCalled("wallet_ffi_get_balance"));
@ -107,7 +107,7 @@ LOGOS_TEST(get_balance_invalid_hex_returns_empty) {
LOGOS_TEST(get_balance_returns_decimal_string) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("get_balance_value").returns(123456789);
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string balance = module.get_balance(VALID_ID, true);
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_get_balance"));
@ -117,14 +117,14 @@ LOGOS_TEST(get_balance_returns_decimal_string) {
LOGOS_TEST(get_balance_zero) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("get_balance_value").returns(0);
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.get_balance(VALID_ID, false), std::string("0"));
}
LOGOS_TEST(get_account_public_returns_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.get_account_public(VALID_ID));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_get_account_public"));
@ -136,7 +136,7 @@ LOGOS_TEST(get_account_public_returns_json) {
LOGOS_TEST(get_account_public_invalid_hex_returns_empty) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(module.get_account_public("zz").empty());
LOGOS_ASSERT_FALSE(t.cFunctionCalled("wallet_ffi_get_account_public"));
@ -144,7 +144,7 @@ LOGOS_TEST(get_account_public_invalid_hex_returns_empty) {
LOGOS_TEST(get_public_account_key_returns_hex) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
std::string expected;
for (int i = 0; i < 32; ++i) expected += "be";
@ -153,7 +153,7 @@ LOGOS_TEST(get_public_account_key_returns_hex) {
LOGOS_TEST(get_private_account_keys_returns_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.get_private_account_keys(VALID_ID));
std::string expected;
@ -167,7 +167,7 @@ LOGOS_TEST(get_private_account_keys_returns_json) {
LOGOS_TEST(account_id_to_base58_invalid_hex_returns_empty) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(module.account_id_to_base58("xyz").empty());
}
@ -175,14 +175,14 @@ LOGOS_TEST(account_id_to_base58_invalid_hex_returns_empty) {
LOGOS_TEST(account_id_to_base58_returns_string) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_account_id_to_base58").returns("SomeBase58Value");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.account_id_to_base58(VALID_ID), std::string("SomeBase58Value"));
}
LOGOS_TEST(account_id_from_base58_returns_hex) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
std::string expected;
for (int i = 0; i < 32; ++i) expected += "5a";
@ -192,7 +192,7 @@ LOGOS_TEST(account_id_from_base58_returns_hex) {
LOGOS_TEST(account_id_from_base58_error_returns_empty) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_account_id_from_base58").returns(static_cast<int>(INTERNAL_ERROR));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(module.account_id_from_base58("anything").empty());
}
@ -204,7 +204,7 @@ LOGOS_TEST(account_id_from_base58_error_returns_empty) {
LOGOS_TEST(sync_to_block_forwards_value) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_sync_to_block").returns(7);
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.sync_to_block(100), static_cast<int64_t>(7));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_sync_to_block"));
@ -213,7 +213,7 @@ LOGOS_TEST(sync_to_block_forwards_value) {
LOGOS_TEST(get_last_synced_block_returns_value) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("last_synced_block_value").returns(55);
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.get_last_synced_block(), static_cast<int64_t>(55));
}
@ -221,7 +221,7 @@ LOGOS_TEST(get_last_synced_block_returns_value) {
LOGOS_TEST(get_last_synced_block_error_returns_zero) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_get_last_synced_block").returns(static_cast<int>(INTERNAL_ERROR));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.get_last_synced_block(), static_cast<int64_t>(0));
}
@ -229,7 +229,7 @@ LOGOS_TEST(get_last_synced_block_error_returns_zero) {
LOGOS_TEST(get_current_block_height_returns_value) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("current_block_height_value").returns(999);
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.get_current_block_height(), static_cast<int64_t>(999));
}
@ -240,7 +240,7 @@ LOGOS_TEST(get_current_block_height_returns_value) {
LOGOS_TEST(transfer_public_success_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.transfer_public(VALID_ID, VALID_ID_2, VALID_U128));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_transfer_public"));
@ -251,7 +251,7 @@ LOGOS_TEST(transfer_public_success_json) {
LOGOS_TEST(transfer_public_invalid_hex_error_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.transfer_public("bad", VALID_ID_2, VALID_U128));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -261,7 +261,7 @@ LOGOS_TEST(transfer_public_invalid_hex_error_json) {
LOGOS_TEST(transfer_public_invalid_amount_error_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.transfer_public(VALID_ID, VALID_ID_2, "ff"));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -271,7 +271,7 @@ LOGOS_TEST(transfer_public_invalid_amount_error_json) {
LOGOS_TEST(transfer_public_ffi_error_json) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_transfer_public").returns(static_cast<int>(INTERNAL_ERROR));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.transfer_public(VALID_ID, VALID_ID_2, VALID_U128));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -280,7 +280,7 @@ LOGOS_TEST(transfer_public_ffi_error_json) {
LOGOS_TEST(transfer_shielded_invalid_keys_json_error) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
// to_keys_json is not valid JSON object -> parse failure.
const nlohmann::json obj = parseObject(module.transfer_shielded(VALID_ID, "not-json", VALID_U128));
@ -290,7 +290,7 @@ LOGOS_TEST(transfer_shielded_invalid_keys_json_error) {
LOGOS_TEST(transfer_shielded_success_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string keysJson = std::string("{\"nullifier_public_key\":\"") + std::string(64, 'a') + std::string("\"}");
const nlohmann::json obj = parseObject(module.transfer_shielded(VALID_ID, keysJson, VALID_U128));
@ -301,7 +301,7 @@ LOGOS_TEST(transfer_shielded_success_json) {
// to_keys_json carrying an explicit "identifier" must be forwarded to the FFI call as-is.
LOGOS_TEST(transfer_shielded_with_identifier_forwards_it_unchanged) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string identifierHex(32, '7'); // 16 bytes of 0x77
const std::string keysJson = std::string("{\"nullifier_public_key\":\"") + std::string(64, 'a')
@ -319,7 +319,7 @@ LOGOS_TEST(transfer_shielded_with_identifier_forwards_it_unchanged) {
// generated each call (regression guard against reintroducing the old hardcoded-zero identifier).
LOGOS_TEST(transfer_shielded_without_identifier_uses_random_nonzero_identifier) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string keysJson = std::string("{\"nullifier_public_key\":\"") + std::string(64, 'a') + "\"}";
@ -338,7 +338,7 @@ LOGOS_TEST(transfer_shielded_without_identifier_uses_random_nonzero_identifier)
// transfer_private mirrors transfer_shielded's identifier handling exactly (see above).
LOGOS_TEST(transfer_private_with_identifier_forwards_it_unchanged) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string identifierHex(32, '7'); // 16 bytes of 0x77
const std::string keysJson = std::string("{\"nullifier_public_key\":\"") + std::string(64, 'a')
@ -354,7 +354,7 @@ LOGOS_TEST(transfer_private_with_identifier_forwards_it_unchanged) {
LOGOS_TEST(transfer_private_without_identifier_uses_random_nonzero_identifier) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string keysJson = std::string("{\"nullifier_public_key\":\"") + std::string(64, 'a') + "\"}";
@ -372,7 +372,7 @@ LOGOS_TEST(transfer_private_without_identifier_uses_random_nonzero_identifier) {
LOGOS_TEST(register_public_account_invalid_hex_error_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.register_public_account("bad"));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -381,7 +381,7 @@ LOGOS_TEST(register_public_account_invalid_hex_error_json) {
LOGOS_TEST(register_private_account_success_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.register_private_account(VALID_ID));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_register_private_account"));
@ -394,7 +394,7 @@ LOGOS_TEST(register_private_account_success_json) {
LOGOS_TEST(bridge_withdraw_success_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.bridge_withdraw(VALID_ID, VALID_ID_2, 100));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_bridge_withdraw"));
@ -405,7 +405,7 @@ LOGOS_TEST(bridge_withdraw_success_json) {
LOGOS_TEST(bridge_withdraw_invalid_hex_error_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.bridge_withdraw("bad", VALID_ID_2, 100));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -416,7 +416,7 @@ LOGOS_TEST(bridge_withdraw_invalid_hex_error_json) {
LOGOS_TEST(bridge_withdraw_ffi_error_json) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_bridge_withdraw").returns(static_cast<int>(INTERNAL_ERROR));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.bridge_withdraw(VALID_ID, VALID_ID_2, 100));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -429,7 +429,7 @@ LOGOS_TEST(bridge_withdraw_ffi_error_json) {
LOGOS_TEST(get_vault_balance_invalid_hex_returns_empty) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(module.get_vault_balance("not-hex").empty());
LOGOS_ASSERT_FALSE(t.cFunctionCalled("wallet_ffi_get_vault_balance"));
@ -438,7 +438,7 @@ LOGOS_TEST(get_vault_balance_invalid_hex_returns_empty) {
LOGOS_TEST(get_vault_balance_returns_decimal_string) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("get_vault_balance_value").returns(42);
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string balance = module.get_vault_balance(VALID_ID);
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_get_vault_balance"));
@ -448,14 +448,14 @@ LOGOS_TEST(get_vault_balance_returns_decimal_string) {
LOGOS_TEST(get_vault_balance_ffi_error_returns_empty) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_get_vault_balance").returns(static_cast<int>(INTERNAL_ERROR));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(module.get_vault_balance(VALID_ID).empty());
}
LOGOS_TEST(vault_claim_success_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.vault_claim(VALID_ID, VALID_U128));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_vault_claim"));
@ -466,7 +466,7 @@ LOGOS_TEST(vault_claim_success_json) {
LOGOS_TEST(vault_claim_invalid_hex_error_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.vault_claim("bad", VALID_U128));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -476,7 +476,7 @@ LOGOS_TEST(vault_claim_invalid_hex_error_json) {
LOGOS_TEST(vault_claim_invalid_amount_error_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.vault_claim(VALID_ID, "ff"));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -486,7 +486,7 @@ LOGOS_TEST(vault_claim_invalid_amount_error_json) {
LOGOS_TEST(vault_claim_ffi_error_json) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_vault_claim").returns(static_cast<int>(INTERNAL_ERROR));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.vault_claim(VALID_ID, VALID_U128));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -495,7 +495,7 @@ LOGOS_TEST(vault_claim_ffi_error_json) {
LOGOS_TEST(vault_claim_private_success_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.vault_claim_private(VALID_ID, VALID_U128));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_vault_claim_private"));
@ -504,7 +504,7 @@ LOGOS_TEST(vault_claim_private_success_json) {
LOGOS_TEST(vault_claim_private_invalid_hex_error_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.vault_claim_private("bad", VALID_U128));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -513,7 +513,7 @@ LOGOS_TEST(vault_claim_private_invalid_hex_error_json) {
LOGOS_TEST(vault_claim_private_invalid_amount_error_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.vault_claim_private(VALID_ID, "ff"));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -523,7 +523,7 @@ LOGOS_TEST(vault_claim_private_invalid_amount_error_json) {
LOGOS_TEST(vault_claim_private_ffi_error_json) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_vault_claim_private").returns(static_cast<int>(INTERNAL_ERROR));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.vault_claim_private(VALID_ID, VALID_U128));
LOGOS_ASSERT_FALSE(obj["success"].get<bool>());
@ -536,7 +536,7 @@ LOGOS_TEST(vault_claim_private_ffi_error_json) {
LOGOS_TEST(claim_pinata_invalid_hex_returns_empty) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(module.claim_pinata("bad", VALID_ID_2, VALID_U128).empty());
LOGOS_ASSERT_FALSE(t.cFunctionCalled("wallet_ffi_claim_pinata"));
@ -544,7 +544,7 @@ LOGOS_TEST(claim_pinata_invalid_hex_returns_empty) {
LOGOS_TEST(claim_pinata_invalid_solution_returns_empty) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(module.claim_pinata(VALID_ID, VALID_ID_2, "ab").empty());
LOGOS_ASSERT_FALSE(t.cFunctionCalled("wallet_ffi_claim_pinata"));
@ -552,7 +552,7 @@ LOGOS_TEST(claim_pinata_invalid_solution_returns_empty) {
LOGOS_TEST(claim_pinata_success_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const nlohmann::json obj = parseObject(module.claim_pinata(VALID_ID, VALID_ID_2, VALID_U128));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_claim_pinata"));
@ -561,7 +561,7 @@ LOGOS_TEST(claim_pinata_success_json) {
LOGOS_TEST(claim_pinata_already_initialized_invalid_siblings_returns_empty) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
// siblings json is not an array -> parse failure.
const std::string result = module.claim_pinata_private_owned_already_initialized(
@ -572,7 +572,7 @@ LOGOS_TEST(claim_pinata_already_initialized_invalid_siblings_returns_empty) {
LOGOS_TEST(claim_pinata_already_initialized_success_json) {
auto t = LogosTestContext("logos_execution_zone");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string siblings = std::string("[\"") + std::string(64, 'a') + std::string("\",\"") + std::string(64, 'b') + std::string("\"]");
const nlohmann::json obj = parseObject(module.claim_pinata_private_owned_already_initialized(
@ -588,7 +588,7 @@ LOGOS_TEST(claim_pinata_already_initialized_success_json) {
LOGOS_TEST(create_new_success_then_double_open_fails) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_create_new").returns(1); // non-null handle
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_TRUE(!module.create_new("/cfg", "/store", "pw").empty());
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_create_new"));
@ -599,7 +599,7 @@ LOGOS_TEST(create_new_success_then_double_open_fails) {
LOGOS_TEST(create_new_null_handle_returns_internal_error) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_create_new").returns(0); // null handle
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.create_new("/cfg", "/store", "pw"), "");
}
@ -607,7 +607,7 @@ LOGOS_TEST(create_new_null_handle_returns_internal_error) {
LOGOS_TEST(open_success) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_open").returns(1);
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.open("/cfg", "/store"), static_cast<int64_t>(SUCCESS));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_open"));
@ -616,7 +616,7 @@ LOGOS_TEST(open_success) {
LOGOS_TEST(save_forwards_return_code) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_save").returns(static_cast<int>(SUCCESS));
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.save(), static_cast<int64_t>(SUCCESS));
LOGOS_ASSERT(t.cFunctionCalled("wallet_ffi_save"));
@ -629,7 +629,7 @@ LOGOS_TEST(save_forwards_return_code) {
LOGOS_TEST(get_sequencer_addr_returns_string) {
auto t = LogosTestContext("logos_execution_zone");
t.mockCFunction("wallet_ffi_get_sequencer_addr").returns("10.0.0.1:9000");
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
LOGOS_ASSERT_EQ(module.get_sequencer_addr(), std::string("10.0.0.1:9000"));
}

View File

@ -1,4 +1,4 @@
// Integration tests for LogosExecutionZoneWalletModule — uses the REAL wallet_ffi
// Integration tests for LEZCoreModule — uses the REAL wallet_ffi
// library. No mocking. Limited to network-free, wallet-handle-free pure functions
// so the suite stays deterministic and offline.
//
@ -6,14 +6,14 @@
// time. Skipped automatically when the library is not found (see CMakeLists.txt).
#include <logos_test.h>
#include "logos_execution_zone_wallet_module.h"
#include "lez_core_module.h"
#include <string>
// account_id_to_base58 and account_id_from_base58 are pure encoding helpers that
// do not require an open wallet, so they can be exercised against the real lib.
LOGOS_TEST(integration_account_id_base58_round_trip) {
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
const std::string idHex = std::string(64, 'a');
@ -26,7 +26,7 @@ LOGOS_TEST(integration_account_id_base58_round_trip) {
}
LOGOS_TEST(integration_account_id_from_base58_rejects_garbage) {
LogosExecutionZoneWalletModule module;
LEZCoreModule module;
// Clearly invalid base58 input should not decode to a valid id.
LOGOS_ASSERT_TRUE(module.account_id_from_base58("!!!not-base58!!!").empty());