Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of the 'charge' portion of the Economic Model scenario 3 #366

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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