Skip to content

Commit c2f5a3a

Browse files
Blob tx support and fuel-vm 0.56.0 (#1988)
Work towards FuelLabs/fuel-specs#589. Spec PR FuelLabs/fuel-specs#592. Adds support for Blob transactions, which are inserted into the onchain database column called `Blobs`. Also updates fuel-vm to 0.56.0, which introduces the new tx type. Work-in-progress, still needs: - [x] Regenesis support - [x] Tests ## Checklist - [x] Breaking changes are clearly marked as such in the PR description and changelog - [x] New behavior is reflected in tests ### Before requesting review - [x] I have reviewed the code myself - [x] I have created follow-up issues caused by this PR and linked them here ### After merging, notify other teams - [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/) - [ ] [Sway compiler](https://github.com/FuelLabs/sway/) - [ ] [Platform documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+) (for out-of-organization contributors, the person merging the PR will do this) --------- Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com> Co-authored-by: segfault-magnet <ahmed.sagdati.ets@gmail.com>
1 parent a204300 commit c2f5a3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+803
-168
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
- [1983](https://github.com/FuelLabs/fuel-core/pull/1983): Add adapters for gas price service for accessing database values
1111

1212
### Breaking
13+
- [#1988](https://github.com/FuelLabs/fuel-core/pull/1988): Updated `fuel-vm` to `0.56.0` ([release notes](https://github.com/FuelLabs/fuel-vm/releases/tag/v0.55.0)). Adds Blob transaction support.
1314
- [2025](https://github.com/FuelLabs/fuel-core/pull/2025): Add new V0 algorithm for gas price to services.
1415
This change includes new flags for the CLI:
1516
- "starting-gas-price" - the starting gas price for the gas price algorithm

Cargo.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fuel-core-xtask = { version = "0.0.0", path = "./xtask" }
8585
fuel-gas-price-algorithm = { version = "0.31.0", path = "crates/fuel-gas-price-algorithm" }
8686

8787
# Fuel dependencies
88-
fuel-vm-private = { version = "0.55.0", package = "fuel-vm", default-features = false }
88+
fuel-vm-private = { version = "0.56.0", package = "fuel-vm", default-features = false }
8989

9090
# Common dependencies
9191
anyhow = "1.0"

benches/benches-outputs/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use fuel_core_types::fuel_tx::{
2-
consensus_parameters::gas::GasCostsValuesV3,
2+
consensus_parameters::gas::GasCostsValuesV4,
33
DependentCost,
44
GasCostsValues,
55
};

benches/benches/block_target_gas_set/contract.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub fn run_contract(group: &mut BenchmarkGroup<WallTime>) {
217217
let mut instructions = setup_instructions();
218218
instructions.extend(vec![
219219
op::movi(0x13, size),
220-
op::ldc(CONTRACT_ID_REGISTER, RegId::ZERO, 0x13),
220+
op::ldc(CONTRACT_ID_REGISTER, RegId::ZERO, 0x13, 0),
221221
op::jmpb(RegId::ZERO, 0),
222222
]);
223223
let id = format!("contract/ldc {:?}", size);

benches/benches/block_target_gas_set/crypto.rs

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -97,43 +97,46 @@ pub fn run_crypto(group: &mut BenchmarkGroup<WallTime>) {
9797
.collect(),
9898
);
9999

100-
let message = Message::new(b"foo");
101100
let ed19_secret = ed25519_dalek::SigningKey::generate(&mut rand::rngs::OsRng {});
102101
let ed19_signature = ed19_secret.sign(&*message);
103102

104-
run(
105-
"crypto/ed19 opcode",
106-
group,
107-
vec![
108-
op::gtf_args(0x20, 0x00, GTFArgs::ScriptData),
109-
op::addi(
110-
0x21,
111-
0x20,
112-
ed19_secret
113-
.verifying_key()
114-
.as_ref()
115-
.len()
116-
.try_into()
117-
.unwrap(),
118-
),
119-
op::addi(
120-
0x22,
121-
0x21,
122-
ed19_signature.to_bytes().len().try_into().unwrap(),
123-
),
124-
op::addi(0x22, 0x21, message.as_ref().len().try_into().unwrap()),
125-
op::ed19(0x20, 0x21, 0x22),
126-
op::jmpb(RegId::ZERO, 0),
127-
],
128-
ed19_secret
129-
.verifying_key()
130-
.to_bytes()
131-
.iter()
132-
.copied()
133-
.chain(ed19_signature.to_bytes())
134-
.chain(message.as_ref().iter().copied())
135-
.collect(),
136-
);
103+
for i in arb_dependent_cost_values() {
104+
let id = format!("crypto/ed19 opcode {:?}", i);
105+
let message = vec![1u8; i as usize];
106+
run(
107+
&id,
108+
group,
109+
vec![
110+
op::gtf_args(0x20, 0x00, GTFArgs::ScriptData),
111+
op::addi(
112+
0x21,
113+
0x20,
114+
ed19_secret
115+
.verifying_key()
116+
.as_ref()
117+
.len()
118+
.try_into()
119+
.unwrap(),
120+
),
121+
op::addi(
122+
0x22,
123+
0x21,
124+
ed19_signature.to_bytes().len().try_into().unwrap(),
125+
),
126+
op::movi(0x23, message.len().try_into().unwrap()),
127+
op::ed19(0x20, 0x21, 0x22, 0x23),
128+
op::jmpb(RegId::ZERO, 0),
129+
],
130+
ed19_secret
131+
.verifying_key()
132+
.to_bytes()
133+
.iter()
134+
.copied()
135+
.chain(ed19_signature.to_bytes())
136+
.chain(message.iter().copied())
137+
.collect(),
138+
);
139+
}
137140

138141
for i in arb_dependent_cost_values() {
139142
let id = format!("crypto/s256 opcode {:?}", i);

benches/benches/vm_set/blockchain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ pub fn run(c: &mut Criterion) {
358358
run_group_ref(
359359
&mut ldc,
360360
format!("{i}"),
361-
VmBench::new(op::ldc(0x10, RegId::ZERO, 0x13))
361+
VmBench::new(op::ldc(0x10, RegId::ZERO, 0x13, 0))
362362
.with_contract_code(code)
363363
.with_data(data)
364364
.with_prepare_script(prepare_script),

benches/benches/vm_set/crypto.rs

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -114,37 +114,44 @@ pub fn run(c: &mut Criterion) {
114114
let ed19_secret = ed25519_dalek::SigningKey::generate(&mut rand::rngs::OsRng {});
115115
let ed19_signature = ed19_secret.sign(&*message);
116116

117-
run_group_ref(
118-
&mut c.benchmark_group("ed19"),
119-
"ed19",
120-
VmBench::new(op::ed19(0x20, 0x21, 0x22))
121-
.with_prepare_script(vec![
122-
op::gtf_args(0x20, 0x00, GTFArgs::ScriptData),
123-
op::addi(
124-
0x21,
125-
0x20,
117+
let mut bench_ed19 = c.benchmark_group("ed19");
118+
for i in &linear {
119+
bench_ed19.throughput(Throughput::Bytes(*i as u64));
120+
run_group_ref(
121+
&mut bench_ed19,
122+
format!("{i}"),
123+
VmBench::new(op::ed19(0x20, 0x21, RegId::ZERO, 0x10))
124+
.with_prepare_script(vec![
125+
op::gtf_args(0x20, 0x00, GTFArgs::ScriptData),
126+
op::addi(
127+
0x21,
128+
0x20,
129+
ed19_secret
130+
.verifying_key()
131+
.as_bytes()
132+
.len()
133+
.try_into()
134+
.unwrap(),
135+
),
136+
op::addi(
137+
0x22,
138+
0x21,
139+
ed19_signature.to_bytes().len().try_into().unwrap(),
140+
),
141+
op::movi(0x10, *i),
142+
op::cfe(0x10),
143+
])
144+
.with_data(
126145
ed19_secret
127146
.verifying_key()
128-
.as_bytes()
129-
.len()
130-
.try_into()
131-
.unwrap(),
132-
),
133-
op::addi(
134-
0x22,
135-
0x21,
136-
ed19_signature.to_bytes().len().try_into().unwrap(),
147+
.to_bytes()
148+
.iter()
149+
.chain(ed19_signature.to_bytes().iter())
150+
.chain(message.iter())
151+
.copied()
152+
.collect(),
137153
),
138-
])
139-
.with_data(
140-
ed19_secret
141-
.verifying_key()
142-
.to_bytes()
143-
.iter()
144-
.chain(ed19_signature.to_bytes().iter())
145-
.chain(message.iter())
146-
.copied()
147-
.collect(),
148-
),
149-
);
154+
);
155+
}
156+
bench_ed19.finish();
150157
}

benches/src/bin/collect.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clap::Parser;
22
use fuel_core_types::fuel_tx::{
3-
consensus_parameters::gas::GasCostsValuesV3,
3+
consensus_parameters::gas::GasCostsValuesV4,
44
ConsensusParameters,
55
GasCosts,
66
};
@@ -371,7 +371,7 @@ pub const GIT: &str = ""#,
371371
r#"";"#,
372372
r##"
373373
pub fn default_gas_costs() -> GasCostsValues {
374-
GasCostsValuesV3 {"##,
374+
GasCostsValuesV4 {"##,
375375
r##" }.into()
376376
}
377377
"##,
@@ -495,7 +495,7 @@ impl State {
495495
)
496496
}
497497

498-
fn to_gas_costs(&self) -> GasCostsValuesV3 {
498+
fn to_gas_costs(&self) -> GasCostsValuesV4 {
499499
serde_yaml::from_value(self.to_yaml()).unwrap()
500500
}
501501

benches/src/default_gas_costs.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::*;
2-
use fuel_core_types::fuel_tx::consensus_parameters::gas::GasCostsValuesV3;
2+
use fuel_core_types::fuel_tx::consensus_parameters::gas::GasCostsValuesV4;
33
pub fn default_gas_costs() -> GasCostsValues {
4-
GasCostsValuesV3 {
4+
GasCostsValuesV4 {
55
add: 2,
66
addi: 2,
77
and: 2,
@@ -16,7 +16,6 @@ pub fn default_gas_costs() -> GasCostsValues {
1616
divi: 2,
1717
eck1: 1907,
1818
ecr1: 26135,
19-
ed19: 1893,
2019
eq: 2,
2120
exp: 2,
2221
expi: 2,
@@ -95,6 +94,14 @@ pub fn default_gas_costs() -> GasCostsValues {
9594
base: 2,
9695
units_per_gas: 15,
9796
},
97+
bldd: DependentCost::LightOperation {
98+
base: 15,
99+
units_per_gas: 272,
100+
},
101+
bsiz: DependentCost::LightOperation {
102+
base: 17,
103+
units_per_gas: 790,
104+
},
98105
cfe: DependentCost::LightOperation {
99106
base: 10,
100107
units_per_gas: 1818181,
@@ -119,6 +126,10 @@ pub fn default_gas_costs() -> GasCostsValues {
119126
base: 31,
120127
units_per_gas: 438,
121128
},
129+
ed19: DependentCost::LightOperation {
130+
base: 3000,
131+
units_per_gas: 214,
132+
},
122133
k256: DependentCost::LightOperation {
123134
base: 27,
124135
units_per_gas: 5,

0 commit comments

Comments
 (0)