Skip to content

Commit

Permalink
Duplicate release 0.35.2 (#540)
Browse files Browse the repository at this point in the history
* Actualization of the gas prices for the `fuel-core 0.20` release

* Bump version to `0.35.2`

* Fix CHANGELOG.md
  • Loading branch information
xgreenx authored Aug 3, 2023
1 parent 78f2d61 commit a827b71
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 78 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [#527](https://github.com/FuelLabs/fuel-vm/pull/527): The balances are empty during predicate estimation/verification.


## [Version 0.35.2]

### Changed

#### Breaking

- [#539](https://github.com/FuelLabs/fuel-vm/pull/539/): Rollbacked the change for the gas charging formula.
Actualized the gas prices for opcodes.

## [Version 0.35.1]

### Added
Expand Down
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ edition = "2021"
homepage = "https://fuel.network/"
license = "BUSL-1.1"
repository = "https://github.com/FuelLabs/fuel-vm"
version = "0.35.1"
version = "0.35.2"

[workspace.dependencies]
fuel-asm = { version = "0.35.1", path = "fuel-asm", default-features = false }
fuel-crypto = { version = "0.35.1", path = "fuel-crypto", default-features = false }
fuel-merkle = { version = "0.35.1", path = "fuel-merkle", default-features = false }
fuel-storage = { version = "0.35.1", path = "fuel-storage", default-features = false }
fuel-tx = { version = "0.35.1", path = "fuel-tx", default-features = false }
fuel-types = { version = "0.35.1", path = "fuel-types", default-features = false }
fuel-vm = { version = "0.35.1", path = "fuel-vm", default-features = false }
fuel-asm = { version = "0.35.2", path = "fuel-asm", default-features = false }
fuel-crypto = { version = "0.35.2", path = "fuel-crypto", default-features = false }
fuel-merkle = { version = "0.35.2", path = "fuel-merkle", default-features = false }
fuel-storage = { version = "0.35.2", path = "fuel-storage", default-features = false }
fuel-tx = { version = "0.35.2", path = "fuel-tx", default-features = false }
fuel-types = { version = "0.35.2", path = "fuel-types", default-features = false }
fuel-vm = { version = "0.35.2", path = "fuel-vm", default-features = false }
bincode = { version = "1.3", default-features = false }
criterion = "0.5.0"
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
use super::*;
/// File generated by fuel-core: benches/src/bin/collect.rs:440. With the following git
/// hash
pub const GIT: &str = "9f1cecfbf8bd316e86f2359bb09813304d9e0986";
pub const fn default_gas_costs() -> GasCostsValues {
pub const GIT: &str = "98341e564b75d1157e61d7d5f38612f6224a5b30";
pub fn default_gas_costs() -> GasCostsValues {
GasCostsValues {
add: 1,
addi: 1,
aloc: 1,
and: 1,
andi: 1,
bal: 22,
bal: 13,
bhei: 1,
bhsh: 1,
burn: 126,
burn: 132,
cb: 1,
cfei: 1,
cfsi: 1,
croo: 20,
croo: 16,
div: 1,
divi: 1,
eck1: 1592,
eck1: 951,
ecr1: 3000,
ed19: 3000,
eq: 1,
Expand All @@ -40,16 +40,16 @@ pub const fn default_gas_costs() -> GasCostsValues {
jnzb: 1,
jnef: 1,
jneb: 1,
k256: 16,
k256: 11,
lb: 1,
log: 43,
log: 9,
lt: 1,
lw: 1,
mcpi: 3,
mint: 127,
mcpi: 33,
mint: 135,
mlog: 1,
srwq: DependentCost {
base: 44,
base: 47,
dep_per_unit: 5,
},
modi: 1,
Expand All @@ -64,83 +64,83 @@ pub const fn default_gas_costs() -> GasCostsValues {
or: 1,
ori: 1,
move_op: 1,
ret: 63,
s256: 4,
ret: 13,
s256: 2,
sb: 1,
scwq: 23,
scwq: 13,
sll: 1,
slli: 1,
srl: 1,
srli: 1,
srw: 21,
srw: 12,
sub: 1,
subi: 1,
sw: 1,
sww: 67,
swwq: 68,
sww: 43,
swwq: 44,
time: 1,
tr: 255,
tro: 196,
tr: 105,
tro: 60,
wdcm: 1,
wqcm: 1,
wdop: 1,
wqop: 1,
wdml: 1,
wqml: 2,
wddv: 2,
wqdv: 3,
wdmd: 4,
wqmd: 7,
wdam: 3,
wqam: 4,
wdmm: 4,
wqmm: 4,
wqml: 1,
wddv: 1,
wqdv: 2,
wdmd: 3,
wqmd: 4,
wdam: 2,
wqam: 3,
wdmm: 3,
wqmm: 3,
xor: 1,
xori: 1,
call: DependentCost {
base: 173,
dep_per_unit: 180,
base: 144,
dep_per_unit: 214,
},
ccp: DependentCost {
base: 22,
dep_per_unit: 152,
base: 15,
dep_per_unit: 103,
},
csiz: DependentCost {
base: 16,
dep_per_unit: 868,
base: 17,
dep_per_unit: 790,
},
ldc: DependentCost {
base: 22,
dep_per_unit: 150,
base: 15,
dep_per_unit: 272,
},
logd: DependentCost {
base: 48,
dep_per_unit: 18,
base: 26,
dep_per_unit: 64,
},
mcl: DependentCost {
base: 1,
dep_per_unit: 2503,
dep_per_unit: 3333,
},
mcli: DependentCost {
base: 1,
dep_per_unit: 2559,
dep_per_unit: 3333,
},
mcp: DependentCost {
base: 1,
dep_per_unit: 1301,
dep_per_unit: 2000,
},
meq: DependentCost {
base: 1,
dep_per_unit: 1747,
dep_per_unit: 2500,
},
rvrt: 65,
rvrt: 13,
smo: DependentCost {
base: 207,
dep_per_unit: 18,
base: 209,
dep_per_unit: 55,
},
retd: DependentCost {
base: 71,
dep_per_unit: 18,
base: 29,
dep_per_unit: 62,
},
}
}
36 changes: 18 additions & 18 deletions fuel-vm/src/interpreter/flow/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Default for Output {
frames: vec![CallFrame::new(
Default::default(),
Default::default(),
make_reg(&[(HP, 1000), (SP, 100), (SSP, 100), (CGAS, 0), (GGAS, 0)]),
make_reg(&[(HP, 1000), (SP, 100), (SSP, 100), (CGAS, 10), (GGAS, 10)]),
10,
0,
0,
Expand Down Expand Up @@ -150,11 +150,11 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
asset_id_mem_address: 0,
amount_of_gas_to_forward: 0,
},
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 170, ggas: 170 },
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 21, ggas: 21 },
context: Context::Script{ block_height: Default::default() },
..Default::default()
} => using check_output(Ok(Output{
reg: RegInput{hp: 1000, sp: 716, ssp: 716, fp: 100, pc: 700, is: 700, bal: 0, cgas: 0, ggas: 0 },
reg: RegInput{hp: 1000, sp: 716, ssp: 716, fp: 100, pc: 700, is: 700, bal: 0, cgas: 0, ggas: 10 },
..Default::default()
})); "basic call working"
)]
Expand All @@ -166,7 +166,7 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
asset_id_mem_address: 2000,
amount_of_gas_to_forward: 30,
},
reg: RegInput{hp: 1000, sp: 200, ssp: 200, fp: 0, pc: 0, is: 0, bal: 0, cgas: 1080, ggas: 1150 },
reg: RegInput{hp: 1000, sp: 200, ssp: 200, fp: 0, pc: 0, is: 0, bal: 0, cgas: 201, ggas: 201 },
context: Context::Script{ block_height: Default::default() },
input_contracts: vec![ContractId::from([1u8; 32])],
memory: mem(&[(2000, vec![2; 32]), (2032, Call::new(ContractId::from([1u8; 32]), 4, 5).into())]),
Expand All @@ -175,12 +175,12 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
script: Some(Default::default()),
..Default::default()
} => using check_output({
let frame = CallFrame::new(ContractId::from([1u8; 32]), AssetId::from([2u8; 32]), make_reg(&[(HP, 1000), (SP, 200), (SSP, 200), (CGAS, 0), (GGAS, 100)]), 100, 4, 5);
let frame = CallFrame::new(ContractId::from([1u8; 32]), AssetId::from([2u8; 32]), make_reg(&[(HP, 1000), (SP, 200), (SSP, 200), (CGAS, 151), (GGAS, 181)]), 100, 4, 5);
let mut receipt = Receipt::call(ContractId::zeroed(), ContractId::from([1u8; 32]), 20, AssetId::from([2u8; 32]), 30, 4, 5, 800, 800);
let mut script = Script::default();
*script.receipts_root_mut() = crypto::ephemeral_merkle_root([receipt.to_bytes()].into_iter());
Ok(Output{
reg: RegInput{hp: 1000, sp: 904, ssp: 904, fp: 200, pc: 800, is: 800, bal: 20, cgas: 30, ggas: 100 },
reg: RegInput{hp: 1000, sp: 904, ssp: 904, fp: 200, pc: 800, is: 800, bal: 20, cgas: 30, ggas: 181 },
receipts: vec![receipt].into(),
frames: vec![frame.clone()],
memory: CheckMem::Check(vec![(200, frame.into()), (2000, vec![2; 32]), (2032, Call::new(ContractId::from([1u8; 32]), 4, 5).into())]),
Expand All @@ -197,7 +197,7 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
asset_id_mem_address: 0,
amount_of_gas_to_forward: 0,
},
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 170, ggas: 170 },
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 11, ggas: 11 },
context: Context::Script{ block_height: Default::default() },
balance: [(AssetId::default(), 30)].into_iter().collect(),
..Default::default()
Expand All @@ -216,14 +216,14 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
asset_id_mem_address: 0,
amount_of_gas_to_forward: 10,
},
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 180, ggas: 200 },
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 40, ggas: 80 },
context: Context::Script{ block_height: Default::default() },
balance: [(AssetId::default(), 30)].into_iter().collect(),
..Default::default()
} => using check_output(Ok(Output{
reg: RegInput{hp: 1000, sp: 716, ssp: 716, fp: 100, pc: 700, is: 700, bal: 20, cgas: 10, ggas: 30 },
reg: RegInput{hp: 1000, sp: 716, ssp: 716, fp: 100, pc: 700, is: 700, bal: 20, cgas: 10, ggas: 69 },
receipts: vec![Receipt::call(Default::default(), Default::default(), 20, Default::default(), 10, 0, 0, 700, 700)].into(),
frames: vec![CallFrame::new(Default::default(), Default::default(), make_reg(&[(HP, 1000), (SP, 100), (SSP, 100), (CGAS, 0), (GGAS, 30)]), 10, 0, 0)],
frames: vec![CallFrame::new(Default::default(), Default::default(), make_reg(&[(HP, 1000), (SP, 100), (SSP, 100), (CGAS, 19), (GGAS, 69)]), 10, 0, 0)],
..Default::default()
})); "forwards gas"
)]
Expand All @@ -235,14 +235,14 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
asset_id_mem_address: 0,
amount_of_gas_to_forward: 100,
},
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 180, ggas: 200 },
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 40, ggas: 80 },
context: Context::Script{ block_height: Default::default() },
balance: [(AssetId::default(), 30)].into_iter().collect(),
..Default::default()
} => using check_output(Ok(Output{
reg: RegInput{hp: 1000, sp: 716, ssp: 716, fp: 100, pc: 700, is: 700, bal: 20, cgas: 10, ggas: 30 },
receipts: vec![Receipt::call(Default::default(), Default::default(), 20, Default::default(), 10, 0, 0, 700, 700)].into(),
frames: vec![CallFrame::new(Default::default(), Default::default(), make_reg(&[(HP, 1000), (SP, 100), (SSP, 100), (CGAS, 0), (GGAS, 30)]), 10, 0, 0)],
reg: RegInput{hp: 1000, sp: 716, ssp: 716, fp: 100, pc: 700, is: 700, bal: 20, cgas: 29, ggas: 69 },
receipts: vec![Receipt::call(Default::default(), Default::default(), 20, Default::default(), 29, 0, 0, 700, 700)].into(),
frames: vec![CallFrame::new(Default::default(), Default::default(), make_reg(&[(HP, 1000), (SP, 100), (SSP, 100), (CGAS, 0), (GGAS, 69)]), 10, 0, 0)],
..Default::default()
})); "the receipt shows forwarded gas correctly when limited by available gas"
)]
Expand All @@ -254,7 +254,7 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
asset_id_mem_address: 0,
amount_of_gas_to_forward: 0,
},
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 170, ggas: 170 },
reg: RegInput{hp: 1000, sp: 100, ssp: 100, fp: 0, pc: 0, is: 0, bal: 0, cgas: 11, ggas: 11 },
context: Context::Call{ block_height: Default::default() },
storage_balance: [(AssetId::default(), 30)].into_iter().collect(),
..Default::default()
Expand All @@ -273,7 +273,7 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
asset_id_mem_address: 0,
amount_of_gas_to_forward: 0,
},
reg: RegInput{hp: 1000, sp: 0, ssp: 0, fp: 0, pc: 0, is: 0, bal: 0, cgas: 170, ggas: 170 },
reg: RegInput{hp: 1000, sp: 0, ssp: 0, fp: 0, pc: 0, is: 0, bal: 0, cgas: 11, ggas: 11 },
context: Context::Script{ block_height: Default::default() },
..Default::default()
} => using check_output(Err(RuntimeError::Recoverable(PanicReason::NotEnoughBalance))); "Tries to forward more coins than the contract has"
Expand All @@ -286,7 +286,7 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
asset_id_mem_address: 0,
amount_of_gas_to_forward: 0,
},
reg: RegInput{hp: 1000, sp: 0, ssp: 0, fp: 0, pc: 0, is: 0, bal: 0, cgas: 170, ggas: 170 },
reg: RegInput{hp: 1000, sp: 0, ssp: 0, fp: 0, pc: 0, is: 0, bal: 0, cgas: 11, ggas: 11 },
context: Context::Script{ block_height: Default::default() },
..Default::default()
} => using check_output(Err(RuntimeError::Recoverable(PanicReason::MemoryOverflow))); "call_params_mem_address overflow"
Expand All @@ -312,7 +312,7 @@ fn mem(set: &[(usize, Vec<u8>)]) -> Memory<MEM_SIZE> {
asset_id_mem_address: 0,
amount_of_gas_to_forward: 0,
},
reg: RegInput{hp: 1000, sp: 0, ssp: 0, fp: 0, pc: 0, is: 0, bal: 0, cgas: 170, ggas: 170 },
reg: RegInput{hp: 1000, sp: 0, ssp: 0, fp: 0, pc: 0, is: 0, bal: 0, cgas: 11, ggas: 11 },
context: Context::Call{ block_height: Default::default() },
balance: [(AssetId::default(), 30)].into_iter().collect(),
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion fuel-vm/src/interpreter/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn dependent_gas_charge_inner(
) -> Result<Word, RuntimeError> {
let cost = gas_cost
.base
.saturating_add(arg.saturating_mul(gas_cost.dep_per_unit));
.saturating_add(arg.saturating_div(gas_cost.dep_per_unit));
gas_charge_inner(cgas, ggas, cost).map(|_| cost)
}

