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

Bump fuel-vm dep to 0.47.1 #1714

Merged
merged 25 commits into from
Mar 4, 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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ benches/benches-outputs/Cargo.lock
benches/benches-outputs/src/test_gas_costs_output.rs
.idea
.env
node_modules/
package-lock.json
package.json

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added

- [#1713](https://github.com/FuelLabs/fuel-core/pull/1713): Added automatic `impl` of traits `StorageWrite` and `StorageRead` for `StructuredStorage`. Tables that use a `Blueprint` can be read and written using these interfaces provided by structured storage types.
- [#1671](https://github.com/FuelLabs/fuel-core/pull/1671): Added a new `Merklized` blueprint that maintains the binary Merkle tree over the storage data. It supports only the insertion of the objects without removing them.
- [#1657](https://github.com/FuelLabs/fuel-core/pull/1657): Moved `ContractsInfo` table from `fuel-vm` to on-chain tables, and created version-able `ContractsInfoType` to act as the table's data type.

Expand Down Expand Up @@ -39,6 +40,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

#### Breaking

- [#1714](https://github.com/FuelLabs/fuel-core/pull/1714): The change bumps the `fuel-vm` to `0.47.1`. It breaks several breaking changes into the protocol:
- All malleable fields are zero during the execution and unavailable through the GTF getters. Accessing them via the memory directly is still possible, but they are zero.
- The `Transaction` doesn't define the gas price anymore. The gas price is defined by the block producer and recorded in the `Mint` transaction at the end of the block. A price of future blocks can be fetched through a [new API nedopoint](https://github.com/FuelLabs/fuel-core/issues/1641) and the price of the last block can be fetch or via the block or another [API endpoint](https://github.com/FuelLabs/fuel-core/issues/1647).
- The `GasPrice` policy is replaced with the `Tip` policy. The user may specify in the native tokens how much he wants to pay the block producer to include his transaction in the block. It is the prioritization mechanism to incentivize the block producer to include users transactions earlier.
- The `MaxFee` policy is mandatory to set. Without it, the transaction pool will reject the transaction. Since the block producer defines the gas price, the only way to control how much user agreed to pay can be done only through this policy.
- The `maturity` field is removed from the `Input::Coin`. The same affect can be achieve with the `Maturity` policy on the transaction and predicate. This changes breaks how input coin is created and removes the passing of this argument.
- The metadata of the `Checked<Tx>` doesn't contain `max_fee` and `min_fee` anymore. Only `max_gas` and `min_gas`. The `max_fee` is controlled by the user via the `MaxFee` policy.
- Added automatic `impl` of traits `StorageWrite` and `StorageRead` for `StructuredStorage`. Tables that use a `Blueprint` can be read and written using these interfaces provided by structured storage types.

- [#1712](https://github.com/FuelLabs/fuel-core/pull/1712): Make `ContractUtxoInfo` type a version-able enum for use in the `ContractsLatestUtxo`table.
- [#1657](https://github.com/FuelLabs/fuel-core/pull/1657): Changed `CROO` gas price type from `Word` to `DependentGasPrice`. The dependent gas price values are dummy values while awaiting updated benchmarks.
- [#1671](https://github.com/FuelLabs/fuel-core/pull/1671): The GraphQL API uses block height instead of the block id where it is possible. The transaction status contains `block_height` instead of the `block_id`.
Expand Down
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fuel-core-tests = { version = "0.0.0", path = "./tests" }
fuel-core-xtask = { version = "0.0.0", path = "./xtask" }

# Fuel dependencies
fuel-vm-private = { version = "0.46.0", package = "fuel-vm", default-features = false }
fuel-vm-private = { version = "0.47.1", package = "fuel-vm", default-features = false }

# Common dependencies
anyhow = "1.0"
Expand Down
4 changes: 1 addition & 3 deletions benches/benches/block_target_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ fn service_with_many_contracts(
(0..state_size).map(|_| {
storage_key.to_big_endian(key_bytes.as_mut());
storage_key.increase().unwrap();
(key_bytes, key_bytes)
(key_bytes, key_bytes.to_vec())
}),
)
.unwrap();
Expand Down Expand Up @@ -362,14 +362,12 @@ fn run_with_service_with_extra_inputs(
);
tx_builder
.script_gas_limit(TARGET_BLOCK_GAS_LIMIT - BASE)
.gas_price(1)
.add_unsigned_coin_input(
SecretKey::random(rng),
rng.gen(),
u32::MAX as u64,
AssetId::BASE,
Default::default(),
Default::default(),
);
for contract_id in &contract_ids {
let input_count = tx_builder.inputs().len();
Expand Down
1 change: 0 additions & 1 deletion benches/benches/block_target_gas_set/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ pub fn run_contract(group: &mut BenchmarkGroup<WallTime>) {
AssetId::zeroed(),
Default::default(),
Default::default(),
Default::default(),
predicate,
vec![],
);
Expand Down
10 changes: 5 additions & 5 deletions benches/benches/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn setup(db: &mut Database, contract: &ContractId, n: usize) {

let mut rng_values = thread_rng();
let gen_values = || -> Bytes32 { rng_values.gen() };
let state_values = iter::repeat_with(gen_values).take(n);
let state_values = iter::repeat_with(gen_values).map(|b| b.to_vec()).take(n);

// State key-values
let state_key_values = state_keys.zip(state_values);
Expand Down Expand Up @@ -66,7 +66,7 @@ fn insert_state_single_contract_database(c: &mut Criterion) {
);
let start = std::time::Instant::now();
inner_db
.merkle_contract_state_insert(&contract, &state, &value)
.contract_state_insert(&contract, &state, value.as_slice())
.expect("failed to insert state into transaction");
elapsed_time += start.elapsed();
}
Expand Down Expand Up @@ -127,7 +127,7 @@ fn insert_state_single_contract_transaction(c: &mut Criterion) {
);
let start = std::time::Instant::now();
inner_db
.merkle_contract_state_insert(&contract, &state, &value)
.contract_state_insert(&contract, &state, value.as_slice())
.expect("failed to insert state into transaction");
elapsed_time += start.elapsed();
}
Expand Down Expand Up @@ -191,7 +191,7 @@ fn insert_state_multiple_contracts_database(c: &mut Criterion) {
);
let start = std::time::Instant::now();
inner_db
.merkle_contract_state_insert(&contract, &state, &value)
.contract_state_insert(&contract, &state, value.as_slice())
.expect("failed to insert state into transaction");
elapsed_time += start.elapsed();
}
Expand Down Expand Up @@ -255,7 +255,7 @@ fn insert_state_multiple_contracts_transaction(c: &mut Criterion) {
);
let start = std::time::Instant::now();
inner_db
.merkle_contract_state_insert(&contract, &state, &value)
.contract_state_insert(&contract, &state, value.as_slice())
.expect("failed to insert state into transaction");
elapsed_time += start.elapsed();
}
Expand Down
9 changes: 0 additions & 9 deletions benches/benches/transaction_throughput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,22 +158,19 @@ fn signed_transfers(c: &mut Criterion) {
let generator = |rng: &mut StdRng| {
TransactionBuilder::script(vec![], vec![])
.script_gas_limit(10000)
.gas_price(1)
.add_unsigned_coin_input(
SecretKey::random(rng),
rng.gen(),
1000,
Default::default(),
Default::default(),
Default::default(),
)
.add_unsigned_coin_input(
SecretKey::random(rng),
rng.gen(),
1000,
Default::default(),
Default::default(),
Default::default(),
)
.add_output(Output::coin(rng.gen(), 50, AssetId::default()))
.add_output(Output::change(rng.gen(), 0, AssetId::default()))
Expand All @@ -189,15 +186,13 @@ fn predicate_transfers(c: &mut Criterion) {

let mut tx = TransactionBuilder::script(vec![], vec![])
.script_gas_limit(10000)
.gas_price(1)
.add_input(Input::coin_predicate(
rng.gen(),
owner,
1000,
Default::default(),
Default::default(),
Default::default(),
Default::default(),
predicate.clone(),
vec![],
))
Expand All @@ -208,7 +203,6 @@ fn predicate_transfers(c: &mut Criterion) {
Default::default(),
Default::default(),
Default::default(),
Default::default(),
predicate,
vec![],
))
Expand Down Expand Up @@ -258,15 +252,13 @@ fn predicate_transfers_eck1(c: &mut Criterion) {

let mut tx = TransactionBuilder::script(vec![], vec![])
.script_gas_limit(10000)
.gas_price(1)
.add_input(Input::coin_predicate(
rng.gen(),
owner,
1000,
Default::default(),
Default::default(),
Default::default(),
Default::default(),
predicate.clone(),
predicate_data.clone(),
))
Expand All @@ -277,7 +269,6 @@ fn predicate_transfers_eck1(c: &mut Criterion) {
Default::default(),
Default::default(),
Default::default(),
Default::default(),
predicate,
predicate_data,
))
Expand Down
6 changes: 3 additions & 3 deletions benches/benches/vm_initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ fn transaction<R: Rng>(
rng.gen(),
AssetId::BASE,
rng.gen(),
rng.gen(),
0,
vec![255; 1],
vec![255; 1],
Expand All @@ -67,7 +66,7 @@ fn transaction<R: Rng>(
script,
script_data,
Policies::new()
.with_gas_price(0)
.with_max_fee(0)
.with_maturity(0.into())
.with_max_fee(Word::MAX),
inputs,
Expand Down Expand Up @@ -103,7 +102,8 @@ pub fn vm_initialization(c: &mut Criterion) {
let mut vm = black_box(
Interpreter::<_, Script, NotSupportedEcal>::with_memory_storage(),
);
black_box(vm.init_script(tx.clone()))
let ready_tx = tx.clone().test_into_ready();
black_box(vm.init_script(ready_tx))
.expect("Should be able to execute transaction");
})
});
Expand Down
4 changes: 1 addition & 3 deletions benches/benches/vm_set/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl BenchDb {
(0..state_size).map(|_| {
storage_key.to_big_endian(key_bytes.as_mut());
storage_key.increase().unwrap();
(key_bytes, key_bytes)
(key_bytes, key_bytes.to_vec())
}),
)?;

Expand Down Expand Up @@ -504,7 +504,6 @@ pub fn run(c: &mut Criterion) {
AssetId::zeroed(),
Default::default(),
Default::default(),
Default::default(),
predicate,
vec![],
);
Expand Down Expand Up @@ -590,7 +589,6 @@ pub fn run(c: &mut Criterion) {
AssetId::zeroed(),
Default::default(),
Default::default(),
Default::default(),
predicate,
vec![],
);
Expand Down
6 changes: 3 additions & 3 deletions benches/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ impl TryFrom<VmBench> for VmBenchPrepared {
{
return Err(anyhow::anyhow!(
"a prepare script should not call/return into different contexts.",
))
));
}

let prepare_script = prepare_script
Expand Down Expand Up @@ -437,16 +437,16 @@ impl TryFrom<VmBench> for VmBenchPrepared {
params.fee_params.gas_per_byte = 0;
params.gas_costs = GasCosts::free();
let mut tx = tx
.gas_price(gas_price)
.script_gas_limit(gas_limit)
.maturity(maturity)
.with_params(params.clone())
.finalize();
tx.estimate_predicates(&CheckPredicateParams::from(&params))
.unwrap();
let tx = tx.into_checked(height, &params).unwrap();
let interpreter_params = InterpreterParams::new(gas_price, &params);

let mut txtor = Transactor::new(db, InterpreterParams::from(&params));
let mut txtor = Transactor::new(db, interpreter_params);

txtor.transact(tx);

Expand Down
Loading
Loading