From 36167e4c28c3801af67bf3ec560c66fde8214a29 Mon Sep 17 00:00:00 2001 From: green Date: Sat, 15 Jun 2024 22:47:25 +0200 Subject: [PATCH 1/3] Release v0.54.0 --- CHANGELOG.md | 2 ++ Cargo.toml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f8ae6578f..8c8f8fc36a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [Version 0.54.0] + ### Added - [#770](https://github.com/FuelLabs/fuel-vm/pull/770): Cache contract inputs in the VM. diff --git a/Cargo.toml b/Cargo.toml index 84e2bcaeb9..5eadc0a1a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,17 +17,17 @@ edition = "2021" homepage = "https://fuel.network/" license = "BUSL-1.1" repository = "https://github.com/FuelLabs/fuel-vm" -version = "0.53.0" +version = "0.54.0" [workspace.dependencies] -fuel-asm = { version = "0.53.0", path = "fuel-asm", default-features = false } -fuel-crypto = { version = "0.53.0", path = "fuel-crypto", default-features = false } -fuel-derive = { version = "0.53.0", path = "fuel-derive", default-features = false } -fuel-merkle = { version = "0.53.0", path = "fuel-merkle", default-features = false } -fuel-storage = { version = "0.53.0", path = "fuel-storage", default-features = false } -fuel-tx = { version = "0.53.0", path = "fuel-tx", default-features = false } -fuel-types = { version = "0.53.0", path = "fuel-types", default-features = false } -fuel-vm = { version = "0.53.0", path = "fuel-vm", default-features = false } +fuel-asm = { version = "0.54.0", path = "fuel-asm", default-features = false } +fuel-crypto = { version = "0.54.0", path = "fuel-crypto", default-features = false } +fuel-derive = { version = "0.54.0", path = "fuel-derive", default-features = false } +fuel-merkle = { version = "0.54.0", path = "fuel-merkle", default-features = false } +fuel-storage = { version = "0.54.0", path = "fuel-storage", default-features = false } +fuel-tx = { version = "0.54.0", path = "fuel-tx", default-features = false } +fuel-types = { version = "0.54.0", path = "fuel-types", default-features = false } +fuel-vm = { version = "0.54.0", path = "fuel-vm", default-features = false } bitflags = "2" bincode = { version = "1.3", default-features = false } criterion = "0.5.0" From d1fb593c30c3b483473bc1852e481fcd5ae9fc0c Mon Sep 17 00:00:00 2001 From: green Date: Sun, 16 Jun 2024 10:27:28 +0200 Subject: [PATCH 2/3] Charge for max length in LDC opcode --- fuel-vm/src/interpreter/blockchain.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fuel-vm/src/interpreter/blockchain.rs b/fuel-vm/src/interpreter/blockchain.rs index ee14c04378..393ac19553 100644 --- a/fuel-vm/src/interpreter/blockchain.rs +++ b/fuel-vm/src/interpreter/blockchain.rs @@ -606,9 +606,6 @@ where return Err(PanicReason::ContractMaxSize.into()) } - let new_sp = ssp.saturating_add(length); - self.memory.grow_stack(new_sp)?; - self.input_contracts.check(&contract_id)?; // Fetch the storage contract @@ -619,16 +616,20 @@ where profiler: self.profiler, }; let contract_len = contract_size(&self.storage, &contract_id)?; + let charge_len = core::cmp::max(contract_len as u64, length); dependent_gas_charge_without_base( self.cgas, self.ggas, profiler, self.gas_cost, - contract_len as u64, + charge_len, )?; let contract = super::contract::contract(self.storage, &contract_id)?; let contract_bytes = contract.as_ref().as_ref(); + let new_sp = ssp.saturating_add(length); + self.memory.grow_stack(new_sp)?; + // Set up ownership registers for the copy using old ssp let owner = OwnershipRegisters::only_allow_stack_write(new_sp, *self.ssp, *self.hp); From ee0388303552eb51cd4d43b480544b62b5e3816c Mon Sep 17 00:00:00 2001 From: green Date: Sun, 16 Jun 2024 10:30:37 +0200 Subject: [PATCH 3/3] Updated CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c8f8fc36a..0e82f371fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Changed +- [#776](https://github.com/FuelLabs/fuel-vm/pull/776): Charge for max length in LDC opcode. + ## [Version 0.54.0] ### Added