Expand Down
8 changes: 4 additions & 4 deletions fuel-vm/src/interpreter/gas/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ struct DepGasChargeInput {
)]
#[test_case(
DepGasChargeInput{
input: GasChargeInput{cgas: 3, ggas: 3, dependent_factor: 1},
input: GasChargeInput{cgas: 1, ggas: 1, dependent_factor: 1},
gas_cost: DependentCost{base: 1, dep_per_unit: 2}
} => Ok(GasChargeOutput{ cgas: 0, ggas: 0}); "just base with gas"
)]
#[test_case(
DepGasChargeInput{
input: GasChargeInput{cgas: 33, ggas: 33, dependent_factor: 8},
input: GasChargeInput{cgas: 3, ggas: 3, dependent_factor: 8},
gas_cost: DependentCost{base: 1, dep_per_unit: 4}
} => Ok(GasChargeOutput{ cgas: 0, ggas: 0}); "base with gas and a unit"
)]
#[test_case(
DepGasChargeInput{
input: GasChargeInput{cgas: 30, ggas: 30, dependent_factor: 5},
input: GasChargeInput{cgas: 3, ggas: 3, dependent_factor: 5},
gas_cost: DependentCost{base: 0, dep_per_unit: 4}
} => Ok(GasChargeOutput{ cgas: 10, ggas: 10}); "base with gas and a unit and left over"
} => Ok(GasChargeOutput{ cgas: 2, ggas: 2}); "base with gas and a unit and left over"
)]
#[test_case(
DepGasChargeInput{
Expand Down

0 comments on commit a827b71

Please sign in to comment.