Skip to content

Commit

Permalink
Merge pull request #366 from dusk-network/issue-365
Browse files Browse the repository at this point in the history
Removal of the 'charge' portion of the Economic Model scenario 3
  • Loading branch information
miloszm authored Jun 11, 2024
2 parents 8502e9e + 0288916 commit 4e0f24c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
5 changes: 5 additions & 0 deletions piecrust-uplink/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -175,6 +179,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First `piecrust-uplink` release

<!-- ISSUES -->
[#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
Expand Down
7 changes: 0 additions & 7 deletions piecrust-uplink/src/abi/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
///
Expand Down
7 changes: 0 additions & 7 deletions piecrust-uplink/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand All @@ -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;
Expand All @@ -206,7 +200,6 @@ impl EconomicMode {
};
match buf[0] {
Self::ALLOWANCE => Allowance(value()),
Self::CHARGE => Charge(value()),
Self::NONE => None,
_ => Unknown,
}
Expand Down
2 changes: 1 addition & 1 deletion piecrust/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize, Error> {
Expand Down

0 comments on commit 4e0f24c

Please sign in to comment.