From 15903368334fd8b9603dc46ea131ee1f43293240 Mon Sep 17 00:00:00 2001 From: TypeError86 Date: Mon, 5 Jan 2026 19:08:45 +0100 Subject: [PATCH 1/4] fix: update unlock amount type from u64 to i128 in lockup.rs --- ex/native/rdb/src/consensus/bic/lockup.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ex/native/rdb/src/consensus/bic/lockup.rs b/ex/native/rdb/src/consensus/bic/lockup.rs index 22a760f..ef59477 100644 --- a/ex/native/rdb/src/consensus/bic/lockup.rs +++ b/ex/native/rdb/src/consensus/bic/lockup.rs @@ -51,13 +51,13 @@ pub fn call_unlock(env: &mut crate::consensus::consensus_apply::ApplyEnv, args: let unlock_height = vault_parts[0].as_slice(); let unlock_height = std::str::from_utf8(&unlock_height).ok().and_then(|s| s.parse::().ok()).unwrap_or_else(|| panic_any("invalid_unlock_height")); let amount = vault_parts[1].as_slice(); - let amount = std::str::from_utf8(&amount).ok().and_then(|s| s.parse::().ok()).unwrap_or_else(|| panic_any("invalid_unlock_amount")); + let amount = std::str::from_utf8(&amount).ok().and_then(|s| s.parse::().ok()).unwrap_or_else(|| panic_any("invalid_unlock_amount")); let symbol = vault_parts[2].as_slice(); if env.caller_env.entry_height < unlock_height { panic_any("vault_is_locked") } else { - kv_increment(env, &bcat(&[b"account:", &env.caller_env.account_caller, b":balance:", symbol]), amount as i128); + kv_increment(env, &bcat(&[b"account:", &env.caller_env.account_caller, b":balance:", symbol]), amount); kv_delete(env, vault_key); } } From 30e7e395ce3ad4eda06488f0cf5ca5a10da0bad5 Mon Sep 17 00:00:00 2001 From: TypeError86 Date: Mon, 5 Jan 2026 19:09:04 +0100 Subject: [PATCH 2/4] feat: add lock and unlock actions for Lockup and LockupPrime --- ex/native/rdb/src/consensus/consensus_apply.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ex/native/rdb/src/consensus/consensus_apply.rs b/ex/native/rdb/src/consensus/consensus_apply.rs index 95308a0..88824c4 100644 --- a/ex/native/rdb/src/consensus/consensus_apply.rs +++ b/ex/native/rdb/src/consensus/consensus_apply.rs @@ -768,6 +768,14 @@ pub fn call_bic(env: &mut ApplyEnv, contract: Vec, function: Vec, args: (b"Coin", b"transfer") => consensus::bic::coin::call_transfer(env, args), + (b"Lockup", b"lock") => consensus::bic::lockup::call_lock(env, args), + (b"Lockup", b"unlock") => consensus::bic::lockup::call_unlock(env, args), + + (b"LockupPrime", b"lock") => consensus::bic::lockup_prime::call_lock(env, args), + (b"LockupPrime", b"unlock") => consensus::bic::lockup_prime::call_unlock(env, args), + (b"LockupPrime", b"daily_checkin") => consensus::bic::lockup_prime::call_daily_checkin(env, args), + _ => std::panic::panic_any("invalid_bic_action") + /* (b"Coin", b"create_and_mint") => consensus::bic::coin::call_create_and_mint(env, args), (b"Coin", b"mint") => consensus::bic::coin::call_mint(env, args), @@ -775,18 +783,11 @@ pub fn call_bic(env: &mut ApplyEnv, contract: Vec, function: Vec, args: (b"Nft", b"transfer") => consensus::bic::nft::call_transfer(env, args), (b"Nft", b"create_collection") => consensus::bic::nft::call_create_collection(env, args), (b"Nft", b"mint") => consensus::bic::nft::call_mint(env, args), - (b"Lockup", b"lock") => consensus::bic::lockup::call_lock(env, args), - (b"Lockup", b"unlock") => consensus::bic::lockup::call_unlock(env, args), (b"Contract", b"deploy") => { consensus_kv::exec_budget_decr(env, protocol::COST_PER_DEPLOY); consensus::bic::contract::call_deploy(env, args) }, - (b"LockupPrime", b"lock") => consensus::bic::lockup_prime::call_lock(env, args), - (b"LockupPrime", b"unlock") => consensus::bic::lockup_prime::call_unlock(env, args), - (b"LockupPrime", b"daily_checkin") => consensus::bic::lockup_prime::call_daily_checkin(env, args), - */ - - _ => std::panic::panic_any("invalid_bic_action") + */ } } From 71ec91853979b48b9db7b09ba38f80cb88b64a09 Mon Sep 17 00:00:00 2001 From: TypeError86 Date: Mon, 5 Jan 2026 19:09:13 +0100 Subject: [PATCH 3/4] chore: update .gitignore to include target directory and native shared objects --- ex/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ex/.gitignore b/ex/.gitignore index 3bfe9e6..b3171ea 100644 --- a/ex/.gitignore +++ b/ex/.gitignore @@ -1,3 +1,6 @@ _build/ deps/ +target/ priv/index.html +priv/native/*.so +amadeusd From 06fe4526d4b1ad6325dbdb7ec710f1cfcdcdaf13 Mon Sep 17 00:00:00 2001 From: TypeError86 Date: Mon, 5 Jan 2026 19:10:18 +0100 Subject: [PATCH 4/4] fix: update apply_into_main_chain function to use tuple for mutations --- ex/lib/consensus/models/entry_genesis.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ex/lib/consensus/models/entry_genesis.ex b/ex/lib/consensus/models/entry_genesis.ex index c46c8fc..a675952 100644 --- a/ex/lib/consensus/models/entry_genesis.ex +++ b/ex/lib/consensus/models/entry_genesis.ex @@ -182,7 +182,7 @@ defmodule EntryGenesis do pop = BlsEx.sign!(sk, pk, BLS12AggSig.dst_pop()) DB.Entry.insert(entry_signed, %{rtx: rtx}) - DB.Entry.apply_into_main_chain(entry_signed, mutations_hash, [], [], "", "", %{rtx: rtx}) + DB.Entry.apply_into_main_chain(entry_signed, mutations_hash, [], {[], []}, "", "", %{rtx: rtx}) RocksDB.put("temporal_tip", entry_signed.hash, %{rtx: rtx, cf: cf.sysconf}) RocksDB.put("rooted_tip", entry_signed.hash, %{rtx: rtx, cf: cf.sysconf})