Просмотр исходного кода

money: stop fee call accumulator updates

brid 1 неделя назад
Родитель
Сommit
b077af3e46
2 измененных файлов с 2 добавлено и 25 удалено
  1. 2 21
      src/contract/money/src/entrypoint/fee_v1.rs
  2. 0 4
      src/contract/money/src/model/mod.rs

+ 2 - 21
src/contract/money/src/entrypoint/fee_v1.rs

@@ -33,7 +33,7 @@ use darkfi_sdk::{
     wasm::{
         self,
         db::{
-            db_contains_key, db_contains_key_local, db_get, db_lookup, db_lookup_local, db_set,
+            db_contains_key, db_contains_key_local, db_lookup, db_lookup_local, db_set,
             db_set_local,
         },
     },
@@ -45,7 +45,7 @@ use crate::{
     error::MoneyError,
     model::{MoneyFeeParamsV1, MoneyFeeUpdateV1, DARK_TOKEN_ID},
     MONEY_CONTRACT_COINS_TREE, MONEY_CONTRACT_COIN_MERKLE_TREE, MONEY_CONTRACT_COIN_ROOTS_TREE,
-    MONEY_CONTRACT_FEES_TREE, MONEY_CONTRACT_INFO_TREE, MONEY_CONTRACT_LATEST_COIN_ROOT,
+    MONEY_CONTRACT_INFO_TREE, MONEY_CONTRACT_LATEST_COIN_ROOT,
     MONEY_CONTRACT_LATEST_NULLIFIER_ROOT, MONEY_CONTRACT_NULLIFIERS_TREE,
     MONEY_CONTRACT_NULLIFIER_ROOTS_TREE, MONEY_CONTRACT_ZKAS_FEE_NS_V1,
 };
@@ -131,7 +131,6 @@ pub(crate) fn money_fee_process_instruction_v1(
     let coin_roots_db = db_lookup(cid, MONEY_CONTRACT_COIN_ROOTS_TREE)?;
     let coin_roots_db_local = db_lookup_local(cid, MONEY_CONTRACT_COIN_ROOTS_TREE)?;
 
-    let fees_db = db_lookup(cid, MONEY_CONTRACT_FEES_TREE)?;
     let nullifiers_db = db_lookup(cid, MONEY_CONTRACT_NULLIFIERS_TREE)?;
 
     // Fees can only be paid using the native token, so we'll compare
@@ -205,25 +204,11 @@ pub(crate) fn money_fee_process_instruction_v1(
         return Err(MoneyError::ValueMismatch.into())
     }
 
-    // Accumulate the height paid fee
-    let verifying_block_height = wasm::util::get_verifying_block_height()?;
-    let Some(paid_fee) = db_get(fees_db, &serialize(&verifying_block_height))? else {
-        msg!("[FeeV1] Error: Block height fees accumulator not found");
-        return Err(MoneyError::PoWRewardCallMissingFeesAccumulator.into())
-    };
-    let paid_fee: u64 = deserialize(&paid_fee)?;
-    let Some(paid_fee) = paid_fee.checked_add(fee) else {
-        msg!("[FeeV1] Error: Could not compute paid fee");
-        return Err(MoneyError::ValueMismatch.into())
-    };
-
     // At this point the state transition has passed, so we create a state update.
     let update = MoneyFeeUpdateV1 {
         nullifier: params.input.nullifier,
         coin: params.output.coin,
         tx_local: params.output.tx_local,
-        height: verifying_block_height,
-        fee: paid_fee,
     };
     // and return it
     Ok(serialize(&update))
@@ -247,10 +232,6 @@ pub(crate) fn money_fee_process_update_v1(
     let coin_roots_db = db_lookup(cid, MONEY_CONTRACT_COIN_ROOTS_TREE)?;
     let coin_roots_db_local = db_lookup_local(cid, MONEY_CONTRACT_COIN_ROOTS_TREE)?;
 
-    let fees_db = db_lookup(cid, MONEY_CONTRACT_FEES_TREE)?;
-
-    db_set(fees_db, &serialize(&update.height), &serialize(&update.fee))?;
-
     wasm::merkle::sparse_merkle_insert_batch(
         info_db,
         nullifiers_db,

+ 0 - 4
src/contract/money/src/model/mod.rs

@@ -192,10 +192,6 @@ pub struct MoneyFeeUpdateV1 {
     pub coin: Coin,
     /// Marker whether the output will be used tx-local
     pub tx_local: bool,
-    /// Block height the fee was verified against
-    pub height: u32,
-    /// Height accumulated fee paid
-    pub fee: u64,
 }
 
 #[derive(Clone, Debug, SerialEncodable, SerialDecodable)]