Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Version v0.24.1
Added
fuel-core
now requires awasm32-unknown-unknown
target to build.ApplicationHeader
to describe what was used to produce this block.ProducerGasPrice
trait that theProducer
depends on to get the gas price for the block.schema.sdl
fromfuel-core-client
.Changed
Breaking
#1771: Contract 'states' and 'balances' brought back into
ContractConfig
. Parquet now writes a file per table.1779: Modify Relayer service to order Events from L1 by block index
#1783: The PR upgrade
fuel-vm
to0.48.0
release. Because of some breaking changes, we also adapted our codebase to follow them:Default
for configs was moved under thetest-helpers
feature. Thefuel-core
binary uses testnet configuration instead ofDefault::default
(for cases whenChainConfig
was not provided by the user).version
, that can be used to decide how to deserialize.UtxoId
type now is 34 bytes instead of 33. It affects hex representation and requires adding00
.block_gas_limit
was moved toConsensusParameters
fromChainConfig
. It means the block producer doesn't specify the block gas limit anymore, and we don't need to propagate this information.bytecodeLength
field is removed from theCreate
transaction.ConsensusParameters
from executor config becauseConsensusParameters::default
is not available anymore. Instead, executors fetchConsensusParameters
from the database.#1769: Include new field on header for the merkle root of imported events. Rename other message root field.
#1768: Moved
ContractsInfo
table to the off-chain database. Removedsalt
field from theContractConfig
.#1761: Adjustments to the upcoming testnet configs:
#1694: The change moves the database transaction logic from the
fuel-core
to thefuel-core-storage
level. The corresponding issue described the reason behind it.Technical details of implementation
The change splits the
KeyValueStore
intoKeyValueInspect
andKeyValueMutate
, as well theBlueprint
intoBlueprintInspect
andBlueprintMutate
. It allows requiring less restricted constraints for any read-related operations.One of the main ideas of the change is to allow for the actual storage only to implement
KeyValueInspect
andModifiable
without theKeyValueMutate
. It simplifies work with the databases and provides a safe way of interacting with them (Modification into the database can only go through theModifiable::commit_changes
). This feature is used to track the height of each database during commits and even limit how commits are done, providing additional safety. This part of the change was done as a separate commit.The
StorageTransaction
is aStructuredStorage
that usesInMemoryTransaction
inside to accumulate modifications. OnlyInMemoryTransaction
has a real implementation of theKeyValueMutate
(Other types only implement it in tests).The implementation of the
Modifiable
for theDatabase
contains a business logic that provides additional safety but limits the usage of the database. TheDatabase
now tracks its height and is responsible for its updates. In thecommit_changes
function, it analyzes the changes that were done and tries to find a new height(For example, in the case of theOnChain
database, we are looking for a newBlock
in theFuelBlocks
table).As was planned in the issue, now the executor has full control over how commits to the storage are done.
All mutation methods now require
&mut self
- exclusive ownership over the object to be able to write into it. It almost negates the chance of concurrent modification of the storage, but it is still possible since theDatabase
implements theClone
trait. To be sure that we don't corrupt the state of the database, thecommit_changes
function implements additional safety checks to be sure that we commit updates per each height only once time.Side changes:
drop
function was moved fromDatabase
toRocksDB
as a preparation for the state rewind since the read view should also keep the drop function until it is destroyed.StatisticTable
table lives in the off-chain worker.Database
from thedap::ConcreteStorage
since it is already available from the VM.Changes
instead of the storage transaction, which simplifies the interaction between modules and port definition.fuel-core-storage
crate and is now reusable. It provides aninterator
method that duplicates the logic fromMemoryStore
on iterating over theBTreeMap
and methods likeiter_all
,iter_all_by_prefix
, etc. It was done in a separate revivable commit.MemoryTransactionView
is fully replaced by theStorageTransactionInner
.flush
method from theDatabase
since it is not needed after Fix for the long database initialization after restart #1664.#1693: The change separates the initial chain state from the chain config and stores them in separate files when generating a snapshot. The state snapshot can be generated in a new format where parquet is used for compression and indexing while postcard is used for encoding. This enables importing in a stream like fashion which reduces memory requirements. Json encoding is still supported to enable easy manual setup. However, parquet is prefered for large state files.
Snapshot command
The CLI was expanded to allow customizing the used encoding. Snapshots are now generated along with a metadata file describing the encoding used. The metadata file contains encoding details as well as the location of additional files inside the snapshot directory containing the actual data. The chain config is always generated in the JSON format.
The snapshot command now has the '--output-directory' for specifying where to save the snapshot.
Run command
The run command now includes the 'db_prune' flag which when provided will prune the existing db and start genesis from the provided snapshot metadata file or the local testnet configuration.
The snapshot metadata file contains paths to the chain config file and files containing chain state items (coins, messages, contracts, contract states, and balances), which are loaded via streaming.
Each item group in the genesis process is handled by a separate worker, allowing for parallel loading. Workers stream file contents in batches.
A database transaction is committed every time an item group is succesfully loaded. Resumability is achieved by recording the last loaded group index within the same db tx. If loading is aborted, the remaining workers are shutdown. Upon restart, workers resume from the last processed group.
Contract States and Balances
Using uniform-sized batches may result in batches containing items from multiple contracts. Optimal performance can presumably be achieved by selecting a batch size that typically encompasses an entire contract's state or balance, allowing for immediate initialization of relevant Merkle trees.
Removed
protobuf
from everywhere sincelibp2p
usesquick-protobuf
.What's Changed
schema.sdl
add some helper types and traits by @Dentosal in Exposeschema.sdl
add some helper types and traits #1731cargo update
by @github-actions in Weeklycargo update
#17450.22.4
by @xgreenx in Duplicating blacklisting feature for TxPool from0.22.4
#1748StorageTransaction
to thefuel-core-storage
crate by @xgreenx in MovedStorageTransaction
to thefuel-core-storage
crate #1694protobuf
from everywhere sincelibp2p
usesquick-protobuf
by @xgreenx in Removedprotobuf
from everywhere sincelibp2p
usesquick-protobuf
#1757cargo update
by @github-actions in Weeklycargo update
#1758ApplicationHeader
by @xgreenx in Added consensus parameters version and state transition version to theApplicationHeader
#1767ContractsInfo
table to the off-chain database by @xgreenx in MovedContractsInfo
table to the off-chain database #1768lazy_static
from teh codebase by @xgreenx in Removed the usage of thelazy_static
from teh codebase #1781fuel-vm 0.48.0
by @xgreenx in Patch to usefuel-vm 0.48.0
#1783fuel-core-bin
crate by @xgreenx in Moved chain specification intofuel-core-bin
crate #1792Full Changelog: v0.23.0...v0.24.1