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

Create sanity benchmark checks for all the arithmetic op codes #1419

Merged
merged 10 commits into from
Oct 17, 2023

Conversation

MitchTurner
Copy link
Member

#1386

This PR adds benchmark tests for all the arithmetic op codes. The actual purpose being running those tests to see if the costs actually line up for all the codes.

These tests work by starting a vm with a set amount of gas, and running an "infinite" loop of each op code until the vm runs out of gas. This is timed and the time is reported.

After running these, I've found a number of divergent op codes that could possibly require updated gas costs:

block target estimation/wddv opcode
                        time:   [4.0950 ms 4.1181 ms 4.1411 ms]
block target estimation/wdmd opcode
                        time:   [3.3510 ms 3.3710 ms 3.3931 ms]
block target estimation/wdam opcode
                        time:   [3.4912 ms 3.5138 ms 3.5363 ms]
block target estimation/wdmm opcode
                        time:   [3.4505 ms 3.4686 ms 3.4868 ms]
block target estimation/wqdv opcode
                        time:   [3.2404 ms 3.2590 ms 3.2796 ms]
block target estimation/wqmd opcode
                        time:   [4.1508 ms 4.1716 ms 4.1928 ms]
block target estimation/wqam opcode
                        time:   [3.6933 ms 3.7081 ms 3.7230 ms]
block target estimation/wqmm opcode
                        time:   [5.2120 ms 5.2395 ms 5.2667 ms]

So, that's wddv, wdmd, wdam, wdmm, wqdv, wqmd, wqam, wqmm.

Whereas all the other op codes take close to 2ms to run out of gas, implying that these divergent op codes could be priced higher. These "wide" op codes all share similar setup, and not all of the "wide" op codes fail the test, so it's probably not the setup that is causing these specific op code benchmarks to fail.


Here are all of the results:

lock target estimation/add opcode
                        time:   [2.1024 ms 2.1142 ms 2.1259 ms]
block target estimation/addi opcode
                        time:   [2.1066 ms 2.1208 ms 2.1369 ms]
block target estimation/aloc opcode
                        time:   [1.8966 ms 1.9104 ms 1.9252 ms]
block target estimation/and opcode
                        time:   [2.0765 ms 2.0877 ms 2.0990 ms]
block target estimation/andi opcode
                        time:   [2.1647 ms 2.1797 ms 2.1963 ms]
block target estimation/div opcode
                        time:   [2.1176 ms 2.1303 ms 2.1440 ms]
block target estimation/divi opcode
                        time:   [2.1445 ms 2.1572 ms 2.1711 ms]
block target estimation/eq opcode
                        time:   [2.0585 ms 2.0721 ms 2.0859 ms]
block target estimation/exp opcode
                        time:   [2.0829 ms 2.0931 ms 2.1031 ms]
block target estimation/expi opcode
                        time:   [2.1114 ms 2.1218 ms 2.1323 ms]
block target estimation/gt opcode
                        time:   [2.0068 ms 2.0176 ms 2.0287 ms]
block target estimation/gtf opcode
                        time:   [2.2672 ms 2.2765 ms 2.2859 ms]
block target estimation/lt opcode
                        time:   [1.9848 ms 1.9959 ms 2.0070 ms]
block target estimation/mlog opcode
                        time:   [2.0176 ms 2.0278 ms 2.0380 ms]
block target estimation/mod opcode
                        time:   [1.9694 ms 1.9819 ms 1.9943 ms]
block target estimation/modi opcode
                        time:   [1.9519 ms 1.9640 ms 1.9760 ms]
block target estimation/move opcode
                        time:   [1.8479 ms 1.8600 ms 1.8716 ms]
block target estimation/movi opcode
                        time:   [1.9531 ms 1.9645 ms 1.9758 ms]
block target estimation/mroo opcode
                        time:   [2.4029 ms 2.4151 ms 2.4272 ms]
block target estimation/mul opcode
                        time:   [2.0221 ms 2.0335 ms 2.0446 ms]
block target estimation/muli opcode
                        time:   [1.9674 ms 1.9781 ms 1.9897 ms]
block target estimation/noop opcode
                        time:   [1.8149 ms 1.8389 ms 1.8631 ms]
block target estimation/not opcode
                        time:   [1.8706 ms 1.8861 ms 1.9008 ms]
block target estimation/or opcode
                        time:   [2.0889 ms 2.0994 ms 2.1111 ms]
block target estimation/ori opcode
                        time:   [2.1002 ms 2.1106 ms 2.1208 ms]
block target estimation/sll opcode
                        time:   [2.1776 ms 2.1864 ms 2.1956 ms]
block target estimation/slli opcode
                        time:   [2.0932 ms 2.1038 ms 2.1153 ms]
block target estimation/srl opcode
                        time:   [2.0355 ms 2.0453 ms 2.0555 ms]
block target estimation/srli opcode
                        time:   [2.0444 ms 2.0509 ms 2.0578 ms]
block target estimation/sub opcode
                        time:   [2.1181 ms 2.1269 ms 2.1358 ms]
block target estimation/subi opcode
                        time:   [1.9773 ms 1.9905 ms 2.0050 ms]
block target estimation/xor opcode
                        time:   [2.0735 ms 2.0837 ms 2.0937 ms]
block target estimation/xori opcode
                        time:   [2.0139 ms 2.0246 ms 2.0354 ms]
block target estimation/wdcm opcode
                        time:   [2.2144 ms 2.2272 ms 2.2406 ms]
block target estimation/wdop opcode
                        time:   [2.5049 ms 2.5220 ms 2.5395 ms]
block target estimation/wdml opcode
                        time:   [2.6808 ms 2.6963 ms 2.7130 ms]
block target estimation/wddv opcode
                        time:   [4.2766 ms 4.3064 ms 4.3368 ms]
block target estimation/wdmd opcode
                        time:   [3.5144 ms 3.5451 ms 3.5798 ms]
block target estimation/wdam opcode
                        time:   [3.7095 ms 3.7397 ms 3.7760 ms]
block target estimation/wdmm opcode
                        time:   [3.6330 ms 3.6595 ms 3.6915 ms]
block target estimation/wqcm opcode
                        time:   [2.4236 ms 2.4410 ms 2.4597 ms]
block target estimation/wqop opcode
                        time:   [2.7717 ms 2.7920 ms 2.8154 ms]
block target estimation/wqml opcode
                        time:   [2.9315 ms 2.9631 ms 2.9986 ms]
block target estimation/wqdv opcode
                        time:   [3.4322 ms 3.4572 ms 3.4846 ms]
block target estimation/wqmd opcode
                        time:   [4.4126 ms 4.4383 ms 4.4669 ms]
block target estimation/wqam opcode
                        time:   [3.8279 ms 3.8610 ms 3.8986 ms]
block target estimation/wqmm opcode
                        time:   [5.8005 ms 5.8658 ms 5.9469 ms]

benches/benches/set/alu.rs Show resolved Hide resolved
benches/benches/set/alu.rs Show resolved Hide resolved
@@ -29,6 +38,27 @@ use fuel_core_types::{
fuel_types::AssetId,
};

/// Allocates a byte array from heap and initializes it. Then points `reg` to it.
fn aloc_bytearray<const S: usize>(reg: u8, v: [u8; S]) -> Vec<Instruction> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to move these functions to utils and reuse them instead of duplicating them.

