Skip to content

Commit d821f9c

Browse files
authored
Merge branch 'master' into chore/protobuf-api-adatper
2 parents a0d99f2 + 92c8001 commit d821f9c

File tree

66 files changed

+1316
-572
lines changed

Some content is hidden

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

66 files changed

+1316
-572
lines changed

.changes/added/3050.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
A new benchmarking group for `niop` operations in the `alu.rs` file. The changes add comprehensive benchmarks for various operations (`ADD`, `SUB`, `MUL`, `EXP`, `SLL`, `XNOR`) across different operand widths (`U8`, `U16`, `U32`)
2+
3+
### Additions to benchmarking:
4+
5+
* A new `niop` benchmarking group was added to evaluate the performance of narrow integer operations (`niop`) with different operand widths (`U8`, `U16`, `U32`).
6+
* Introduced the `niop_bench` macro to simplify the creation of benchmarks for operations like `ADD`, `SUB`, `MUL`, `EXP`, `SLL`, and `XNOR`.
7+
* Benchmarks iterate over generated operand pairs for each width, ensuring a variety of test cases for each operation.

.changes/breaking/3050.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- Used a new `fuel-vm 0.64.0` release which brings breaking changes: https://github.com/FuelLabs/fuel-vm/releases/tag/v0.64.0
2+
- The default gas cost has been changed according to new optimizations and a new benchmark machine for a local node.
3+
- Receipts now are behind an `Arc` pointer to avoid unnecessary cloning. It affects transaction states and preconfirmations.
4+
- The `deploy_contract_with_id` now works with `[u8]` instead of the `Contract` type.

.changes/changed/3050.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Actualized benchmarks with the performance of the network. With this change we should be able to run benchmarks on nightly bases.
2+
3+
Added several optimizations to the code base:
4+
- Executor now reuses the memory instance between blocks production and validation avoiding allocations.
5+
- Receipts are not cloned anymore from the VM. Instead, they are extracted from the VM and stored ina s shared pointer.
6+
- The gas usage for script is discovered in a faster way.
7+
- `Create` transaction doesn't require a cloning of the contract bytecode anymore to calculate its `ContractId`.
8+
- Serialization and deserialization of the bytes became much faster for canonical, `postcard`, `bincode` codecs.

.changes/changed/3104.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Automatically adjust relayer log page size to prevent sync failures from oversized Ethereum RPC responses.

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Default code owners for fuel-core
2-
* @xgreenx @Dentosal @MitchTurner @AurelienFT @rymnc
2+
* @xgreenx @Dentosal @MitchTurner @rymnc
33

44
# Code owners for the gas price algorithm
55
crates/fuel-gas-price-algorithm @xgreenx @Dentosal @MitchTurner
66

77
# Code owners for the transaction pool
8-
crates/services/txpool_v2 @xgreenx @Dentosal @MitchTurner @AurelienFT
8+
crates/services/txpool_v2 @xgreenx @Dentosal @MitchTurner
99

1010
# Code owners for the gas price service (v0 & v1)
1111
crates/services/gas_price_service @xgreenx @Dentosal @MitchTurner @rymnc

Cargo.lock

Lines changed: 38 additions & 36 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
@@ -114,7 +114,7 @@ fuel-core-wasm-executor = { version = "0.46.0", path = "./crates/services/upgrad
114114
fuel-gas-price-algorithm = { version = "0.46.0", path = "crates/fuel-gas-price-algorithm" }
115115

116116
# Fuel dependencies
117-
fuel-vm-private = { version = "0.63.0", package = "fuel-vm", default-features = false }
117+
fuel-vm-private = { version = "0.64.0", package = "fuel-vm", default-features = false }
118118
futures = "0.3"
119119
hex = { version = "0.4", features = ["serde"] }
120120
hyper = { version = "0.14.26" }

benches/benches/block_target_gas.rs

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,25 @@ pub struct MultiContractBenchmarkRunnerBuilder {
128128
rng: rand::rngs::StdRng,
129129
}
130130

131+
#[derive(Debug, Clone)]
132+
pub struct BenchContract {
133+
contract_id: ContractId,
134+
bytecode: Option<Vec<u8>>,
135+
}
136+
131137
impl SanityBenchmarkRunnerBuilder {
132138
/// Creates a factory for benchmarks that share a service with a contract, `contract_id`, pre-
133139
/// deployed.
134140
/// The size of the database can be overridden with the `STATE_SIZE` environment variable.
135141
pub fn new_shared(contract_id: ContractId) -> SharedSanityBenchmarkRunnerBuilder {
136142
let state_size = crate::utils::get_state_size();
137-
let (service, rt) = service_with_many_contracts(state_size, vec![contract_id]);
143+
let (service, rt) = service_with_many_contracts(
144+
state_size,
145+
vec![BenchContract {
146+
contract_id,
147+
bytecode: None,
148+
}],
149+
);
138150
let rng = rand::rngs::StdRng::seed_from_u64(2322u64);
139151
SharedSanityBenchmarkRunnerBuilder {
140152
service,
@@ -144,11 +156,37 @@ impl SanityBenchmarkRunnerBuilder {
144156
}
145157
}
146158

159+
pub fn new_shared_with_contract(
160+
contract: BenchContract,
161+
) -> SharedSanityBenchmarkRunnerBuilder {
162+
let state_size = crate::utils::get_state_size();
163+
let contract_id = *contract.contract_id;
164+
let (service, rt) = service_with_many_contracts(state_size, vec![contract]);
165+
let rng = rand::rngs::StdRng::seed_from_u64(2322u64);
166+
167+
SharedSanityBenchmarkRunnerBuilder {
168+
service,
169+
rt,
170+
contract_id: contract_id.into(),
171+
rng,
172+
}
173+
}
174+
147175
pub fn new_with_many_contracts(
148176
contract_ids: Vec<ContractId>,
149177
) -> MultiContractBenchmarkRunnerBuilder {
150178
let state_size = 1000; // Arbitrary small state size
151-
let (service, rt) = service_with_many_contracts(state_size, contract_ids.clone());
179+
let (service, rt) = service_with_many_contracts(
180+
state_size,
181+
contract_ids
182+
.iter()
183+
.cloned()
184+
.map(|id| BenchContract {
185+
contract_id: id,
186+
bytecode: None,
187+
})
188+
.collect(),
189+
);
152190
let rng = rand::rngs::StdRng::seed_from_u64(2322u64);
153191
MultiContractBenchmarkRunnerBuilder {
154192
service,
@@ -247,7 +285,7 @@ fn run(
247285
) {
248286
let mut rng = rand::rngs::StdRng::seed_from_u64(2322u64);
249287
let contract_ids = vec![];
250-
let (service, rt) = service_with_many_contracts(0, contract_ids.clone()); // Doesn't need any contracts
288+
let (service, rt) = service_with_many_contracts(0, vec![]); // Doesn't need any contracts
251289
run_with_service_with_extra_inputs(
252290
id,
253291
group,
@@ -266,9 +304,9 @@ fn run(
266304
/// `state_size` for each contract.
267305
fn service_with_many_contracts(
268306
state_size: u64,
269-
contract_ids: Vec<ContractId>,
307+
contracts: Vec<BenchContract>,
270308
) -> (FuelService, tokio::runtime::Runtime) {
271-
let rt = tokio::runtime::Builder::new_current_thread()
309+
let rt = tokio::runtime::Builder::new_multi_thread()
272310
.enable_all()
273311
.build()
274312
.unwrap();
@@ -301,10 +339,11 @@ fn service_with_many_contracts(
301339
.consensus_parameters
302340
.set_gas_costs(GasCosts::new(default_gas_costs()));
303341

304-
let contract_configs = contract_ids
342+
let contract_configs = contracts
305343
.iter()
306-
.map(|contract_id| ContractConfig {
307-
contract_id: *contract_id,
344+
.map(|contract| ContractConfig {
345+
contract_id: (*contract.contract_id).into(),
346+
code: contract.bytecode.clone().unwrap_or_default(),
308347
..Default::default()
309348
})
310349
.collect::<Vec<_>>();
@@ -320,10 +359,11 @@ fn service_with_many_contracts(
320359
let mut storage_key = primitive_types::U256::zero();
321360
let mut key_bytes = Bytes32::zeroed();
322361

323-
for contract_id in contract_ids.iter() {
362+
for contract in contracts.iter() {
363+
let contract_id = contract.contract_id;
324364
database
325365
.init_contract_state(
326-
contract_id,
366+
&contract_id,
327367
(0..state_size).map(|_| {
328368
storage_key.to_big_endian(key_bytes.as_mut());
329369
storage_key.increase().unwrap();
@@ -336,7 +376,7 @@ fn service_with_many_contracts(
336376
let mut sub_id = SubAssetId::zeroed();
337377
database
338378
.init_contract_balances(
339-
contract_id,
379+
&contract_id,
340380
(0..state_size).map(|k| {
341381
storage_key.to_big_endian(sub_id.as_mut());
342382

0 commit comments

Comments
 (0)