diff --git a/piecrust-uplink/CHANGELOG.md b/piecrust-uplink/CHANGELOG.md index d66eaa1f..e000fb97 100644 --- a/piecrust-uplink/CHANGELOG.md +++ b/piecrust-uplink/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Removed + +- Removed the 'charge' portion of the economic protocol [#365] + ## [0.13.0] - 2024-06-05 ### Added @@ -175,6 +179,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - First `piecrust-uplink` release +[#365]: https://github.com/dusk-network/piecrust/issues/365 [#357]: https://github.com/dusk-network/piecrust/issues/357 [#353]: https://github.com/dusk-network/piecrust/issues/353 [#350]: https://github.com/dusk-network/piecrust/issues/350 diff --git a/piecrust-uplink/src/abi/state.rs b/piecrust-uplink/src/abi/state.rs index bd9b0f2e..e95e02ca 100644 --- a/piecrust-uplink/src/abi/state.rs +++ b/piecrust-uplink/src/abi/state.rs @@ -206,13 +206,6 @@ pub fn set_allowance(allowance: u64) { set_eco_mode(EconomicMode::Allowance(allowance)); } -/// Allows the contract to set charge which will be used -/// as a fee. If charge is greater than gas spent, -/// the difference will be added to contract's balance. -pub fn set_charge(charge: u64) { - set_eco_mode(EconomicMode::Charge(charge)); -} - /// Calls the function with name `fn_name` of the given `contract` using /// `fn_arg` as argument, allowing it to spend the given `gas_limit`. /// diff --git a/piecrust-uplink/src/types.rs b/piecrust-uplink/src/types.rs index 0b5da83a..ffe3521b 100644 --- a/piecrust-uplink/src/types.rs +++ b/piecrust-uplink/src/types.rs @@ -163,14 +163,12 @@ impl RawResult { #[archive_attr(derive(CheckBytes))] pub enum EconomicMode { Allowance(u64), - Charge(u64), None, Unknown, } impl EconomicMode { const ALLOWANCE: u8 = 1; - const CHARGE: u8 = 2; const NONE: u8 = 0; pub fn write(&self, buf: &mut [u8]) { @@ -186,10 +184,6 @@ impl EconomicMode { write_value(allowance, buf); buf[0] = Self::ALLOWANCE; } - Charge(charge) => { - write_value(charge, buf); - buf[0] = Self::CHARGE; - } None => { zero_buf(buf); buf[0] = Self::NONE; @@ -206,7 +200,6 @@ impl EconomicMode { }; match buf[0] { Self::ALLOWANCE => Allowance(value()), - Self::CHARGE => Charge(value()), Self::NONE => None, _ => Unknown, } diff --git a/piecrust/src/session.rs b/piecrust/src/session.rs index 5551e305..dab21864 100644 --- a/piecrust/src/session.rs +++ b/piecrust/src/session.rs @@ -632,7 +632,7 @@ impl Session { /// Creates a new instance of the given contract, returning its memory /// length. - pub(crate) fn create_instance( + fn create_instance( &mut self, contract: ContractId, ) -> Result {