Comment on lines 393 to 405
{
let data = vec![0u8; 32];
run(
"gtf opcode",
group,
[
op::gtf_args(0x10, RegId::ZERO, GTFArgs::ScriptData),
op::jmpb(RegId::ZERO, 0),
]
.to_vec(),
data,
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving into a separate section during this PR would be nice because we need to test with any possible GTFArgs.

You don't need to test with all GTFArgs. But could you create a dedicated follow-up issue only for the gtf opcode, please?

We need to find the worst possible getter and use it as the primary price for the GTF opcode.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it as a sub-requirement of this issue. It looks like a lot of them, so, yeah, I agree it should be done in a separate PR :)

Copy link
Contributor

@bvrooman bvrooman Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're putting GTF tests in the run_alu benches, but GTF is not part of the arithmetic ops - For this PR, would it make sense to move GTF out of run_alu and into a separate function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bvrooman We intend to add thorough coverage for gtf with another PR.

Comment on lines 393 to 405
{
let data = vec![0u8; 32];
run(
"gtf opcode",
group,
[
op::gtf_args(0x10, RegId::ZERO, GTFArgs::ScriptData),
op::jmpb(RegId::ZERO, 0),
]
.to_vec(),
data,
);
}
Copy link
Contributor

@bvrooman bvrooman Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're putting GTF tests in the run_alu benches, but GTF is not part of the arithmetic ops - For this PR, would it make sense to move GTF out of run_alu and into a separate function?

.to_vec(),
vec![],
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're missing the MLDV op (but maybe that was intentional?). I just realized that the ops spec isn't really in alphabetical order, but this is where it would go relative to the rest of the arithmetic ops.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it! Thanks.

Comment on lines 674 to 676
MathArgs {
op: MathOp::SUB,
indirect_rhs: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be valuable to test any of the other misc wide ops as well?
(Same question for WQ ops)

@MitchTurner
Copy link
Member Author

@bvrooman It might have been misleading to call this arithmetic op codes. I'm just basing this off of what is in the alu.rs file. This includes gtf and does not include mldv.

That might be an oversight by the writers of the alu.rs file. So maybe I should include mldv?

@bvrooman
Copy link
Contributor

@bvrooman It might have been misleading to call this arithmetic op codes. I'm just basing this off of what is in the alu.rs file. This includes gtf and does not include mldv.

That might be an oversight by the writers of the alu.rs file. So maybe I should include mldv?

If I had to guess, mldv was either created added after the original alu.rs file was created, or it was just an oversight. Either way, it sounds reasonable to add it here.

Now, your run_alu function maps quite nicely to the Arithmetic/Logic spec, with pretty much 1-1 parity. This makes it easy to cross reference with the spec, and future modifications to the spec can be easily translated into this function here. But gtf is the odd man out, so I think it would be nice if we simply moved that to another location. If I had to guess here too, mixing gtf with the alu op codes may have been simply an oversight or an artifact of an older spec.

Copy link
Collaborator

@xgreenx xgreenx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After running these, I've found a number of divergent op codes that could possibly require updated gas costs:

Yeah, it seems these opcodes are a little bit underpriced. But not too much. Because you used another hardware to run them than we used to define prices. I've run benchmarks for prices first, and the block_gas_limit benchmark with new prices produces better results.

block target estimation/sub opcode                                                                            
                        time:   [9.6523 ms 9.6840 ms 9.7187 ms]
                        change: [-3.7896% -3.2630% -2.7580%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/subi opcode                                                                            
                        time:   [9.4285 ms 9.4505 ms 9.4767 ms]
                        change: [-4.1387% -3.7634% -3.4060%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/xor opcode                                                                            
                        time:   [9.4393 ms 9.4714 ms 9.5094 ms]
                        change: [-3.9255% -3.4993% -3.0863%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/xori opcode                                                                            
                        time:   [9.3637 ms 9.4041 ms 9.4483 ms]
                        change: [-3.2782% -2.7571% -2.1994%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wdcm opcode                                                                            
                        time:   [11.603 ms 11.630 ms 11.663 ms]
                        change: [-4.2311% -3.8511% -3.4542%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wdop opcode                                                                            
                        time:   [13.161 ms 13.205 ms 13.257 ms]
                        change: [-3.6999% -3.3480% -2.9338%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wdml opcode                                                                            
                        time:   [13.354 ms 13.393 ms 13.436 ms]
                        change: [-4.4740% -4.0350% -3.5724%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wddv opcode                                                                            
                        time:   [15.602 ms 15.626 ms 15.656 ms]
                        change: [-35.788% -35.616% -35.449%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wdmd opcode                                                                            
                        time:   [19.051 ms 19.090 ms 19.138 ms]
                        change: [-22.502% -22.294% -22.054%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wdam opcode                                                                            
                        time:   [17.373 ms 17.429 ms 17.489 ms]
                        change: [-39.283% -32.188% -26.632%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wdmm opcode                                                                            
                        time:   [18.882 ms 18.901 ms 18.922 ms]
                        change: [-22.358% -22.208% -22.065%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wqcm opcode                                                                            
                        time:   [12.041 ms 12.085 ms 12.142 ms]
                        change: [-5.0285% -3.5735% -2.5372%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wqop opcode                                                                            
                        time:   [15.092 ms 15.136 ms 15.184 ms]
                        change: [-3.1202% -2.7670% -2.4070%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wqml opcode                                                                            
                        time:   [15.082 ms 15.123 ms 15.172 ms]
                        change: [-3.6045% -3.2474% -2.8672%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wqdv opcode                                                                            
                        time:   [19.316 ms 19.375 ms 19.458 ms]
                        change: [-3.7534% -3.3422% -2.8591%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wqmd opcode                                                                            
                        time:   [19.568 ms 19.633 ms 19.706 ms]
                        change: [-30.202% -29.907% -29.640%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wqam opcode                                                                            
                        time:   [15.648 ms 15.671 ms 15.700 ms]
                        change: [-22.636% -22.422% -22.217%] (p = 0.00 < 0.05)
                        Performance has improved.
block target estimation/wqmm opcode                                                                            
                        time:   [26.896 ms 26.946 ms 27.006 ms]
                        change: [-22.056% -21.430% -20.983%] (p = 0.00 < 0.05)
                        Performance has improved.

While average execution time for 1M gas is 10ms.

group.finish();
}

fn run_alu(group: &mut BenchmarkGroup<WallTime>) {
run(
"add opcode",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add an alu/ prefix to each benchmark. In this case, we can easily run only all alu benchmarks later.

bvrooman
bvrooman previously approved these changes Oct 17, 2023
#[path = "utils.rs"]
mod utils;

#[path = "block_target_gas/alu.rs"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it already should work without path

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the block_target_gas code into a new block_target_gas/main.rs and now it does (apparently main.rs is the convention for benches).

@@ -29,6 +39,17 @@ use fuel_core_types::{
fuel_types::AssetId,
};

#[path = "utils.rs"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work without path

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I've moved block_target_gas into its own module thing, it won't. But it's true in the old structure that I could have.

error[E0583]: file not found for module `utils`
  --> benches/benches/block_target_gas/main.rs:43:1
   |
43 | mod utils;
   | ^^^^^^^^^^
   |
   = help: to create the module `utils`, create file "benches/benches/block_target_gas/utils.rs" or "benches/benches/block_target_gas/utils/mod.rs"

@@ -1,4 +1,4 @@
mod set;
pub mod set;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to make it public?

fn make_u128(reg: u8, v: u128) -> Vec<Instruction> {
aloc_bytearray(reg, v.to_be_bytes())
}
#[path = "../utils.rs"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should be able to import utils on the set module level and be able to use them here from super

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. From the vm.rs because that is the parent to set.

Created `block_gas_limit_set` similar to `vm_set` folder.
Removed `#[path = ...]`.
@MitchTurner MitchTurner merged commit 9d46cec into master Oct 17, 2023
30 checks passed
@MitchTurner MitchTurner deleted the sanity-check-opcodes branch October 17, 2023 23:15
@MitchTurner MitchTurner restored the sanity-check-opcodes branch October 18, 2023 23:51
@MitchTurner MitchTurner deleted the sanity-check-opcodes branch October 19, 2023 00:14
bvrooman pushed a commit that referenced this pull request Nov 24, 2023
## Version 0.21.0

This release focuses on preparing `fuel-core` for the mainnet
environment.
- Most of the changes improved the security and stability of the node.
- The gas model was reworked to cover all aspects of execution.
- The benchmarking system was significantly enhanced, covering worst
scenarios.
- A new set of benchmarks was added to track the accuracy of gas prices.
- Optimized heavy operations and removed/replaced exploitable
functionality.

Besides that, there are more concrete changes:
- Unified naming conventions for all CLI arguments. Added dependencies
between related fields to avoid misconfiguration in case of missing
arguments. Added `--debug` flag that enables additional functionality
like a debugger.
- Improved telemetry to cover the internal work of services and added
support for the Pyroscope, allowing it to generate real-time flamegraphs
to track performance.
- Improved stability of the P2P layer and adjusted the updating of
reputation. The speed of block synchronization was significantly
increased.
- The node is more stable and resilient. Improved DoS resistance and
resource management. Fixed critical bugs during state transition.
- Reworked the `Mint` transaction to accumulate the fee from block
production inside the contract defined by the block producer.

FuelVM received a lot of safety and stability improvements:
- The audit helped identify some bugs and errors that have been
successfully fixed.
- Updated the gas price model to charge for resources used during the
transaction lifecycle.
- Added `no_std` and 32 bit system support. This opens doors for fraud
proving in the future.
- Removed the `ChainId` from the `PredicateId` calculation, allowing the
use of predicates cross-chain.
- Improvements in the performance of some storage-related opcodes.
- Support the `ECAL` instruction that allows adding custom functionality
to the VM. It can be used to create unique rollups or advanced indexers
in the future.
- Support of [transaction
policies](https://github.com/FuelLabs/fuel-vm/blob/master/CHANGELOG.md#version-0420)
provides additional safety for the user.
It also allows the implementation of a multi-dimensional price model in
the future, making the transaction execution cheaper and allowing more
transactions that don't affect storage.
- Refactored errors, returning more detailed errors to the user,
simplifying debugging.

### Added

- [#1503](#1503): Add `gtf`
opcode sanity check.
- [#1502](#1502): Added price
benchmark for `vm_initialization`.
- [#1501](#1501): Add a CLI
command for generating a fee collection contract.
- [#1492](#1492): Support
backward iteration in the RocksDB. It allows backward queries that were
not allowed before.
- [#1490](#1490): Add push and
pop benchmarks.
- [#1485](#1485): Prepare rc
release of fuel core v0.21
- [#1476](#1453): Add the
majority of the "other" benchmarks for contract opcodes.
- [#1473](#1473): Expose
fuel-core version as a constant
- [#1469](#1469): Added
support of bloom filter for RocksDB tables and increased the block
cache.
- [#1465](#1465): Improvements
for keygen cli and crates
- [#1642](#1462): Added
benchmark to measure the performance of contract state and contract ID
calculation; use for gas costing.
- [#1457](#1457): Fixing
incorrect measurement for fast(µs) opcodes.
- [#1456](#1456): Added
flushing of the RocksDB during a graceful shutdown.
- [#1456](#1456): Added more
logs to track the service lifecycle.
- [#1453](#1453): Add the
majority of the "sanity" benchmarks for contract opcodes.
- [#1452](#1452): Added
benchmark to measure the performance of contract root calculation when
utilizing the maximum contract size; used for gas costing of contract
root during predicate owner validation.
- [#1449](#1449): Fix coin
pagination in e2e test client.
- [#1447](#1447): Add timeout
for continuous e2e tests
- [#1444](#1444): Add "sanity"
benchmarks for memory opcodes.
- [#1437](#1437): Add some
transaction throughput tests for basic transfers.
- [#1436](#1436): Add a github
action to continuously test beta-4.
- [#1433](#1433): Add "sanity"
benchmarks for flow opcodes.
- [#1432](#1432): Add a new
`--api-request-timeout` argument to control TTL for GraphQL requests.
- [#1430](#1430): Add "sanity"
benchmarks for crypto opcodes.
- [#1426](#1426) Split keygen
into a create and a binary.
- [#1419](#1419): Add
additional "sanity" benchmarks for arithmetic op code instructions.
- [#1411](#1411): Added WASM
and `no_std` compatibility.
- [#1405](#1405): Use correct
names for service metrics.
- [#1400](#1400): Add releasy
beta to fuel-core so that new commits to fuel-core master triggers
fuels-rs.
- [#1371](#1371): Add new
client function for querying the `MessageStatus` for a specific message
(by `Nonce`).
- [#1356](#1356): Add peer
reputation reporting to heartbeat code.
- [#1355](#1355): Added new
metrics related to block importing, such as tps, sync delays etc.
- [#1339](#1339): Adds
`baseAssetId` to `FeeParameters` in the GraphQL API.
- [#1331](#1331): Add peer
reputation reporting to block import code.
- [#1324](#1324): Added
pyroscope profiling to fuel-core, intended to be used by a secondary
docker image that has debug symbols enabled.
- [#1309](#1309): Add
documentation for running debug builds with CLion and Visual Studio
Code.
- [#1308](#1308): Add support
for loading .env files when compiling with the `env` feature. This
allows users to conveniently supply CLI arguments in a secure and
IDE-agnostic way.
- [#1304](#1304): Implemented
`submit_and_await_commit_with_receipts` method for `FuelClient`.
- [#1286](#1286): Include
readable names for test cases where missing.
- [#1274](#1274): Added tests
to benchmark block synchronization.
- [#1263](#1263): Add gas
benchmarks for `ED19` and `ECR1` instructions.

### Changed

- [#1512](#1512): Internally
simplify merkle_contract_state_range.
- [#1507](#1507): Updated
chain configuration to be ready for beta 5 network. It includes opcode
prices from the latest benchmark and contract for the block producer.
- [#1477](#1477): Upgraded the
Rust version used in CI and containers to 1.73.0. Also includes
associated Clippy changes.
- [#1469](#1469): Replaced
usage of `MemoryTransactionView` by `Checkpoint` database in the
benchmarks.
- [#1468](#1468): Bumped
version of the `fuel-vm` to `v0.40.0`. It brings some breaking changes
into consensus parameters API because of changes in the underlying
types.
- [#1466](#1466): Handling
overflows during arithmetic operations.
- [#1460](#1460): Change
tracking branch from main to master for releasy tests.
- [#1454](#1454): Update gas
benchmarks for opcodes that append receipts.
- [#1440](#1440): Don't report
reserved nodes that send invalid transactions.
- [#1439](#1439): Reduced
memory BMT consumption during creation of the header.
- [#1434](#1434): Continue
gossiping transactions to reserved peers regardless of gossiping
reputation score.
- [#1408](#1408): Update gas
benchmarks for storage opcodes to use a pre-populated database to get
more accurate worst-case costs.
- [#1399](#1399): The Relayer
now queries Ethereum for its latest finalized block instead of using a
configurable "finalization period" to presume finality.
- [#1397](#1397): Improved
keygen. Created a crate to be included from forc plugins and upgraded
internal library to drop requirement of protoc to build
- [#1395](#1395): Add
DependentCost benchmarks for `k256`, `s256` and `mcpi` instructions.
- [#1393](#1393): Increase
heartbeat timeout from `2` to `60` seconds, as suggested in [this
issue](#1330).
- [#1392](#1392): Fixed an
overflow in `message_proof`.
- [#1390](#1390): Up the
`ethers` version to `2` to fix an issue with `tungstenite`.
- [#1383](#1383): Disallow
usage of `log` crate internally in favor of `tracing` crate.
- [#1380](#1380): Add
preliminary, hard-coded config values for heartbeat peer reputation,
removing `todo`.
- [#1377](#1377): Remove
`DiscoveryEvent` and use `KademliaEvent` directly in
`DiscoveryBehavior`.
- [#1366](#1366): Improve
caching during docker builds in CI by replacing gha
- [#1358](#1358): Upgraded the
Rust version used in CI to 1.72.0. Also includes associated Clippy
changes.
- [#1349](#1349): Updated
peer-to-peer transactions API to support multiple blocks in a single
request, and updated block synchronization to request multiple blocks
based on the configured range of headers.
- [#1342](#1342): Add error
handling for P2P requests to return `None` to requester and log error.
- [#1318](#1318): Modified
block synchronization to use asynchronous task execution when retrieving
block headers.
- [#1314](#1314): Removed
`types::ConsensusParameters` in favour of `fuel_tx:ConsensusParameters`.
- [#1302](#1302): Removed the
usage of flake and building of the bridge contract ABI.
It simplifies the maintenance and updating of the events, requiring only
putting the event definition into the codebase of the relayer.
- [#1293](#1293):
Parallelized the `estimate_predicates` endpoint to utilize all available
threads.
- [#1270](#1270): Modify the
way block headers are retrieved from peers to be done in batches.

#### Breaking
- [#1506](#1506): Added
validation of the coin's fields during block production and validation.
Before, it was possible to submit a transaction that didn't match the
coin's values in the database, allowing printing/using unavailable
assets.
- [#1491](#1491): Removed
unused request and response variants from the Gossipsub implementation,
as well as related definitions and tests. Specifically, this removes
gossiping of `ConsensusVote` and `NewBlock` events.
- [#1472](#1472): Upgraded
`fuel-vm` to `v0.42.0`. It introduces transaction policies that changes
layout of the transaction. FOr more information check the
[v0.42.0](FuelLabs/fuel-vm#635) release.
- [#1470](#1470): Divide
`DependentCost` into "light" and "heavy" operations.
- [#1464](#1464): Avoid
possible truncation of higher bits. It may invalidate the code that
truncated higher bits causing different behavior on 32-bit vs. 64-bit
systems. The change affects some endpoints that now require lesser
integers.
- [#1432](#1432): All
subscriptions and requests have a TTL now. So each subscription
lifecycle is limited in time. If the subscription is closed because of
TTL, it means that you subscribed after your transaction had been
dropped by the network.
- [#1407](#1407): The
recipient is a `ContractId` instead of `Address`. The block producer
should deploy its contract to receive the transaction fee. The collected
fee is zero until the recipient contract is set.
- [#1407](#1407): The `Mint`
transaction is reworked with new fields to support the account-base
model. It affects serialization and deserialization of the transaction
and also affects GraphQL schema.
- [#1407](#1407): The `Mint`
transaction is the last transaction in the block instead of the first.
- [#1374](#1374): Renamed
`base_chain_height` to `da_height` and return current relayer height
instead of latest Fuel block height.
- [#1367](#1367): Update to
the latest version of fuel-vm.
- [#1363](#1363): Change
message_proof api to take `nonce` instead of `message_id`
- [#1355](#1355): Removed the
`metrics` feature flag from the fuel-core crate, and metrics are now
included by default.
- [#1339](#1339): Added a new
required field called `base_asset_id` to the `FeeParameters` definition
in `ConsensusParameters`, as well as default values for `base_asset_id`
in the `beta` and `dev` chain specifications.
- [#1322](#1322):
The `debug` flag is added to the CLI. The flag should be used for local
development only. Enabling debug mode:
      - Allows GraphQL Endpoints to arbitrarily advance blocks.
      - Enables debugger GraphQL Endpoints.
      - Allows setting `utxo_validation` to `false`.
- [#1318](#1318): Removed the
`--sync-max-header-batch-requests` CLI argument, and renamed
`--sync-max-get-txns` to `--sync-block-stream-buffer-size` to better
represent the current behavior in the import.
- [#1290](#1290): Standardize
CLI args to use `-` instead of `_`.
- [#1279](#1279): Added a new
CLI flag to enable the Relayer service `--enable-relayer`, and disabled
the Relayer service by default. When supplying the `--enable-relayer`
flag, the `--relayer` argument becomes mandatory, and omitting it is an
error. Similarly, providing a `--relayer` argument without the
`--enable-relayer` flag is an error. Lastly, providing the `--keypair`
or `--network` arguments will also produce an error if the
`--enable-p2p` flag is not set.
- [#1262](#1262): The
`ConsensusParameters` aggregates all configuration data related to the
consensus. It contains many fields that are segregated by the usage. The
API of some functions was affected to use lesser types instead the whole
`ConsensusParameters`. It is a huge breaking change requiring
repetitively monotonically updating all places that use the
`ConsensusParameters`. But during updating, consider that maybe you can
use lesser types. Usage of them may simplify signatures of methods and
make them more user-friendly and transparent.

### Removed

#### Breaking
- [#1484](#1484): Removed
`--network` CLI argument. Now the name of the network is fetched form
chain configuration.
- [#1399](#1399): Removed
`relayer-da-finalization` parameter from the relayer CLI.
- [#1338](#1338): Updated
GraphQL client to use `DependentCost` for `k256`, `mcpi`, `s256`,
`scwq`, `swwq` opcodes.
- [#1322](#1322): The
`manual_blocks_enabled` flag is removed from the CLI. The analog is a
`debug` flag.

## What's Changed
* Added changelog in the same way as we did for `fuel-vm` by @xgreenx in
#1287
* Decompose consensus params struct by @MitchTurner in
#1262
* Replace all instances of `_` in CLI `long` arguments with `-` by
@MitchTurner in #1290
* [rpc] Parallelise estimate_predicates endpoint by @YusongWang in
#1293
* Add readable test names to test cases by @MitchTurner in
#1286
* ED19 and ECR1 benchmarks by @Dentosal in
#1263
* feat: Add `enable-relayer` flag to `fuel-core` CLI by @bvrooman in
#1279
* Small nits found during deploying and benchmarking by @xgreenx in
#1303
* Implemented `submit_and_await_commit_with_receipts` method by @xgreenx
in #1304
* Removed the usage of flake and building of the bridge contract ABI by
@xgreenx in #1302
* Download range of headers during syncing by @MitchTurner in
#1270
* feat: Enable .env file loading using `env` feature by @bvrooman in
#1308
* chore: Remove types::ConsensusParameters by @bvrooman in
#1314
* docs: Debugging instructions using IDEs by @bvrooman in
#1309
* test: Block Import benchmarks and test helpers by @bvrooman in
#1274
* Fix audit CI for `webpki` by @xgreenx in
#1319
* chore: Single buffer block sync by @bvrooman in
#1318
* Run unit tests without default features only for specific crates by
@xgreenx in #1321
* Added support for `debug` CLI flag. by @xgreenx in
#1322
* Report Peers that give bad Block Info by @MitchTurner in
#1331
* Pyroscope profiling by @Voxelot in
#1324
* Add error handling for P2P requests to return `None` to requester and
log error by @MitchTurner in
#1342
* Importer Metrics by @Voxelot in
#1355
* chore: Upgrade to Rust 1.72.0 in CI by @bvrooman in
#1358
* chore: Upgrade `fuel-vm` to 0.37.0 by @bvrooman in
#1338
* docs: remove stale schema by @calldelegation in
#1362
* Replace message_id with nonce in `MessageProof` query by @MitchTurner
in #1363
* feat: Configurable base asset by @bvrooman in
#1339
* avoid gha caching for docker builds by @Voxelot in
#1366
* Add tracking for peer heartbeats by @MitchTurner in
#1356
* docs: fix broken link in README by @PaulRBerg in
#1357
* Use right level of error for `.env` file and duplicated service by
@xgreenx in #1372
* Add query and handling for `MessageStatus` by @MitchTurner in
#1371
* Renamed `base_chain_height` to `da_height` and return current relayer
height instead of latest Fuel block height by @xgreenx in
#1374
* Remove `DiscoveryEvent` and use `KademliaEvent` instead by
@MitchTurner in #1377
* Remove todo from code and provide some preliminary peer review config
values by @MitchTurner in
#1380
* Clippy lint to disallow logging crate macros in favor of tracing by
@Dentosal in #1383
* fuel-vm nostd update by @Dentosal in
#1367
* Up the `ethers` version to `2` to fix an issue with `tungstenite` by
@xgreenx in #1390
* Increase heartbeat timeout to one minute by @Dentosal in
#1393
* feat: batch transactions import by @bvrooman in
#1349
* Fix an interger overflow in message_proof when looking beyond genesis
by @Dentosal in #1392
* Improve keygen by @cr-fuel in
#1397
* Benchmark {k256, s256, mcpi} opcodes using DependentCost by @Dentosal
in #1395
* Use correct names for service metrics by @xgreenx in
#1405
* feat: Retrieve finalized blocks from Ethereum by @bvrooman in
#1399
* Updated CI to run `cargo update` weekly by @xgreenx in
#1415
* CI `cargo update` weekly by @xgreenx in
#1416
* Weekly `cargo update` by @github-actions in
#1417
* Fix typos by @GoodDaisy in
#1424
* feat: Support no_std and WASM compilation for `fuel-core` crates by
@bvrooman in #1411
* Create sanity benchmark checks for all the arithmetic op codes by
@MitchTurner in #1419
* Update benchmarking and collecting for `scwq`, `swwq` and `srwq`
opcodes by @xgreenx in #1427
* Account-base fee collection by @xgreenx in
#1407
* Rollback modification of the chain specification by @xgreenx in
#1429
* Tx subscription cleanup (#1422) by @xgreenx in
#1432
* Mark reserved peers as explicit for gossipsub to avoid reputation
decreasing (#1423) by @xgreenx in
#1434
* Weekly `cargo update` by @github-actions in
#1438
* ci: add beta releasy to fuel-core by @kayagokalp in
#1400
* setup a cron job to test beta-4 continuously by @Voxelot in
#1436
* chore: Use MerkleRootCalculator when only BMT root is needed by
@bvrooman in #1439
* Crypto op code sanity checks by @MitchTurner in
#1430
* Update gas benchmarks for some storage opcodes by @Dentosal in
#1408
* Split keygen into a create and a binary by @cr-fuel in
#1426
* Basic Transfer TPS Benchmarking by @Voxelot in
#1437
* "flow" op code sanity benchmarks by @MitchTurner in
#1433
* Applying `#1435` to `master` by @xgreenx in
#1440
* "memory" opcode sanity checks by @MitchTurner in
#1444
* Add timeout to E2E test by @Voxelot in
#1447
* fix owns_coins to properly paginate by @Voxelot in
#1449
* Fixing incorrect measurement for fast(µs) opcodes by @xgreenx in
#1457
* Call `flush` during end of the `FuelService` by @xgreenx in
#1456
* chore: fix releasy test tracking branch from `main` to `master` by
@kayagokalp in #1460
* Weekly `cargo update` by @github-actions in
#1461
* `DB::repair` breaks the table for checkpoints by @xgreenx in
#1463
* Avoid possible truncation of higher bits by @xgreenx in
#1464
* Bumping `fuel-vm` to `v0.40.0` by @xgreenx in
#1468
* Improvements for keygen cli and crates by @cr-fuel in
#1465
* Handling overflows during arithmetic operations by @xgreenx in
#1466
* test: Add contract code root benchmark by @bvrooman in
#1452
* test: Add state root and contract id benchmarks by @bvrooman in
#1462
* Avoid storage caching in benchmarks by @xgreenx in
#1469
* Weekly `cargo update` by @github-actions in
#1471
* Expose fuel-core version as a constant by @Br1ght0ne in
#1473
* Upgrade ed25519_dalek 1.0.1 -> 2.0.0 by @Dentosal in
#1475
* chore: Upgrade Rust 1.73 by @bvrooman in
#1477
* Decrease number of iterations for sequential benchmarks by @xgreenx in
#1480
* Add mldv bench by @Dentosal in
#1481
* feat: Separate light and heavy gas costs (core) by @bvrooman in
#1483
* chore: Remove `network` parameter from CLI by @bvrooman in
#1484
* Transaction policies support by @xgreenx in
#1472
* stage release candidate for beta-5 by @Voxelot in
#1485
* setup docker auth for binary publishing by @Voxelot in
#1488
* Fix macos binary publishing by @xgreenx in
#1489
* Add documentation for our calculation of a _reasonable_ gas fee for
storage by @MitchTurner in
#1478
* "contract" op code sanity checks by @MitchTurner in
#1453
* "other" op code sanity check by @MitchTurner in
#1476
* Add push and pop benches by @MitchTurner in
#1490
* chore: Remove unused gossipsub items by @bvrooman in
#1491
* Adjusting of the prices benchmarks after sanity check benchmarks by
@xgreenx in #1494
* Weekly `cargo update` by @github-actions in
#1498
* Update benches that are affected by receipts by @Dentosal in
#1454
* Support backward iteration in the RocksDB by @xgreenx in
#1492
* Added validation of the coin's fields during block production and
validation by @xgreenx in
#1506
* Added price benchmark for `vm_initialization` by @xgreenx in
#1502
* Sanity-check `gtf` opcode by @MitchTurner in
#1503
* Tool for generating fee collection contract by @Voxelot in
#1501
* Chain config for beta 5 network by @xgreenx in
#1507
* Remove usage of iter_all_filtered from merkle_contract_state_range by
@Dentosal in #1512

## New Contributors
* @YusongWang made their first contribution in
#1293
* @calldelegation made their first contribution in
#1362
* @PaulRBerg made their first contribution in
#1357
* @cr-fuel made their first contribution in
#1397
* @github-actions made their first contribution in
#1417
* @GoodDaisy made their first contribution in
#1424

**Full Changelog**:
v0.20.8...v0.21.0

---------

Co-authored-by: Brandon Vrooman <brandon.vrooman@fuel.sh>
crypto523 added a commit to crypto523/fuel-core that referenced this pull request Oct 7, 2024
## Version 0.21.0

This release focuses on preparing `fuel-core` for the mainnet
environment.
- Most of the changes improved the security and stability of the node.
- The gas model was reworked to cover all aspects of execution.
- The benchmarking system was significantly enhanced, covering worst
scenarios.
- A new set of benchmarks was added to track the accuracy of gas prices.
- Optimized heavy operations and removed/replaced exploitable
functionality.

Besides that, there are more concrete changes:
- Unified naming conventions for all CLI arguments. Added dependencies
between related fields to avoid misconfiguration in case of missing
arguments. Added `--debug` flag that enables additional functionality
like a debugger.
- Improved telemetry to cover the internal work of services and added
support for the Pyroscope, allowing it to generate real-time flamegraphs
to track performance.
- Improved stability of the P2P layer and adjusted the updating of
reputation. The speed of block synchronization was significantly
increased.
- The node is more stable and resilient. Improved DoS resistance and
resource management. Fixed critical bugs during state transition.
- Reworked the `Mint` transaction to accumulate the fee from block
production inside the contract defined by the block producer.

FuelVM received a lot of safety and stability improvements:
- The audit helped identify some bugs and errors that have been
successfully fixed.
- Updated the gas price model to charge for resources used during the
transaction lifecycle.
- Added `no_std` and 32 bit system support. This opens doors for fraud
proving in the future.
- Removed the `ChainId` from the `PredicateId` calculation, allowing the
use of predicates cross-chain.
- Improvements in the performance of some storage-related opcodes.
- Support the `ECAL` instruction that allows adding custom functionality
to the VM. It can be used to create unique rollups or advanced indexers
in the future.
- Support of [transaction
policies](https://github.com/FuelLabs/fuel-vm/blob/master/CHANGELOG.md#version-0420)
provides additional safety for the user.
It also allows the implementation of a multi-dimensional price model in
the future, making the transaction execution cheaper and allowing more
transactions that don't affect storage.
- Refactored errors, returning more detailed errors to the user,
simplifying debugging.

### Added

- [#1503](FuelLabs/fuel-core#1503): Add `gtf`
opcode sanity check.
- [#1502](FuelLabs/fuel-core#1502): Added price
benchmark for `vm_initialization`.
- [#1501](FuelLabs/fuel-core#1501): Add a CLI
command for generating a fee collection contract.
- [#1492](FuelLabs/fuel-core#1492): Support
backward iteration in the RocksDB. It allows backward queries that were
not allowed before.
- [#1490](FuelLabs/fuel-core#1490): Add push and
pop benchmarks.
- [#1485](FuelLabs/fuel-core#1485): Prepare rc
release of fuel core v0.21
- [#1476](FuelLabs/fuel-core#1453): Add the
majority of the "other" benchmarks for contract opcodes.
- [#1473](FuelLabs/fuel-core#1473): Expose
fuel-core version as a constant
- [#1469](FuelLabs/fuel-core#1469): Added
support of bloom filter for RocksDB tables and increased the block
cache.
- [#1465](FuelLabs/fuel-core#1465): Improvements
for keygen cli and crates
- [#1642](FuelLabs/fuel-core#1462): Added
benchmark to measure the performance of contract state and contract ID
calculation; use for gas costing.
- [#1457](FuelLabs/fuel-core#1457): Fixing
incorrect measurement for fast(µs) opcodes.
- [#1456](FuelLabs/fuel-core#1456): Added
flushing of the RocksDB during a graceful shutdown.
- [#1456](FuelLabs/fuel-core#1456): Added more
logs to track the service lifecycle.
- [#1453](FuelLabs/fuel-core#1453): Add the
majority of the "sanity" benchmarks for contract opcodes.
- [#1452](FuelLabs/fuel-core#1452): Added
benchmark to measure the performance of contract root calculation when
utilizing the maximum contract size; used for gas costing of contract
root during predicate owner validation.
- [#1449](FuelLabs/fuel-core#1449): Fix coin
pagination in e2e test client.
- [#1447](FuelLabs/fuel-core#1447): Add timeout
for continuous e2e tests
- [#1444](FuelLabs/fuel-core#1444): Add "sanity"
benchmarks for memory opcodes.
- [#1437](FuelLabs/fuel-core#1437): Add some
transaction throughput tests for basic transfers.
- [#1436](FuelLabs/fuel-core#1436): Add a github
action to continuously test beta-4.
- [#1433](FuelLabs/fuel-core#1433): Add "sanity"
benchmarks for flow opcodes.
- [#1432](FuelLabs/fuel-core#1432): Add a new
`--api-request-timeout` argument to control TTL for GraphQL requests.
- [#1430](FuelLabs/fuel-core#1430): Add "sanity"
benchmarks for crypto opcodes.
- [#1426](FuelLabs/fuel-core#1426) Split keygen
into a create and a binary.
- [#1419](FuelLabs/fuel-core#1419): Add
additional "sanity" benchmarks for arithmetic op code instructions.
- [#1411](FuelLabs/fuel-core#1411): Added WASM
and `no_std` compatibility.
- [#1405](FuelLabs/fuel-core#1405): Use correct
names for service metrics.
- [#1400](FuelLabs/fuel-core#1400): Add releasy
beta to fuel-core so that new commits to fuel-core master triggers
fuels-rs.
- [#1371](FuelLabs/fuel-core#1371): Add new
client function for querying the `MessageStatus` for a specific message
(by `Nonce`).
- [#1356](FuelLabs/fuel-core#1356): Add peer
reputation reporting to heartbeat code.
- [#1355](FuelLabs/fuel-core#1355): Added new
metrics related to block importing, such as tps, sync delays etc.
- [#1339](FuelLabs/fuel-core#1339): Adds
`baseAssetId` to `FeeParameters` in the GraphQL API.
- [#1331](FuelLabs/fuel-core#1331): Add peer
reputation reporting to block import code.
- [#1324](FuelLabs/fuel-core#1324): Added
pyroscope profiling to fuel-core, intended to be used by a secondary
docker image that has debug symbols enabled.
- [#1309](FuelLabs/fuel-core#1309): Add
documentation for running debug builds with CLion and Visual Studio
Code.
- [#1308](FuelLabs/fuel-core#1308): Add support
for loading .env files when compiling with the `env` feature. This
allows users to conveniently supply CLI arguments in a secure and
IDE-agnostic way.
- [#1304](FuelLabs/fuel-core#1304): Implemented
`submit_and_await_commit_with_receipts` method for `FuelClient`.
- [#1286](FuelLabs/fuel-core#1286): Include
readable names for test cases where missing.
- [#1274](FuelLabs/fuel-core#1274): Added tests
to benchmark block synchronization.
- [#1263](FuelLabs/fuel-core#1263): Add gas
benchmarks for `ED19` and `ECR1` instructions.

### Changed

- [#1512](FuelLabs/fuel-core#1512): Internally
simplify merkle_contract_state_range.
- [#1507](FuelLabs/fuel-core#1507): Updated
chain configuration to be ready for beta 5 network. It includes opcode
prices from the latest benchmark and contract for the block producer.
- [#1477](FuelLabs/fuel-core#1477): Upgraded the
Rust version used in CI and containers to 1.73.0. Also includes
associated Clippy changes.
- [#1469](FuelLabs/fuel-core#1469): Replaced
usage of `MemoryTransactionView` by `Checkpoint` database in the
benchmarks.
- [#1468](FuelLabs/fuel-core#1468): Bumped
version of the `fuel-vm` to `v0.40.0`. It brings some breaking changes
into consensus parameters API because of changes in the underlying
types.
- [#1466](FuelLabs/fuel-core#1466): Handling
overflows during arithmetic operations.
- [#1460](FuelLabs/fuel-core#1460): Change
tracking branch from main to master for releasy tests.
- [#1454](FuelLabs/fuel-core#1454): Update gas
benchmarks for opcodes that append receipts.
- [#1440](FuelLabs/fuel-core#1440): Don't report
reserved nodes that send invalid transactions.
- [#1439](FuelLabs/fuel-core#1439): Reduced
memory BMT consumption during creation of the header.
- [#1434](FuelLabs/fuel-core#1434): Continue
gossiping transactions to reserved peers regardless of gossiping
reputation score.
- [#1408](FuelLabs/fuel-core#1408): Update gas
benchmarks for storage opcodes to use a pre-populated database to get
more accurate worst-case costs.
- [#1399](FuelLabs/fuel-core#1399): The Relayer
now queries Ethereum for its latest finalized block instead of using a
configurable "finalization period" to presume finality.
- [#1397](FuelLabs/fuel-core#1397): Improved
keygen. Created a crate to be included from forc plugins and upgraded
internal library to drop requirement of protoc to build
- [#1395](FuelLabs/fuel-core#1395): Add
DependentCost benchmarks for `k256`, `s256` and `mcpi` instructions.
- [#1393](FuelLabs/fuel-core#1393): Increase
heartbeat timeout from `2` to `60` seconds, as suggested in [this
issue](FuelLabs/fuel-core#1330).
- [#1392](FuelLabs/fuel-core#1392): Fixed an
overflow in `message_proof`.
- [#1390](FuelLabs/fuel-core#1390): Up the
`ethers` version to `2` to fix an issue with `tungstenite`.
- [#1383](FuelLabs/fuel-core#1383): Disallow
usage of `log` crate internally in favor of `tracing` crate.
- [#1380](FuelLabs/fuel-core#1380): Add
preliminary, hard-coded config values for heartbeat peer reputation,
removing `todo`.
- [#1377](FuelLabs/fuel-core#1377): Remove
`DiscoveryEvent` and use `KademliaEvent` directly in
`DiscoveryBehavior`.
- [#1366](FuelLabs/fuel-core#1366): Improve
caching during docker builds in CI by replacing gha
- [#1358](FuelLabs/fuel-core#1358): Upgraded the
Rust version used in CI to 1.72.0. Also includes associated Clippy
changes.
- [#1349](FuelLabs/fuel-core#1349): Updated
peer-to-peer transactions API to support multiple blocks in a single
request, and updated block synchronization to request multiple blocks
based on the configured range of headers.
- [#1342](FuelLabs/fuel-core#1342): Add error
handling for P2P requests to return `None` to requester and log error.
- [#1318](FuelLabs/fuel-core#1318): Modified
block synchronization to use asynchronous task execution when retrieving
block headers.
- [#1314](FuelLabs/fuel-core#1314): Removed
`types::ConsensusParameters` in favour of `fuel_tx:ConsensusParameters`.
- [#1302](FuelLabs/fuel-core#1302): Removed the
usage of flake and building of the bridge contract ABI.
It simplifies the maintenance and updating of the events, requiring only
putting the event definition into the codebase of the relayer.
- [#1293](FuelLabs/fuel-core#1293):
Parallelized the `estimate_predicates` endpoint to utilize all available
threads.
- [#1270](FuelLabs/fuel-core#1270): Modify the
way block headers are retrieved from peers to be done in batches.

#### Breaking
- [#1506](FuelLabs/fuel-core#1506): Added
validation of the coin's fields during block production and validation.
Before, it was possible to submit a transaction that didn't match the
coin's values in the database, allowing printing/using unavailable
assets.
- [#1491](FuelLabs/fuel-core#1491): Removed
unused request and response variants from the Gossipsub implementation,
as well as related definitions and tests. Specifically, this removes
gossiping of `ConsensusVote` and `NewBlock` events.
- [#1472](FuelLabs/fuel-core#1472): Upgraded
`fuel-vm` to `v0.42.0`. It introduces transaction policies that changes
layout of the transaction. FOr more information check the
[v0.42.0](FuelLabs/fuel-vm#635) release.
- [#1470](FuelLabs/fuel-core#1470): Divide
`DependentCost` into "light" and "heavy" operations.
- [#1464](FuelLabs/fuel-core#1464): Avoid
possible truncation of higher bits. It may invalidate the code that
truncated higher bits causing different behavior on 32-bit vs. 64-bit
systems. The change affects some endpoints that now require lesser
integers.
- [#1432](FuelLabs/fuel-core#1432): All
subscriptions and requests have a TTL now. So each subscription
lifecycle is limited in time. If the subscription is closed because of
TTL, it means that you subscribed after your transaction had been
dropped by the network.
- [#1407](FuelLabs/fuel-core#1407): The
recipient is a `ContractId` instead of `Address`. The block producer
should deploy its contract to receive the transaction fee. The collected
fee is zero until the recipient contract is set.
- [#1407](FuelLabs/fuel-core#1407): The `Mint`
transaction is reworked with new fields to support the account-base
model. It affects serialization and deserialization of the transaction
and also affects GraphQL schema.
- [#1407](FuelLabs/fuel-core#1407): The `Mint`
transaction is the last transaction in the block instead of the first.
- [#1374](FuelLabs/fuel-core#1374): Renamed
`base_chain_height` to `da_height` and return current relayer height
instead of latest Fuel block height.
- [#1367](FuelLabs/fuel-core#1367): Update to
the latest version of fuel-vm.
- [#1363](FuelLabs/fuel-core#1363): Change
message_proof api to take `nonce` instead of `message_id`
- [#1355](FuelLabs/fuel-core#1355): Removed the
`metrics` feature flag from the fuel-core crate, and metrics are now
included by default.
- [#1339](FuelLabs/fuel-core#1339): Added a new
required field called `base_asset_id` to the `FeeParameters` definition
in `ConsensusParameters`, as well as default values for `base_asset_id`
in the `beta` and `dev` chain specifications.
- [#1322](FuelLabs/fuel-core#1322):
The `debug` flag is added to the CLI. The flag should be used for local
development only. Enabling debug mode:
      - Allows GraphQL Endpoints to arbitrarily advance blocks.
      - Enables debugger GraphQL Endpoints.
      - Allows setting `utxo_validation` to `false`.
- [#1318](FuelLabs/fuel-core#1318): Removed the
`--sync-max-header-batch-requests` CLI argument, and renamed
`--sync-max-get-txns` to `--sync-block-stream-buffer-size` to better
represent the current behavior in the import.
- [#1290](FuelLabs/fuel-core#1290): Standardize
CLI args to use `-` instead of `_`.
- [#1279](FuelLabs/fuel-core#1279): Added a new
CLI flag to enable the Relayer service `--enable-relayer`, and disabled
the Relayer service by default. When supplying the `--enable-relayer`
flag, the `--relayer` argument becomes mandatory, and omitting it is an
error. Similarly, providing a `--relayer` argument without the
`--enable-relayer` flag is an error. Lastly, providing the `--keypair`
or `--network` arguments will also produce an error if the
`--enable-p2p` flag is not set.
- [#1262](FuelLabs/fuel-core#1262): The
`ConsensusParameters` aggregates all configuration data related to the
consensus. It contains many fields that are segregated by the usage. The
API of some functions was affected to use lesser types instead the whole
`ConsensusParameters`. It is a huge breaking change requiring
repetitively monotonically updating all places that use the
`ConsensusParameters`. But during updating, consider that maybe you can
use lesser types. Usage of them may simplify signatures of methods and
make them more user-friendly and transparent.

### Removed

#### Breaking
- [#1484](FuelLabs/fuel-core#1484): Removed
`--network` CLI argument. Now the name of the network is fetched form
chain configuration.
- [#1399](FuelLabs/fuel-core#1399): Removed
`relayer-da-finalization` parameter from the relayer CLI.
- [#1338](FuelLabs/fuel-core#1338): Updated
GraphQL client to use `DependentCost` for `k256`, `mcpi`, `s256`,
`scwq`, `swwq` opcodes.
- [#1322](FuelLabs/fuel-core#1322): The
`manual_blocks_enabled` flag is removed from the CLI. The analog is a
`debug` flag.

## What's Changed
* Added changelog in the same way as we did for `fuel-vm` by @xgreenx in
FuelLabs/fuel-core#1287
* Decompose consensus params struct by @MitchTurner in
FuelLabs/fuel-core#1262
* Replace all instances of `_` in CLI `long` arguments with `-` by
@MitchTurner in FuelLabs/fuel-core#1290
* [rpc] Parallelise estimate_predicates endpoint by @YusongWang in
FuelLabs/fuel-core#1293
* Add readable test names to test cases by @MitchTurner in
FuelLabs/fuel-core#1286
* ED19 and ECR1 benchmarks by @Dentosal in
FuelLabs/fuel-core#1263
* feat: Add `enable-relayer` flag to `fuel-core` CLI by @bvrooman in
FuelLabs/fuel-core#1279
* Small nits found during deploying and benchmarking by @xgreenx in
FuelLabs/fuel-core#1303
* Implemented `submit_and_await_commit_with_receipts` method by @xgreenx
in FuelLabs/fuel-core#1304
* Removed the usage of flake and building of the bridge contract ABI by
@xgreenx in FuelLabs/fuel-core#1302
* Download range of headers during syncing by @MitchTurner in
FuelLabs/fuel-core#1270
* feat: Enable .env file loading using `env` feature by @bvrooman in
FuelLabs/fuel-core#1308
* chore: Remove types::ConsensusParameters by @bvrooman in
FuelLabs/fuel-core#1314
* docs: Debugging instructions using IDEs by @bvrooman in
FuelLabs/fuel-core#1309
* test: Block Import benchmarks and test helpers by @bvrooman in
FuelLabs/fuel-core#1274
* Fix audit CI for `webpki` by @xgreenx in
FuelLabs/fuel-core#1319
* chore: Single buffer block sync by @bvrooman in
FuelLabs/fuel-core#1318
* Run unit tests without default features only for specific crates by
@xgreenx in FuelLabs/fuel-core#1321
* Added support for `debug` CLI flag. by @xgreenx in
FuelLabs/fuel-core#1322
* Report Peers that give bad Block Info by @MitchTurner in
FuelLabs/fuel-core#1331
* Pyroscope profiling by @Voxelot in
FuelLabs/fuel-core#1324
* Add error handling for P2P requests to return `None` to requester and
log error by @MitchTurner in
FuelLabs/fuel-core#1342
* Importer Metrics by @Voxelot in
FuelLabs/fuel-core#1355
* chore: Upgrade to Rust 1.72.0 in CI by @bvrooman in
FuelLabs/fuel-core#1358
* chore: Upgrade `fuel-vm` to 0.37.0 by @bvrooman in
FuelLabs/fuel-core#1338
* docs: remove stale schema by @calldelegation in
FuelLabs/fuel-core#1362
* Replace message_id with nonce in `MessageProof` query by @MitchTurner
in FuelLabs/fuel-core#1363
* feat: Configurable base asset by @bvrooman in
FuelLabs/fuel-core#1339
* avoid gha caching for docker builds by @Voxelot in
FuelLabs/fuel-core#1366
* Add tracking for peer heartbeats by @MitchTurner in
FuelLabs/fuel-core#1356
* docs: fix broken link in README by @PaulRBerg in
FuelLabs/fuel-core#1357
* Use right level of error for `.env` file and duplicated service by
@xgreenx in FuelLabs/fuel-core#1372
* Add query and handling for `MessageStatus` by @MitchTurner in
FuelLabs/fuel-core#1371
* Renamed `base_chain_height` to `da_height` and return current relayer
height instead of latest Fuel block height by @xgreenx in
FuelLabs/fuel-core#1374
* Remove `DiscoveryEvent` and use `KademliaEvent` instead by
@MitchTurner in FuelLabs/fuel-core#1377
* Remove todo from code and provide some preliminary peer review config
values by @MitchTurner in
FuelLabs/fuel-core#1380
* Clippy lint to disallow logging crate macros in favor of tracing by
@Dentosal in FuelLabs/fuel-core#1383
* fuel-vm nostd update by @Dentosal in
FuelLabs/fuel-core#1367
* Up the `ethers` version to `2` to fix an issue with `tungstenite` by
@xgreenx in FuelLabs/fuel-core#1390
* Increase heartbeat timeout to one minute by @Dentosal in
FuelLabs/fuel-core#1393
* feat: batch transactions import by @bvrooman in
FuelLabs/fuel-core#1349
* Fix an interger overflow in message_proof when looking beyond genesis
by @Dentosal in FuelLabs/fuel-core#1392
* Improve keygen by @cr-fuel in
FuelLabs/fuel-core#1397
* Benchmark {k256, s256, mcpi} opcodes using DependentCost by @Dentosal
in FuelLabs/fuel-core#1395
* Use correct names for service metrics by @xgreenx in
FuelLabs/fuel-core#1405
* feat: Retrieve finalized blocks from Ethereum by @bvrooman in
FuelLabs/fuel-core#1399
* Updated CI to run `cargo update` weekly by @xgreenx in
FuelLabs/fuel-core#1415
* CI `cargo update` weekly by @xgreenx in
FuelLabs/fuel-core#1416
* Weekly `cargo update` by @github-actions in
FuelLabs/fuel-core#1417
* Fix typos by @GoodDaisy in
FuelLabs/fuel-core#1424
* feat: Support no_std and WASM compilation for `fuel-core` crates by
@bvrooman in FuelLabs/fuel-core#1411
* Create sanity benchmark checks for all the arithmetic op codes by
@MitchTurner in FuelLabs/fuel-core#1419
* Update benchmarking and collecting for `scwq`, `swwq` and `srwq`
opcodes by @xgreenx in FuelLabs/fuel-core#1427
* Account-base fee collection by @xgreenx in
FuelLabs/fuel-core#1407
* Rollback modification of the chain specification by @xgreenx in
FuelLabs/fuel-core#1429
* Tx subscription cleanup (#1422) by @xgreenx in
FuelLabs/fuel-core#1432
* Mark reserved peers as explicit for gossipsub to avoid reputation
decreasing (#1423) by @xgreenx in
FuelLabs/fuel-core#1434
* Weekly `cargo update` by @github-actions in
FuelLabs/fuel-core#1438
* ci: add beta releasy to fuel-core by @kayagokalp in
FuelLabs/fuel-core#1400
* setup a cron job to test beta-4 continuously by @Voxelot in
FuelLabs/fuel-core#1436
* chore: Use MerkleRootCalculator when only BMT root is needed by
@bvrooman in FuelLabs/fuel-core#1439
* Crypto op code sanity checks by @MitchTurner in
FuelLabs/fuel-core#1430
* Update gas benchmarks for some storage opcodes by @Dentosal in
FuelLabs/fuel-core#1408
* Split keygen into a create and a binary by @cr-fuel in
FuelLabs/fuel-core#1426
* Basic Transfer TPS Benchmarking by @Voxelot in
FuelLabs/fuel-core#1437
* "flow" op code sanity benchmarks by @MitchTurner in
FuelLabs/fuel-core#1433
* Applying `#1435` to `master` by @xgreenx in
FuelLabs/fuel-core#1440
* "memory" opcode sanity checks by @MitchTurner in
FuelLabs/fuel-core#1444
* Add timeout to E2E test by @Voxelot in
FuelLabs/fuel-core#1447
* fix owns_coins to properly paginate by @Voxelot in
FuelLabs/fuel-core#1449
* Fixing incorrect measurement for fast(µs) opcodes by @xgreenx in
FuelLabs/fuel-core#1457
* Call `flush` during end of the `FuelService` by @xgreenx in
FuelLabs/fuel-core#1456
* chore: fix releasy test tracking branch from `main` to `master` by
@kayagokalp in FuelLabs/fuel-core#1460
* Weekly `cargo update` by @github-actions in
FuelLabs/fuel-core#1461
* `DB::repair` breaks the table for checkpoints by @xgreenx in
FuelLabs/fuel-core#1463
* Avoid possible truncation of higher bits by @xgreenx in
FuelLabs/fuel-core#1464
* Bumping `fuel-vm` to `v0.40.0` by @xgreenx in
FuelLabs/fuel-core#1468
* Improvements for keygen cli and crates by @cr-fuel in
FuelLabs/fuel-core#1465
* Handling overflows during arithmetic operations by @xgreenx in
FuelLabs/fuel-core#1466
* test: Add contract code root benchmark by @bvrooman in
FuelLabs/fuel-core#1452
* test: Add state root and contract id benchmarks by @bvrooman in
FuelLabs/fuel-core#1462
* Avoid storage caching in benchmarks by @xgreenx in
FuelLabs/fuel-core#1469
* Weekly `cargo update` by @github-actions in
FuelLabs/fuel-core#1471
* Expose fuel-core version as a constant by @Br1ght0ne in
FuelLabs/fuel-core#1473
* Upgrade ed25519_dalek 1.0.1 -> 2.0.0 by @Dentosal in
FuelLabs/fuel-core#1475
* chore: Upgrade Rust 1.73 by @bvrooman in
FuelLabs/fuel-core#1477
* Decrease number of iterations for sequential benchmarks by @xgreenx in
FuelLabs/fuel-core#1480
* Add mldv bench by @Dentosal in
FuelLabs/fuel-core#1481
* feat: Separate light and heavy gas costs (core) by @bvrooman in
FuelLabs/fuel-core#1483
* chore: Remove `network` parameter from CLI by @bvrooman in
FuelLabs/fuel-core#1484
* Transaction policies support by @xgreenx in
FuelLabs/fuel-core#1472
* stage release candidate for beta-5 by @Voxelot in
FuelLabs/fuel-core#1485
* setup docker auth for binary publishing by @Voxelot in
FuelLabs/fuel-core#1488
* Fix macos binary publishing by @xgreenx in
FuelLabs/fuel-core#1489
* Add documentation for our calculation of a _reasonable_ gas fee for
storage by @MitchTurner in
FuelLabs/fuel-core#1478
* "contract" op code sanity checks by @MitchTurner in
FuelLabs/fuel-core#1453
* "other" op code sanity check by @MitchTurner in
FuelLabs/fuel-core#1476
* Add push and pop benches by @MitchTurner in
FuelLabs/fuel-core#1490
* chore: Remove unused gossipsub items by @bvrooman in
FuelLabs/fuel-core#1491
* Adjusting of the prices benchmarks after sanity check benchmarks by
@xgreenx in FuelLabs/fuel-core#1494
* Weekly `cargo update` by @github-actions in
FuelLabs/fuel-core#1498
* Update benches that are affected by receipts by @Dentosal in
FuelLabs/fuel-core#1454
* Support backward iteration in the RocksDB by @xgreenx in
FuelLabs/fuel-core#1492
* Added validation of the coin's fields during block production and
validation by @xgreenx in
FuelLabs/fuel-core#1506
* Added price benchmark for `vm_initialization` by @xgreenx in
FuelLabs/fuel-core#1502
* Sanity-check `gtf` opcode by @MitchTurner in
FuelLabs/fuel-core#1503
* Tool for generating fee collection contract by @Voxelot in
FuelLabs/fuel-core#1501
* Chain config for beta 5 network by @xgreenx in
FuelLabs/fuel-core#1507
* Remove usage of iter_all_filtered from merkle_contract_state_range by
@Dentosal in FuelLabs/fuel-core#1512

## New Contributors
* @YusongWang made their first contribution in
FuelLabs/fuel-core#1293
* @calldelegation made their first contribution in
FuelLabs/fuel-core#1362
* @PaulRBerg made their first contribution in
FuelLabs/fuel-core#1357
* @cr-fuel made their first contribution in
FuelLabs/fuel-core#1397
* @github-actions made their first contribution in
FuelLabs/fuel-core#1417
* @GoodDaisy made their first contribution in
FuelLabs/fuel-core#1424

**Full Changelog**:
FuelLabs/fuel-core@v0.20.8...v0.21.0

---------

Co-authored-by: Brandon Vrooman <brandon.vrooman@fuel.sh>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants