Skip to content

Commit

Permalink
rusk: remove economic protocol features
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Leegwater Simões committed Jun 26, 2024
1 parent 2a1d230 commit 716b7a1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 208 deletions.
1 change: 1 addition & 0 deletions rusk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- Remove economic protocol handling
- Remove allowlist [#1257]
- Remove STCO and WFCO [#1675]

Expand Down
18 changes: 3 additions & 15 deletions rusk/src/lib/chain/rusk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use execution_core::{
use node_data::ledger::{SpentTransaction, Transaction};
use rusk_abi::dusk::Dusk;
use rusk_abi::{
CallReceipt, ContractError, ContractId, Error as PiecrustError, Event,
Session, STAKE_CONTRACT, TRANSFER_CONTRACT, VM,
CallReceipt, ContractError, Error as PiecrustError, Event, Session,
STAKE_CONTRACT, TRANSFER_CONTRACT, VM,
};
use rusk_profile::to_rusk_state_id_path;
use tokio::sync::broadcast;
Expand Down Expand Up @@ -150,7 +150,6 @@ impl Rusk {
spent_txs.push(SpentTransaction {
inner: unspent_tx,
gas_spent,
economic_mode: receipt.economic_mode,
block_height,
err,
});
Expand Down Expand Up @@ -439,7 +438,6 @@ fn accept(
spent_txs.push(SpentTransaction {
inner: unspent_tx.clone(),
gas_spent,
economic_mode: receipt.economic_mode,
block_height,
// We're currently ignoring the result of successful calls
err: receipt.data.err().map(|e| format!("{e}")),
Expand Down Expand Up @@ -500,24 +498,14 @@ fn execute(
receipt.gas_spent = receipt.gas_limit;
}

let contract_id = tx
.call
.clone()
.map(|(module_id, _, _)| ContractId::from_bytes(module_id));

// Refund the appropriate amount to the transaction. This call is guaranteed
// to never error. If it does, then a programming error has occurred. As
// such, the call to `Result::expect` is warranted.
let refund_receipt = session
.call::<_, ()>(
TRANSFER_CONTRACT,
"refund",
&(
tx.fee,
receipt.gas_spent,
receipt.economic_mode.clone(),
contract_id,
),
&(tx.fee, receipt.gas_spent),
u64::MAX,
)
.expect("Refunding must succeed");
Expand Down
187 changes: 0 additions & 187 deletions rusk/tests/services/contract_pays.rs

This file was deleted.

4 changes: 2 additions & 2 deletions rusk/tests/services/gas_behavior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const BLOCK_HEIGHT: u64 = 1;
const BLOCK_GAS_LIMIT: u64 = 1_000_000_000_000;
const INITIAL_BALANCE: u64 = 10_000_000_000;

const GAS_LIMIT_0: u64 = 7_000_000;
const GAS_LIMIT_1: u64 = 200_000_000;
const GAS_LIMIT_0: u64 = 100_000_000;
const GAS_LIMIT_1: u64 = 300_000_000;

// Creates the Rusk initial state for the tests below
fn initial_state<P: AsRef<Path>>(dir: P) -> Result<Rusk> {
Expand Down
1 change: 0 additions & 1 deletion rusk/tests/services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

pub mod contract_pays;
pub mod gas_behavior;
pub mod multi_transfer;
pub mod stake;
Expand Down
4 changes: 2 additions & 2 deletions rusk/tests/services/multi_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use crate::common::wallet::{TestProverClient, TestStateClient, TestStore};
const BLOCK_HEIGHT: u64 = 1;
// This is purposefully chosen to be low to trigger the discarding of a
// perfectly good transaction.
const BLOCK_GAS_LIMIT: u64 = 24_000_000;
const GAS_LIMIT: u64 = 12_000_000; // Lowest value for a transfer
const BLOCK_GAS_LIMIT: u64 = 42_000_000;
const GAS_LIMIT: u64 = 21_000_000; // Lowest value for a transfer
const INITIAL_BALANCE: u64 = 10_000_000_000;

// Creates the Rusk initial state for the tests below
Expand Down
2 changes: 1 addition & 1 deletion rusk/tests/services/unspendable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const INITIAL_BALANCE: u64 = 10_000_000_000;

const GAS_LIMIT_0: u64 = 20_000_000; // Enough to spend, but OOG during ICC
const GAS_LIMIT_1: u64 = 1_000; // Not enough to spend
const GAS_LIMIT_2: u64 = 200_000_000; // All ok
const GAS_LIMIT_2: u64 = 300_000_000; // All ok

// Creates the Rusk initial state for the tests below
fn initial_state<P: AsRef<Path>>(dir: P) -> Result<Rusk> {
Expand Down

0 comments on commit 716b7a1

Please sign in to comment.