mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 22:21:16 +00:00
chore: update to release set v0.2.1
This commit is contained in:
Generated
+493
-463
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -34,8 +34,8 @@ exclude = [
|
||||
resolver = "2"
|
||||
|
||||
[workspace.dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["test-utils"], package = "lee" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["test-utils"], package = "lee" }
|
||||
token_core = { path = "programs/token/core" }
|
||||
token_program = { path = "programs/token" }
|
||||
amm_core = { path = "programs/amm/core" }
|
||||
@@ -92,4 +92,4 @@ wildcard_enum_match_arm = "deny"
|
||||
|
||||
# Too noisy for this codebase unless enforced selectively.
|
||||
module_name_repetitions = "allow"
|
||||
similar_names = "allow"
|
||||
similar_names = "allow"
|
||||
+4
-4
@@ -8,8 +8,8 @@ See the [Logos QML UI App Tutorial](https://github.com/logos-co/logos-tutorial/b
|
||||
|
||||
This app is a `ui_qml` module with a hand-written C++ backend
|
||||
(`src/AmmUiBackend.*`, plugin in `src/AmmUiPlugin.*`) that depends on the core
|
||||
**`logos_execution_zone`** wallet module. The backend calls the core module's
|
||||
wallet FFI through `m_logos->logos_execution_zone.*` and exposes an async QtRO
|
||||
**`lez_core`** wallet module. The backend calls the core module's
|
||||
wallet FFI through `m_logos->lez_core.*` and exposes an async QtRO
|
||||
surface (`src/AmmUiBackend.rep`) plus an account list model to the QML view.
|
||||
|
||||
**Onboarding is non-invasive.** The app opens straight to the Trade screen; the
|
||||
@@ -28,7 +28,7 @@ Account/keystore sharing follows the runtime:
|
||||
`openOrAdoptWallet()`), surfacing **shared** accounts across apps.
|
||||
|
||||
> Follow-up: the app reconstructs the wallet paths itself because the
|
||||
> `logos_execution_zone` module only exposes path-taking `create_new`/`open`.
|
||||
> `lez_core` module only exposes path-taking `create_new`/`open`.
|
||||
> LEZ's wallet FFI now provides path-free variants (`wallet_ffi_create_new_default`,
|
||||
> `wallet_ffi_open_default`, plus `wallet_ffi_default_config_path` /
|
||||
> `_storage_path` / `wallet_ffi_wallet_exists_default`). Once the module surfaces
|
||||
@@ -70,7 +70,7 @@ default.)
|
||||
## Running inside Logos Basecamp
|
||||
|
||||
This app is a UI plugin that depends on the **core wallet module**
|
||||
`logos_execution_zone` (see the Wallet / chain integration section above). Both
|
||||
`lez_core` (see the Wallet / chain integration section above). Both
|
||||
have to be installed into Basecamp — the UI plugin alone will show the AMM tab
|
||||
but fail to open it with `Failed to load core dependencies for amm_ui`.
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
# match the metadata.json `dependencies` entry so the builder can resolve
|
||||
# it as a module dependency. This revision exposes generic transaction
|
||||
# submission by deployed program ID.
|
||||
logos_execution_zone = {
|
||||
lez_core = {
|
||||
url = "github:logos-blockchain/logos-execution-zone-module?rev=d70225ced646934d2294fd9e8f8b03615c104b80";
|
||||
|
||||
# The module pins the monorepo at v0.2.0-rc6 (e37876a), which owns the
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"main": "amm_ui_plugin",
|
||||
"view": "qml/Main.qml",
|
||||
"icon": "icons/amm.png",
|
||||
"dependencies": ["logos_execution_zone", "amm_module"],
|
||||
"dependencies": ["lez_core", "amm_module"],
|
||||
|
||||
"nix": {
|
||||
"packages": {
|
||||
|
||||
@@ -274,7 +274,7 @@ QString AmmUiBackend::swapExactInput(QString defAHex, QString defBHex, QString u
|
||||
QString minOutDecimal, QString deadlineDecimal)
|
||||
{
|
||||
// This app's connected state is the authoritative submit guard. disconnectWallet()
|
||||
// only locks this UI and leaves the shared logos_execution_zone wallet open (another
|
||||
// only locks this UI and leaves the shared lez_core wallet open (another
|
||||
// app may keep it open, or this app opened-then-disconnected), and the QML submit path
|
||||
// doesn't check isWalletOpen — so without this a swap could sign/submit while the UI
|
||||
// shows "Connect".
|
||||
|
||||
@@ -114,7 +114,7 @@ private:
|
||||
LogosAPI* m_logosAPI;
|
||||
// Handle for the amm_module core module (resolvePool / swapExactInput /
|
||||
// resolveTokens). The module wraps the amm_ffi brain and
|
||||
// reaches the shared wallet through its own logos_execution_zone dependency;
|
||||
// reaches the shared wallet through its own lez_core dependency;
|
||||
// this backend keeps a thin LogosModules over the same LogosAPI as the
|
||||
// wallet provider so both resolve that one shared wallet instance.
|
||||
std::unique_ptr<LogosModules> m_logos;
|
||||
|
||||
@@ -67,6 +67,17 @@ TEST_WALLET_DEPTH="${TEST_WALLET_DEPTH:-3}"
|
||||
# whatever the wallet home is already configured with.
|
||||
TEST_SEQUENCER_ADDR="${TEST_SEQUENCER_ADDR:-}"
|
||||
|
||||
# Sequencer confirmation poll. The wallet poller (lee `lez/wallet/src/poller.rs`)
|
||||
# calls get_transaction up to `seq_tx_poll_max_blocks` times, sleeping
|
||||
# `seq_poll_timeout` BETWEEN polls — despite its name that field is the inter-poll
|
||||
# DELAY, not a total timeout, so total wait ≈ blocks × delay. The wallet defaults
|
||||
# (5 × 12s ≈ 48s) can abort a tx that confirms a little later. Widen the window by
|
||||
# raising the NUMBER of polls and keeping the delay short so detection stays
|
||||
# responsive (40 × 3s ≈ 2min). Do NOT inflate the delay — a large delay just polls
|
||||
# rarely and appears to hang. Override via env.
|
||||
TEST_SEQ_TX_POLL_MAX_BLOCKS="${TEST_SEQ_TX_POLL_MAX_BLOCKS:-40}"
|
||||
TEST_SEQ_POLL_TIMEOUT="${TEST_SEQ_POLL_TIMEOUT:-3s}"
|
||||
|
||||
# Deterministic accounts, created in THIS fixed order after a fresh restore so
|
||||
# their ids are reproducible. Resolved to ids at runtime via `wallet account id`.
|
||||
# token-c-*/token-d-* are APPENDED (not inserted) so the pre-existing a/b/lp ids don't shift.
|
||||
@@ -205,17 +216,9 @@ restore_test_wallet() {
|
||||
kv "wallet home" "$TEST_WALLET_HOME"
|
||||
mkdir -p "$TEST_WALLET_HOME"
|
||||
|
||||
if [ -n "$TEST_SEQUENCER_ADDR" ]; then
|
||||
log "${DIM}\$ wallet config set sequencer_addr $TEST_SEQUENCER_ADDR${RST}"
|
||||
# On a fresh home the first wallet command triggers one-time setup, which
|
||||
# reads a password from STDIN ("Input password:") and generates a THROWAWAY
|
||||
# random-seed wallet. Feed the password so it never blocks; restore-keys
|
||||
# below immediately rewrites storage from the test mnemonic and sets the real
|
||||
# password to $TEST_WALLET_PASSWORD.
|
||||
printf '%s\n' "$TEST_WALLET_PASSWORD" \
|
||||
| wallet config set sequencer_addr "$TEST_SEQUENCER_ADDR" \
|
||||
|| log "${YEL}⚠ 'wallet config set sequencer_addr' failed — configure the wallet manually.${RST}"
|
||||
fi
|
||||
# The sequencer + poll config is written by write_wallet_config() before this
|
||||
# runs (v0.2.1 schema; `wallet config set` can't set the sequencer). restore-keys
|
||||
# is the first STORAGE command on a fresh home and rewrites it from the mnemonic.
|
||||
|
||||
# restore-keys reads the mnemonic then the password from stdin (non-interactive)
|
||||
# and REWRITES storage — so the wallet's password becomes $TEST_WALLET_PASSWORD.
|
||||
@@ -245,6 +248,30 @@ ensure_accounts() {
|
||||
done
|
||||
}
|
||||
|
||||
# Write the wallet config in the v0.2.1 schema. That version replaced the old
|
||||
# `sequencer_addr` string with a `sequencers` LIST and `wallet config set` refuses
|
||||
# the sequencer field ("Unknown field"), so we write the file directly — which
|
||||
# also replaces any stale old-format config the new wallet can't deserialize
|
||||
# ("missing field `sequencers`"). The widened poll window (see TEST_SEQ_* above)
|
||||
# is baked in here. Runs on every setup, before any wallet command reads config.
|
||||
write_wallet_config() {
|
||||
local addr="${TEST_SEQUENCER_ADDR:-http://127.0.0.1:3040}"
|
||||
sec "Write wallet config (v0.2.1 schema)"
|
||||
mkdir -p "$TEST_WALLET_HOME"
|
||||
kv "sequencer_addr" "$addr"
|
||||
kv "seq_tx_poll_max_blocks" "$TEST_SEQ_TX_POLL_MAX_BLOCKS"
|
||||
kv "seq_poll_timeout" "$TEST_SEQ_POLL_TIMEOUT"
|
||||
cat > "$TEST_WALLET_HOME/wallet_config.json" <<JSON
|
||||
{
|
||||
"sequencers": [{ "sequencer_addr": "$addr" }],
|
||||
"seq_poll_timeout": "$TEST_SEQ_POLL_TIMEOUT",
|
||||
"seq_tx_poll_max_blocks": $TEST_SEQ_TX_POLL_MAX_BLOCKS,
|
||||
"seq_poll_max_retries": 5,
|
||||
"seq_block_poll_max_amount": 100
|
||||
}
|
||||
JSON
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# 0. Preflight + wallet bootstrap
|
||||
###############################################################################
|
||||
@@ -257,7 +284,20 @@ require_file "$TOKEN_IDL"; require_file "$AMM_IDL"
|
||||
kv "repo root" "$REPO_ROOT"
|
||||
kv "token bin" "$TOKEN_BIN"; kv "amm bin" "$AMM_BIN"; kv "twap bin" "$TWAP_BIN"
|
||||
|
||||
if [ ! -d "$TEST_WALLET_HOME" ] || [ "${FORCE_BOOTSTRAP:-0}" = "1" ]; then
|
||||
# Decide whether keys need restoring from the key material (storage.json), NOT the
|
||||
# home dir — write_wallet_config below creates the dir, so a dir check would always
|
||||
# read as "already bootstrapped".
|
||||
NEEDS_KEY_RESTORE=0
|
||||
if [ ! -f "$TEST_WALLET_HOME/storage.json" ] || [ "${FORCE_BOOTSTRAP:-0}" = "1" ]; then
|
||||
NEEDS_KEY_RESTORE=1
|
||||
fi
|
||||
|
||||
# Write the v0.2.1 wallet config FIRST so every wallet command below can read it
|
||||
# (and any stale old-format config is replaced). Also sets the sequencer + widened
|
||||
# poll window.
|
||||
write_wallet_config
|
||||
|
||||
if [ "$NEEDS_KEY_RESTORE" = "1" ]; then
|
||||
restore_test_wallet
|
||||
else
|
||||
kv "test wallet" "reusing $TEST_WALLET_HOME (FORCE_BOOTSTRAP=1 to re-restore keys)"
|
||||
|
||||
@@ -119,7 +119,7 @@ WalletSession LogosWalletProvider::connect(const WalletPaths& paths)
|
||||
} else {
|
||||
if (!QFileInfo::exists(paths.storage))
|
||||
return failedSession(WalletFailure::WalletMissing);
|
||||
if (m_impl->logos->logos_execution_zone.open(paths.config, paths.storage)
|
||||
if (m_impl->logos->lez_core.open(paths.config, paths.storage, paths.statistics)
|
||||
!= WALLET_FFI_SUCCESS) {
|
||||
return failedSession(WalletFailure::OpenFailed);
|
||||
}
|
||||
@@ -146,8 +146,8 @@ WalletCreation LogosWalletProvider::createWallet(const WalletPaths& paths,
|
||||
}
|
||||
|
||||
WalletCreation creation;
|
||||
creation.mnemonic = m_impl->logos->logos_execution_zone.create_new(
|
||||
paths.config, paths.storage, password);
|
||||
creation.mnemonic = m_impl->logos->lez_core.create_new(
|
||||
paths.config, paths.storage, paths.statistics, password);
|
||||
if (creation.mnemonic.isEmpty())
|
||||
return failedCreation(WalletFailure::CreateFailed);
|
||||
|
||||
@@ -196,8 +196,8 @@ WalletAccountCreation LogosWalletProvider::createAccount(bool isPublic)
|
||||
}
|
||||
|
||||
creation.accountId = isPublic
|
||||
? m_impl->logos->logos_execution_zone.create_account_public()
|
||||
: m_impl->logos->logos_execution_zone.create_account_private();
|
||||
? m_impl->logos->lez_core.create_account_public()
|
||||
: m_impl->logos->lez_core.create_account_private();
|
||||
if (!isHex(creation.accountId, 64)) {
|
||||
creation.failure = WalletFailure::CreateFailed;
|
||||
return creation;
|
||||
@@ -224,7 +224,7 @@ WalletAccountRead LogosWalletProvider::readPublicAccount(const QString& accountI
|
||||
|
||||
QJsonParseError parseError;
|
||||
const QJsonDocument document = QJsonDocument::fromJson(
|
||||
m_impl->logos->logos_execution_zone.get_account_public(accountId).toUtf8(),
|
||||
m_impl->logos->lez_core.get_account_public(accountId).toUtf8(),
|
||||
&parseError);
|
||||
if (parseError.error != QJsonParseError::NoError || !document.isObject())
|
||||
return read;
|
||||
@@ -291,7 +291,7 @@ WalletSubmission LogosWalletProvider::submitPublicTransaction(
|
||||
}
|
||||
|
||||
const QString response =
|
||||
m_impl->logos->logos_execution_zone.send_generic_public_transaction(
|
||||
m_impl->logos->lez_core.send_generic_public_transaction(
|
||||
transaction.accountIds,
|
||||
signingRequirements,
|
||||
QVariant::fromValue(instructionBytes),
|
||||
@@ -335,27 +335,27 @@ bool LogosWalletProvider::sharedWalletIsOpen() const
|
||||
{
|
||||
if (!m_impl->logos)
|
||||
return false;
|
||||
if (!m_impl->logos->logos_execution_zone.get_sequencer_addr().isEmpty())
|
||||
if (!m_impl->logos->lez_core.get_sequencer_addr().isEmpty())
|
||||
return true;
|
||||
return !m_impl->logos->logos_execution_zone.list_accounts().isEmpty();
|
||||
return !m_impl->logos->lez_core.list_accounts().isEmpty();
|
||||
}
|
||||
|
||||
WalletSnapshot LogosWalletProvider::loadSnapshot()
|
||||
{
|
||||
WalletSnapshot result;
|
||||
result.currentBlockHeight = static_cast<quint64>(
|
||||
qMax(0, m_impl->logos->logos_execution_zone.get_current_block_height()));
|
||||
qMax(0, m_impl->logos->lez_core.get_current_block_height()));
|
||||
if (result.currentBlockHeight > 0
|
||||
&& m_impl->logos->logos_execution_zone.sync_to_block(result.currentBlockHeight)
|
||||
&& m_impl->logos->lez_core.sync_to_block(result.currentBlockHeight)
|
||||
!= WALLET_FFI_SUCCESS) {
|
||||
result.failure = WalletFailure::ReadFailed;
|
||||
return result;
|
||||
}
|
||||
result.lastSyncedBlock = static_cast<quint64>(
|
||||
qMax(0, m_impl->logos->logos_execution_zone.get_last_synced_block()));
|
||||
result.sequencerAddress = m_impl->logos->logos_execution_zone.get_sequencer_addr();
|
||||
qMax(0, m_impl->logos->lez_core.get_last_synced_block()));
|
||||
result.sequencerAddress = m_impl->logos->lez_core.get_sequencer_addr();
|
||||
|
||||
const QVariantList entries = m_impl->logos->logos_execution_zone.list_accounts();
|
||||
const QVariantList entries = m_impl->logos->lez_core.list_accounts();
|
||||
result.accounts.reserve(entries.size());
|
||||
result.publicAccountReads.reserve(entries.size());
|
||||
for (const QVariant& value : entries) {
|
||||
@@ -374,9 +374,9 @@ WalletSnapshot LogosWalletProvider::loadSnapshot()
|
||||
result.publicAccountReads.append(read);
|
||||
account.balance = read.ok()
|
||||
? littleEndianU128ToDecimal(read.balanceHex)
|
||||
: m_impl->logos->logos_execution_zone.get_balance(address, true);
|
||||
: m_impl->logos->lez_core.get_balance(address, true);
|
||||
} else {
|
||||
account.balance = m_impl->logos->logos_execution_zone.get_balance(address, false);
|
||||
account.balance = m_impl->logos->lez_core.get_balance(address, false);
|
||||
}
|
||||
result.accounts.append(account);
|
||||
}
|
||||
@@ -389,5 +389,5 @@ WalletSnapshot LogosWalletProvider::loadSnapshot()
|
||||
bool LogosWalletProvider::save() const
|
||||
{
|
||||
return m_impl->logos
|
||||
&& m_impl->logos->logos_execution_zone.save() == WALLET_FFI_SUCCESS;
|
||||
&& m_impl->logos->lez_core.save() == WALLET_FFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,9 @@ void WalletController::openOnStartup()
|
||||
|
||||
const QString config = defaultConfigPath();
|
||||
const QString storage = defaultStoragePath();
|
||||
const WalletSession session = m_wallet.connect({ config, storage });
|
||||
const QString statistics = QFileInfo(config).absolutePath()
|
||||
+ QStringLiteral("/statistics.json");
|
||||
const WalletSession session = m_wallet.connect({ config, storage, statistics });
|
||||
if (session.failure == WalletFailure::WalletMissing)
|
||||
return;
|
||||
if (!session.ok()) {
|
||||
@@ -110,8 +112,10 @@ QString WalletController::createWallet(const QString& configPath,
|
||||
{
|
||||
const QString config = toLocalPath(configPath);
|
||||
const QString storage = toLocalPath(storagePath);
|
||||
const QString statistics = QFileInfo(config).absolutePath()
|
||||
+ QStringLiteral("/statistics.json");
|
||||
const WalletCreation creation = m_wallet.createWallet(
|
||||
{ config, storage }, password);
|
||||
{ config, storage, statistics }, password);
|
||||
if (creation.mnemonic.isEmpty()) {
|
||||
qWarning() << "WalletController: wallet creation failed"
|
||||
<< walletFailureCode(creation.failure);
|
||||
@@ -140,7 +144,9 @@ bool WalletController::open()
|
||||
? defaultConfigPath() : m_state.configPath;
|
||||
const QString storage = m_state.storagePath.isEmpty()
|
||||
? defaultStoragePath() : m_state.storagePath;
|
||||
const WalletSession session = m_wallet.connect({ config, storage });
|
||||
const QString statistics = QFileInfo(config).absolutePath()
|
||||
+ QStringLiteral("/statistics.json");
|
||||
const WalletSession session = m_wallet.connect({ config, storage, statistics });
|
||||
if (!session.ok()) {
|
||||
qWarning() << "WalletController: wallet open failed"
|
||||
<< walletFailureCode(session.failure);
|
||||
|
||||
@@ -21,6 +21,10 @@ QString walletFailureCode(WalletFailure failure);
|
||||
struct WalletPaths {
|
||||
QString config;
|
||||
QString storage;
|
||||
// Sequencer-calibration statistics cache (v0.2.1 lez_core open/create_new take
|
||||
// this path). It need not exist — the wallet starts from empty stats and
|
||||
// recalibrates; it just lives alongside config/storage in the wallet home.
|
||||
QString statistics;
|
||||
};
|
||||
|
||||
struct WalletAccountRead {
|
||||
|
||||
@@ -64,16 +64,16 @@ private slots:
|
||||
void LogosWalletProviderTest::adoptsOpenWalletAndCachesSnapshots()
|
||||
{
|
||||
LogosModules modules;
|
||||
modules.logos_execution_zone.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.logos_execution_zone.currentBlockHeight = 12;
|
||||
modules.logos_execution_zone.lastSyncedBlock = 11;
|
||||
modules.logos_execution_zone.accounts = {
|
||||
modules.lez_core.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.lez_core.currentBlockHeight = 12;
|
||||
modules.lez_core.lastSyncedBlock = 11;
|
||||
modules.lez_core.accounts = {
|
||||
accountEntry(ACCOUNT_A, true),
|
||||
accountEntry(ACCOUNT_B, false),
|
||||
};
|
||||
modules.logos_execution_zone.publicAccounts.insert(
|
||||
modules.lez_core.publicAccounts.insert(
|
||||
ACCOUNT_A, publicAccountJson());
|
||||
modules.logos_execution_zone.balances.insert(ACCOUNT_B, QStringLiteral("42"));
|
||||
modules.lez_core.balances.insert(ACCOUNT_B, QStringLiteral("42"));
|
||||
|
||||
LogosWalletProvider provider(&modules);
|
||||
const WalletSession session = provider.connect({ QStringLiteral("unused"), QStringLiteral("unused") });
|
||||
@@ -87,25 +87,25 @@ void LogosWalletProviderTest::adoptsOpenWalletAndCachesSnapshots()
|
||||
QCOMPARE(session.snapshot.currentBlockHeight, quint64(12));
|
||||
QCOMPARE(session.snapshot.lastSyncedBlock, quint64(11));
|
||||
|
||||
const int listCalls = modules.logos_execution_zone.listCalls;
|
||||
const int readCalls = modules.logos_execution_zone.publicReadCalls;
|
||||
const int listCalls = modules.lez_core.listCalls;
|
||||
const int readCalls = modules.lez_core.publicReadCalls;
|
||||
QVERIFY(provider.snapshot().ok());
|
||||
QCOMPARE(modules.logos_execution_zone.listCalls, listCalls);
|
||||
QCOMPARE(modules.logos_execution_zone.publicReadCalls, readCalls);
|
||||
QCOMPARE(modules.lez_core.listCalls, listCalls);
|
||||
QCOMPARE(modules.lez_core.publicReadCalls, readCalls);
|
||||
|
||||
QVERIFY(provider.snapshot(true).ok());
|
||||
QVERIFY(modules.logos_execution_zone.listCalls > listCalls);
|
||||
QVERIFY(modules.logos_execution_zone.publicReadCalls > readCalls);
|
||||
QVERIFY(modules.lez_core.listCalls > listCalls);
|
||||
QVERIFY(modules.lez_core.publicReadCalls > readCalls);
|
||||
|
||||
modules.logos_execution_zone.publicAccounts[ACCOUNT_A] = publicAccountJson(
|
||||
modules.lez_core.publicAccounts[ACCOUNT_A] = publicAccountJson(
|
||||
PROGRAM_ID, QString(32, QLatin1Char('f')));
|
||||
QCOMPARE(provider.snapshot(true).accounts.at(0).balance,
|
||||
QStringLiteral("340282366920938463463374607431768211455"));
|
||||
|
||||
provider.clearSnapshot();
|
||||
const int afterRefresh = modules.logos_execution_zone.listCalls;
|
||||
const int afterRefresh = modules.lez_core.listCalls;
|
||||
QVERIFY(provider.snapshot().ok());
|
||||
QVERIFY(modules.logos_execution_zone.listCalls > afterRefresh);
|
||||
QVERIFY(modules.lez_core.listCalls > afterRefresh);
|
||||
|
||||
provider.disconnect();
|
||||
QCOMPARE(provider.snapshot().failure, WalletFailure::WalletUnavailable);
|
||||
@@ -129,8 +129,8 @@ void LogosWalletProviderTest::opensConfiguredWalletWhenNoSharedSessionExists()
|
||||
|
||||
QVERIFY(session.ok());
|
||||
QVERIFY(!session.adopted);
|
||||
QCOMPARE(modules.logos_execution_zone.openCalls, 1);
|
||||
QCOMPARE(modules.logos_execution_zone.openedStorage, storage);
|
||||
QCOMPARE(modules.lez_core.openCalls, 1);
|
||||
QCOMPARE(modules.lez_core.openedStorage, storage);
|
||||
|
||||
LogosModules missingModules;
|
||||
LogosWalletProvider missingProvider(&missingModules);
|
||||
@@ -152,30 +152,30 @@ void LogosWalletProviderTest::createsAndPersistsWallet()
|
||||
const WalletCreation creation = provider.createWallet(paths, QStringLiteral("secret"));
|
||||
|
||||
QVERIFY(creation.ok());
|
||||
QCOMPARE(creation.mnemonic, modules.logos_execution_zone.mnemonic);
|
||||
QCOMPARE(modules.logos_execution_zone.createdConfig, paths.config);
|
||||
QCOMPARE(modules.logos_execution_zone.createdStorage, paths.storage);
|
||||
QCOMPARE(modules.logos_execution_zone.createdPassword, QStringLiteral("secret"));
|
||||
QVERIFY(modules.logos_execution_zone.saveCalls >= 1);
|
||||
QCOMPARE(creation.mnemonic, modules.lez_core.mnemonic);
|
||||
QCOMPARE(modules.lez_core.createdConfig, paths.config);
|
||||
QCOMPARE(modules.lez_core.createdStorage, paths.storage);
|
||||
QCOMPARE(modules.lez_core.createdPassword, QStringLiteral("secret"));
|
||||
QVERIFY(modules.lez_core.saveCalls >= 1);
|
||||
|
||||
LogosModules rejectedModules;
|
||||
rejectedModules.logos_execution_zone.mnemonic.clear();
|
||||
rejectedModules.lez_core.mnemonic.clear();
|
||||
LogosWalletProvider rejectedProvider(&rejectedModules);
|
||||
QCOMPARE(rejectedProvider.createWallet(paths, QStringLiteral("secret")).failure,
|
||||
WalletFailure::CreateFailed);
|
||||
|
||||
LogosModules unsavedModules;
|
||||
unsavedModules.logos_execution_zone.saveResult = 1;
|
||||
unsavedModules.lez_core.saveResult = 1;
|
||||
LogosWalletProvider unsavedProvider(&unsavedModules);
|
||||
const WalletCreation unsaved = unsavedProvider.createWallet(paths, QStringLiteral("secret"));
|
||||
QCOMPARE(unsaved.failure, WalletFailure::SaveFailed);
|
||||
QCOMPARE(unsaved.mnemonic, unsavedModules.logos_execution_zone.mnemonic);
|
||||
QCOMPARE(unsaved.mnemonic, unsavedModules.lez_core.mnemonic);
|
||||
}
|
||||
|
||||
void LogosWalletProviderTest::validatesCompletePublicAccountPayloads()
|
||||
{
|
||||
LogosModules modules;
|
||||
modules.logos_execution_zone.publicAccounts.insert(ACCOUNT_A, publicAccountJson());
|
||||
modules.lez_core.publicAccounts.insert(ACCOUNT_A, publicAccountJson());
|
||||
LogosWalletProvider provider(&modules);
|
||||
|
||||
const WalletAccountRead valid = provider.readPublicAccount(ACCOUNT_A);
|
||||
@@ -185,16 +185,16 @@ void LogosWalletProviderTest::validatesCompletePublicAccountPayloads()
|
||||
QCOMPARE(valid.balanceHex, QStringLiteral("01000000000000000000000000000000"));
|
||||
QCOMPARE(valid.dataHex, QStringLiteral("00ff"));
|
||||
|
||||
modules.logos_execution_zone.publicAccounts[ACCOUNT_A] = publicAccountJson(PROGRAM_ID.toUpper());
|
||||
modules.lez_core.publicAccounts[ACCOUNT_A] = publicAccountJson(PROGRAM_ID.toUpper());
|
||||
QVERIFY(!provider.readPublicAccount(ACCOUNT_A).ok());
|
||||
modules.logos_execution_zone.publicAccounts[ACCOUNT_A] = publicAccountJson(
|
||||
modules.lez_core.publicAccounts[ACCOUNT_A] = publicAccountJson(
|
||||
PROGRAM_ID, QStringLiteral("01"));
|
||||
QVERIFY(!provider.readPublicAccount(ACCOUNT_A).ok());
|
||||
modules.logos_execution_zone.publicAccounts[ACCOUNT_A] = publicAccountJson(
|
||||
modules.lez_core.publicAccounts[ACCOUNT_A] = publicAccountJson(
|
||||
PROGRAM_ID, QStringLiteral("01000000000000000000000000000000"),
|
||||
QString(32, QLatin1Char('0')), QStringLiteral("abc"));
|
||||
QVERIFY(!provider.readPublicAccount(ACCOUNT_A).ok());
|
||||
modules.logos_execution_zone.publicAccounts[ACCOUNT_A] = QStringLiteral("[]");
|
||||
modules.lez_core.publicAccounts[ACCOUNT_A] = QStringLiteral("[]");
|
||||
QVERIFY(!provider.readPublicAccount(ACCOUNT_A).ok());
|
||||
QVERIFY(!provider.readPublicAccount(QStringLiteral("invalid")).ok());
|
||||
}
|
||||
@@ -202,9 +202,9 @@ void LogosWalletProviderTest::validatesCompletePublicAccountPayloads()
|
||||
void LogosWalletProviderTest::fallsBackToBalanceWhenPublicReadFails()
|
||||
{
|
||||
LogosModules modules;
|
||||
modules.logos_execution_zone.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.logos_execution_zone.accounts = { accountEntry(ACCOUNT_A, true) };
|
||||
modules.logos_execution_zone.balances.insert(ACCOUNT_A, QStringLiteral("42"));
|
||||
modules.lez_core.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.lez_core.accounts = { accountEntry(ACCOUNT_A, true) };
|
||||
modules.lez_core.balances.insert(ACCOUNT_A, QStringLiteral("42"));
|
||||
|
||||
LogosWalletProvider provider(&modules);
|
||||
const WalletSession session = provider.connect({});
|
||||
@@ -219,32 +219,32 @@ void LogosWalletProviderTest::fallsBackToBalanceWhenPublicReadFails()
|
||||
void LogosWalletProviderTest::createsAndPersistsAccounts()
|
||||
{
|
||||
LogosModules modules;
|
||||
modules.logos_execution_zone.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.logos_execution_zone.publicAccountId = ACCOUNT_A;
|
||||
modules.logos_execution_zone.accounts = { accountEntry(ACCOUNT_A, true) };
|
||||
modules.logos_execution_zone.publicAccounts.insert(ACCOUNT_A, publicAccountJson());
|
||||
modules.lez_core.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.lez_core.publicAccountId = ACCOUNT_A;
|
||||
modules.lez_core.accounts = { accountEntry(ACCOUNT_A, true) };
|
||||
modules.lez_core.publicAccounts.insert(ACCOUNT_A, publicAccountJson());
|
||||
LogosWalletProvider provider(&modules);
|
||||
QVERIFY(provider.connect({}).ok());
|
||||
|
||||
const int savesBeforeCreate = modules.logos_execution_zone.saveCalls;
|
||||
const int savesBeforeCreate = modules.lez_core.saveCalls;
|
||||
const WalletAccountCreation creation = provider.createAccount(true);
|
||||
QVERIFY(creation.ok());
|
||||
QCOMPARE(creation.accountId, ACCOUNT_A);
|
||||
QVERIFY(creation.publicAccount.ok());
|
||||
QCOMPARE(creation.snapshot.accounts.size(), 1);
|
||||
QVERIFY(modules.logos_execution_zone.saveCalls > savesBeforeCreate);
|
||||
QVERIFY(modules.lez_core.saveCalls > savesBeforeCreate);
|
||||
|
||||
modules.logos_execution_zone.saveResult = 1;
|
||||
modules.lez_core.saveResult = 1;
|
||||
QCOMPARE(provider.createAccount(true).failure, WalletFailure::SaveFailed);
|
||||
}
|
||||
|
||||
void LogosWalletProviderTest::preservesCreatedAccountWhenPublicReadFails()
|
||||
{
|
||||
LogosModules modules;
|
||||
modules.logos_execution_zone.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.logos_execution_zone.publicAccountId = ACCOUNT_A;
|
||||
modules.logos_execution_zone.accounts = { accountEntry(ACCOUNT_A, true) };
|
||||
modules.logos_execution_zone.balances.insert(ACCOUNT_A, QStringLiteral("7"));
|
||||
modules.lez_core.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.lez_core.publicAccountId = ACCOUNT_A;
|
||||
modules.lez_core.accounts = { accountEntry(ACCOUNT_A, true) };
|
||||
modules.lez_core.balances.insert(ACCOUNT_A, QStringLiteral("7"));
|
||||
LogosWalletProvider provider(&modules);
|
||||
QVERIFY(provider.connect({}).ok());
|
||||
|
||||
@@ -260,14 +260,14 @@ void LogosWalletProviderTest::preservesCreatedAccountWhenPublicReadFails()
|
||||
void LogosWalletProviderTest::preservesCreatedAccountWhenSnapshotRefreshFails()
|
||||
{
|
||||
LogosModules modules;
|
||||
modules.logos_execution_zone.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.logos_execution_zone.publicAccountId = ACCOUNT_A;
|
||||
modules.logos_execution_zone.publicAccounts.insert(ACCOUNT_A, publicAccountJson());
|
||||
modules.lez_core.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.lez_core.publicAccountId = ACCOUNT_A;
|
||||
modules.lez_core.publicAccounts.insert(ACCOUNT_A, publicAccountJson());
|
||||
LogosWalletProvider provider(&modules);
|
||||
QVERIFY(provider.connect({}).ok());
|
||||
|
||||
modules.logos_execution_zone.currentBlockHeight = 1;
|
||||
modules.logos_execution_zone.syncResult = 1;
|
||||
modules.lez_core.currentBlockHeight = 1;
|
||||
modules.lez_core.syncResult = 1;
|
||||
const WalletAccountCreation creation = provider.createAccount(true);
|
||||
|
||||
QVERIFY(creation.ok());
|
||||
@@ -278,8 +278,8 @@ void LogosWalletProviderTest::preservesCreatedAccountWhenSnapshotRefreshFails()
|
||||
void LogosWalletProviderTest::dispatchesExactGenericTransaction()
|
||||
{
|
||||
LogosModules modules;
|
||||
modules.logos_execution_zone.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.logos_execution_zone.transactionResponse = QStringLiteral(
|
||||
modules.lez_core.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.lez_core.transactionResponse = QStringLiteral(
|
||||
R"({"success":true,"tx_hash":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"})");
|
||||
LogosWalletProvider provider(&modules);
|
||||
QVERIFY(provider.connect({}).ok());
|
||||
@@ -293,19 +293,19 @@ void LogosWalletProviderTest::dispatchesExactGenericTransaction()
|
||||
const WalletSubmission submission = provider.submitPublicTransaction(transaction);
|
||||
QVERIFY(submission.accepted());
|
||||
QCOMPARE(submission.nativeHash, QString(64, QLatin1Char('a')));
|
||||
QCOMPARE(modules.logos_execution_zone.submitCalls, 1);
|
||||
QCOMPARE(modules.logos_execution_zone.submittedProgramId, PROGRAM_ID);
|
||||
QCOMPARE(modules.logos_execution_zone.submittedAccountIds, transaction.accountIds);
|
||||
QCOMPARE(modules.logos_execution_zone.submittedSigningRequirements,
|
||||
QCOMPARE(modules.lez_core.submitCalls, 1);
|
||||
QCOMPARE(modules.lez_core.submittedProgramId, PROGRAM_ID);
|
||||
QCOMPARE(modules.lez_core.submittedAccountIds, transaction.accountIds);
|
||||
QCOMPARE(modules.lez_core.submittedSigningRequirements,
|
||||
QVariantList({ true, false }));
|
||||
QCOMPARE(modules.logos_execution_zone.submittedInstruction.toList(),
|
||||
QCOMPARE(modules.lez_core.submittedInstruction.toList(),
|
||||
QVariantList({ 7U, 0U, 4294967295U }));
|
||||
}
|
||||
|
||||
void LogosWalletProviderTest::rejectsInvalidSubmissionResponses()
|
||||
{
|
||||
LogosModules modules;
|
||||
modules.logos_execution_zone.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
modules.lez_core.sequencerAddress = QStringLiteral("http://sequencer");
|
||||
LogosWalletProvider provider(&modules);
|
||||
QVERIFY(provider.connect({}).ok());
|
||||
|
||||
@@ -323,7 +323,7 @@ void LogosWalletProviderTest::rejectsInvalidSubmissionResponses()
|
||||
QStringLiteral(R"({"success":true,"tx_hash":"short"})"),
|
||||
};
|
||||
for (const QString& response : invalidResponses) {
|
||||
modules.logos_execution_zone.transactionResponse = response;
|
||||
modules.lez_core.transactionResponse = response;
|
||||
QCOMPARE(provider.submitPublicTransaction(transaction).failure,
|
||||
WalletFailure::SubmissionFailed);
|
||||
}
|
||||
|
||||
@@ -32,28 +32,33 @@ public:
|
||||
int submitCalls = 0;
|
||||
QString openedConfig;
|
||||
QString openedStorage;
|
||||
QString openedStatistics;
|
||||
QString createdConfig;
|
||||
QString createdStorage;
|
||||
QString createdStatistics;
|
||||
QString createdPassword;
|
||||
QStringList submittedAccountIds;
|
||||
QVariantList submittedSigningRequirements;
|
||||
QVariant submittedInstruction;
|
||||
QString submittedProgramId;
|
||||
|
||||
int open(const QString& config, const QString& storage)
|
||||
int open(const QString& config, const QString& storage, const QString& statistics)
|
||||
{
|
||||
++openCalls;
|
||||
openedConfig = config;
|
||||
openedStorage = storage;
|
||||
openedStatistics = statistics;
|
||||
return openResult;
|
||||
}
|
||||
|
||||
QString create_new(const QString& config,
|
||||
const QString& storage,
|
||||
const QString& statistics,
|
||||
const QString& password)
|
||||
{
|
||||
createdConfig = config;
|
||||
createdStorage = storage;
|
||||
createdStatistics = statistics;
|
||||
createdPassword = password;
|
||||
return mnemonic;
|
||||
}
|
||||
@@ -114,5 +119,5 @@ struct LogosModules {
|
||||
LogosModules() = default;
|
||||
explicit LogosModules(LogosAPI*) { }
|
||||
|
||||
FakeExecutionZone logos_execution_zone;
|
||||
FakeExecutionZone lez_core;
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ the UI does not assemble transaction instructions itself.
|
||||
|
||||
This app is a `ui_qml` module with a hand-written C++ backend
|
||||
(`src/TokenUiBackend.*`, plugin in `src/TokenUiPlugin.*`) that depends on the
|
||||
core **`logos_execution_zone`** wallet module and **`token_module`** Token
|
||||
core **`lez_core`** wallet module and **`token_module`** Token
|
||||
Program API. The backend exposes an async QtRO surface
|
||||
(`src/TokenUiBackend.rep`) plus an account list model to the QML view. Wallet
|
||||
session behavior and the `Logos.Wallet` control come from
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"main": "token_ui_plugin",
|
||||
"view": "qml/Main.qml",
|
||||
"icon": "icons/token.png",
|
||||
"dependencies": ["logos_execution_zone", "token_module"],
|
||||
"dependencies": ["lez_core", "token_module"],
|
||||
|
||||
"nix": {
|
||||
"packages": {
|
||||
|
||||
@@ -20,7 +20,7 @@ overrides:
|
||||
|
||||
- `logos-qt-mcp` test framework
|
||||
- inspector-enabled Basecamp bundle
|
||||
- `logos_execution_zone` portable core module
|
||||
- `lez_core` portable core module
|
||||
- `token_module` portable core module
|
||||
- `token_ui` portable UI plugin
|
||||
|
||||
@@ -36,7 +36,7 @@ nix build .#test-framework -o apps/token/result-mcp
|
||||
For manual runs, stage the portable install outputs into a Basecamp user
|
||||
directory: `.#install-portable` for `token_module`,
|
||||
`.#token-ui-install-portable` for `token_ui`, and the matching portable
|
||||
`logos_execution_zone` install. Launch the inspector-enabled bundle with
|
||||
`lez_core` install. Launch the inspector-enabled bundle with
|
||||
`--user-dir <path> -platform offscreen`.
|
||||
|
||||
Run the non-mutating visual flow:
|
||||
|
||||
Generated
+24220
-11804
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,19 @@
|
||||
{
|
||||
description = "LEZ programs — host client modules and FFIs";
|
||||
|
||||
# Fetch the prebuilt lez_core wallet-ffi (and its deps, e.g. `ring`) from the
|
||||
# Logos Cachix instead of compiling locally — CI builds the module on macos-15 +
|
||||
# ubuntu with its native LEZ v0.2.2 pin, so this hits for both. Building the
|
||||
# wallet-ffi from source fails on Apple Silicon (ring's ARM asm vs the nix
|
||||
# cc-wrapper), so the cache is effectively required on macOS. First `nix build`
|
||||
# prompts to trust this config (or set accept-flake-config = true).
|
||||
nixConfig = {
|
||||
extra-substituters = [ "https://logos-co.cachix.org" ];
|
||||
extra-trusted-public-keys = [
|
||||
"logos-co.cachix.org-1:12K8609ho1pCt0erUQrOrs/KmOuhWq/EhVwhzQRb35E="
|
||||
];
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
@@ -21,27 +34,23 @@
|
||||
# match the metadata.json `dependencies` entry so the builder can resolve it
|
||||
# as a module dependency.
|
||||
#
|
||||
# Fork of logos-blockchain/logos-execution-zone-module @ d70225ced with the
|
||||
# QtRO serialization fix: send_generic_public_transaction's `instruction` uses
|
||||
# a byte-string IPC type so the args survive the cross-process boundary (at
|
||||
# d70225ced the API already takes program_id_hex instead of program_elf/deps).
|
||||
# See docs/amm-swap-qtro-serialization-bug.md.
|
||||
logos_execution_zone = {
|
||||
url = "github:gravityblast/logos-execution-zone-module?ref=fix/generic-tx-instruction-bstr";
|
||||
|
||||
# Override the module's pinned LEZ monorepo (logos-execution-zone) to the
|
||||
# SAME rev the target sequencer runs (415964d7): the wallet client and the
|
||||
# sequencer must agree on the JSON-RPC API, or tx submission fails at
|
||||
# runtime with `MethodNotFound`. 415964d7's wallet_ffi takes a program id
|
||||
# for send_generic_public_transaction, matching the d70225ced module.
|
||||
inputs.logos-execution-zone.url =
|
||||
"github:logos-blockchain/logos-execution-zone?rev=415964d7f9043a1bfe28da8d0e8b3a6f64abb258";
|
||||
};
|
||||
# Upstream logos-blockchain/logos-execution-zone-module, fix/generic-tx-instruction-bstr
|
||||
# branch: carries the QtRO serialization fix — send_generic_public_transaction's
|
||||
# `instruction` uses a byte-string IPC type so the args survive the cross-process
|
||||
# boundary (the fix is NOT on `main`; see docs/amm-swap-qtro-serialization-bug.md).
|
||||
#
|
||||
# No LEZ override: the branch natively pins logos-execution-zone v0.2.2, which is the
|
||||
# deployed sequencer's version — the wallet-ffi and sequencer must agree on the
|
||||
# JSON-RPC API and the wallet-config schema (v0.2.1 introduced the `sequencers` list).
|
||||
# Keeping the native pin also means this is the exact derivation upstream CI built, so
|
||||
# the wallet-ffi is fetched from the Logos nix binary cache instead of compiling `ring`
|
||||
# locally (which fails under the nix cc-wrapper on Apple Silicon).
|
||||
lez_core.url = "github:logos-blockchain/logos-execution-zone-module?ref=fix/generic-tx-instruction-bstr";
|
||||
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ self, nixpkgs, flake-utils, crane, rust-overlay, logos-module-builder, logos_execution_zone, ... }:
|
||||
inputs@{ self, nixpkgs, flake-utils, crane, rust-overlay, logos-module-builder, lez_core, ... }:
|
||||
let
|
||||
crateOutputs = flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
@@ -121,7 +130,7 @@
|
||||
# The AMM QML UI module (apps/amm). It links no amm_ffi library of its
|
||||
# own — the AMM logic lives in the amm_module core module, which the UI
|
||||
# depends on (declared in apps/amm/metadata.json, reached via
|
||||
# modules().amm_module in the backend) alongside the logos_execution_zone
|
||||
# modules().amm_module in the backend) alongside the lez_core
|
||||
# wallet module.
|
||||
appOutputs = logos-module-builder.lib.mkLogosQmlModule {
|
||||
src = ./apps/amm;
|
||||
@@ -253,8 +262,8 @@
|
||||
# AMM core module (modules/amm): the AMM business logic as a headless
|
||||
# `core` Logos module. It links the amm_ffi crate (the transport-
|
||||
# independent AMM brain, resolved via `self`) and depends on the
|
||||
# logos_execution_zone wallet module (declared in modules/amm/metadata.json,
|
||||
# reached via modules().logos_execution_zone in the impl). Exposed as the
|
||||
# lez_core wallet module (declared in modules/amm/metadata.json,
|
||||
# reached via modules().lez_core in the impl). Exposed as the
|
||||
# `amm-module` package; no UI/app output.
|
||||
ammModuleOutputs = logos-module-builder.lib.mkLogosModule {
|
||||
src = ./modules/amm;
|
||||
|
||||
@@ -19,8 +19,8 @@ string(JSON MODULE_NAME GET ${METADATA_JSON} name)
|
||||
# "interface": "universal"). EXTERNAL_LIBS links amm_ffi — the pure-Rust,
|
||||
# transport-independent AMM brain (PDA/decode/quote/plan/encode) exposed as a
|
||||
# JSON FFI (amm_ffi.h), the same library the UI links. The chain I/O
|
||||
# dependency (logos_execution_zone) is declared in metadata.json and reached via
|
||||
# modules().logos_execution_zone in the impl, so it is NOT listed here.
|
||||
# dependency (lez_core) is declared in metadata.json and reached via
|
||||
# modules().lez_core in the impl, so it is NOT listed here.
|
||||
logos_module(
|
||||
NAME ${MODULE_NAME}
|
||||
SOURCES
|
||||
|
||||
+12
-12
@@ -13,7 +13,7 @@ for the module framework.
|
||||
The impl class `AmmModuleImpl` (`src/amm_module_impl.{h,cpp}`) is a **transport
|
||||
adapter**: the AMM domain math lives in the Rust `amm_ffi` crate (a
|
||||
transport-independent JSON FFI), and this module sequences those pure ops with
|
||||
chain I/O delegated to the `logos_execution_zone` wallet module. Its public
|
||||
chain I/O delegated to the `lez_core` wallet module. Its public
|
||||
methods (the module API is generated from the header) are:
|
||||
|
||||
**Reads**
|
||||
@@ -57,9 +57,9 @@ CLI ──logoscore call────────┤ │ PDA derivation
|
||||
▼ │ quote/plan math, instruction encoding
|
||||
amm_module ───┤ — transport-independent (external_libraries)
|
||||
│ │
|
||||
│ └── logos_execution_zone (dependency):
|
||||
│ └── lez_core (dependency):
|
||||
▼ chain reads + tx submit + base58,
|
||||
via modules().logos_execution_zone.*
|
||||
via modules().lez_core.*
|
||||
```
|
||||
|
||||
The `amm_ffi` crate is deliberately I/O-free — each op takes the account data
|
||||
@@ -77,7 +77,7 @@ The impl is deliberately **Qt-free** (`std::string` / `LogosMap` / `LogosList` /
|
||||
## Amount / id conventions
|
||||
|
||||
**Account ids accept base58 or hex.** The `*Hex` args and request-map ids are
|
||||
normalized at each method's boundary (via `logos_execution_zone.account_id_from_base58`
|
||||
normalized at each method's boundary (via `lez_core.account_id_from_base58`
|
||||
for base58 inputs), so the wallet/runbook's base58 ids can be passed directly.
|
||||
|
||||
**Amounts (`amountIn`/`minOut`, u128) and `deadline` (u64 unix-ms)** are declared
|
||||
@@ -141,9 +141,9 @@ Have all of the following in place before staging the modules dir:
|
||||
nix build .#amm-module # from the repo root; output under result/lib/
|
||||
```
|
||||
|
||||
4. **The wallet module it depends on, built** — `logos_execution_zone` is a
|
||||
4. **The wallet module it depends on, built** — `lez_core` is a
|
||||
*separate repo*, not part of this tree. Build the **same rev** this module
|
||||
pins as its `logos_execution_zone` flake input (mismatched revs = ABI/ImageID
|
||||
pins as its `lez_core` flake input (mismatched revs = ABI/ImageID
|
||||
drift), producing `logos_execution_zone_plugin.dylib` + `libwallet_ffi.dylib`:
|
||||
|
||||
```bash
|
||||
@@ -178,7 +178,7 @@ modules/
|
||||
libamm_ffi.dylib
|
||||
variant # one line: darwin-arm64-dev
|
||||
manifest.json
|
||||
logos_execution_zone/
|
||||
lez_core/
|
||||
logos_execution_zone_plugin.dylib
|
||||
libwallet_ffi.dylib
|
||||
variant
|
||||
@@ -190,7 +190,7 @@ modules/
|
||||
```json
|
||||
{
|
||||
"name": "amm_module", "type": "core", "version": "0.1.0",
|
||||
"manifestVersion": "0.2.0", "dependencies": ["logos_execution_zone"],
|
||||
"manifestVersion": "0.2.0", "dependencies": ["lez_core"],
|
||||
"main": { "darwin-arm64-dev": "amm_module_plugin.dylib" }
|
||||
}
|
||||
```
|
||||
@@ -202,7 +202,7 @@ first, then the module:
|
||||
AMM_PROGRAM_BIN=/abs/path/to/amm.bin \
|
||||
logoscore -D -m ./modules --persistence-path ./data
|
||||
|
||||
logoscore load-module logos_execution_zone # dependency first
|
||||
logoscore load-module lez_core # dependency first
|
||||
logoscore load-module amm_module
|
||||
```
|
||||
|
||||
@@ -211,7 +211,7 @@ which fails on a null wallet handle (surfacing as an absent pool), so open the
|
||||
wallet first — `resolvePoolAccount` then works:
|
||||
|
||||
```bash
|
||||
logoscore call logos_execution_zone open ~/.lee/wallet/wallet_config.json ~/.lee/wallet/storage.json
|
||||
logoscore call lez_core open ~/.lee/wallet/wallet_config.json ~/.lee/wallet/storage.json
|
||||
logoscore call amm_module resolvePoolAccount <defA_hex> <defB_hex>
|
||||
```
|
||||
|
||||
@@ -251,7 +251,7 @@ wallet is opened.
|
||||
`amm_module` is a **core** module (installed into `modules/`, alongside the
|
||||
wallet module), not a UI plugin. Build its `.lgx` from the root flake and
|
||||
install with `lgpm --modules-dir …` (see `apps/amm/README.md` for the full
|
||||
three-package flow: `logos_execution_zone` + `amm_module` + the `amm_ui` UI
|
||||
three-package flow: `lez_core` + `amm_module` + the `amm_ui` UI
|
||||
plugin).
|
||||
|
||||
## QtRO / byte-string note
|
||||
@@ -260,7 +260,7 @@ plugin).
|
||||
(`std::vector<uint8_t>`). This module sends the plan's u32 words as their
|
||||
little-endian bytes and references the program by its id hex (not the raw ELF).
|
||||
It requires the wallet module built with the byte-string `instruction` param —
|
||||
the fork pinned as the `logos_execution_zone` input. See
|
||||
the fork pinned as the `lez_core` input. See
|
||||
`docs/amm-swap-qtro-serialization-bug.md`.
|
||||
|
||||
## Full API runbook
|
||||
|
||||
@@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"]
|
||||
alloy-primitives = { version = "1", default-features = false }
|
||||
amm_core = { workspace = true }
|
||||
borsh = { workspace = true }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
hex = "0.4"
|
||||
nssa_core = { workspace = true }
|
||||
risc0-binfmt = { version = "=3.0.4", default-features = false }
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
|
||||
# Core wallet module dependency. The input name must match the
|
||||
# metadata.json `dependencies` entry so the builder resolves it as a module
|
||||
# dependency. Same fork the repo-root flake pins (the QtRO byte-string
|
||||
# `instruction` fix for send_generic_public_transaction).
|
||||
logos_execution_zone.url = "github:gravityblast/logos-execution-zone-module?ref=fix/generic-tx-instruction-bstr";
|
||||
# dependency. Same upstream branch the repo-root flake pins (the QtRO byte-string
|
||||
# `instruction` fix for send_generic_public_transaction). This flake is not built
|
||||
# standalone (see NOTE below), so the repo-root flake's v0.2.1 LEZ override wins.
|
||||
lez_core.url = "github:logos-blockchain/logos-execution-zone-module?ref=fix/generic-tx-instruction-bstr";
|
||||
};
|
||||
|
||||
# NOTE: like apps/amm, this flake is NOT built standalone. The amm_ffi
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"category": "amm",
|
||||
"description": "AMM business logic — on-chain pool resolution and swaps",
|
||||
"main": "amm_module_plugin",
|
||||
"dependencies": ["logos_execution_zone"],
|
||||
"dependencies": ["lez_core"],
|
||||
|
||||
"nix": {
|
||||
"packages": {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
// Generated at build time by logos-cpp-generator. Defines `LogosModules` with
|
||||
// one std-typed accessor per metadata.json dependency — here
|
||||
// `logos_execution_zone`. Included only in the .cpp so the impl header the
|
||||
// `lez_core`. Included only in the .cpp so the impl header the
|
||||
// generator parses stays free of Qt and codegen types.
|
||||
#include "logos_sdk.h"
|
||||
|
||||
@@ -273,7 +273,7 @@ std::string AmmModuleImpl::normalizeAccountId(const std::string& id) {
|
||||
}
|
||||
|
||||
// Try base58 -> hex via the wallet module ("" on failure).
|
||||
std::string hex = modules().logos_execution_zone.account_id_from_base58(t);
|
||||
std::string hex = modules().lez_core.account_id_from_base58(t);
|
||||
std::transform(hex.begin(), hex.end(), hex.begin(),
|
||||
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
||||
return hex;
|
||||
@@ -286,7 +286,7 @@ nlohmann::json AmmModuleImpl::readPublicAccount(const std::string& account_id) {
|
||||
json result = {{"id", account_id}, {"status", "read_failed"}};
|
||||
|
||||
const std::string account_json =
|
||||
modules().logos_execution_zone.get_account_public(account_id);
|
||||
modules().lez_core.get_account_public(account_id);
|
||||
const auto obj = json::parse(account_json, nullptr, /*allow_exceptions=*/false);
|
||||
if (!obj.is_object()) return result;
|
||||
|
||||
@@ -315,7 +315,7 @@ nlohmann::json AmmModuleImpl::walletAccountReads(bool wallet_open) {
|
||||
|
||||
// Normalize the wallet module's [any] return (a vector or a json array)
|
||||
// through json so we can iterate/type-check it uniformly.
|
||||
json accounts = modules().logos_execution_zone.list_accounts();
|
||||
json accounts = modules().lez_core.list_accounts();
|
||||
if (!accounts.is_array())
|
||||
return json::array();
|
||||
|
||||
@@ -452,7 +452,7 @@ LogosMap AmmModuleImpl::transferOwnership(const LogosMap& request) {
|
||||
AMM_TRACE("transferOwnership: SUBMIT programId=" << program_id
|
||||
<< " accounts=" << accounts.size());
|
||||
|
||||
const std::string reply = modules().logos_execution_zone.send_generic_public_transaction(
|
||||
const std::string reply = modules().lez_core.send_generic_public_transaction(
|
||||
accounts, signers, instruction, program_id);
|
||||
AMM_TRACE("transferOwnership: tx reply=" << reply);
|
||||
|
||||
@@ -537,7 +537,7 @@ LogosMap AmmModuleImpl::oracleSetupSubmit(const LogosMap& request, bool observat
|
||||
|
||||
AMM_TRACE("oracleSetup(" << (observations ? "observations" : "priceAccount")
|
||||
<< "): SUBMIT programId=" << program_id << " accounts=" << accounts.size());
|
||||
const std::string reply = modules().logos_execution_zone.send_generic_public_transaction(
|
||||
const std::string reply = modules().lez_core.send_generic_public_transaction(
|
||||
accounts, signers, instruction, program_id);
|
||||
AMM_TRACE("oracleSetup: tx reply=" << reply);
|
||||
|
||||
@@ -742,7 +742,7 @@ std::string AmmModuleImpl::swapExactInput(const std::string& def_a_hex,
|
||||
AMM_TRACE("swapExactInput: SUBMIT programId=" << program_id
|
||||
<< " instrBytes=" << instruction.size() << " accounts=" << accounts.size());
|
||||
|
||||
const std::string reply = modules().logos_execution_zone.send_generic_public_transaction(
|
||||
const std::string reply = modules().lez_core.send_generic_public_transaction(
|
||||
accounts, signers, instruction, program_id);
|
||||
AMM_TRACE("swapExactInput: tx reply=" << reply);
|
||||
|
||||
@@ -832,7 +832,7 @@ std::string AmmModuleImpl::swapExactOutput(const std::string& def_a_hex,
|
||||
AMM_TRACE("swapExactOutput: SUBMIT programId=" << program_id
|
||||
<< " instrBytes=" << instruction.size() << " accounts=" << accounts.size());
|
||||
|
||||
const std::string reply = modules().logos_execution_zone.send_generic_public_transaction(
|
||||
const std::string reply = modules().lez_core.send_generic_public_transaction(
|
||||
accounts, signers, instruction, program_id);
|
||||
AMM_TRACE("swapExactOutput: tx reply=" << reply);
|
||||
|
||||
@@ -967,7 +967,7 @@ LogosMap AmmModuleImpl::createPool(const LogosMap& request) {
|
||||
AMM_TRACE("createPool: SUBMIT programId=" << program_id
|
||||
<< " instrBytes=" << instruction.size() << " accounts=" << accounts.size());
|
||||
|
||||
const std::string reply = modules().logos_execution_zone.send_generic_public_transaction(
|
||||
const std::string reply = modules().lez_core.send_generic_public_transaction(
|
||||
accounts, signers, instruction, program_id);
|
||||
AMM_TRACE("createPool: tx reply=" << reply);
|
||||
|
||||
@@ -1123,7 +1123,7 @@ LogosMap AmmModuleImpl::addLiquidity(const LogosMap& request) {
|
||||
AMM_TRACE("addLiquidity: SUBMIT programId=" << program_id
|
||||
<< " instrBytes=" << instruction.size() << " accounts=" << accounts.size());
|
||||
|
||||
const std::string reply = modules().logos_execution_zone.send_generic_public_transaction(
|
||||
const std::string reply = modules().lez_core.send_generic_public_transaction(
|
||||
accounts, signers, instruction, program_id);
|
||||
AMM_TRACE("addLiquidity: tx reply=" << reply);
|
||||
|
||||
@@ -1274,7 +1274,7 @@ LogosMap AmmModuleImpl::removeLiquidity(const LogosMap& request) {
|
||||
AMM_TRACE("removeLiquidity: SUBMIT programId=" << program_id
|
||||
<< " instrBytes=" << instruction.size() << " accounts=" << accounts.size());
|
||||
|
||||
const std::string reply = modules().logos_execution_zone.send_generic_public_transaction(
|
||||
const std::string reply = modules().lez_core.send_generic_public_transaction(
|
||||
accounts, signers, instruction, program_id);
|
||||
AMM_TRACE("removeLiquidity: tx reply=" << reply);
|
||||
|
||||
@@ -1341,7 +1341,7 @@ LogosMap AmmModuleImpl::syncReserves(const LogosMap& request) {
|
||||
AMM_TRACE("syncReserves: SUBMIT programId=" << program_id
|
||||
<< " instrBytes=" << instruction.size() << " accounts=" << accounts.size());
|
||||
|
||||
const std::string reply = modules().logos_execution_zone.send_generic_public_transaction(
|
||||
const std::string reply = modules().lez_core.send_generic_public_transaction(
|
||||
accounts, signers, instruction, program_id);
|
||||
AMM_TRACE("syncReserves: tx reply=" << reply);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// `amm_ffi` crate and is reached through its JSON FFI (amm_ffi.h — one
|
||||
// `char* op(const char*)` per operation, request and response both JSON). This
|
||||
// module sequences those ops with chain I/O delegated to the
|
||||
// `logos_execution_zone` wallet module (reached via modules().logos_execution_zone).
|
||||
// `lez_core` wallet module (reached via modules().lez_core).
|
||||
//
|
||||
// The same surface is consumed by the QML UI (via modules().amm_module) and
|
||||
// headlessly (logoscore call amm_module ...). The swap / add-liquidity
|
||||
|
||||
@@ -15,7 +15,7 @@ Basecamp UI / logoscore
|
||||
|
|
||||
token_module Qt-free C++ transport/orchestration
|
||||
/ \
|
||||
token_ffi logos_execution_zone
|
||||
token_ffi lez_core
|
||||
Rust codecs shared wallet reads, account listing, transaction submission
|
||||
and planners
|
||||
```
|
||||
@@ -25,7 +25,7 @@ them with RISC Zero. This is intentional: the current Token IDL cannot fully
|
||||
describe `new_definition_with_metadata`, and its final three instruction
|
||||
indexes do not match the Rust enum's serialized order.
|
||||
|
||||
The module reuses the host-loaded `logos_execution_zone` instance. It never
|
||||
The module reuses the host-loaded `lez_core` instance. It never
|
||||
opens a second wallet and never creates account keys. Callers create fresh
|
||||
public accounts through the wallet module, then pass their IDs to Token
|
||||
operations.
|
||||
@@ -117,7 +117,7 @@ Creation, explicit initialization, and NFT printing require fresh public wallet
|
||||
accounts. Create each one before calling the token method:
|
||||
|
||||
```bash
|
||||
logoscore call logos_execution_zone create_account_public --json
|
||||
logoscore call lez_core create_account_public --json
|
||||
```
|
||||
|
||||
For transfer and mint, an initialized destination needs no destination
|
||||
@@ -199,7 +199,7 @@ modules/
|
||||
libtoken_ffi.dylib
|
||||
variant # one line: darwin-arm64-dev
|
||||
manifest.json
|
||||
logos_execution_zone/
|
||||
lez_core/
|
||||
logos_execution_zone_plugin.dylib
|
||||
libwallet_ffi.dylib
|
||||
variant
|
||||
@@ -211,15 +211,15 @@ modules/
|
||||
```json
|
||||
{
|
||||
"name": "token_module", "type": "core", "version": "0.1.0",
|
||||
"manifestVersion": "0.2.0", "dependencies": ["logos_execution_zone"],
|
||||
"manifestVersion": "0.2.0", "dependencies": ["lez_core"],
|
||||
"main": { "darwin-arm64-dev": "token_module_plugin.dylib" }
|
||||
}
|
||||
```
|
||||
|
||||
Copy the dylibs into place (`result/lib/*` → `modules/token_module/`,
|
||||
`result-lez/lib/*` → `modules/logos_execution_zone/`) and write each `variant`
|
||||
`result-lez/lib/*` → `modules/lez_core/`) and write each `variant`
|
||||
as a single line (`darwin-arm64-dev` on arm64 macOS). The
|
||||
`logos_execution_zone/manifest.json` mirrors this with its own name and plugin.
|
||||
`lez_core/manifest.json` mirrors this with its own name and plugin.
|
||||
|
||||
### 3. Start the daemon and load (dependency first)
|
||||
|
||||
@@ -230,7 +230,7 @@ dependency before the module:
|
||||
TOKEN_PROGRAM_ID=F8sGbDbjcxvJHpUQJcArEaY7EbLMVmqZgRm3fXPw3jb3 \
|
||||
logoscore -D -m ./modules --persistence-path ./data
|
||||
|
||||
logoscore load-module logos_execution_zone # dependency first
|
||||
logoscore load-module lez_core # dependency first
|
||||
logoscore load-module token_module
|
||||
logoscore module-info token_module --json
|
||||
logoscore call token_module programInfo --json
|
||||
@@ -245,7 +245,7 @@ The final call must return `invalid_account_id` without crashing, and
|
||||
Open a wallet configured for the target sequencer, then pass a real account ID:
|
||||
|
||||
```bash
|
||||
logoscore call logos_execution_zone open \
|
||||
logoscore call lez_core open \
|
||||
/path/to/wallet_config.json /path/to/storage.json "$WALLET_PASSWORD" --json
|
||||
|
||||
logoscore call token_module inspectDefinition \
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"category": "token",
|
||||
"description": "Universal Logos core module for LEZ token account reads and transactions",
|
||||
"main": "token_module_plugin",
|
||||
"dependencies": ["logos_execution_zone"],
|
||||
"dependencies": ["lez_core"],
|
||||
"nix": {
|
||||
"packages": {
|
||||
"build": [],
|
||||
|
||||
@@ -251,7 +251,7 @@ nlohmann::json TokenModuleImpl::tokenProgramInfo() {
|
||||
: derived_program_hex;
|
||||
const std::string program_id = binary_configured
|
||||
? derived_program
|
||||
: modules().logos_execution_zone.account_id_to_base58(program_id_hex);
|
||||
: modules().lez_core.account_id_to_base58(program_id_hex);
|
||||
if (program_id.empty() || !isHexLength(program_id_hex, 64) || isZeroId(program_id_hex)) {
|
||||
return json();
|
||||
}
|
||||
@@ -273,7 +273,7 @@ std::string TokenModuleImpl::normalizeAccountId(const std::string& id) {
|
||||
if (normalized.empty()) return {};
|
||||
|
||||
normalized = lowercase(
|
||||
modules().logos_execution_zone.account_id_from_base58(normalized));
|
||||
modules().lez_core.account_id_from_base58(normalized));
|
||||
return isHexLength(normalized, 64) && !isZeroId(normalized)
|
||||
? normalized
|
||||
: std::string();
|
||||
@@ -283,9 +283,9 @@ nlohmann::json TokenModuleImpl::readPublicAccount(const std::string& account_id)
|
||||
json read = {{"id", account_id}, {"status", "not_found"}};
|
||||
logos::CallError call_error;
|
||||
const std::string raw =
|
||||
modules().logos_execution_zone.get_account_public(account_id, &call_error);
|
||||
modules().lez_core.get_account_public(account_id, &call_error);
|
||||
if (!call_error.ok()) {
|
||||
TOKEN_TRACE("logos_execution_zone account read transport failure: " << call_error.code);
|
||||
TOKEN_TRACE("lez_core account read transport failure: " << call_error.code);
|
||||
read["status"] = "backend_error";
|
||||
return read;
|
||||
}
|
||||
@@ -321,9 +321,9 @@ nlohmann::json TokenModuleImpl::readPublicAccount(const std::string& account_id)
|
||||
|
||||
nlohmann::json TokenModuleImpl::walletAccountIds() {
|
||||
logos::CallError call_error;
|
||||
const json accounts = modules().logos_execution_zone.list_accounts(&call_error);
|
||||
const json accounts = modules().lez_core.list_accounts(&call_error);
|
||||
if (!call_error.ok()) {
|
||||
TOKEN_TRACE("logos_execution_zone account list transport failure: " << call_error.code);
|
||||
TOKEN_TRACE("lez_core account list transport failure: " << call_error.code);
|
||||
return json();
|
||||
}
|
||||
if (!accounts.is_array()) return json();
|
||||
@@ -509,14 +509,14 @@ LogosMap TokenModuleImpl::submitPlan(const nlohmann::json& plan) {
|
||||
}
|
||||
|
||||
logos::CallError call_error;
|
||||
const std::string raw = modules().logos_execution_zone.send_generic_public_transaction(
|
||||
const std::string raw = modules().lez_core.send_generic_public_transaction(
|
||||
account_ids,
|
||||
signers,
|
||||
instruction,
|
||||
program_id,
|
||||
&call_error);
|
||||
if (!call_error.ok()) {
|
||||
TOKEN_TRACE("logos_execution_zone submission transport failure: " << call_error.code);
|
||||
TOKEN_TRACE("lez_core submission transport failure: " << call_error.code);
|
||||
return publicError("wallet_submission_failed");
|
||||
}
|
||||
const json reply = json::parse(raw, nullptr, false);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
// Universal Logos core module for the LEZ Token program. Public methods form
|
||||
// the generated API, so this header deliberately uses only standard C++ and
|
||||
// Logos JSON types. Rust token_ffi owns token codecs and instruction encoding;
|
||||
// logos_execution_zone owns wallet/account I/O and transaction submission.
|
||||
// lez_core owns wallet/account I/O and transaction submission.
|
||||
class TokenModuleImpl : public LogosModuleContext {
|
||||
public:
|
||||
TokenModuleImpl() = default;
|
||||
|
||||
@@ -7,8 +7,8 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
amm_core = { path = "core" }
|
||||
token_core = { path = "../token/core" }
|
||||
twap_oracle_core = { path = "../twap_oracle/core" }
|
||||
|
||||
@@ -7,8 +7,8 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework-macros" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework-macros" }
|
||||
token_core = { path = "../../token/core" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
||||
Generated
+5
-5
@@ -751,7 +751,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "clock_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"lee_core",
|
||||
@@ -1637,7 +1637,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "lee_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -2640,7 +2640,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
[[package]]
|
||||
name = "spel-framework"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"lee_core",
|
||||
@@ -2652,7 +2652,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-core"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -2669,7 +2669,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-macros"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -56,11 +56,11 @@ name = "amm"
|
||||
path = "src/bin/amm.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
|
||||
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
amm_core = { path = "../../core" }
|
||||
amm_program = { path = "../..", package = "amm_program" }
|
||||
token_core = { path = "../../../token/core" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
borsh = "1.5"
|
||||
borsh = "1.5"
|
||||
@@ -8,7 +8,7 @@ use std::num::NonZeroU128;
|
||||
|
||||
use spel_framework::prelude::*;
|
||||
use spel_framework::context::ProgramContext;
|
||||
use nssa_core::{
|
||||
use lee_core::{
|
||||
account::{AccountId, AccountWithMetadata},
|
||||
program::ProgramId,
|
||||
};
|
||||
|
||||
@@ -7,6 +7,6 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
ata_core = { path = "core" }
|
||||
token_core = { path = "../token/core" }
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
|
||||
Generated
+4
-4
@@ -1099,7 +1099,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
[[package]]
|
||||
name = "lee_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -1856,7 +1856,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
[[package]]
|
||||
name = "spel-framework"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"lee_core",
|
||||
@@ -1868,7 +1868,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-core"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -1885,7 +1885,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-macros"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -56,8 +56,8 @@ name = "ata"
|
||||
path = "src/bin/ata.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
|
||||
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
# Pin ruint (transitive via risc0-binfmt) below 1.18, which raised its MSRV to
|
||||
# rustc 1.90. The risc0 guest toolchain ships rustc 1.88, so 1.18+ fails the
|
||||
@@ -68,4 +68,4 @@ ata_core = { path = "../../core" }
|
||||
ata_program = { path = "../..", package = "ata_program" }
|
||||
token_core = { path = "../../../token/core" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
borsh = "1.5"
|
||||
borsh = "1.5"
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use spel_framework::prelude::*;
|
||||
use spel_framework::context::ProgramContext;
|
||||
use nssa_core::{account::AccountWithMetadata, program::ProgramId};
|
||||
use lee_core::{account::AccountWithMetadata, program::ProgramId};
|
||||
|
||||
#[cfg(not(test))]
|
||||
risc0_zkvm::guest::entry!(main);
|
||||
|
||||
@@ -11,9 +11,9 @@ edition = "2021"
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
|
||||
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", package = "lee" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
twap_oracle_core = { path = "../twap_oracle/core" }
|
||||
twap-oracle-methods = { path = "../twap_oracle/methods" }
|
||||
# `prove` exposes `ExecutorImpl`/`Session` (the cycle split); we only execute, never prove.
|
||||
|
||||
@@ -9,7 +9,7 @@ workspace = true
|
||||
[dependencies]
|
||||
nssa = { workspace = true }
|
||||
nssa_core = { workspace = true, features = ["host", "test_utils"] }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
amm_core = { workspace = true }
|
||||
token_core = { workspace = true }
|
||||
ata_core = { workspace = true }
|
||||
|
||||
@@ -1885,6 +1885,12 @@ fn advance_clock(state: &mut V03State, timestamp: u64) {
|
||||
}
|
||||
.to_bytes();
|
||||
let clock_account = Account {
|
||||
// The real CLOCK_01 system account is owned by the clock program, not the
|
||||
// default program (see lee `system_accounts::clock_account`). A default owner
|
||||
// makes the spel-framework output filter drop the (unchanged, unclaimed)
|
||||
// clock post-state, which v0.2.1's DeclaredAccountMissingFromOutput invariant
|
||||
// then rejects. Use a non-default placeholder owner, as the oracle fixtures do.
|
||||
program_owner: [8u32; 8],
|
||||
data: Data::try_from(data).expect("clock account data fits"),
|
||||
..Account::default()
|
||||
};
|
||||
|
||||
@@ -8,12 +8,12 @@ use nssa::{
|
||||
},
|
||||
program::Program,
|
||||
program_deployment_transaction::{self, ProgramDeploymentTransaction},
|
||||
public_transaction, PrivateKey, PublicKey, PublicTransaction, SharedSecretKey, V03State,
|
||||
public_transaction, PrivateKey, PublicKey, PublicTransaction, V03State,
|
||||
};
|
||||
use nssa_core::{
|
||||
account::{Account, AccountId, AccountWithMetadata, Data, Nonce},
|
||||
encryption::{EphemeralPublicKey, ViewingPublicKey},
|
||||
EncryptedAccountData, InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
|
||||
encryption::ViewingPublicKey,
|
||||
InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
|
||||
};
|
||||
use token_core::{TokenDefinition, TokenHolding};
|
||||
|
||||
@@ -515,14 +515,14 @@ fn ata_create_from_private_owner() {
|
||||
let owner_npk = NullifierPublicKey::from(&owner_nsk);
|
||||
// `ViewingPublicKey::from_seed` needs two 32-byte halves `(d, z)`.
|
||||
let owner_vpk = ViewingPublicKey::from_seed(&[31u8; 32], &[32u8; 32]);
|
||||
let owner_id = AccountId::for_regular_private_account(&owner_npk, 0);
|
||||
let owner_id = AccountId::for_regular_private_account(&owner_npk, &owner_vpk, 0);
|
||||
|
||||
// ATA derived from the private owner
|
||||
let seed = compute_ata_seed(Ids::token_program(), owner_id, Ids::token_definition());
|
||||
let owner_ata_id = get_associated_token_account_id(&Ids::ata_program(), &seed);
|
||||
|
||||
// Pre-states: private uninitialized owner, public token definition, public uninitialized ATA.
|
||||
let owner_pre = AccountWithMetadata::new(Account::default(), false, owner_id);
|
||||
let owner_pre = AccountWithMetadata::new(Account::default(), true, owner_id);
|
||||
let def_pre = AccountWithMetadata::new(
|
||||
Accounts::token_definition_init(),
|
||||
false,
|
||||
@@ -535,8 +535,9 @@ fn ata_create_from_private_owner() {
|
||||
};
|
||||
let instruction_data = Program::serialize_instruction(instruction).unwrap();
|
||||
|
||||
// Encapsulate a shared secret against the owner's viewing key; the circuit fills the EPK.
|
||||
let shared_secret = SharedSecretKey::encapsulate_deterministic(&owner_vpk, &[0u8; 32], 0).0;
|
||||
// The private owner is a fresh account the caller does not own: PrivateForeignInit.
|
||||
// The circuit derives the EPK from `random_seed`; the init references the current root.
|
||||
let commitment_root = state.commitment_root();
|
||||
|
||||
let ata_program = Program::new(ata_methods::ATA_ELF.to_vec().into()).unwrap();
|
||||
let token_program = Program::new(token_methods::TOKEN_ELF.to_vec().into()).unwrap();
|
||||
@@ -550,12 +551,12 @@ fn ata_create_from_private_owner() {
|
||||
instruction_data,
|
||||
vec![
|
||||
// owner: new private account, not owned/spent by the caller (no nsk, no proof).
|
||||
InputAccountIdentity::PrivateUnauthorized {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(&owner_npk, &owner_vpk),
|
||||
InputAccountIdentity::PrivateForeignInit {
|
||||
vpk: owner_vpk,
|
||||
random_seed: [0; 32],
|
||||
npk: owner_npk,
|
||||
ssk: shared_secret,
|
||||
identifier: 0,
|
||||
commitment_root,
|
||||
},
|
||||
// token_definition: public
|
||||
InputAccountIdentity::Public,
|
||||
@@ -566,12 +567,7 @@ fn ata_create_from_private_owner() {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let message = Message::try_from_circuit_output(
|
||||
vec![Ids::token_definition(), owner_ata_id],
|
||||
vec![],
|
||||
output,
|
||||
)
|
||||
.unwrap();
|
||||
let message = Message::from_circuit_output(vec![], output);
|
||||
|
||||
let witness_set = WitnessSet::for_message(&message, proof, &[]);
|
||||
let tx = PrivacyPreservingTransaction::new(message, witness_set);
|
||||
|
||||
@@ -226,6 +226,12 @@ fn seed_clock(state: &mut V03State, timestamp: u64) {
|
||||
}
|
||||
.to_bytes();
|
||||
let clock_account = Account {
|
||||
// The real CLOCK_01 system account is owned by the clock program, not the
|
||||
// default program (see lee `system_accounts::clock_account`). A default owner
|
||||
// makes the spel-framework output filter drop the (unchanged, unclaimed)
|
||||
// clock post-state, which v0.2.1's DeclaredAccountMissingFromOutput invariant
|
||||
// then rejects. Use a non-default placeholder owner, as the oracle fixture does.
|
||||
program_owner: [8u32; 8],
|
||||
data: Data::try_from(data).expect("clock account data fits"),
|
||||
..Account::default()
|
||||
};
|
||||
@@ -258,6 +264,21 @@ fn state_for_stablecoin_tests() -> V03State {
|
||||
Accounts::collateral_definition_init(),
|
||||
);
|
||||
state.force_insert_account(Ids::user_holding(), Accounts::user_holding_init());
|
||||
// Seed the owner as a non-default-owned account. In nssa, balance-holding user
|
||||
// accounts are owned by a system program (see lee `system_accounts` / the
|
||||
// `time_locked_transfer` sender), not the default program. A default-owned owner
|
||||
// works the first time it signs (its pre-state is still `Account::default()`), but
|
||||
// once `open_position` bumps its nonce the spel-framework output filter drops the
|
||||
// (unchanged, unclaimed, default-owned) owner post-state from the second
|
||||
// transaction — which v0.2.1's DeclaredAccountMissingFromOutput invariant then
|
||||
// rejects. A non-default owner keeps it in the diff across both transactions.
|
||||
state.force_insert_account(
|
||||
Ids::owner(),
|
||||
Account {
|
||||
program_owner: [7u32; 8],
|
||||
..Account::default()
|
||||
},
|
||||
);
|
||||
state
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ use nssa::{
|
||||
privacy_preserving_transaction::{Message, PrivacyPreservingTransaction, WitnessSet},
|
||||
program::Program,
|
||||
program_deployment_transaction::{self, ProgramDeploymentTransaction},
|
||||
public_transaction, PrivateKey, PublicKey, PublicTransaction, SharedSecretKey, V03State,
|
||||
public_transaction, PrivateKey, PublicKey, PublicTransaction, V03State,
|
||||
};
|
||||
use nssa_core::{
|
||||
account::{Account, AccountId, AccountWithMetadata, Data, Nonce},
|
||||
encryption::{EphemeralPublicKey, ViewingPublicKey},
|
||||
Commitment, EncryptedAccountData, InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
|
||||
encryption::ViewingPublicKey,
|
||||
Commitment, InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
|
||||
};
|
||||
use token_core::{TokenDefinition, TokenHolding};
|
||||
|
||||
@@ -648,7 +648,7 @@ impl PrivateKeys {
|
||||
}
|
||||
|
||||
fn holder_id() -> AccountId {
|
||||
AccountId::for_regular_private_account(&Self::holder_npk(), 0)
|
||||
AccountId::for_regular_private_account(&Self::holder_npk(), &Self::holder_vpk(), 0)
|
||||
}
|
||||
|
||||
fn recipient_nsk() -> NullifierSecretKey {
|
||||
@@ -664,7 +664,7 @@ impl PrivateKeys {
|
||||
}
|
||||
|
||||
fn recipient_id() -> AccountId {
|
||||
AccountId::for_regular_private_account(&Self::recipient_npk(), 0)
|
||||
AccountId::for_regular_private_account(&Self::recipient_npk(), &Self::recipient_vpk(), 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -686,11 +686,12 @@ fn shielded_token_transfer(amount: u128, state: &mut V03State) -> Account {
|
||||
let recipient_id = PrivateKeys::recipient_id();
|
||||
|
||||
let sender = AccountWithMetadata::new(sender_account, true, sender_id);
|
||||
let recipient = AccountWithMetadata::new(Account::default(), false, recipient_id);
|
||||
let recipient = AccountWithMetadata::new(Account::default(), true, recipient_id);
|
||||
|
||||
// Sender encapsulates a shared secret against the recipient's viewing key. The
|
||||
// circuit fills the real EPK, so we pass an empty placeholder in the identity.
|
||||
let shared_secret = SharedSecretKey::encapsulate_deterministic(&recipient_vpk, &[0u8; 32], 0).0;
|
||||
// The recipient is a fresh private account the sender does not own: PrivateForeignInit.
|
||||
// The circuit derives the EPK from `random_seed`; the init references the current
|
||||
// commitment-set root.
|
||||
let commitment_root = state.commitment_root();
|
||||
|
||||
let instruction = token_core::Instruction::Transfer {
|
||||
amount_to_transfer: amount,
|
||||
@@ -700,20 +701,19 @@ fn shielded_token_transfer(amount: u128, state: &mut V03State) -> Account {
|
||||
Program::serialize_instruction(instruction).unwrap(),
|
||||
vec![
|
||||
InputAccountIdentity::Public,
|
||||
InputAccountIdentity::PrivateUnauthorized {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(&recipient_npk, &recipient_vpk),
|
||||
InputAccountIdentity::PrivateForeignInit {
|
||||
vpk: recipient_vpk,
|
||||
random_seed: [0; 32],
|
||||
npk: recipient_npk,
|
||||
ssk: shared_secret,
|
||||
identifier: 0,
|
||||
commitment_root,
|
||||
},
|
||||
],
|
||||
&token_program().into(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let message =
|
||||
Message::try_from_circuit_output(vec![sender_id], vec![sender_nonce], output).unwrap();
|
||||
let message = Message::from_circuit_output(vec![sender_nonce], output);
|
||||
|
||||
let witness_set = WitnessSet::for_message(&message, proof, &[&Keys::holder_key()]);
|
||||
let tx = PrivacyPreservingTransaction::new(message, witness_set);
|
||||
@@ -766,7 +766,6 @@ fn token_private_transfer() {
|
||||
|
||||
// Shield tokens into a private account (becomes the sender for the private transfer).
|
||||
let sender_account = shielded_token_transfer(shielded_amount, &mut state);
|
||||
let sender_npk = PrivateKeys::recipient_npk();
|
||||
let sender_nsk = PrivateKeys::recipient_nsk();
|
||||
let sender_vpk = PrivateKeys::recipient_vpk();
|
||||
let sender_id = PrivateKeys::recipient_id();
|
||||
@@ -779,14 +778,10 @@ fn token_private_transfer() {
|
||||
let membership_proof = state
|
||||
.get_proof_for_commitment(&sender_commitment)
|
||||
.expect("sender's commitment must be in the set");
|
||||
|
||||
// Distinct `output_index` per private output keeps the encapsulated secrets reproducible.
|
||||
let shared_secret_1 = SharedSecretKey::encapsulate_deterministic(&sender_vpk, &[0u8; 32], 0).0;
|
||||
let shared_secret_2 =
|
||||
SharedSecretKey::encapsulate_deterministic(&new_recipient_vpk, &[0u8; 32], 1).0;
|
||||
let commitment_root = state.commitment_root();
|
||||
|
||||
let sender_pre = AccountWithMetadata::new(sender_account.clone(), true, sender_id);
|
||||
let new_recipient_pre = AccountWithMetadata::new(Account::default(), false, new_recipient_id);
|
||||
let new_recipient_pre = AccountWithMetadata::new(Account::default(), true, new_recipient_id);
|
||||
|
||||
let instruction = token_core::Instruction::Transfer {
|
||||
amount_to_transfer: transfer_amount,
|
||||
@@ -796,29 +791,26 @@ fn token_private_transfer() {
|
||||
Program::serialize_instruction(instruction).unwrap(),
|
||||
vec![
|
||||
InputAccountIdentity::PrivateAuthorizedUpdate {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(&sender_npk, &sender_vpk),
|
||||
ssk: shared_secret_1,
|
||||
vpk: sender_vpk,
|
||||
random_seed: [0; 32],
|
||||
view_tag: 0,
|
||||
nsk: sender_nsk,
|
||||
membership_proof,
|
||||
identifier: 0,
|
||||
},
|
||||
InputAccountIdentity::PrivateUnauthorized {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(
|
||||
&new_recipient_npk,
|
||||
&new_recipient_vpk,
|
||||
),
|
||||
InputAccountIdentity::PrivateForeignInit {
|
||||
vpk: new_recipient_vpk,
|
||||
random_seed: [0; 32],
|
||||
npk: new_recipient_npk,
|
||||
ssk: shared_secret_2,
|
||||
identifier: 0,
|
||||
commitment_root,
|
||||
},
|
||||
],
|
||||
&token_program().into(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let message = Message::try_from_circuit_output(vec![], vec![], output).unwrap();
|
||||
let message = Message::from_circuit_output(vec![], output);
|
||||
|
||||
let witness_set = WitnessSet::for_message(&message, proof, &[]);
|
||||
let tx = PrivacyPreservingTransaction::new(message, witness_set);
|
||||
@@ -863,7 +855,6 @@ fn token_deshielded_transfer() {
|
||||
|
||||
// Shield tokens into a private account, then deshield some back to a public account.
|
||||
let sender_account = shielded_token_transfer(shielded_amount, &mut state);
|
||||
let sender_npk = PrivateKeys::recipient_npk();
|
||||
let sender_nsk = PrivateKeys::recipient_nsk();
|
||||
let sender_vpk = PrivateKeys::recipient_vpk();
|
||||
let sender_id = PrivateKeys::recipient_id();
|
||||
@@ -874,8 +865,6 @@ fn token_deshielded_transfer() {
|
||||
.get_proof_for_commitment(&sender_commitment)
|
||||
.expect("sender's commitment must be in the set");
|
||||
|
||||
let shared_secret = SharedSecretKey::encapsulate_deterministic(&sender_vpk, &[0u8; 32], 0).0;
|
||||
|
||||
let public_recipient_pre = AccountWithMetadata::new(
|
||||
state.get_account_by_id(public_recipient_id),
|
||||
false,
|
||||
@@ -891,9 +880,9 @@ fn token_deshielded_transfer() {
|
||||
Program::serialize_instruction(instruction).unwrap(),
|
||||
vec![
|
||||
InputAccountIdentity::PrivateAuthorizedUpdate {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(&sender_npk, &sender_vpk),
|
||||
ssk: shared_secret,
|
||||
vpk: sender_vpk,
|
||||
random_seed: [0; 32],
|
||||
view_tag: 0,
|
||||
nsk: sender_nsk,
|
||||
membership_proof,
|
||||
identifier: 0,
|
||||
@@ -904,8 +893,7 @@ fn token_deshielded_transfer() {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let message =
|
||||
Message::try_from_circuit_output(vec![public_recipient_id], vec![], output).unwrap();
|
||||
let message = Message::from_circuit_output(vec![], output);
|
||||
|
||||
let witness_set = WitnessSet::for_message(&message, proof, &[]);
|
||||
let tx = PrivacyPreservingTransaction::new(message, witness_set);
|
||||
|
||||
@@ -4,8 +4,8 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
stablecoin_core = { path = "core" }
|
||||
token_core = { path = "../token/core" }
|
||||
twap_oracle_core = { path = "../twap_oracle/core" }
|
||||
|
||||
@@ -4,7 +4,7 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
alloy-primitives = { version = "1", default-features = false }
|
||||
# Pin ruint (transitive via alloy-primitives) below 1.18, which raised its MSRV to rustc 1.90.
|
||||
@@ -14,7 +14,7 @@ ruint = { version = "=1.17.0", default-features = false }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
twap_oracle_core = { path = "../../twap_oracle/core" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework-macros" }
|
||||
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework-macros" }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
//! Print the stablecoin position + collateral-vault PDAs.
|
||||
//!
|
||||
//! Usage:
|
||||
//! cargo run -q -p stablecoin_program --example stablecoin_pdas -- <stablecoin_pid> <owner>
|
||||
//! <position_nonce>
|
||||
//!
|
||||
//! `stablecoin_pid` is a ProgramId as 8 comma-separated u32 limbs (as printed by
|
||||
//! `spel program-id`); `owner` is a base58 account id; `position_nonce` is a u64.
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use nssa_core::{account::AccountId, program::ProgramId};
|
||||
use stablecoin_core::{compute_position_pda, compute_position_vault_pda};
|
||||
|
||||
// Accepts a ProgramId as 8 comma-separated u32 limbs, a 64-char ImageID hex, or a base58
|
||||
// ImageID. Hex/base58 are decoded as the 32 ImageID bytes read little-endian per u32 word,
|
||||
// matching how `spel program-id` maps the ImageID to limbs.
|
||||
fn parse_pid(s: &str) -> ProgramId {
|
||||
if s.contains(',') {
|
||||
let limbs: Vec<u32> = s
|
||||
.split(',')
|
||||
.map(|x| x.trim().parse().expect("ProgramId limb must be a u32"))
|
||||
.collect();
|
||||
assert_eq!(limbs.len(), 8, "ProgramId must be 8 u32 limbs");
|
||||
let mut pid: ProgramId = [0u32; 8];
|
||||
pid.copy_from_slice(&limbs);
|
||||
return pid;
|
||||
}
|
||||
let bytes: [u8; 32] = if s.len() == 64 && s.bytes().all(|b| b.is_ascii_hexdigit()) {
|
||||
let mut out = [0u8; 32];
|
||||
for (byte, pair) in out.iter_mut().zip(s.as_bytes().chunks_exact(2)) {
|
||||
let pair: [u8; 2] = pair.try_into().expect("hex pair");
|
||||
let hex = std::str::from_utf8(&pair).expect("ascii hex");
|
||||
*byte = u8::from_str_radix(hex, 16).expect("invalid hex digit");
|
||||
}
|
||||
out
|
||||
} else {
|
||||
AccountId::from_str(s)
|
||||
.expect("ProgramId must be 8 u32 limbs, a 64-char hex ImageID, or base58")
|
||||
.into_value()
|
||||
};
|
||||
let mut pid: ProgramId = [0u32; 8];
|
||||
for (limb, chunk) in pid.iter_mut().zip(bytes.chunks_exact(4)) {
|
||||
*limb = u32::from_le_bytes(chunk.try_into().expect("4-byte chunk"));
|
||||
}
|
||||
pid
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = std::env::args().skip(1).collect();
|
||||
let [stablecoin_s, owner_s, nonce_s] = args.as_slice() else {
|
||||
eprintln!("usage: stablecoin_pdas <stablecoin_pid> <owner> <position_nonce>");
|
||||
std::process::exit(1);
|
||||
};
|
||||
let stablecoin = parse_pid(stablecoin_s);
|
||||
let owner = AccountId::from_str(owner_s).expect("owner must be base58");
|
||||
let position_nonce: u64 = nonce_s.parse().expect("position_nonce must be a u64");
|
||||
|
||||
let position = compute_position_pda(stablecoin, owner, position_nonce);
|
||||
println!("position {position}");
|
||||
println!(
|
||||
"position_vault {}",
|
||||
compute_position_vault_pda(stablecoin, position)
|
||||
);
|
||||
}
|
||||
+5
-5
@@ -691,7 +691,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "clock_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"lee_core",
|
||||
@@ -1597,7 +1597,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
[[package]]
|
||||
name = "lee_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -2610,7 +2610,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
[[package]]
|
||||
name = "spel-framework"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"lee_core",
|
||||
@@ -2622,7 +2622,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-core"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -2639,7 +2639,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-macros"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -14,12 +14,12 @@ name = "stablecoin"
|
||||
path = "src/bin/stablecoin.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
|
||||
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
twap_oracle_core = { path = "../../../twap_oracle/core" }
|
||||
stablecoin_core = { path = "../../core" }
|
||||
stablecoin_program = { path = "../..", package = "stablecoin_program" }
|
||||
token_core = { path = "../../../token/core" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
borsh = "1.5"
|
||||
borsh = "1.5"
|
||||
@@ -1,6 +1,6 @@
|
||||
#![cfg_attr(not(test), no_main)]
|
||||
|
||||
use nssa_core::account::AccountWithMetadata;
|
||||
use lee_core::account::AccountWithMetadata;
|
||||
use spel_framework::context::ProgramContext;
|
||||
use spel_framework::prelude::*;
|
||||
|
||||
@@ -43,7 +43,7 @@ mod stablecoin {
|
||||
collateral_definition: AccountWithMetadata,
|
||||
market_price_oracle: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
freeze_authority_account_id: nssa_core::account::AccountId,
|
||||
freeze_authority_account_id: lee_core::account::AccountId,
|
||||
initial_stability_fee_per_millisecond: u128,
|
||||
initial_controller_proportional_gain: i128,
|
||||
initial_controller_integral_gain: i128,
|
||||
|
||||
@@ -7,5 +7,5 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
token_core = { path = "core" }
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework-macros" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework-macros" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
||||
Generated
+4
-4
@@ -1065,7 +1065,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
[[package]]
|
||||
name = "lee_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -1822,7 +1822,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
[[package]]
|
||||
name = "spel-framework"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"lee_core",
|
||||
@@ -1834,7 +1834,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-core"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -1851,7 +1851,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-macros"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -56,8 +56,8 @@ name = "token"
|
||||
path = "src/bin/token.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
|
||||
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
# Pin ruint (transitive via risc0-binfmt) below 1.18, which raised its MSRV to
|
||||
# rustc 1.90. The risc0 guest toolchain ships rustc 1.88, so 1.18+ fails the
|
||||
@@ -67,4 +67,4 @@ ruint = { version = "=1.17.0", default-features = false }
|
||||
token_core = { path = "../../core" }
|
||||
token_program = { path = "../..", package = "token_program" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
borsh = "1.5"
|
||||
borsh = "1.5"
|
||||
@@ -4,7 +4,7 @@
|
||||
reason = "SPEL macro emits cloned validation slices for one-account instructions"
|
||||
)]
|
||||
|
||||
use nssa_core::account::{AccountId, AccountWithMetadata};
|
||||
use lee_core::account::{AccountId, AccountWithMetadata};
|
||||
use spel_framework::context::ProgramContext;
|
||||
use spel_framework::prelude::*;
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
twap_oracle_core = { path = "core" }
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -7,10 +7,10 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework-macros" }
|
||||
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework-macros" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
uniswap_v3_math = "0.6.2"
|
||||
alloy-primitives = { version = "1", default-features = false }
|
||||
|
||||
+5
-5
@@ -691,7 +691,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "clock_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"lee_core",
|
||||
@@ -1597,7 +1597,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
[[package]]
|
||||
name = "lee_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -2610,7 +2610,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
[[package]]
|
||||
name = "spel-framework"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"lee_core",
|
||||
@@ -2622,7 +2622,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-core"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
@@ -2639,7 +2639,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "spel-framework-macros"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -14,11 +14,11 @@ name = "twap_oracle"
|
||||
path = "src/bin/twap_oracle.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
|
||||
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
twap_oracle_core = { path = "../../core" }
|
||||
twap_oracle_program = { path = "../..", package = "twap_oracle_program" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
borsh = "1.5"
|
||||
borsh = "1.5"
|
||||
@@ -1,6 +1,6 @@
|
||||
#![cfg_attr(not(test), no_main)]
|
||||
|
||||
use nssa_core::account::{AccountId, AccountWithMetadata};
|
||||
use lee_core::account::{AccountId, AccountWithMetadata};
|
||||
use spel_framework::context::ProgramContext;
|
||||
use spel_framework::prelude::*;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ name = "idl-gen"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework-core = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework-core", features = ["idl-gen"] }
|
||||
spel-framework-core = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework-core", features = ["idl-gen"] }
|
||||
# `preserve_order` keeps object keys in struct-declaration order when
|
||||
# round-tripping through serde_json::Value (see main.rs), so the only
|
||||
# reordering we apply is sorting the `types` array.
|
||||
|
||||
@@ -15,7 +15,13 @@ fn main() {
|
||||
|
||||
let dep_dirs = find_path_dep_dirs(&path);
|
||||
|
||||
match spel_framework_core::idl_gen::generate_idl_from_file_with_deps(&path, &dep_dirs) {
|
||||
// Dependency-scan problems arrive as warnings (never errors); surface them.
|
||||
let mut on_warning = |w: String| eprintln!("warning: {w}");
|
||||
match spel_framework_core::idl_gen::generate_idl_from_file_with_deps(
|
||||
&path,
|
||||
&dep_dirs,
|
||||
&mut on_warning,
|
||||
) {
|
||||
Ok(idl) => {
|
||||
// spel-framework emits the top-level `types` array in HashMap
|
||||
// iteration order, which is non-deterministic across processes.
|
||||
|
||||
Reference in New Issue
Block a user