From 16abcd230efe96065155f24ea5292bfc210a99b1 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Tue, 19 Mar 2024 01:12:05 -0700 Subject: [PATCH 01/21] add l1 event type for relayed forced transactions --- crates/services/relayer/src/abi.rs | 1 + crates/services/relayer/src/config.rs | 5 ++ crates/services/relayer/src/log.rs | 60 ++++++++++++++++- crates/services/relayer/src/mock_db.rs | 14 +++- crates/services/relayer/src/ports/tests.rs | 2 +- crates/services/relayer/src/service.rs | 2 +- .../services/relayer/src/service/get_logs.rs | 8 ++- crates/services/relayer/src/test_helpers.rs | 2 +- crates/storage/src/tables.rs | 2 +- crates/types/src/entities.rs | 9 ++- crates/types/src/entities/relayer.rs | 4 ++ .../src/entities/{ => relayer}/message.rs | 0 .../types/src/entities/relayer/transaction.rs | 66 +++++++++++++++++++ crates/types/src/services/executor.rs | 2 +- crates/types/src/services/relayer.rs | 14 +++- 15 files changed, 177 insertions(+), 14 deletions(-) create mode 100644 crates/types/src/entities/relayer.rs rename crates/types/src/entities/{ => relayer}/message.rs (100%) create mode 100644 crates/types/src/entities/relayer/transaction.rs diff --git a/crates/services/relayer/src/abi.rs b/crates/services/relayer/src/abi.rs index 82ea7c57ab..0347a7fb82 100644 --- a/crates/services/relayer/src/abi.rs +++ b/crates/services/relayer/src/abi.rs @@ -8,6 +8,7 @@ pub mod bridge { MessageSent, r#"[ event MessageSent(bytes32 indexed sender, bytes32 indexed recipient, uint256 indexed nonce, uint64 amount, bytes data) + event Transaction(uint64 max_gas, bytes canonically_serialized_tx) ]"#, ); } diff --git a/crates/services/relayer/src/config.rs b/crates/services/relayer/src/config.rs index 3651dfabbf..e8a9b8e53f 100644 --- a/crates/services/relayer/src/config.rs +++ b/crates/services/relayer/src/config.rs @@ -13,6 +13,11 @@ use std::{ pub(crate) static ETH_LOG_MESSAGE: Lazy = Lazy::new(crate::abi::bridge::MessageSentFilter::signature); +pub(crate) static ETH_FORCED_TX: Lazy = + Lazy::new(crate::abi::bridge::TransactionFilter::signature); + +// pub(crate) static ETH_LOG_TRANSACTION: Lazy = Lazy::new(crate::abi::bridge::) + // TODO: Move settlement fields into `ChainConfig` because it is part of the consensus. #[derive(Clone, Debug)] /// Configuration settings for the Relayer. diff --git a/crates/services/relayer/src/log.rs b/crates/services/relayer/src/log.rs index 95dfc0cf4d..cb9a4f6b5c 100644 --- a/crates/services/relayer/src/log.rs +++ b/crates/services/relayer/src/log.rs @@ -10,9 +10,15 @@ use ethers_core::{ }; use fuel_core_types::{ blockchain::primitives::DaBlockHeight, - entities::message::{ - Message, - MessageV1, + entities::{ + relayer::{ + message::{ + Message, + MessageV1, + }, + transaction::RelayedTransactionV1, + }, + RelayedTransaction, }, fuel_types::{ Address, @@ -32,6 +38,13 @@ pub struct MessageLog { pub da_height: DaBlockHeight, } +#[derive(Debug, Clone, Eq, PartialEq)] +pub struct TransactionLog { + pub max_gas: u64, + pub serialized_transaction: Vec, + pub da_height: DaBlockHeight, +} + impl From<&MessageLog> for Message { fn from(message: &MessageLog) -> Self { MessageV1 { @@ -46,10 +59,22 @@ impl From<&MessageLog> for Message { } } +impl From for RelayedTransaction { + fn from(transaction: TransactionLog) -> Self { + RelayedTransactionV1 { + max_gas: transaction.max_gas, + serialized_transaction: transaction.serialized_transaction, + da_height: transaction.da_height, + } + .into() + } +} + #[derive(Debug, Clone, Eq, PartialEq)] pub enum EthEventLog { // Bridge message from da side Message(MessageLog), + Transaction(TransactionLog), Ignored, } @@ -97,6 +122,35 @@ impl TryFrom<&Log> for EthEventLog { ), }) } + n if n == *config::ETH_FORCED_TX => { + if log.topics.len() != 1 { + return Err(anyhow!("Malformed topics for Message")) + } + + let raw_log = RawLog { + topics: log.topics.clone(), + data: log.data.to_vec(), + }; + + let event = abi::bridge::TransactionFilter::decode_log(&raw_log) + .map_err(anyhow::Error::msg)?; + + let max_gas = event.max_gas; + let serialized_transaction = event.canonically_serialized_tx; + + Self::Transaction(TransactionLog { + max_gas, + serialized_transaction: serialized_transaction.to_vec(), + // Safety: logs without block numbers are rejected by + // FinalizationQueue::append_eth_log before the conversion to EthEventLog happens. + // If block_number is none, that means the log is pending. + da_height: DaBlockHeight::from( + log.block_number + .ok_or(anyhow!("Log missing block height"))? + .as_u64(), + ), + }) + } _ => Self::Ignored, }; diff --git a/crates/services/relayer/src/mock_db.rs b/crates/services/relayer/src/mock_db.rs index a544bde0af..043a659c15 100644 --- a/crates/services/relayer/src/mock_db.rs +++ b/crates/services/relayer/src/mock_db.rs @@ -7,7 +7,11 @@ use fuel_core_storage::{ }; use fuel_core_types::{ blockchain::primitives::DaBlockHeight, - entities::message::Message, + entities::{ + relayer::transaction::RelayedTransactionId, + Message, + RelayedTransaction, + }, fuel_types::Nonce, services::relayer::Event, }; @@ -25,6 +29,8 @@ use std::{ #[derive(Default)] pub struct Data { pub messages: BTreeMap>, + pub transactions: + BTreeMap>, pub finalized_da_height: Option, } @@ -63,6 +69,12 @@ impl RelayerDb for MockDb { .or_default() .insert(*message.id(), message.clone()); } + Event::Transaction(transaction) => { + m.transactions + .entry(transaction.da_height()) + .or_default() + .insert(transaction.relayed_id(), transaction.clone()); + } } } let max = m.finalized_da_height.get_or_insert(0u64.into()); diff --git a/crates/services/relayer/src/ports/tests.rs b/crates/services/relayer/src/ports/tests.rs index 57a2757124..449808dfde 100644 --- a/crates/services/relayer/src/ports/tests.rs +++ b/crates/services/relayer/src/ports/tests.rs @@ -14,7 +14,7 @@ use fuel_core_storage::test_helpers::{ MockBasic, MockStorage, }; -use fuel_core_types::entities::message::Message; +use fuel_core_types::entities::relayer::message::Message; use std::borrow::Cow; use test_case::test_case; diff --git a/crates/services/relayer/src/service.rs b/crates/services/relayer/src/service.rs index 00cd86acc1..083b6d1953 100644 --- a/crates/services/relayer/src/service.rs +++ b/crates/services/relayer/src/service.rs @@ -29,7 +29,7 @@ use fuel_core_services::{ }; use fuel_core_types::{ blockchain::primitives::DaBlockHeight, - entities::message::Message, + entities::Message, }; use futures::StreamExt; use std::{ diff --git a/crates/services/relayer/src/service/get_logs.rs b/crates/services/relayer/src/service/get_logs.rs index 515def95fd..c8d246857b 100644 --- a/crates/services/relayer/src/service/get_logs.rs +++ b/crates/services/relayer/src/service/get_logs.rs @@ -1,5 +1,8 @@ use super::*; -use fuel_core_types::services::relayer::Event; +use fuel_core_types::{ + entities::RelayedTransaction, + services::relayer::Event, +}; use futures::TryStreamExt; use std::collections::BTreeMap; @@ -75,6 +78,9 @@ where Some(Ok(Event::Message(Message::from(&m)))) } // TODO: Log out ignored messages. + EthEventLog::Transaction(tx) => { + Some(Ok(Event::Transaction(RelayedTransaction::from(tx)))) + } EthEventLog::Ignored => None, } } diff --git a/crates/services/relayer/src/test_helpers.rs b/crates/services/relayer/src/test_helpers.rs index 2b00477134..ce59fcef13 100644 --- a/crates/services/relayer/src/test_helpers.rs +++ b/crates/services/relayer/src/test_helpers.rs @@ -23,7 +23,7 @@ use ethers_core::{ }, }; use fuel_core_types::{ - entities::message::Message, + entities::Message, fuel_types::Address, }; diff --git a/crates/storage/src/tables.rs b/crates/storage/src/tables.rs index e72fc6243f..686eb7fc6b 100644 --- a/crates/storage/src/tables.rs +++ b/crates/storage/src/tables.rs @@ -13,7 +13,7 @@ use fuel_core_types::{ ContractUtxoInfo, ContractsInfoType, }, - message::Message, + relayer::message::Message, }, fuel_tx::{ Transaction, diff --git a/crates/types/src/entities.rs b/crates/types/src/entities.rs index 90328f77c3..0f4b90f042 100644 --- a/crates/types/src/entities.rs +++ b/crates/types/src/entities.rs @@ -1,12 +1,15 @@ //! Higher level domain types -use crate::entities::message::MessageV1; +use crate::entities::relayer::message::MessageV1; use coins::message_coin::MessageCoin; -use message::Message; +pub use relayer::{ + message::Message, + transaction::RelayedTransaction, +}; pub mod coins; pub mod contract; -pub mod message; +pub mod relayer; impl TryFrom for MessageCoin { type Error = anyhow::Error; diff --git a/crates/types/src/entities/relayer.rs b/crates/types/src/entities/relayer.rs new file mode 100644 index 0000000000..ef1bb96613 --- /dev/null +++ b/crates/types/src/entities/relayer.rs @@ -0,0 +1,4 @@ +//! Relayed entities + +pub mod message; +pub mod transaction; diff --git a/crates/types/src/entities/message.rs b/crates/types/src/entities/relayer/message.rs similarity index 100% rename from crates/types/src/entities/message.rs rename to crates/types/src/entities/relayer/message.rs diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs new file mode 100644 index 0000000000..4acd7457af --- /dev/null +++ b/crates/types/src/entities/relayer/transaction.rs @@ -0,0 +1,66 @@ +//! Relayed (forced) transaction entity types + +use crate::{ + blockchain::primitives::DaBlockHeight, + fuel_crypto, + fuel_types::Bytes32, +}; + +/// Transaction sent from the DA layer to fuel by the relayer +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Debug, Clone, PartialEq, Eq)] +#[non_exhaustive] +pub enum RelayedTransaction { + /// V1 version of the relayed transaction + V1(RelayedTransactionV1), +} + +/// The V1 version of the relayed transaction +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct RelayedTransactionV1 { + /// The max gas that this transaction can consume + pub max_gas: u64, + /// The serialized transaction transmitted from the bridge + pub serialized_transaction: Vec, + /// The block height from the parent da layer that originated this transaction + pub da_height: DaBlockHeight, +} + +/// The hash of a relayed transaction +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct RelayedTransactionId(Bytes32); + +impl RelayedTransaction { + /// Get the DA height the transaction originated from + pub fn da_height(&self) -> DaBlockHeight { + match self { + RelayedTransaction::V1(transaction) => transaction.da_height, + } + } + + /// The hash of the relayed transaction + pub fn relayed_id(&self) -> RelayedTransactionId { + match &self { + RelayedTransaction::V1(tx) => tx.relayed_transaction_id(), + } + } +} + +impl RelayedTransactionV1 { + /// The hash of the relayed transaction (max_gas (big endian) || serialized_transaction) + pub fn relayed_transaction_id(&self) -> RelayedTransactionId { + let hasher = fuel_crypto::Hasher::default() + .chain(self.max_gas.to_be_bytes()) + .chain(self.serialized_transaction.as_slice()); + + RelayedTransactionId((*hasher.finalize()).into()) + } +} + +impl From for RelayedTransaction { + fn from(relayed_transaction: RelayedTransactionV1) -> Self { + RelayedTransaction::V1(relayed_transaction) + } +} diff --git a/crates/types/src/services/executor.rs b/crates/types/src/services/executor.rs index b1b3f98608..f1b829452d 100644 --- a/crates/types/src/services/executor.rs +++ b/crates/types/src/services/executor.rs @@ -10,7 +10,7 @@ use crate::{ }, entities::{ coins::coin::Coin, - message::Message, + relayer::message::Message, }, fuel_tx::{ Receipt, diff --git a/crates/types/src/services/relayer.rs b/crates/types/src/services/relayer.rs index dc71affee9..387085506c 100644 --- a/crates/types/src/services/relayer.rs +++ b/crates/types/src/services/relayer.rs @@ -2,7 +2,10 @@ use crate::{ blockchain::primitives::DaBlockHeight, - entities::message::Message, + entities::{ + Message, + RelayedTransaction, + }, }; /// The event that may come from the relayer. @@ -11,6 +14,8 @@ use crate::{ pub enum Event { /// The message event which was sent to the bridge. Message(Message), + /// A transaction that was forced included from L1 + Transaction(RelayedTransaction), } impl Event { @@ -18,6 +23,7 @@ impl Event { pub fn da_height(&self) -> DaBlockHeight { match self { Event::Message(message) => message.da_height(), + Event::Transaction(transaction) => transaction.da_height(), } } } @@ -27,3 +33,9 @@ impl From for Event { Event::Message(message) } } + +impl From for Event { + fn from(transaction: RelayedTransaction) -> Self { + Event::Transaction(transaction) + } +} From dff78446be269c73726cc618237e7ac6c58ffb5d Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Tue, 19 Mar 2024 23:06:13 -0700 Subject: [PATCH 02/21] fix refactoring --- bin/fuel-core/src/cli/snapshot.rs | 2 +- crates/chain-config/src/config/message.rs | 2 +- crates/fuel-core/src/coins_query.rs | 2 +- crates/fuel-core/src/database/block.rs | 2 +- crates/fuel-core/src/database/message.rs | 2 +- crates/fuel-core/src/executor.rs | 2 +- crates/fuel-core/src/graphql_api/database.rs | 2 +- crates/fuel-core/src/graphql_api/ports.rs | 2 +- crates/fuel-core/src/query/message.rs | 2 +- crates/fuel-core/src/query/message/test.rs | 2 +- crates/fuel-core/src/schema/message.rs | 26 +++++++++---------- .../src/service/adapters/graphql_api.rs | 2 +- .../service/adapters/graphql_api/on_chain.rs | 2 +- .../fuel-core/src/service/adapters/txpool.rs | 2 +- crates/fuel-core/src/service/genesis.rs | 2 +- crates/services/executor/src/executor.rs | 3 +++ crates/services/txpool/src/mock_db.rs | 2 +- crates/services/txpool/src/ports.rs | 2 +- .../txpool/src/txpool/test_helpers.rs | 2 +- 19 files changed, 33 insertions(+), 30 deletions(-) diff --git a/bin/fuel-core/src/cli/snapshot.rs b/bin/fuel-core/src/cli/snapshot.rs index 9562c8262e..b38a5ccd40 100644 --- a/bin/fuel-core/src/cli/snapshot.rs +++ b/bin/fuel-core/src/cli/snapshot.rs @@ -292,7 +292,7 @@ mod tests { ContractUtxoInfo, ContractsInfoType, }, - message::{ + relayer::message::{ Message, MessageV1, }, diff --git a/crates/chain-config/src/config/message.rs b/crates/chain-config/src/config/message.rs index 15d2429642..34f1a573d3 100644 --- a/crates/chain-config/src/config/message.rs +++ b/crates/chain-config/src/config/message.rs @@ -5,7 +5,7 @@ use crate::{ use fuel_core_storage::MerkleRoot; use fuel_core_types::{ blockchain::primitives::DaBlockHeight, - entities::message::{ + entities::relayer::message::{ Message, MessageV1, }, diff --git a/crates/fuel-core/src/coins_query.rs b/crates/fuel-core/src/coins_query.rs index 1f89146941..ecbcaa31ba 100644 --- a/crates/fuel-core/src/coins_query.rs +++ b/crates/fuel-core/src/coins_query.rs @@ -263,7 +263,7 @@ mod tests { Coin, CompressedCoin, }, - message::{ + relayer::message::{ Message, MessageV1, }, diff --git a/crates/fuel-core/src/database/block.rs b/crates/fuel-core/src/database/block.rs index 05bdf825a9..48cc3c1cdf 100644 --- a/crates/fuel-core/src/database/block.rs +++ b/crates/fuel-core/src/database/block.rs @@ -32,7 +32,7 @@ use fuel_core_types::{ }, primitives::BlockId, }, - entities::message::MerkleProof, + entities::relayer::message::MerkleProof, fuel_merkle::binary::MerkleTree, fuel_types::BlockHeight, }; diff --git a/crates/fuel-core/src/database/message.rs b/crates/fuel-core/src/database/message.rs index 64ddda0569..dbcca1dbfa 100644 --- a/crates/fuel-core/src/database/message.rs +++ b/crates/fuel-core/src/database/message.rs @@ -22,7 +22,7 @@ use fuel_core_storage::{ Result as StorageResult, }; use fuel_core_types::{ - entities::message::Message, + entities::relayer::message::Message, fuel_types::{ Address, Nonce, diff --git a/crates/fuel-core/src/executor.rs b/crates/fuel-core/src/executor.rs index bdceda7abc..ee9b733c6e 100644 --- a/crates/fuel-core/src/executor.rs +++ b/crates/fuel-core/src/executor.rs @@ -40,7 +40,7 @@ mod tests { }, entities::{ coins::coin::CompressedCoin, - message::{ + relayer::message::{ Message, MessageV1, }, diff --git a/crates/fuel-core/src/graphql_api/database.rs b/crates/fuel-core/src/graphql_api/database.rs index 5ab0e09ead..d06d186a70 100644 --- a/crates/fuel-core/src/graphql_api/database.rs +++ b/crates/fuel-core/src/graphql_api/database.rs @@ -33,7 +33,7 @@ use fuel_core_types::{ DaBlockHeight, }, }, - entities::message::{ + entities::relayer::message::{ MerkleProof, Message, }, diff --git a/crates/fuel-core/src/graphql_api/ports.rs b/crates/fuel-core/src/graphql_api/ports.rs index 069852e596..20f1ddb74a 100644 --- a/crates/fuel-core/src/graphql_api/ports.rs +++ b/crates/fuel-core/src/graphql_api/ports.rs @@ -28,7 +28,7 @@ use fuel_core_types::{ DaBlockHeight, }, }, - entities::message::{ + entities::relayer::message::{ MerkleProof, Message, }, diff --git a/crates/fuel-core/src/query/message.rs b/crates/fuel-core/src/query/message.rs index 8820a1521e..b9e527272b 100644 --- a/crates/fuel-core/src/query/message.rs +++ b/crates/fuel-core/src/query/message.rs @@ -28,7 +28,7 @@ use fuel_core_storage::{ }; use fuel_core_types::{ blockchain::block::CompressedBlock, - entities::message::{ + entities::relayer::message::{ MerkleProof, Message, MessageProof, diff --git a/crates/fuel-core/src/query/message/test.rs b/crates/fuel-core/src/query/message/test.rs index 2c40700fdf..2d1e6759d4 100644 --- a/crates/fuel-core/src/query/message/test.rs +++ b/crates/fuel-core/src/query/message/test.rs @@ -6,7 +6,7 @@ use fuel_core_types::{ ConsensusHeader, PartialBlockHeader, }, - entities::message::MerkleProof, + entities::relayer::message::MerkleProof, fuel_tx::{ Script, Transaction, diff --git a/crates/fuel-core/src/schema/message.rs b/crates/fuel-core/src/schema/message.rs index 43cdd8379f..f2dfc16639 100644 --- a/crates/fuel-core/src/schema/message.rs +++ b/crates/fuel-core/src/schema/message.rs @@ -33,7 +33,7 @@ use async_graphql::{ }; use fuel_core_types::entities; -pub struct Message(pub(crate) entities::message::Message); +pub struct Message(pub(crate) entities::relayer::message::Message); #[Object] impl Message { @@ -158,7 +158,7 @@ impl MessageQuery { Ok(status.into()) } } -pub struct MerkleProof(pub(crate) entities::message::MerkleProof); +pub struct MerkleProof(pub(crate) entities::relayer::message::MerkleProof); #[Object] impl MerkleProof { @@ -176,7 +176,7 @@ impl MerkleProof { } } -pub struct MessageProof(pub(crate) entities::message::MessageProof); +pub struct MessageProof(pub(crate) entities::relayer::message::MessageProof); #[Object] impl MessageProof { @@ -217,19 +217,19 @@ impl MessageProof { } } -impl From for Message { - fn from(message: entities::message::Message) -> Self { +impl From for Message { + fn from(message: entities::relayer::message::Message) -> Self { Message(message) } } -impl From for MerkleProof { - fn from(proof: entities::message::MerkleProof) -> Self { +impl From for MerkleProof { + fn from(proof: entities::relayer::message::MerkleProof) -> Self { MerkleProof(proof) } } -pub struct MessageStatus(pub(crate) entities::message::MessageStatus); +pub struct MessageStatus(pub(crate) entities::relayer::message::MessageStatus); #[derive(Enum, Copy, Clone, Eq, PartialEq)] enum MessageState { @@ -242,15 +242,15 @@ enum MessageState { impl MessageStatus { async fn state(&self) -> MessageState { match self.0.state { - entities::message::MessageState::Unspent => MessageState::Unspent, - entities::message::MessageState::Spent => MessageState::Spent, - entities::message::MessageState::NotFound => MessageState::NotFound, + entities::relayer::message::MessageState::Unspent => MessageState::Unspent, + entities::relayer::message::MessageState::Spent => MessageState::Spent, + entities::relayer::message::MessageState::NotFound => MessageState::NotFound, } } } -impl From for MessageStatus { - fn from(status: entities::message::MessageStatus) -> Self { +impl From for MessageStatus { + fn from(status: entities::relayer::message::MessageStatus) -> Self { MessageStatus(status) } } diff --git a/crates/fuel-core/src/service/adapters/graphql_api.rs b/crates/fuel-core/src/service/adapters/graphql_api.rs index b3ef02fc74..8cfedc3c32 100644 --- a/crates/fuel-core/src/service/adapters/graphql_api.rs +++ b/crates/fuel-core/src/service/adapters/graphql_api.rs @@ -24,7 +24,7 @@ use fuel_core_txpool::{ types::TxId, }; use fuel_core_types::{ - entities::message::MerkleProof, + entities::relayer::message::MerkleProof, fuel_tx::{ Bytes32, Transaction, diff --git a/crates/fuel-core/src/service/adapters/graphql_api/on_chain.rs b/crates/fuel-core/src/service/adapters/graphql_api/on_chain.rs index 1662133ecc..f550abf28c 100644 --- a/crates/fuel-core/src/service/adapters/graphql_api/on_chain.rs +++ b/crates/fuel-core/src/service/adapters/graphql_api/on_chain.rs @@ -27,7 +27,7 @@ use fuel_core_types::{ block::CompressedBlock, primitives::DaBlockHeight, }, - entities::message::Message, + entities::relayer::message::Message, fuel_tx::AssetId, fuel_types::{ BlockHeight, diff --git a/crates/fuel-core/src/service/adapters/txpool.rs b/crates/fuel-core/src/service/adapters/txpool.rs index 02914e0f5d..15ccc2b4e4 100644 --- a/crates/fuel-core/src/service/adapters/txpool.rs +++ b/crates/fuel-core/src/service/adapters/txpool.rs @@ -20,7 +20,7 @@ use fuel_core_txpool::ports::BlockImporter; use fuel_core_types::{ entities::{ coins::coin::CompressedCoin, - message::Message, + relayer::message::Message, }, fuel_tx::{ Transaction, diff --git a/crates/fuel-core/src/service/genesis.rs b/crates/fuel-core/src/service/genesis.rs index f8dc1db03d..6a07c106f8 100644 --- a/crates/fuel-core/src/service/genesis.rs +++ b/crates/fuel-core/src/service/genesis.rs @@ -52,7 +52,7 @@ use fuel_core_types::{ ContractUtxoInfo, ContractsInfoType, }, - message::Message, + relayer::message::Message, }, fuel_tx::Contract, fuel_types::{ diff --git a/crates/services/executor/src/executor.rs b/crates/services/executor/src/executor.rs index 413ac0a871..38271559b9 100644 --- a/crates/services/executor/src/executor.rs +++ b/crates/services/executor/src/executor.rs @@ -745,6 +745,9 @@ where .events .push(ExecutorEvent::MessageImported(message)); } + Event::Transaction(_) => { + // TODO: implement handling of forced transactions in a later PR + } } } } diff --git a/crates/services/txpool/src/mock_db.rs b/crates/services/txpool/src/mock_db.rs index bbaa5bc15e..0b83e7a533 100644 --- a/crates/services/txpool/src/mock_db.rs +++ b/crates/services/txpool/src/mock_db.rs @@ -9,7 +9,7 @@ use fuel_core_types::{ Coin, CompressedCoin, }, - message::Message, + relayer::message::Message, }, fuel_tx::{ Contract, diff --git a/crates/services/txpool/src/ports.rs b/crates/services/txpool/src/ports.rs index 7a32746c7e..bcc9bbec35 100644 --- a/crates/services/txpool/src/ports.rs +++ b/crates/services/txpool/src/ports.rs @@ -3,7 +3,7 @@ use fuel_core_storage::Result as StorageResult; use fuel_core_types::{ entities::{ coins::coin::CompressedCoin, - message::Message, + relayer::message::Message, }, fuel_tx::{ Transaction, diff --git a/crates/services/txpool/src/txpool/test_helpers.rs b/crates/services/txpool/src/txpool/test_helpers.rs index 05499981a3..7b25ca7ef3 100644 --- a/crates/services/txpool/src/txpool/test_helpers.rs +++ b/crates/services/txpool/src/txpool/test_helpers.rs @@ -1,6 +1,6 @@ use crate::test_helpers::IntoEstimated; use fuel_core_types::{ - entities::message::{ + entities::relayer::message::{ Message, MessageV1, }, From 580166d05e8b09bd7439169fdd083dece2ed269c Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Tue, 19 Mar 2024 23:24:42 -0700 Subject: [PATCH 03/21] newtype helpers --- crates/types/src/entities/relayer/transaction.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs index 4acd7457af..b281625339 100644 --- a/crates/types/src/entities/relayer/transaction.rs +++ b/crates/types/src/entities/relayer/transaction.rs @@ -29,7 +29,17 @@ pub struct RelayedTransactionV1 { /// The hash of a relayed transaction #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive( + Debug, + Clone, + PartialEq, + Eq, + PartialOrd, + Ord, + Hash, + derive_more::Display, + derive_more::From, +)] pub struct RelayedTransactionId(Bytes32); impl RelayedTransaction { From e435eb9c9184caa15ec7ee2983ebd41af52debd5 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Tue, 19 Mar 2024 23:55:04 -0700 Subject: [PATCH 04/21] add test for getting transactions --- crates/services/relayer/src/mock_db.rs | 12 ++++++ crates/services/relayer/src/test_helpers.rs | 19 +++++++++- crates/services/relayer/tests/integration.rs | 39 +++++++++++++++++++- 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/crates/services/relayer/src/mock_db.rs b/crates/services/relayer/src/mock_db.rs index 043a659c15..b667de596c 100644 --- a/crates/services/relayer/src/mock_db.rs +++ b/crates/services/relayer/src/mock_db.rs @@ -52,6 +52,18 @@ impl MockDb { .iter() .find_map(|(_, map)| map.get(id).cloned()) } + + pub fn get_transaction( + &self, + id: &RelayedTransactionId, + ) -> Option { + self.data + .lock() + .unwrap() + .transactions + .iter() + .find_map(|(_, map)| map.get(id).cloned()) + } } impl RelayerDb for MockDb { diff --git a/crates/services/relayer/src/test_helpers.rs b/crates/services/relayer/src/test_helpers.rs index ce59fcef13..6eae963bc6 100644 --- a/crates/services/relayer/src/test_helpers.rs +++ b/crates/services/relayer/src/test_helpers.rs @@ -23,7 +23,10 @@ use ethers_core::{ }, }; use fuel_core_types::{ - entities::Message, + entities::{ + Message, + RelayedTransaction, + }, fuel_types::Address, }; @@ -31,6 +34,7 @@ pub mod middleware; pub trait LogTestHelper { fn to_msg(&self) -> Message; + fn to_tx(&self) -> RelayedTransaction; } pub trait EvtToLog { @@ -44,6 +48,13 @@ impl LogTestHelper for Log { _ => panic!("This log does not form a message"), } } + + fn to_tx(&self) -> RelayedTransaction { + match EthEventLog::try_from(self).unwrap() { + EthEventLog::Transaction(t) => RelayedTransaction::from(t), + _ => panic!("This log does not form a message"), + } + } } impl EvtToLog for crate::abi::bridge::MessageSentFilter { @@ -52,6 +63,12 @@ impl EvtToLog for crate::abi::bridge::MessageSentFilter { } } +impl EvtToLog for crate::abi::bridge::TransactionFilter { + fn into_log(self) -> Log { + event_to_log(self, &crate::abi::bridge::MESSAGESENT_ABI) + } +} + pub fn event_to_log(event: E, abi: ðers_core::abi::Abi) -> Log where E: EthEvent, diff --git a/crates/services/relayer/tests/integration.rs b/crates/services/relayer/tests/integration.rs index d93118439b..612bb95233 100644 --- a/crates/services/relayer/tests/integration.rs +++ b/crates/services/relayer/tests/integration.rs @@ -2,7 +2,10 @@ use ethers_core::types::U256; use fuel_core_relayer::{ - bridge::MessageSentFilter, + bridge::{ + MessageSentFilter, + TransactionFilter, + }, mock_db::MockDb, new_service_test, ports::RelayerDb, @@ -124,6 +127,40 @@ async fn can_get_messages() { } } +#[tokio::test(start_paused = true)] +async fn can_get_transactions() { + let mock_db = MockDb::default(); + let eth_node = MockMiddleware::default(); + + let config = Config::default(); + let contract_address = config.eth_v2_listening_contracts[0]; + let transaction = |max_gas: u64, block_number: u64| { + let transaction = TransactionFilter { + max_gas, + ..Default::default() + }; + let mut log = transaction.into_log(); + log.address = contract_address; + log.block_number = Some(block_number.into()); + log + }; + + let logs = vec![transaction(2, 1), transaction(3, 2)]; + let expected_transactions: Vec<_> = logs.iter().map(|l| l.to_tx()).collect(); + eth_node.update_data(|data| data.logs_batch = vec![logs.clone()]); + // Setup the eth node with a block high enough that there + // will be some finalized blocks. + eth_node.update_data(|data| data.best_block.number = Some(100.into())); + let relayer = new_service_test(eth_node, mock_db.clone(), config); + relayer.start_and_await().await.unwrap(); + + relayer.shared.await_synced().await.unwrap(); + + for tx in expected_transactions { + assert_eq!(mock_db.get_transaction(&tx.relayed_id()).unwrap(), tx); + } +} + #[tokio::test(start_paused = true)] async fn deploy_height_is_set() { let mock_db = MockDb::default(); From bba8e436e38d3a4f2289c8ed819b408edc417d90 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Wed, 20 Mar 2024 00:01:53 -0700 Subject: [PATCH 05/21] add todo --- crates/types/src/entities/relayer/transaction.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs index b281625339..62c71abe50 100644 --- a/crates/types/src/entities/relayer/transaction.rs +++ b/crates/types/src/entities/relayer/transaction.rs @@ -64,7 +64,8 @@ impl RelayedTransactionV1 { let hasher = fuel_crypto::Hasher::default() .chain(self.max_gas.to_be_bytes()) .chain(self.serialized_transaction.as_slice()); - + /// TODO: This needs some kind of nonce, potentially using the block number + event idx + /// if the contract won't provide it. RelayedTransactionId((*hasher.finalize()).into()) } } From 335733e52c273f96274a785f3604ba507c464942 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Wed, 20 Mar 2024 17:27:18 -0700 Subject: [PATCH 06/21] fix comment --- crates/types/src/entities/relayer/transaction.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs index 62c71abe50..bdecc4f615 100644 --- a/crates/types/src/entities/relayer/transaction.rs +++ b/crates/types/src/entities/relayer/transaction.rs @@ -64,8 +64,7 @@ impl RelayedTransactionV1 { let hasher = fuel_crypto::Hasher::default() .chain(self.max_gas.to_be_bytes()) .chain(self.serialized_transaction.as_slice()); - /// TODO: This needs some kind of nonce, potentially using the block number + event idx - /// if the contract won't provide it. + // TODO: We need some kind of assurance from L1 that this ID is unique RelayedTransactionId((*hasher.finalize()).into()) } } From 3943f6776366e057c65ab296000c34c7e9405ba8 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Wed, 20 Mar 2024 17:38:12 -0700 Subject: [PATCH 07/21] remove commented out code --- crates/services/relayer/src/config.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/services/relayer/src/config.rs b/crates/services/relayer/src/config.rs index e8a9b8e53f..47673f0cc9 100644 --- a/crates/services/relayer/src/config.rs +++ b/crates/services/relayer/src/config.rs @@ -16,8 +16,6 @@ pub(crate) static ETH_LOG_MESSAGE: Lazy = pub(crate) static ETH_FORCED_TX: Lazy = Lazy::new(crate::abi::bridge::TransactionFilter::signature); -// pub(crate) static ETH_LOG_TRANSACTION: Lazy = Lazy::new(crate::abi::bridge::) - // TODO: Move settlement fields into `ChainConfig` because it is part of the consensus. #[derive(Clone, Debug)] /// Configuration settings for the Relayer. From 63649565ca3b0d90eec2765f3ce68f5cedbbeeef Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Wed, 20 Mar 2024 18:09:16 -0700 Subject: [PATCH 08/21] add some extra testing --- crates/services/relayer/src/ports/tests.rs | 121 +++++++++++------- .../types/src/entities/relayer/transaction.rs | 35 ++++- 2 files changed, 110 insertions(+), 46 deletions(-) diff --git a/crates/services/relayer/src/ports/tests.rs b/crates/services/relayer/src/ports/tests.rs index 449808dfde..68abe106e4 100644 --- a/crates/services/relayer/src/ports/tests.rs +++ b/crates/services/relayer/src/ports/tests.rs @@ -14,7 +14,13 @@ use fuel_core_storage::test_helpers::{ MockBasic, MockStorage, }; -use fuel_core_types::entities::relayer::message::Message; +use fuel_core_types::{ + entities::{ + relayer::message::Message, + RelayedTransaction, + }, + services::relayer::Event, +}; use std::borrow::Cow; use test_case::test_case; @@ -119,58 +125,85 @@ fn insert_always_raises_da_height_monotonically() { } #[test] -fn insert_fails_for_messages_with_different_height() { - // Given - let last_height = 1u64; - let events: Vec<_> = (0..=last_height) - .map(|i| { - let mut message = Message::default(); - message.set_da_height(i.into()); - message.set_amount(i); - message.into() - }) - .collect(); - - let mut db = MockDatabase { - data: Box::new(DBTx::default), - storage: Default::default(), - }; - - // When - let result = db.insert_events(&last_height.into(), &events); +fn insert_fails_for_events_with_different_height() { + fn inner_test Event>(f: F) { + // Given + let last_height = 1u64; + let events: Vec<_> = (0..=last_height).map(f).collect(); + + let mut db = MockDatabase { + data: Box::new(DBTx::default), + storage: Default::default(), + }; + + // When + let result = db.insert_events(&last_height.into(), &events); + + // Then + let err = result.expect_err( + "Should return error since DA message heights are different between each other", + ); + assert!(err.to_string().contains("Invalid da height")); + } - // Then - let err = result.expect_err( - "Should return error since DA message heights are different between each other", - ); - assert!(err.to_string().contains("Invalid da height")); + // test with messages + inner_test(|i| { + let mut message = Message::default(); + message.set_da_height(i.into()); + message.set_amount(i); + message.into() + }); + + // test with forced transactions + inner_test(|i| { + let mut transaction = RelayedTransaction::default(); + transaction.set_da_height(i.into()); + transaction.set_mas_gas(i); + transaction.into() + }) } #[test] -fn insert_fails_for_messages_same_height_but_on_different_height() { - // Given +fn insert_fails_for_events_same_height_but_on_different_height() { + fn inner_test Event>(f: F, last_height: u64) { + // Given + let events: Vec<_> = (0..=last_height).map(f).collect(); + + // When + let mut db = MockDatabase { + data: Box::new(DBTx::default), + storage: Default::default(), + }; + let next_height = last_height + 1; + let result = db.insert_events(&next_height.into(), &events); + + // Then + let err = + result.expect_err("Should return error since DA message heights and commit da heights are different"); + assert!(err.to_string().contains("Invalid da height")); + } + let last_height = 1u64; - let events: Vec<_> = (0..=last_height) - .map(|i| { + // messages + inner_test( + |i| { let mut message = Message::default(); message.set_da_height(last_height.into()); message.set_amount(i); message.into() - }) - .collect(); - - // When - let mut db = MockDatabase { - data: Box::new(DBTx::default), - storage: Default::default(), - }; - let next_height = last_height + 1; - let result = db.insert_events(&next_height.into(), &events); - - // Then - let err = - result.expect_err("Should return error since DA message heights and commit da heights are different"); - assert!(err.to_string().contains("Invalid da height")); + }, + last_height, + ); + // relayed transactions + inner_test( + |i| { + let mut transaction = RelayedTransaction::default(); + transaction.set_da_height(last_height.into()); + transaction.set_mas_gas(i); + transaction.into() + }, + last_height, + ); } #[test_case(None, 0, 0; "can set DA height to 0 when there is none available")] diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs index bdecc4f615..949808795e 100644 --- a/crates/types/src/entities/relayer/transaction.rs +++ b/crates/types/src/entities/relayer/transaction.rs @@ -15,9 +15,15 @@ pub enum RelayedTransaction { V1(RelayedTransactionV1), } +impl Default for RelayedTransaction { + fn default() -> Self { + Self::V1(Default::default()) + } +} + /// The V1 version of the relayed transaction #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Default, Debug, Clone, PartialEq, Eq)] pub struct RelayedTransactionV1 { /// The max gas that this transaction can consume pub max_gas: u64, @@ -43,13 +49,38 @@ pub struct RelayedTransactionV1 { pub struct RelayedTransactionId(Bytes32); impl RelayedTransaction { - /// Get the DA height the transaction originated from + /// Get the DA height that originated this transaction from L1 pub fn da_height(&self) -> DaBlockHeight { match self { RelayedTransaction::V1(transaction) => transaction.da_height, } } + /// Set the da height + pub fn set_da_height(&mut self, height: DaBlockHeight) { + match self { + RelayedTransaction::V1(transaction) => { + transaction.da_height = height; + } + } + } + + /// Get the max gas + pub fn max_gas(&self) -> u64 { + match self { + RelayedTransaction::V1(transaction) => transaction.max_gas, + } + } + + /// Set the max gas + pub fn set_mas_gas(&mut self, max_gas: u64) { + match self { + RelayedTransaction::V1(transaction) => { + transaction.max_gas = max_gas; + } + } + } + /// The hash of the relayed transaction pub fn relayed_id(&self) -> RelayedTransactionId { match &self { From a69fcde886483c14599e524d4a4304701fbfbee8 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Wed, 20 Mar 2024 18:10:42 -0700 Subject: [PATCH 09/21] add transaction events to real storage tests --- crates/services/relayer/src/storage.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/services/relayer/src/storage.rs b/crates/services/relayer/src/storage.rs index 3ef5438d46..7c7b0a7056 100644 --- a/crates/services/relayer/src/storage.rs +++ b/crates/services/relayer/src/storage.rs @@ -221,6 +221,9 @@ mod tests { fuel_core_storage::basic_storage_tests!( EventsHistory, ::Key::default(), - vec![Event::Message(Default::default())] + vec![ + Event::Message(Default::default()), + Event::Transaction(Default::default()) + ] ); } From 64bfac6d81440600f8002d66ef6c31fb6ea50c7f Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Wed, 20 Mar 2024 18:11:52 -0700 Subject: [PATCH 10/21] CHANGELOG.md --- CHANGELOG.md | 587 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 398 insertions(+), 189 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd9152bd03..15ef792666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Change Log + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) @@ -10,136 +11,229 @@ Description of the upcoming release here. ### Added +- [#1770](https://github.com/FuelLabs/fuel-core/pull/1770): Add the new L1 event type for forced transactions. - [#1747](https://github.com/FuelLabs/fuel-core/pull/1747): The DA block height is now included in the genesis state. - [#1740](https://github.com/FuelLabs/fuel-core/pull/1740): Remove optional fields from genesis configs -- [#1737](https://github.com/FuelLabs/fuel-core/pull/1737): Remove temporary tables for calculating roots during genesis. +- [#1737](https://github.com/FuelLabs/fuel-core/pull/1737): Remove temporary tables for calculating roots during + genesis. - [#1731](https://github.com/FuelLabs/fuel-core/pull/1731): Expose `schema.sdl` from `fuel-core-client`. ### Changed #### Breaking -- [#1694](https://github.com/FuelLabs/fuel-core/pull/1694): The change moves the database transaction logic from the `fuel-core` to the `fuel-core-storage` level. The corresponding [issue](https://github.com/FuelLabs/fuel-core/issues/1589) described the reason behind it. - ## Technical details of implementation +- [#1694](https://github.com/FuelLabs/fuel-core/pull/1694): The change moves the database transaction logic from + the `fuel-core` to the `fuel-core-storage` level. The + corresponding [issue](https://github.com/FuelLabs/fuel-core/issues/1589) described the reason behind it. - - The change splits the `KeyValueStore` into `KeyValueInspect` and `KeyValueMutate`, as well the `Blueprint` into `BlueprintInspect` and `BlueprintMutate`. It allows requiring less restricted constraints for any read-related operations. + ## Technical details of implementation + + - The change splits the `KeyValueStore` into `KeyValueInspect` and `KeyValueMutate`, as well the `Blueprint` + into `BlueprintInspect` and `BlueprintMutate`. 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` + and `Modifiable` without the `KeyValueMutate`. It simplifies work with the databases and provides a safe way of + interacting with them (Modification into the database can only go through the `Modifiable::commit_changes`). This + feature is used + to [track the height](https://github.com/FuelLabs/fuel-core/pull/1694/files#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898) + 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](https://github.com/FuelLabs/fuel-core/pull/1694/commits/7b1141ac838568e3590f09dd420cb24a6946bd32). + + - The `StorageTransaction` is a `StructuredStorage` that uses `InMemoryTransaction` inside to accumulate + modifications. Only `InMemoryTransaction` has a real implementation of the `KeyValueMutate`(Other types only + implement it in tests). + + - The implementation of the `Modifiable` for the `Database` contains a business logic that provides additional + safety but limits the usage of the database. The `Database` now tracks its height and is responsible for its + updates. In the `commit_changes` function, it analyzes the changes that were done and tries to find a new height( + For example, in the case of the `OnChain` database, we are looking for a new `Block` in the `FuelBlocks` table). - - One of the main ideas of the change is to allow for the actual storage only to implement `KeyValueInspect` and `Modifiable` without the `KeyValueMutate`. It simplifies work with the databases and provides a safe way of interacting with them (Modification into the database can only go through the `Modifiable::commit_changes`). This feature is used to [track the height](https://github.com/FuelLabs/fuel-core/pull/1694/files#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898) 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](https://github.com/FuelLabs/fuel-core/pull/1694/commits/7b1141ac838568e3590f09dd420cb24a6946bd32). - - - The `StorageTransaction` is a `StructuredStorage` that uses `InMemoryTransaction` inside to accumulate modifications. Only `InMemoryTransaction` has a real implementation of the `KeyValueMutate`(Other types only implement it in tests). - - - The implementation of the `Modifiable` for the `Database` contains a business logic that provides additional safety but limits the usage of the database. The `Database` now tracks its height and is responsible for its updates. In the `commit_changes` function, it analyzes the changes that were done and tries to find a new height(For example, in the case of the `OnChain` database, we are looking for a new `Block` in the `FuelBlocks` 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 the `Database` implements the `Clone` trait. To be sure that we don't corrupt the state of the database, the `commit_changes` function implements additional safety checks to be sure that we commit updates per each height only once time. - - Side changes: - - The `drop` function was moved from `Database` to `RocksDB` as a preparation for the state rewind since the read view should also keep the drop function until it is destroyed. - - The `StatisticTable` table lives in the off-chain worker. - - Removed duplication of the `Database` from the `dap::ConcreteStorage` since it is already available from the VM. - - The executor return only produced `Changes` instead of the storage transaction, which simplifies the interaction between modules and port definition. - - The logic related to the iteration over the storage is moved to the `fuel-core-storage` crate and is now reusable. It provides an `interator` method that duplicates the logic from `MemoryStore` on iterating over the `BTreeMap` and methods like `iter_all`, `iter_all_by_prefix`, etc. It was done in a separate revivable [commit](https://github.com/FuelLabs/fuel-core/pull/1694/commits/5b9bd78320e6f36d0650ec05698f12f7d1b3c7c9). - - The `MemoryTransactionView` is fully replaced by the `StorageTransactionInner`. - - Removed `flush` method from the `Database` since it is not needed after https://github.com/FuelLabs/fuel-core/pull/1664. + - 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 the `Database` + implements the `Clone` trait. To be sure that we don't corrupt the state of the database, the `commit_changes` + function implements additional safety checks to be sure that we commit updates per each height only once time. -- [#1693](https://github.com/FuelLabs/fuel-core/pull/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. + - Side changes: + - The `drop` function was moved from `Database` to `RocksDB` as a preparation for the state rewind since the + read view should also keep the drop function until it is destroyed. + - The `StatisticTable` table lives in the off-chain worker. + - Removed duplication of the `Database` from the `dap::ConcreteStorage` since it is already available from the + VM. + - The executor return only produced `Changes` instead of the storage transaction, which simplifies the + interaction between modules and port definition. + - The logic related to the iteration over the storage is moved to the `fuel-core-storage` crate and is now + reusable. It provides an `interator` method that duplicates the logic from `MemoryStore` on iterating over + the `BTreeMap` and methods like `iter_all`, `iter_all_by_prefix`, etc. It was done in a separate + revivable [commit](https://github.com/FuelLabs/fuel-core/pull/1694/commits/5b9bd78320e6f36d0650ec05698f12f7d1b3c7c9). + - The `MemoryTransactionView` is fully replaced by the `StorageTransactionInner`. + - Removed `flush` method from the `Database` since it is not needed + after https://github.com/FuelLabs/fuel-core/pull/1664. + +- [#1693](https://github.com/FuelLabs/fuel-core/pull/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 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 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. + 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. + 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. + 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. - + 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. ## [Version 0.23.0] ### 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. +- [#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. ### Changed - [#1723](https://github.com/FuelLabs/fuel-core/pull/1723): Notify about imported blocks from the off-chain worker. -- [#1717](https://github.com/FuelLabs/fuel-core/pull/1717): The fix for the [#1657](https://github.com/FuelLabs/fuel-core/pull/1657) to include the contract into `ContractsInfo` table. +- [#1717](https://github.com/FuelLabs/fuel-core/pull/1717): The fix for + the [#1657](https://github.com/FuelLabs/fuel-core/pull/1657) to include the contract into `ContractsInfo` table. - [#1657](https://github.com/FuelLabs/fuel-core/pull/1657): Upgrade to `fuel-vm` 0.46.0. -- [#1671](https://github.com/FuelLabs/fuel-core/pull/1671): The logic related to the `FuelBlockIdsToHeights` is moved to the off-chain worker. +- [#1671](https://github.com/FuelLabs/fuel-core/pull/1671): The logic related to the `FuelBlockIdsToHeights` is moved to + the off-chain worker. - [#1663](https://github.com/FuelLabs/fuel-core/pull/1663): Reduce the punishment criteria for mempool gossipping. -- [#1658](https://github.com/FuelLabs/fuel-core/pull/1658): Removed `Receipts` table. Instead, receipts are part of the `TransactionStatuses` table. +- [#1658](https://github.com/FuelLabs/fuel-core/pull/1658): Removed `Receipts` table. Instead, receipts are part of + the `TransactionStatuses` table. - [#1640](https://github.com/FuelLabs/fuel-core/pull/1640): Upgrade to fuel-vm 0.45.0. -- [#1635](https://github.com/FuelLabs/fuel-core/pull/1635): Move updating of the owned messages and coins to off-chain worker. +- [#1635](https://github.com/FuelLabs/fuel-core/pull/1635): Move updating of the owned messages and coins to off-chain + worker. - [#1650](https://github.com/FuelLabs/fuel-core/pull/1650): Add api endpoint for getting estimates for future gas prices - [#1649](https://github.com/FuelLabs/fuel-core/pull/1649): Add api endpoint for getting latest gas price - [#1600](https://github.com/FuelLabs/fuel-core/pull/1640): Upgrade to fuel-vm 0.45.0 - [#1633](https://github.com/FuelLabs/fuel-core/pull/1633): Notify services about importing of the genesis block. -- [#1625](https://github.com/FuelLabs/fuel-core/pull/1625): Making relayer independent from the executor and preparation for the force transaction inclusion. +- [#1625](https://github.com/FuelLabs/fuel-core/pull/1625): Making relayer independent from the executor and preparation + for the force transaction inclusion. - [#1613](https://github.com/FuelLabs/fuel-core/pull/1613): Add api endpoint to retrieve a message by its nonce. - [#1612](https://github.com/FuelLabs/fuel-core/pull/1612): Use `AtomicView` in all services for consistent results. - [#1597](https://github.com/FuelLabs/fuel-core/pull/1597): Unify namespacing for `libp2p` modules -- [#1591](https://github.com/FuelLabs/fuel-core/pull/1591): Simplify libp2p dependencies and not depend on all sub modules directly. -- [#1590](https://github.com/FuelLabs/fuel-core/pull/1590): Use `AtomicView` in the `TxPool` to read the state of the database during insertion of the transactions. -- [#1587](https://github.com/FuelLabs/fuel-core/pull/1587): Use `BlockHeight` as a primary key for the `FuelsBlock` table. -- [#1585](https://github.com/FuelLabs/fuel-core/pull/1585): Let `NetworkBehaviour` macro generate `FuelBehaviorEvent` in p2p -- [#1579](https://github.com/FuelLabs/fuel-core/pull/1579): The change extracts the off-chain-related logic from the executor and moves it to the GraphQL off-chain worker. It creates two new concepts - Off-chain and On-chain databases where the GraphQL worker has exclusive ownership of the database and may modify it without intersecting with the On-chain database. -- [#1577](https://github.com/FuelLabs/fuel-core/pull/1577): Moved insertion of sealed blocks into the `BlockImporter` instead of the executor. -- [#1574](https://github.com/FuelLabs/fuel-core/pull/1574): Penalizes peers for sending invalid responses or for not replying at all. -- [#1601](https://github.com/FuelLabs/fuel-core/pull/1601): Fix formatting in docs and check that `cargo doc` passes in the CI. +- [#1591](https://github.com/FuelLabs/fuel-core/pull/1591): Simplify libp2p dependencies and not depend on all sub + modules directly. +- [#1590](https://github.com/FuelLabs/fuel-core/pull/1590): Use `AtomicView` in the `TxPool` to read the state of the + database during insertion of the transactions. +- [#1587](https://github.com/FuelLabs/fuel-core/pull/1587): Use `BlockHeight` as a primary key for the `FuelsBlock` + table. +- [#1585](https://github.com/FuelLabs/fuel-core/pull/1585): Let `NetworkBehaviour` macro generate `FuelBehaviorEvent` in + p2p +- [#1579](https://github.com/FuelLabs/fuel-core/pull/1579): The change extracts the off-chain-related logic from the + executor and moves it to the GraphQL off-chain worker. It creates two new concepts - Off-chain and On-chain databases + where the GraphQL worker has exclusive ownership of the database and may modify it without intersecting with the + On-chain database. +- [#1577](https://github.com/FuelLabs/fuel-core/pull/1577): Moved insertion of sealed blocks into the `BlockImporter` + instead of the executor. +- [#1574](https://github.com/FuelLabs/fuel-core/pull/1574): Penalizes peers for sending invalid responses or for not + replying at all. +- [#1601](https://github.com/FuelLabs/fuel-core/pull/1601): Fix formatting in docs and check that `cargo doc` passes in + the CI. - [#1636](https://github.com/FuelLabs/fuel-core/pull/1636): Add more docs to GraphQL DAP API. #### Breaking -- [#1725](https://github.com/FuelLabs/fuel-core/pull/1725): All API endpoints now are prefixed with `/v1` version. New usage looks like: `/v1/playground`, `/v1/graphql`, `/v1/graphql-sub`, `/v1/metrics`, `/v1/health`. -- [#1722](https://github.com/FuelLabs/fuel-core/pull/1722): Bugfix: Zero `predicate_gas_used` field during validation of the produced block. -- [#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` 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`. -- [#1675](https://github.com/FuelLabs/fuel-core/pull/1675): Simplify GQL schema by disabling contract resolvers in most cases, and just return a ContractId scalar instead. -- [#1658](https://github.com/FuelLabs/fuel-core/pull/1658): Receipts are part of the transaction status. - Removed `reason` from the `TransactionExecutionResult::Failed`. It can be calculated based on the program state and receipts. - Also, it is not possible to fetch `receipts` from the `Transaction` directly anymore. Instead, you need to fetch `status` and its receipts. +- [#1725](https://github.com/FuelLabs/fuel-core/pull/1725): All API endpoints now are prefixed with `/v1` version. New + usage looks like: `/v1/playground`, `/v1/graphql`, `/v1/graphql-sub`, `/v1/metrics`, `/v1/health`. +- [#1722](https://github.com/FuelLabs/fuel-core/pull/1722): Bugfix: Zero `predicate_gas_used` field during validation of + the produced block. +- [#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` 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`. +- [#1675](https://github.com/FuelLabs/fuel-core/pull/1675): Simplify GQL schema by disabling contract resolvers in most + cases, and just return a ContractId scalar instead. +- [#1658](https://github.com/FuelLabs/fuel-core/pull/1658): Receipts are part of the transaction status. + Removed `reason` from the `TransactionExecutionResult::Failed`. It can be calculated based on the program state and + receipts. + Also, it is not possible to fetch `receipts` from the `Transaction` directly anymore. Instead, you need to + fetch `status` and its receipts. - [#1646](https://github.com/FuelLabs/fuel-core/pull/1646): Remove redundant receipts from queries. -- [#1639](https://github.com/FuelLabs/fuel-core/pull/1639): Make Merkle metadata, i.e. `SparseMerkleMetadata` and `DenseMerkleMetadata` type version-able enums +- [#1639](https://github.com/FuelLabs/fuel-core/pull/1639): Make Merkle metadata, i.e. `SparseMerkleMetadata` + and `DenseMerkleMetadata` type version-able enums - [#1632](https://github.com/FuelLabs/fuel-core/pull/1632): Make `Message` type a version-able enum - [#1631](https://github.com/FuelLabs/fuel-core/pull/1631): Modify api endpoint to dry run multiple transactions. -- [#1629](https://github.com/FuelLabs/fuel-core/pull/1629): Use a separate database for each data domain. Each database has its own folder where data is stored. +- [#1629](https://github.com/FuelLabs/fuel-core/pull/1629): Use a separate database for each data domain. Each database + has its own folder where data is stored. - [#1628](https://github.com/FuelLabs/fuel-core/pull/1628): Make `CompressedCoin` type a version-able enum - [#1616](https://github.com/FuelLabs/fuel-core/pull/1616): Make `BlockHeader` type a version-able enum -- [#1614](https://github.com/FuelLabs/fuel-core/pull/1614): Use the default consensus key regardless of trigger mode. The change is breaking because it removes the `--dev-keys` argument. If the `debug` flag is set, the default consensus key will be used, regardless of the trigger mode. +- [#1614](https://github.com/FuelLabs/fuel-core/pull/1614): Use the default consensus key regardless of trigger mode. + The change is breaking because it removes the `--dev-keys` argument. If the `debug` flag is set, the default consensus + key will be used, regardless of the trigger mode. - [#1596](https://github.com/FuelLabs/fuel-core/pull/1596): Make `Consensus` type a version-able enum - [#1593](https://github.com/FuelLabs/fuel-core/pull/1593): Make `Block` type a version-able enum -- [#1576](https://github.com/FuelLabs/fuel-core/pull/1576): The change moves the implementation of the storage traits for required tables from `fuel-core` to `fuel-core-storage` crate. The change also adds a more flexible configuration of the encoding/decoding per the table and allows the implementation of specific behaviors for the table in a much easier way. It unifies the encoding between database, SMTs, and iteration, preventing mismatching bytes representation on the Rust type system level. Plus, it increases the re-usage of the code by applying the same blueprint to other tables. - - It is a breaking PR because it changes database encoding/decoding for some tables. - - ### StructuredStorage - - The change adds a new type `StructuredStorage`. It is a wrapper around the key-value storage that implements the storage traits(`StorageInspect`, `StorageMutate`, `StorageRead`, etc) for the tables with blueprint. This blueprint works in tandem with the `TableWithBlueprint` trait. The table may implement `TableWithBlueprint` specifying the blueprint, as an example: - +- [#1576](https://github.com/FuelLabs/fuel-core/pull/1576): The change moves the implementation of the storage traits + for required tables from `fuel-core` to `fuel-core-storage` crate. The change also adds a more flexible configuration + of the encoding/decoding per the table and allows the implementation of specific behaviors for the table in a much + easier way. It unifies the encoding between database, SMTs, and iteration, preventing mismatching bytes representation + on the Rust type system level. Plus, it increases the re-usage of the code by applying the same blueprint to other + tables. + + It is a breaking PR because it changes database encoding/decoding for some tables. + + ### StructuredStorage + + The change adds a new type `StructuredStorage`. It is a wrapper around the key-value storage that implements the + storage traits(`StorageInspect`, `StorageMutate`, `StorageRead`, etc) for the tables with blueprint. This blueprint + works in tandem with the `TableWithBlueprint` trait. The table may implement `TableWithBlueprint` specifying the + blueprint, as an example: + ```rust impl TableWithBlueprint for ContractsRawCode { type Blueprint = Plain; @@ -149,19 +243,25 @@ Description of the upcoming release here. } } ``` - - It is a definition of the blueprint for the `ContractsRawCode` table. It has a plain blueprint meaning it simply encodes/decodes bytes and stores/loads them into/from the storage. As a key codec and value codec, it uses a `Raw` encoding/decoding that simplifies writing bytes and loads them back into the memory without applying any serialization or deserialization algorithm. - - If the table implements `TableWithBlueprint` and the selected codec satisfies all blueprint requirements, the corresponding storage traits for that table are implemented on the `StructuredStorage` type. - - ### Codecs - - Each blueprint allows customizing the key and value codecs. It allows the use of different codecs for different tables, taking into account the complexity and weight of the data and providing a way of more optimal implementation. - - That property may be very useful to perform migration in a more easier way. Plus, it also can be a `no_std` migration potentially allowing its fraud proving. - - An example of migration: - + + It is a definition of the blueprint for the `ContractsRawCode` table. It has a plain blueprint meaning it simply + encodes/decodes bytes and stores/loads them into/from the storage. As a key codec and value codec, it uses a `Raw` + encoding/decoding that simplifies writing bytes and loads them back into the memory without applying any serialization + or deserialization algorithm. + + If the table implements `TableWithBlueprint` and the selected codec satisfies all blueprint requirements, the + corresponding storage traits for that table are implemented on the `StructuredStorage` type. + + ### Codecs + + Each blueprint allows customizing the key and value codecs. It allows the use of different codecs for different + tables, taking into account the complexity and weight of the data and providing a way of more optimal implementation. + + That property may be very useful to perform migration in a more easier way. Plus, it also can be a `no_std` migration + potentially allowing its fraud proving. + + An example of migration: + ```rust /// Define the table for V1 value encoding/decoding. impl TableWithBlueprint for ContractsRawCodeV1 { @@ -192,15 +292,18 @@ Description of the upcoming release here. } } ``` - - ### Structures - - The blueprint of the table defines its behavior. As an example, a `Plain` blueprint simply encodes/decodes bytes and stores/loads them into/from the storage. The `SMT` blueprint builds a sparse merkle tree on top of the key-value pairs. - - Implementing a blueprint one time, we can apply it to any table satisfying the requirements of this blueprint. It increases the re-usage of the code and minimizes duplication. - - It can be useful if we decide to create global roots for all required tables that are used in fraud proving. - + + ### Structures + + The blueprint of the table defines its behavior. As an example, a `Plain` blueprint simply encodes/decodes bytes and + stores/loads them into/from the storage. The `SMT` blueprint builds a sparse merkle tree on top of the key-value + pairs. + + Implementing a blueprint one time, we can apply it to any table satisfying the requirements of this blueprint. It + increases the re-usage of the code and minimizes duplication. + + It can be useful if we decide to create global roots for all required tables that are used in fraud proving. + ```rust impl TableWithBlueprint for SpentMessages { type Blueprint = Plain; @@ -222,28 +325,33 @@ Description of the upcoming release here. } } ``` - - ### Side changes - - #### `iter_all` - The `iter_all` functionality now accepts the table instead of `K` and `V` generics. It is done to use the correct codec during deserialization. Also, the table definition provides the column. - - #### Duplicated unit tests - - The `fuel-core-storage` crate provides macros that generate unit tests. Almost all tables had the same test like `get`, `insert`, `remove`, `exist`. All duplicated tests were moved to macros. The unique one still stays at the same place where it was before. - - #### `StorageBatchMutate` - - Added a new `StorageBatchMutate` trait that we can move to `fuel-storage` crate later. It allows batch operations on the storage. It may be more performant in some cases. -- [#1573](https://github.com/FuelLabs/fuel-core/pull/1573): Remove nested p2p request/response encoding. Only breaks p2p networking compatibility with older fuel-core versions, but is otherwise fully internal. + ### Side changes + + #### `iter_all` + The `iter_all` functionality now accepts the table instead of `K` and `V` generics. It is done to use the correct + codec during deserialization. Also, the table definition provides the column. + + #### Duplicated unit tests + + The `fuel-core-storage` crate provides macros that generate unit tests. Almost all tables had the same test + like `get`, `insert`, `remove`, `exist`. All duplicated tests were moved to macros. The unique one still stays at the + same place where it was before. + + #### `StorageBatchMutate` + + Added a new `StorageBatchMutate` trait that we can move to `fuel-storage` crate later. It allows batch operations on + the storage. It may be more performant in some cases. +- [#1573](https://github.com/FuelLabs/fuel-core/pull/1573): Remove nested p2p request/response encoding. Only breaks p2p + networking compatibility with older fuel-core versions, but is otherwise fully internal. ## [Version 0.22.4] ### Added -- [#1743](https://github.com/FuelLabs/fuel-core/pull/1743): Added blacklisting of the transactions on the `TxPool` level. +- [#1743](https://github.com/FuelLabs/fuel-core/pull/1743): Added blacklisting of the transactions on the `TxPool` + level. ```shell --tx-blacklist-addresses The list of banned addresses ignored by the `TxPool` @@ -270,45 +378,57 @@ Description of the upcoming release here. ### Added -- [#1732](https://github.com/FuelLabs/fuel-core/pull/1732): Added `Clone` bounds to most datatypes of `fuel-core-client`. +- [#1732](https://github.com/FuelLabs/fuel-core/pull/1732): Added `Clone` bounds to most datatypes + of `fuel-core-client`. ## [Version 0.22.2] ### Added -- [#1729](https://github.com/FuelLabs/fuel-core/pull/1729): Exposed the `schema.sdl` file from `fuel-core-client`. The user can create his own queries by using this file. +- [#1729](https://github.com/FuelLabs/fuel-core/pull/1729): Exposed the `schema.sdl` file from `fuel-core-client`. The + user can create his own queries by using this file. ## [Version 0.22.1] ### Fixed -- [#1664](https://github.com/FuelLabs/fuel-core/pull/1664): Fixed long database initialization after restart of the node by setting limit to the WAL file. +- [#1664](https://github.com/FuelLabs/fuel-core/pull/1664): Fixed long database initialization after restart of the node + by setting limit to the WAL file. ## [Version 0.22.0] ### Added -- [#1515](https://github.com/FuelLabs/fuel-core/pull/1515): Added support of `--version` command for `fuel-core-keygen` binary. -- [#1504](https://github.com/FuelLabs/fuel-core/pull/1504): A `Success` or `Failure` variant of `TransactionStatus` returned by a query now contains the associated receipts generated by transaction execution. +- [#1515](https://github.com/FuelLabs/fuel-core/pull/1515): Added support of `--version` command for `fuel-core-keygen` + binary. +- [#1504](https://github.com/FuelLabs/fuel-core/pull/1504): A `Success` or `Failure` variant of `TransactionStatus` + returned by a query now contains the associated receipts generated by transaction execution. #### Breaking -- [#1531](https://github.com/FuelLabs/fuel-core/pull/1531): Make `fuel-core-executor` `no_std` compatible. It affects the `fuel-core` crate because it uses the `fuel-core-executor` crate. The change is breaking because of moved types. + +- [#1531](https://github.com/FuelLabs/fuel-core/pull/1531): Make `fuel-core-executor` `no_std` compatible. It affects + the `fuel-core` crate because it uses the `fuel-core-executor` crate. The change is breaking because of moved types. - [#1524](https://github.com/FuelLabs/fuel-core/pull/1524): Adds information about connected peers to the GQL API. ### Changed -- [#1517](https://github.com/FuelLabs/fuel-core/pull/1517): Changed default gossip heartbeat interval to 500ms. +- [#1517](https://github.com/FuelLabs/fuel-core/pull/1517): Changed default gossip heartbeat interval to 500ms. - [#1520](https://github.com/FuelLabs/fuel-core/pull/1520): Extract `executor` into `fuel-core-executor` crate. ### Fixed #### Breaking -- [#1536](https://github.com/FuelLabs/fuel-core/pull/1536): The change fixes the contracts tables to not touch SMT nodes of foreign contracts. Before, it was possible to invalidate the SMT from another contract. It is a breaking change and requires re-calculating the whole state from the beginning with new SMT roots. -- [#1542](https://github.com/FuelLabs/fuel-core/pull/1542): Migrates information about peers to NodeInfo instead of ChainInfo. It also elides information about peers in the default node_info query. + +- [#1536](https://github.com/FuelLabs/fuel-core/pull/1536): The change fixes the contracts tables to not touch SMT nodes + of foreign contracts. Before, it was possible to invalidate the SMT from another contract. It is a breaking change and + requires re-calculating the whole state from the beginning with new SMT roots. +- [#1542](https://github.com/FuelLabs/fuel-core/pull/1542): Migrates information about peers to NodeInfo instead of + ChainInfo. It also elides information about peers in the default node_info query. ## [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. @@ -316,21 +436,31 @@ This release focuses on preparing `fuel-core` for the mainnet environment: - 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. + +- 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. +- 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 @@ -338,41 +468,57 @@ FuelVM received a lot of safety and stability improvements: - [#1503](https://github.com/FuelLabs/fuel-core/pull/1503): Add `gtf` opcode sanity check. - [#1502](https://github.com/FuelLabs/fuel-core/pull/1502): Added price benchmark for `vm_initialization`. - [#1501](https://github.com/FuelLabs/fuel-core/pull/1501): Add a CLI command for generating a fee collection contract. -- [#1492](https://github.com/FuelLabs/fuel-core/pull/1492): Support backward iteration in the RocksDB. It allows backward queries that were not allowed before. +- [#1492](https://github.com/FuelLabs/fuel-core/pull/1492): Support backward iteration in the RocksDB. It allows + backward queries that were not allowed before. - [#1490](https://github.com/FuelLabs/fuel-core/pull/1490): Add push and pop benchmarks. - [#1485](https://github.com/FuelLabs/fuel-core/pull/1485): Prepare rc release of fuel core v0.21 -- [#1476](https://github.com/FuelLabs/fuel-core/pull/1453): Add the majority of the "other" benchmarks for contract opcodes. +- [#1476](https://github.com/FuelLabs/fuel-core/pull/1453): Add the majority of the "other" benchmarks for contract + opcodes. - [#1473](https://github.com/FuelLabs/fuel-core/pull/1473): Expose fuel-core version as a constant -- [#1469](https://github.com/FuelLabs/fuel-core/pull/1469): Added support of bloom filter for RocksDB tables and increased the block cache. +- [#1469](https://github.com/FuelLabs/fuel-core/pull/1469): Added support of bloom filter for RocksDB tables and + increased the block cache. - [#1465](https://github.com/FuelLabs/fuel-core/pull/1465): Improvements for keygen cli and crates -- [#1642](https://github.com/FuelLabs/fuel-core/pull/1462): Added benchmark to measure the performance of contract state and contract ID calculation; use for gas costing. +- [#1642](https://github.com/FuelLabs/fuel-core/pull/1462): Added benchmark to measure the performance of contract state + and contract ID calculation; use for gas costing. - [#1457](https://github.com/FuelLabs/fuel-core/pull/1457): Fixing incorrect measurement for fast(µs) opcodes. - [#1456](https://github.com/FuelLabs/fuel-core/pull/1456): Added flushing of the RocksDB during a graceful shutdown. - [#1456](https://github.com/FuelLabs/fuel-core/pull/1456): Added more logs to track the service lifecycle. -- [#1453](https://github.com/FuelLabs/fuel-core/pull/1453): Add the majority of the "sanity" benchmarks for contract opcodes. -- [#1452](https://github.com/FuelLabs/fuel-core/pull/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. +- [#1453](https://github.com/FuelLabs/fuel-core/pull/1453): Add the majority of the "sanity" benchmarks for contract + opcodes. +- [#1452](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1449): Fix coin pagination in e2e test client. - [#1447](https://github.com/FuelLabs/fuel-core/pull/1447): Add timeout for continuous e2e tests - [#1444](https://github.com/FuelLabs/fuel-core/pull/1444): Add "sanity" benchmarks for memory opcodes. - [#1437](https://github.com/FuelLabs/fuel-core/pull/1437): Add some transaction throughput tests for basic transfers. - [#1436](https://github.com/FuelLabs/fuel-core/pull/1436): Add a github action to continuously test beta-4. - [#1433](https://github.com/FuelLabs/fuel-core/pull/1433): Add "sanity" benchmarks for flow opcodes. -- [#1432](https://github.com/FuelLabs/fuel-core/pull/1432): Add a new `--api-request-timeout` argument to control TTL for GraphQL requests. +- [#1432](https://github.com/FuelLabs/fuel-core/pull/1432): Add a new `--api-request-timeout` argument to control TTL + for GraphQL requests. - [#1430](https://github.com/FuelLabs/fuel-core/pull/1430): Add "sanity" benchmarks for crypto opcodes. - [#1426](https://github.com/FuelLabs/fuel-core/pull/1426) Split keygen into a create and a binary. -- [#1419](https://github.com/FuelLabs/fuel-core/pull/1419): Add additional "sanity" benchmarks for arithmetic op code instructions. +- [#1419](https://github.com/FuelLabs/fuel-core/pull/1419): Add additional "sanity" benchmarks for arithmetic op code + instructions. - [#1411](https://github.com/FuelLabs/fuel-core/pull/1411): Added WASM and `no_std` compatibility. - [#1405](https://github.com/FuelLabs/fuel-core/pull/1405): Use correct names for service metrics. -- [#1400](https://github.com/FuelLabs/fuel-core/pull/1400): Add releasy beta to fuel-core so that new commits to fuel-core master triggers fuels-rs. -- [#1371](https://github.com/FuelLabs/fuel-core/pull/1371): Add new client function for querying the `MessageStatus` for a specific message (by `Nonce`). +- [#1400](https://github.com/FuelLabs/fuel-core/pull/1400): Add releasy beta to fuel-core so that new commits to + fuel-core master triggers fuels-rs. +- [#1371](https://github.com/FuelLabs/fuel-core/pull/1371): Add new client function for querying the `MessageStatus` for + a specific message (by `Nonce`). - [#1356](https://github.com/FuelLabs/fuel-core/pull/1356): Add peer reputation reporting to heartbeat code. -- [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Added new metrics related to block importing, such as tps, sync delays etc. +- [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Added new metrics related to block importing, such as tps, + sync delays etc. - [#1339](https://github.com/FuelLabs/fuel-core/pull/1339): Adds `baseAssetId` to `FeeParameters` in the GraphQL API. - [#1331](https://github.com/FuelLabs/fuel-core/pull/1331): Add peer reputation reporting to block import code. -- [#1324](https://github.com/FuelLabs/fuel-core/pull/1324): Added pyroscope profiling to fuel-core, intended to be used by a secondary docker image that has debug symbols enabled. -- [#1309](https://github.com/FuelLabs/fuel-core/pull/1309): Add documentation for running debug builds with CLion and Visual Studio Code. -- [#1308](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1304): Implemented `submit_and_await_commit_with_receipts` method for `FuelClient`. +- [#1324](https://github.com/FuelLabs/fuel-core/pull/1324): Added pyroscope profiling to fuel-core, intended to be used + by a secondary docker image that has debug symbols enabled. +- [#1309](https://github.com/FuelLabs/fuel-core/pull/1309): Add documentation for running debug builds with CLion and + Visual Studio Code. +- [#1308](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1304): Implemented `submit_and_await_commit_with_receipts` method + for `FuelClient`. - [#1286](https://github.com/FuelLabs/fuel-core/pull/1286): Include readable names for test cases where missing. - [#1274](https://github.com/FuelLabs/fuel-core/pull/1274): Added tests to benchmark block synchronization. - [#1263](https://github.com/FuelLabs/fuel-core/pull/1263): Add gas benchmarks for `ED19` and `ECR1` instructions. @@ -380,66 +526,129 @@ FuelVM received a lot of safety and stability improvements: ### Changed - [#1512](https://github.com/FuelLabs/fuel-core/pull/1512): Internally simplify merkle_contract_state_range. -- [#1507](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1477): Upgraded the Rust version used in CI and containers to 1.73.0. Also includes associated Clippy changes. -- [#1469](https://github.com/FuelLabs/fuel-core/pull/1469): Replaced usage of `MemoryTransactionView` by `Checkpoint` database in the benchmarks. -- [#1468](https://github.com/FuelLabs/fuel-core/pull/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. +- [#1507](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1477): Upgraded the Rust version used in CI and containers to + 1.73.0. Also includes associated Clippy changes. +- [#1469](https://github.com/FuelLabs/fuel-core/pull/1469): Replaced usage of `MemoryTransactionView` by `Checkpoint` + database in the benchmarks. +- [#1468](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1466): Handling overflows during arithmetic operations. -- [#1460](https://github.com/FuelLabs/fuel-core/pull/1460): Change tracking branch from main to master for releasy tests. +- [#1460](https://github.com/FuelLabs/fuel-core/pull/1460): Change tracking branch from main to master for releasy + tests. - [#1454](https://github.com/FuelLabs/fuel-core/pull/1454): Update gas benchmarks for opcodes that append receipts. - [#1440](https://github.com/FuelLabs/fuel-core/pull/1440): Don't report reserved nodes that send invalid transactions. -- [#1439](https://github.com/FuelLabs/fuel-core/pull/1439): Reduced memory BMT consumption during creation of the header. -- [#1434](https://github.com/FuelLabs/fuel-core/pull/1434): Continue gossiping transactions to reserved peers regardless of gossiping reputation score. -- [#1408](https://github.com/FuelLabs/fuel-core/pull/1408): Update gas benchmarks for storage opcodes to use a pre-populated database to get more accurate worst-case costs. -- [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): The Relayer now queries Ethereum for its latest finalized block instead of using a configurable "finalization period" to presume finality. -- [#1397](https://github.com/FuelLabs/fuel-core/pull/1397): Improved keygen. Created a crate to be included from forc plugins and upgraded internal library to drop requirement of protoc to build -- [#1395](https://github.com/FuelLabs/fuel-core/pull/1395): Add DependentCost benchmarks for `k256`, `s256` and `mcpi` instructions. -- [#1393](https://github.com/FuelLabs/fuel-core/pull/1393): Increase heartbeat timeout from `2` to `60` seconds, as suggested in [this issue](https://github.com/FuelLabs/fuel-core/issues/1330). +- [#1439](https://github.com/FuelLabs/fuel-core/pull/1439): Reduced memory BMT consumption during creation of the + header. +- [#1434](https://github.com/FuelLabs/fuel-core/pull/1434): Continue gossiping transactions to reserved peers regardless + of gossiping reputation score. +- [#1408](https://github.com/FuelLabs/fuel-core/pull/1408): Update gas benchmarks for storage opcodes to use a + pre-populated database to get more accurate worst-case costs. +- [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): The Relayer now queries Ethereum for its latest finalized + block instead of using a configurable "finalization period" to presume finality. +- [#1397](https://github.com/FuelLabs/fuel-core/pull/1397): Improved keygen. Created a crate to be included from forc + plugins and upgraded internal library to drop requirement of protoc to build +- [#1395](https://github.com/FuelLabs/fuel-core/pull/1395): Add DependentCost benchmarks for `k256`, `s256` and `mcpi` + instructions. +- [#1393](https://github.com/FuelLabs/fuel-core/pull/1393): Increase heartbeat timeout from `2` to `60` seconds, as + suggested in [this issue](https://github.com/FuelLabs/fuel-core/issues/1330). - [#1392](https://github.com/FuelLabs/fuel-core/pull/1392): Fixed an overflow in `message_proof`. -- [#1390](https://github.com/FuelLabs/fuel-core/pull/1390): Up the `ethers` version to `2` to fix an issue with `tungstenite`. -- [#1383](https://github.com/FuelLabs/fuel-core/pull/1383): Disallow usage of `log` crate internally in favor of `tracing` crate. -- [#1380](https://github.com/FuelLabs/fuel-core/pull/1380): Add preliminary, hard-coded config values for heartbeat peer reputation, removing `todo`. -- [#1377](https://github.com/FuelLabs/fuel-core/pull/1377): Remove `DiscoveryEvent` and use `KademliaEvent` directly in `DiscoveryBehavior`. +- [#1390](https://github.com/FuelLabs/fuel-core/pull/1390): Up the `ethers` version to `2` to fix an issue + with `tungstenite`. +- [#1383](https://github.com/FuelLabs/fuel-core/pull/1383): Disallow usage of `log` crate internally in favor + of `tracing` crate. +- [#1380](https://github.com/FuelLabs/fuel-core/pull/1380): Add preliminary, hard-coded config values for heartbeat peer + reputation, removing `todo`. +- [#1377](https://github.com/FuelLabs/fuel-core/pull/1377): Remove `DiscoveryEvent` and use `KademliaEvent` directly + in `DiscoveryBehavior`. - [#1366](https://github.com/FuelLabs/fuel-core/pull/1366): Improve caching during docker builds in CI by replacing gha -- [#1358](https://github.com/FuelLabs/fuel-core/pull/1358): Upgraded the Rust version used in CI to 1.72.0. Also includes associated Clippy changes. -- [#1349](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1342): Add error handling for P2P requests to return `None` to requester and log error. -- [#1318](https://github.com/FuelLabs/fuel-core/pull/1318): Modified block synchronization to use asynchronous task execution when retrieving block headers. -- [#1314](https://github.com/FuelLabs/fuel-core/pull/1314): Removed `types::ConsensusParameters` in favour of `fuel_tx:ConsensusParameters`. -- [#1302](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/issues/1293): Parallelized the `estimate_predicates` endpoint to utilize all available threads. -- [#1270](https://github.com/FuelLabs/fuel-core/pull/1270): Modify the way block headers are retrieved from peers to be done in batches. +- [#1358](https://github.com/FuelLabs/fuel-core/pull/1358): Upgraded the Rust version used in CI to 1.72.0. Also + includes associated Clippy changes. +- [#1349](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1342): Add error handling for P2P requests to return `None` to + requester and log error. +- [#1318](https://github.com/FuelLabs/fuel-core/pull/1318): Modified block synchronization to use asynchronous task + execution when retrieving block headers. +- [#1314](https://github.com/FuelLabs/fuel-core/pull/1314): Removed `types::ConsensusParameters` in favour + of `fuel_tx:ConsensusParameters`. +- [#1302](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/issues/1293): Parallelized the `estimate_predicates` endpoint to utilize + all available threads. +- [#1270](https://github.com/FuelLabs/fuel-core/pull/1270): Modify the way block headers are retrieved from peers to be + done in batches. #### Breaking -- [#1506](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-vm/pull/635) release. + +- [#1506](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-vm/pull/635) release. - [#1470](https://github.com/FuelLabs/fuel-core/pull/1470): Divide `DependentCost` into "light" and "heavy" operations. -- [#1464](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1407): The `Mint` transaction is the last transaction in the block instead of the first. -- [#1374](https://github.com/FuelLabs/fuel-core/pull/1374): Renamed `base_chain_height` to `da_height` and return current relayer height instead of latest Fuel block height. +- [#1464](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1407): The `Mint` transaction is the last transaction in the block + instead of the first. +- [#1374](https://github.com/FuelLabs/fuel-core/pull/1374): Renamed `base_chain_height` to `da_height` and return + current relayer height instead of latest Fuel block height. - [#1367](https://github.com/FuelLabs/fuel-core/pull/1367): Update to the latest version of fuel-vm. -- [#1363](https://github.com/FuelLabs/fuel-core/pull/1363): Change message_proof api to take `nonce` instead of `message_id` -- [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Removed the `metrics` feature flag from the fuel-core crate, and metrics are now included by default. -- [#1339](https://github.com/FuelLabs/fuel-core/pull/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. +- [#1363](https://github.com/FuelLabs/fuel-core/pull/1363): Change message_proof api to take `nonce` instead + of `message_id` +- [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Removed the `metrics` feature flag from the fuel-core crate, + and metrics are now included by default. +- [#1339](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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. + - Allows GraphQL Endpoints to arbitrarily advance blocks. + - Enables debugger GraphQL Endpoints. + - Allows setting `utxo_validation` to `false`. +- [#1318](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1290): Standardize CLI args to use `-` instead of `_`. -- [#1279](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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. +- [#1279](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1484): Removed `--network` CLI argument. Now the name of the network is fetched form chain configuration. -- [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): Removed `relayer-da-finalization` parameter from the relayer CLI. -- [#1338](https://github.com/FuelLabs/fuel-core/pull/1338): Updated GraphQL client to use `DependentCost` for `k256`, `mcpi`, `s256`, `scwq`, `swwq` opcodes. -- [#1322](https://github.com/FuelLabs/fuel-core/pull/1322): The `manual_blocks_enabled` flag is removed from the CLI. The analog is a `debug` flag. \ No newline at end of file + +- [#1484](https://github.com/FuelLabs/fuel-core/pull/1484): Removed `--network` CLI argument. Now the name of the + network is fetched form chain configuration. +- [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): Removed `relayer-da-finalization` parameter from the relayer + CLI. +- [#1338](https://github.com/FuelLabs/fuel-core/pull/1338): Updated GraphQL client to use `DependentCost` + for `k256`, `mcpi`, `s256`, `scwq`, `swwq` opcodes. +- [#1322](https://github.com/FuelLabs/fuel-core/pull/1322): The `manual_blocks_enabled` flag is removed from the CLI. + The analog is a `debug` flag. \ No newline at end of file From 4a70f67eed1064c1b9dc13d6123ba925a27449dc Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Wed, 20 Mar 2024 18:16:44 -0700 Subject: [PATCH 11/21] CHANGELOG.md --- CHANGELOG.md | 587 +++++++++++++++++---------------------------------- 1 file changed, 190 insertions(+), 397 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d0b2bb1db..a7c30309ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,4 @@ # Change Log - All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) @@ -17,14 +16,12 @@ Description of the upcoming release here. - [#1752](https://github.com/FuelLabs/fuel-core/pull/1752): Add `ProducerGasPrice` trait that the `Producer` depends on to get the gas price for the block. - [#1747](https://github.com/FuelLabs/fuel-core/pull/1747): The DA block height is now included in the genesis state. - [#1740](https://github.com/FuelLabs/fuel-core/pull/1740): Remove optional fields from genesis configs -- [#1737](https://github.com/FuelLabs/fuel-core/pull/1737): Remove temporary tables for calculating roots during - genesis. +- [#1737](https://github.com/FuelLabs/fuel-core/pull/1737): Remove temporary tables for calculating roots during genesis. - [#1731](https://github.com/FuelLabs/fuel-core/pull/1731): Expose `schema.sdl` from `fuel-core-client`. ### Changed #### Breaking - - [#1768](https://github.com/FuelLabs/fuel-core/pull/1768): Moved `ContractsInfo` table to the off-chain database. Removed `salt` field from the `ContractConfig`. - [#1761](https://github.com/FuelLabs/fuel-core/pull/1761): Adjustments to the upcoming testnet configs: - Decreased the max size of the contract/predicate/script to be 100KB. @@ -34,91 +31,54 @@ Description of the upcoming release here. - Renamed folders to be "testnet" and "dev-testnet". - The name of the networks are "Upgradable Testnet" and "Upgradable Dev Testnet". -- [#1694](https://github.com/FuelLabs/fuel-core/pull/1694): The change moves the database transaction logic from - the `fuel-core` to the `fuel-core-storage` level. The - corresponding [issue](https://github.com/FuelLabs/fuel-core/issues/1589) described the reason behind it. - - ## Technical details of implementation - - - The change splits the `KeyValueStore` into `KeyValueInspect` and `KeyValueMutate`, as well the `Blueprint` - into `BlueprintInspect` and `BlueprintMutate`. It allows requiring less restricted constraints for any - read-related operations. +- [#1694](https://github.com/FuelLabs/fuel-core/pull/1694): The change moves the database transaction logic from the `fuel-core` to the `fuel-core-storage` level. The corresponding [issue](https://github.com/FuelLabs/fuel-core/issues/1589) described the reason behind it. - - One of the main ideas of the change is to allow for the actual storage only to implement `KeyValueInspect` - and `Modifiable` without the `KeyValueMutate`. It simplifies work with the databases and provides a safe way of - interacting with them (Modification into the database can only go through the `Modifiable::commit_changes`). This - feature is used - to [track the height](https://github.com/FuelLabs/fuel-core/pull/1694/files#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898) - 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](https://github.com/FuelLabs/fuel-core/pull/1694/commits/7b1141ac838568e3590f09dd420cb24a6946bd32). + ## Technical details of implementation - - The `StorageTransaction` is a `StructuredStorage` that uses `InMemoryTransaction` inside to accumulate - modifications. Only `InMemoryTransaction` has a real implementation of the `KeyValueMutate`(Other types only - implement it in tests). - - - The implementation of the `Modifiable` for the `Database` contains a business logic that provides additional - safety but limits the usage of the database. The `Database` now tracks its height and is responsible for its - updates. In the `commit_changes` function, it analyzes the changes that were done and tries to find a new height( - For example, in the case of the `OnChain` database, we are looking for a new `Block` in the `FuelBlocks` table). + - The change splits the `KeyValueStore` into `KeyValueInspect` and `KeyValueMutate`, as well the `Blueprint` into `BlueprintInspect` and `BlueprintMutate`. 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` and `Modifiable` without the `KeyValueMutate`. It simplifies work with the databases and provides a safe way of interacting with them (Modification into the database can only go through the `Modifiable::commit_changes`). This feature is used to [track the height](https://github.com/FuelLabs/fuel-core/pull/1694/files#diff-c95a3d57a39feac7c8c2f3b193a24eec39e794413adc741df36450f9a4539898) 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](https://github.com/FuelLabs/fuel-core/pull/1694/commits/7b1141ac838568e3590f09dd420cb24a6946bd32). + + - The `StorageTransaction` is a `StructuredStorage` that uses `InMemoryTransaction` inside to accumulate modifications. Only `InMemoryTransaction` has a real implementation of the `KeyValueMutate`(Other types only implement it in tests). + + - The implementation of the `Modifiable` for the `Database` contains a business logic that provides additional safety but limits the usage of the database. The `Database` now tracks its height and is responsible for its updates. In the `commit_changes` function, it analyzes the changes that were done and tries to find a new height(For example, in the case of the `OnChain` database, we are looking for a new `Block` in the `FuelBlocks` 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 the `Database` - implements the `Clone` trait. To be sure that we don't corrupt the state of the database, the `commit_changes` - function implements additional safety checks to be sure that we commit updates per each height only once time. + + - 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 the `Database` implements the `Clone` trait. To be sure that we don't corrupt the state of the database, the `commit_changes` function implements additional safety checks to be sure that we commit updates per each height only once time. - Side changes: - - The `drop` function was moved from `Database` to `RocksDB` as a preparation for the state rewind since the - read view should also keep the drop function until it is destroyed. - - The `StatisticTable` table lives in the off-chain worker. - - Removed duplication of the `Database` from the `dap::ConcreteStorage` since it is already available from the - VM. - - The executor return only produced `Changes` instead of the storage transaction, which simplifies the - interaction between modules and port definition. - - The logic related to the iteration over the storage is moved to the `fuel-core-storage` crate and is now - reusable. It provides an `interator` method that duplicates the logic from `MemoryStore` on iterating over - the `BTreeMap` and methods like `iter_all`, `iter_all_by_prefix`, etc. It was done in a separate - revivable [commit](https://github.com/FuelLabs/fuel-core/pull/1694/commits/5b9bd78320e6f36d0650ec05698f12f7d1b3c7c9). - - The `MemoryTransactionView` is fully replaced by the `StorageTransactionInner`. - - Removed `flush` method from the `Database` since it is not needed - after https://github.com/FuelLabs/fuel-core/pull/1664. - -- [#1693](https://github.com/FuelLabs/fuel-core/pull/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. + - The `drop` function was moved from `Database` to `RocksDB` as a preparation for the state rewind since the read view should also keep the drop function until it is destroyed. + - The `StatisticTable` table lives in the off-chain worker. + - Removed duplication of the `Database` from the `dap::ConcreteStorage` since it is already available from the VM. + - The executor return only produced `Changes` instead of the storage transaction, which simplifies the interaction between modules and port definition. + - The logic related to the iteration over the storage is moved to the `fuel-core-storage` crate and is now reusable. It provides an `interator` method that duplicates the logic from `MemoryStore` on iterating over the `BTreeMap` and methods like `iter_all`, `iter_all_by_prefix`, etc. It was done in a separate revivable [commit](https://github.com/FuelLabs/fuel-core/pull/1694/commits/5b9bd78320e6f36d0650ec05698f12f7d1b3c7c9). + - The `MemoryTransactionView` is fully replaced by the `StorageTransactionInner`. + - Removed `flush` method from the `Database` since it is not needed after https://github.com/FuelLabs/fuel-core/pull/1664. + +- [#1693](https://github.com/FuelLabs/fuel-core/pull/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 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 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. + 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. + 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. + 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 + 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 - [#1757](https://github.com/FuelLabs/fuel-core/pull/1757): Removed `protobuf` from everywhere since `libp2p` uses `quick-protobuf`. @@ -126,128 +86,76 @@ Description of the upcoming release here. ### 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. +- [#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. ### Changed - [#1723](https://github.com/FuelLabs/fuel-core/pull/1723): Notify about imported blocks from the off-chain worker. -- [#1717](https://github.com/FuelLabs/fuel-core/pull/1717): The fix for - the [#1657](https://github.com/FuelLabs/fuel-core/pull/1657) to include the contract into `ContractsInfo` table. +- [#1717](https://github.com/FuelLabs/fuel-core/pull/1717): The fix for the [#1657](https://github.com/FuelLabs/fuel-core/pull/1657) to include the contract into `ContractsInfo` table. - [#1657](https://github.com/FuelLabs/fuel-core/pull/1657): Upgrade to `fuel-vm` 0.46.0. -- [#1671](https://github.com/FuelLabs/fuel-core/pull/1671): The logic related to the `FuelBlockIdsToHeights` is moved to - the off-chain worker. +- [#1671](https://github.com/FuelLabs/fuel-core/pull/1671): The logic related to the `FuelBlockIdsToHeights` is moved to the off-chain worker. - [#1663](https://github.com/FuelLabs/fuel-core/pull/1663): Reduce the punishment criteria for mempool gossipping. -- [#1658](https://github.com/FuelLabs/fuel-core/pull/1658): Removed `Receipts` table. Instead, receipts are part of - the `TransactionStatuses` table. +- [#1658](https://github.com/FuelLabs/fuel-core/pull/1658): Removed `Receipts` table. Instead, receipts are part of the `TransactionStatuses` table. - [#1640](https://github.com/FuelLabs/fuel-core/pull/1640): Upgrade to fuel-vm 0.45.0. -- [#1635](https://github.com/FuelLabs/fuel-core/pull/1635): Move updating of the owned messages and coins to off-chain - worker. +- [#1635](https://github.com/FuelLabs/fuel-core/pull/1635): Move updating of the owned messages and coins to off-chain worker. - [#1650](https://github.com/FuelLabs/fuel-core/pull/1650): Add api endpoint for getting estimates for future gas prices - [#1649](https://github.com/FuelLabs/fuel-core/pull/1649): Add api endpoint for getting latest gas price - [#1600](https://github.com/FuelLabs/fuel-core/pull/1640): Upgrade to fuel-vm 0.45.0 - [#1633](https://github.com/FuelLabs/fuel-core/pull/1633): Notify services about importing of the genesis block. -- [#1625](https://github.com/FuelLabs/fuel-core/pull/1625): Making relayer independent from the executor and preparation - for the force transaction inclusion. +- [#1625](https://github.com/FuelLabs/fuel-core/pull/1625): Making relayer independent from the executor and preparation for the force transaction inclusion. - [#1613](https://github.com/FuelLabs/fuel-core/pull/1613): Add api endpoint to retrieve a message by its nonce. - [#1612](https://github.com/FuelLabs/fuel-core/pull/1612): Use `AtomicView` in all services for consistent results. - [#1597](https://github.com/FuelLabs/fuel-core/pull/1597): Unify namespacing for `libp2p` modules -- [#1591](https://github.com/FuelLabs/fuel-core/pull/1591): Simplify libp2p dependencies and not depend on all sub - modules directly. -- [#1590](https://github.com/FuelLabs/fuel-core/pull/1590): Use `AtomicView` in the `TxPool` to read the state of the - database during insertion of the transactions. -- [#1587](https://github.com/FuelLabs/fuel-core/pull/1587): Use `BlockHeight` as a primary key for the `FuelsBlock` - table. -- [#1585](https://github.com/FuelLabs/fuel-core/pull/1585): Let `NetworkBehaviour` macro generate `FuelBehaviorEvent` in - p2p -- [#1579](https://github.com/FuelLabs/fuel-core/pull/1579): The change extracts the off-chain-related logic from the - executor and moves it to the GraphQL off-chain worker. It creates two new concepts - Off-chain and On-chain databases - where the GraphQL worker has exclusive ownership of the database and may modify it without intersecting with the - On-chain database. -- [#1577](https://github.com/FuelLabs/fuel-core/pull/1577): Moved insertion of sealed blocks into the `BlockImporter` - instead of the executor. -- [#1574](https://github.com/FuelLabs/fuel-core/pull/1574): Penalizes peers for sending invalid responses or for not - replying at all. -- [#1601](https://github.com/FuelLabs/fuel-core/pull/1601): Fix formatting in docs and check that `cargo doc` passes in - the CI. +- [#1591](https://github.com/FuelLabs/fuel-core/pull/1591): Simplify libp2p dependencies and not depend on all sub modules directly. +- [#1590](https://github.com/FuelLabs/fuel-core/pull/1590): Use `AtomicView` in the `TxPool` to read the state of the database during insertion of the transactions. +- [#1587](https://github.com/FuelLabs/fuel-core/pull/1587): Use `BlockHeight` as a primary key for the `FuelsBlock` table. +- [#1585](https://github.com/FuelLabs/fuel-core/pull/1585): Let `NetworkBehaviour` macro generate `FuelBehaviorEvent` in p2p +- [#1579](https://github.com/FuelLabs/fuel-core/pull/1579): The change extracts the off-chain-related logic from the executor and moves it to the GraphQL off-chain worker. It creates two new concepts - Off-chain and On-chain databases where the GraphQL worker has exclusive ownership of the database and may modify it without intersecting with the On-chain database. +- [#1577](https://github.com/FuelLabs/fuel-core/pull/1577): Moved insertion of sealed blocks into the `BlockImporter` instead of the executor. +- [#1574](https://github.com/FuelLabs/fuel-core/pull/1574): Penalizes peers for sending invalid responses or for not replying at all. +- [#1601](https://github.com/FuelLabs/fuel-core/pull/1601): Fix formatting in docs and check that `cargo doc` passes in the CI. - [#1636](https://github.com/FuelLabs/fuel-core/pull/1636): Add more docs to GraphQL DAP API. #### Breaking -- [#1725](https://github.com/FuelLabs/fuel-core/pull/1725): All API endpoints now are prefixed with `/v1` version. New - usage looks like: `/v1/playground`, `/v1/graphql`, `/v1/graphql-sub`, `/v1/metrics`, `/v1/health`. -- [#1722](https://github.com/FuelLabs/fuel-core/pull/1722): Bugfix: Zero `predicate_gas_used` field during validation of - the produced block. -- [#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` 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`. -- [#1675](https://github.com/FuelLabs/fuel-core/pull/1675): Simplify GQL schema by disabling contract resolvers in most - cases, and just return a ContractId scalar instead. -- [#1658](https://github.com/FuelLabs/fuel-core/pull/1658): Receipts are part of the transaction status. - Removed `reason` from the `TransactionExecutionResult::Failed`. It can be calculated based on the program state and - receipts. - Also, it is not possible to fetch `receipts` from the `Transaction` directly anymore. Instead, you need to - fetch `status` and its receipts. +- [#1725](https://github.com/FuelLabs/fuel-core/pull/1725): All API endpoints now are prefixed with `/v1` version. New usage looks like: `/v1/playground`, `/v1/graphql`, `/v1/graphql-sub`, `/v1/metrics`, `/v1/health`. +- [#1722](https://github.com/FuelLabs/fuel-core/pull/1722): Bugfix: Zero `predicate_gas_used` field during validation of the produced block. +- [#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` 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`. +- [#1675](https://github.com/FuelLabs/fuel-core/pull/1675): Simplify GQL schema by disabling contract resolvers in most cases, and just return a ContractId scalar instead. +- [#1658](https://github.com/FuelLabs/fuel-core/pull/1658): Receipts are part of the transaction status. + Removed `reason` from the `TransactionExecutionResult::Failed`. It can be calculated based on the program state and receipts. + Also, it is not possible to fetch `receipts` from the `Transaction` directly anymore. Instead, you need to fetch `status` and its receipts. - [#1646](https://github.com/FuelLabs/fuel-core/pull/1646): Remove redundant receipts from queries. -- [#1639](https://github.com/FuelLabs/fuel-core/pull/1639): Make Merkle metadata, i.e. `SparseMerkleMetadata` - and `DenseMerkleMetadata` type version-able enums +- [#1639](https://github.com/FuelLabs/fuel-core/pull/1639): Make Merkle metadata, i.e. `SparseMerkleMetadata` and `DenseMerkleMetadata` type version-able enums - [#1632](https://github.com/FuelLabs/fuel-core/pull/1632): Make `Message` type a version-able enum - [#1631](https://github.com/FuelLabs/fuel-core/pull/1631): Modify api endpoint to dry run multiple transactions. -- [#1629](https://github.com/FuelLabs/fuel-core/pull/1629): Use a separate database for each data domain. Each database - has its own folder where data is stored. +- [#1629](https://github.com/FuelLabs/fuel-core/pull/1629): Use a separate database for each data domain. Each database has its own folder where data is stored. - [#1628](https://github.com/FuelLabs/fuel-core/pull/1628): Make `CompressedCoin` type a version-able enum - [#1616](https://github.com/FuelLabs/fuel-core/pull/1616): Make `BlockHeader` type a version-able enum -- [#1614](https://github.com/FuelLabs/fuel-core/pull/1614): Use the default consensus key regardless of trigger mode. - The change is breaking because it removes the `--dev-keys` argument. If the `debug` flag is set, the default consensus - key will be used, regardless of the trigger mode. +- [#1614](https://github.com/FuelLabs/fuel-core/pull/1614): Use the default consensus key regardless of trigger mode. The change is breaking because it removes the `--dev-keys` argument. If the `debug` flag is set, the default consensus key will be used, regardless of the trigger mode. - [#1596](https://github.com/FuelLabs/fuel-core/pull/1596): Make `Consensus` type a version-able enum - [#1593](https://github.com/FuelLabs/fuel-core/pull/1593): Make `Block` type a version-able enum -- [#1576](https://github.com/FuelLabs/fuel-core/pull/1576): The change moves the implementation of the storage traits - for required tables from `fuel-core` to `fuel-core-storage` crate. The change also adds a more flexible configuration - of the encoding/decoding per the table and allows the implementation of specific behaviors for the table in a much - easier way. It unifies the encoding between database, SMTs, and iteration, preventing mismatching bytes representation - on the Rust type system level. Plus, it increases the re-usage of the code by applying the same blueprint to other - tables. - - It is a breaking PR because it changes database encoding/decoding for some tables. - - ### StructuredStorage - - The change adds a new type `StructuredStorage`. It is a wrapper around the key-value storage that implements the - storage traits(`StorageInspect`, `StorageMutate`, `StorageRead`, etc) for the tables with blueprint. This blueprint - works in tandem with the `TableWithBlueprint` trait. The table may implement `TableWithBlueprint` specifying the - blueprint, as an example: - +- [#1576](https://github.com/FuelLabs/fuel-core/pull/1576): The change moves the implementation of the storage traits for required tables from `fuel-core` to `fuel-core-storage` crate. The change also adds a more flexible configuration of the encoding/decoding per the table and allows the implementation of specific behaviors for the table in a much easier way. It unifies the encoding between database, SMTs, and iteration, preventing mismatching bytes representation on the Rust type system level. Plus, it increases the re-usage of the code by applying the same blueprint to other tables. + + It is a breaking PR because it changes database encoding/decoding for some tables. + + ### StructuredStorage + + The change adds a new type `StructuredStorage`. It is a wrapper around the key-value storage that implements the storage traits(`StorageInspect`, `StorageMutate`, `StorageRead`, etc) for the tables with blueprint. This blueprint works in tandem with the `TableWithBlueprint` trait. The table may implement `TableWithBlueprint` specifying the blueprint, as an example: + ```rust impl TableWithBlueprint for ContractsRawCode { type Blueprint = Plain; @@ -257,25 +165,19 @@ Description of the upcoming release here. } } ``` - - It is a definition of the blueprint for the `ContractsRawCode` table. It has a plain blueprint meaning it simply - encodes/decodes bytes and stores/loads them into/from the storage. As a key codec and value codec, it uses a `Raw` - encoding/decoding that simplifies writing bytes and loads them back into the memory without applying any serialization - or deserialization algorithm. - - If the table implements `TableWithBlueprint` and the selected codec satisfies all blueprint requirements, the - corresponding storage traits for that table are implemented on the `StructuredStorage` type. - - ### Codecs - - Each blueprint allows customizing the key and value codecs. It allows the use of different codecs for different - tables, taking into account the complexity and weight of the data and providing a way of more optimal implementation. - - That property may be very useful to perform migration in a more easier way. Plus, it also can be a `no_std` migration - potentially allowing its fraud proving. - - An example of migration: - + + It is a definition of the blueprint for the `ContractsRawCode` table. It has a plain blueprint meaning it simply encodes/decodes bytes and stores/loads them into/from the storage. As a key codec and value codec, it uses a `Raw` encoding/decoding that simplifies writing bytes and loads them back into the memory without applying any serialization or deserialization algorithm. + + If the table implements `TableWithBlueprint` and the selected codec satisfies all blueprint requirements, the corresponding storage traits for that table are implemented on the `StructuredStorage` type. + + ### Codecs + + Each blueprint allows customizing the key and value codecs. It allows the use of different codecs for different tables, taking into account the complexity and weight of the data and providing a way of more optimal implementation. + + That property may be very useful to perform migration in a more easier way. Plus, it also can be a `no_std` migration potentially allowing its fraud proving. + + An example of migration: + ```rust /// Define the table for V1 value encoding/decoding. impl TableWithBlueprint for ContractsRawCodeV1 { @@ -306,18 +208,15 @@ Description of the upcoming release here. } } ``` - - ### Structures - - The blueprint of the table defines its behavior. As an example, a `Plain` blueprint simply encodes/decodes bytes and - stores/loads them into/from the storage. The `SMT` blueprint builds a sparse merkle tree on top of the key-value - pairs. - - Implementing a blueprint one time, we can apply it to any table satisfying the requirements of this blueprint. It - increases the re-usage of the code and minimizes duplication. - - It can be useful if we decide to create global roots for all required tables that are used in fraud proving. - + + ### Structures + + The blueprint of the table defines its behavior. As an example, a `Plain` blueprint simply encodes/decodes bytes and stores/loads them into/from the storage. The `SMT` blueprint builds a sparse merkle tree on top of the key-value pairs. + + Implementing a blueprint one time, we can apply it to any table satisfying the requirements of this blueprint. It increases the re-usage of the code and minimizes duplication. + + It can be useful if we decide to create global roots for all required tables that are used in fraud proving. + ```rust impl TableWithBlueprint for SpentMessages { type Blueprint = Plain; @@ -339,33 +238,28 @@ Description of the upcoming release here. } } ``` + + ### Side changes + + #### `iter_all` + The `iter_all` functionality now accepts the table instead of `K` and `V` generics. It is done to use the correct codec during deserialization. Also, the table definition provides the column. + + #### Duplicated unit tests + + The `fuel-core-storage` crate provides macros that generate unit tests. Almost all tables had the same test like `get`, `insert`, `remove`, `exist`. All duplicated tests were moved to macros. The unique one still stays at the same place where it was before. + + #### `StorageBatchMutate` + + Added a new `StorageBatchMutate` trait that we can move to `fuel-storage` crate later. It allows batch operations on the storage. It may be more performant in some cases. - ### Side changes - - #### `iter_all` - The `iter_all` functionality now accepts the table instead of `K` and `V` generics. It is done to use the correct - codec during deserialization. Also, the table definition provides the column. - - #### Duplicated unit tests - - The `fuel-core-storage` crate provides macros that generate unit tests. Almost all tables had the same test - like `get`, `insert`, `remove`, `exist`. All duplicated tests were moved to macros. The unique one still stays at the - same place where it was before. - - #### `StorageBatchMutate` - - Added a new `StorageBatchMutate` trait that we can move to `fuel-storage` crate later. It allows batch operations on - the storage. It may be more performant in some cases. +- [#1573](https://github.com/FuelLabs/fuel-core/pull/1573): Remove nested p2p request/response encoding. Only breaks p2p networking compatibility with older fuel-core versions, but is otherwise fully internal. -- [#1573](https://github.com/FuelLabs/fuel-core/pull/1573): Remove nested p2p request/response encoding. Only breaks p2p - networking compatibility with older fuel-core versions, but is otherwise fully internal. ## [Version 0.22.4] ### Added -- [#1743](https://github.com/FuelLabs/fuel-core/pull/1743): Added blacklisting of the transactions on the `TxPool` - level. +- [#1743](https://github.com/FuelLabs/fuel-core/pull/1743): Added blacklisting of the transactions on the `TxPool` level. ```shell --tx-blacklist-addresses The list of banned addresses ignored by the `TxPool` @@ -392,57 +286,45 @@ Description of the upcoming release here. ### Added -- [#1732](https://github.com/FuelLabs/fuel-core/pull/1732): Added `Clone` bounds to most datatypes - of `fuel-core-client`. +- [#1732](https://github.com/FuelLabs/fuel-core/pull/1732): Added `Clone` bounds to most datatypes of `fuel-core-client`. ## [Version 0.22.2] ### Added -- [#1729](https://github.com/FuelLabs/fuel-core/pull/1729): Exposed the `schema.sdl` file from `fuel-core-client`. The - user can create his own queries by using this file. +- [#1729](https://github.com/FuelLabs/fuel-core/pull/1729): Exposed the `schema.sdl` file from `fuel-core-client`. The user can create his own queries by using this file. ## [Version 0.22.1] ### Fixed +- [#1664](https://github.com/FuelLabs/fuel-core/pull/1664): Fixed long database initialization after restart of the node by setting limit to the WAL file. -- [#1664](https://github.com/FuelLabs/fuel-core/pull/1664): Fixed long database initialization after restart of the node - by setting limit to the WAL file. ## [Version 0.22.0] ### Added -- [#1515](https://github.com/FuelLabs/fuel-core/pull/1515): Added support of `--version` command for `fuel-core-keygen` - binary. -- [#1504](https://github.com/FuelLabs/fuel-core/pull/1504): A `Success` or `Failure` variant of `TransactionStatus` - returned by a query now contains the associated receipts generated by transaction execution. +- [#1515](https://github.com/FuelLabs/fuel-core/pull/1515): Added support of `--version` command for `fuel-core-keygen` binary. +- [#1504](https://github.com/FuelLabs/fuel-core/pull/1504): A `Success` or `Failure` variant of `TransactionStatus` returned by a query now contains the associated receipts generated by transaction execution. #### Breaking - -- [#1531](https://github.com/FuelLabs/fuel-core/pull/1531): Make `fuel-core-executor` `no_std` compatible. It affects - the `fuel-core` crate because it uses the `fuel-core-executor` crate. The change is breaking because of moved types. +- [#1531](https://github.com/FuelLabs/fuel-core/pull/1531): Make `fuel-core-executor` `no_std` compatible. It affects the `fuel-core` crate because it uses the `fuel-core-executor` crate. The change is breaking because of moved types. - [#1524](https://github.com/FuelLabs/fuel-core/pull/1524): Adds information about connected peers to the GQL API. ### Changed -- [#1517](https://github.com/FuelLabs/fuel-core/pull/1517): Changed default gossip heartbeat interval to 500ms. +- [#1517](https://github.com/FuelLabs/fuel-core/pull/1517): Changed default gossip heartbeat interval to 500ms. - [#1520](https://github.com/FuelLabs/fuel-core/pull/1520): Extract `executor` into `fuel-core-executor` crate. ### Fixed #### Breaking - -- [#1536](https://github.com/FuelLabs/fuel-core/pull/1536): The change fixes the contracts tables to not touch SMT nodes - of foreign contracts. Before, it was possible to invalidate the SMT from another contract. It is a breaking change and - requires re-calculating the whole state from the beginning with new SMT roots. -- [#1542](https://github.com/FuelLabs/fuel-core/pull/1542): Migrates information about peers to NodeInfo instead of - ChainInfo. It also elides information about peers in the default node_info query. +- [#1536](https://github.com/FuelLabs/fuel-core/pull/1536): The change fixes the contracts tables to not touch SMT nodes of foreign contracts. Before, it was possible to invalidate the SMT from another contract. It is a breaking change and requires re-calculating the whole state from the beginning with new SMT roots. +- [#1542](https://github.com/FuelLabs/fuel-core/pull/1542): Migrates information about peers to NodeInfo instead of ChainInfo. It also elides information about peers in the default node_info query. ## [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. @@ -450,31 +332,21 @@ This release focuses on preparing `fuel-core` for the mainnet environment: - 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. +- 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. +- 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 @@ -482,57 +354,41 @@ FuelVM received a lot of safety and stability improvements: - [#1503](https://github.com/FuelLabs/fuel-core/pull/1503): Add `gtf` opcode sanity check. - [#1502](https://github.com/FuelLabs/fuel-core/pull/1502): Added price benchmark for `vm_initialization`. - [#1501](https://github.com/FuelLabs/fuel-core/pull/1501): Add a CLI command for generating a fee collection contract. -- [#1492](https://github.com/FuelLabs/fuel-core/pull/1492): Support backward iteration in the RocksDB. It allows - backward queries that were not allowed before. +- [#1492](https://github.com/FuelLabs/fuel-core/pull/1492): Support backward iteration in the RocksDB. It allows backward queries that were not allowed before. - [#1490](https://github.com/FuelLabs/fuel-core/pull/1490): Add push and pop benchmarks. - [#1485](https://github.com/FuelLabs/fuel-core/pull/1485): Prepare rc release of fuel core v0.21 -- [#1476](https://github.com/FuelLabs/fuel-core/pull/1453): Add the majority of the "other" benchmarks for contract - opcodes. +- [#1476](https://github.com/FuelLabs/fuel-core/pull/1453): Add the majority of the "other" benchmarks for contract opcodes. - [#1473](https://github.com/FuelLabs/fuel-core/pull/1473): Expose fuel-core version as a constant -- [#1469](https://github.com/FuelLabs/fuel-core/pull/1469): Added support of bloom filter for RocksDB tables and - increased the block cache. +- [#1469](https://github.com/FuelLabs/fuel-core/pull/1469): Added support of bloom filter for RocksDB tables and increased the block cache. - [#1465](https://github.com/FuelLabs/fuel-core/pull/1465): Improvements for keygen cli and crates -- [#1642](https://github.com/FuelLabs/fuel-core/pull/1462): Added benchmark to measure the performance of contract state - and contract ID calculation; use for gas costing. +- [#1642](https://github.com/FuelLabs/fuel-core/pull/1462): Added benchmark to measure the performance of contract state and contract ID calculation; use for gas costing. - [#1457](https://github.com/FuelLabs/fuel-core/pull/1457): Fixing incorrect measurement for fast(µs) opcodes. - [#1456](https://github.com/FuelLabs/fuel-core/pull/1456): Added flushing of the RocksDB during a graceful shutdown. - [#1456](https://github.com/FuelLabs/fuel-core/pull/1456): Added more logs to track the service lifecycle. -- [#1453](https://github.com/FuelLabs/fuel-core/pull/1453): Add the majority of the "sanity" benchmarks for contract - opcodes. -- [#1452](https://github.com/FuelLabs/fuel-core/pull/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. +- [#1453](https://github.com/FuelLabs/fuel-core/pull/1453): Add the majority of the "sanity" benchmarks for contract opcodes. +- [#1452](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1449): Fix coin pagination in e2e test client. - [#1447](https://github.com/FuelLabs/fuel-core/pull/1447): Add timeout for continuous e2e tests - [#1444](https://github.com/FuelLabs/fuel-core/pull/1444): Add "sanity" benchmarks for memory opcodes. - [#1437](https://github.com/FuelLabs/fuel-core/pull/1437): Add some transaction throughput tests for basic transfers. - [#1436](https://github.com/FuelLabs/fuel-core/pull/1436): Add a github action to continuously test beta-4. - [#1433](https://github.com/FuelLabs/fuel-core/pull/1433): Add "sanity" benchmarks for flow opcodes. -- [#1432](https://github.com/FuelLabs/fuel-core/pull/1432): Add a new `--api-request-timeout` argument to control TTL - for GraphQL requests. +- [#1432](https://github.com/FuelLabs/fuel-core/pull/1432): Add a new `--api-request-timeout` argument to control TTL for GraphQL requests. - [#1430](https://github.com/FuelLabs/fuel-core/pull/1430): Add "sanity" benchmarks for crypto opcodes. - [#1426](https://github.com/FuelLabs/fuel-core/pull/1426) Split keygen into a create and a binary. -- [#1419](https://github.com/FuelLabs/fuel-core/pull/1419): Add additional "sanity" benchmarks for arithmetic op code - instructions. +- [#1419](https://github.com/FuelLabs/fuel-core/pull/1419): Add additional "sanity" benchmarks for arithmetic op code instructions. - [#1411](https://github.com/FuelLabs/fuel-core/pull/1411): Added WASM and `no_std` compatibility. - [#1405](https://github.com/FuelLabs/fuel-core/pull/1405): Use correct names for service metrics. -- [#1400](https://github.com/FuelLabs/fuel-core/pull/1400): Add releasy beta to fuel-core so that new commits to - fuel-core master triggers fuels-rs. -- [#1371](https://github.com/FuelLabs/fuel-core/pull/1371): Add new client function for querying the `MessageStatus` for - a specific message (by `Nonce`). +- [#1400](https://github.com/FuelLabs/fuel-core/pull/1400): Add releasy beta to fuel-core so that new commits to fuel-core master triggers fuels-rs. +- [#1371](https://github.com/FuelLabs/fuel-core/pull/1371): Add new client function for querying the `MessageStatus` for a specific message (by `Nonce`). - [#1356](https://github.com/FuelLabs/fuel-core/pull/1356): Add peer reputation reporting to heartbeat code. -- [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Added new metrics related to block importing, such as tps, - sync delays etc. +- [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Added new metrics related to block importing, such as tps, sync delays etc. - [#1339](https://github.com/FuelLabs/fuel-core/pull/1339): Adds `baseAssetId` to `FeeParameters` in the GraphQL API. - [#1331](https://github.com/FuelLabs/fuel-core/pull/1331): Add peer reputation reporting to block import code. -- [#1324](https://github.com/FuelLabs/fuel-core/pull/1324): Added pyroscope profiling to fuel-core, intended to be used - by a secondary docker image that has debug symbols enabled. -- [#1309](https://github.com/FuelLabs/fuel-core/pull/1309): Add documentation for running debug builds with CLion and - Visual Studio Code. -- [#1308](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1304): Implemented `submit_and_await_commit_with_receipts` method - for `FuelClient`. +- [#1324](https://github.com/FuelLabs/fuel-core/pull/1324): Added pyroscope profiling to fuel-core, intended to be used by a secondary docker image that has debug symbols enabled. +- [#1309](https://github.com/FuelLabs/fuel-core/pull/1309): Add documentation for running debug builds with CLion and Visual Studio Code. +- [#1308](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1304): Implemented `submit_and_await_commit_with_receipts` method for `FuelClient`. - [#1286](https://github.com/FuelLabs/fuel-core/pull/1286): Include readable names for test cases where missing. - [#1274](https://github.com/FuelLabs/fuel-core/pull/1274): Added tests to benchmark block synchronization. - [#1263](https://github.com/FuelLabs/fuel-core/pull/1263): Add gas benchmarks for `ED19` and `ECR1` instructions. @@ -540,129 +396,66 @@ FuelVM received a lot of safety and stability improvements: ### Changed - [#1512](https://github.com/FuelLabs/fuel-core/pull/1512): Internally simplify merkle_contract_state_range. -- [#1507](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1477): Upgraded the Rust version used in CI and containers to - 1.73.0. Also includes associated Clippy changes. -- [#1469](https://github.com/FuelLabs/fuel-core/pull/1469): Replaced usage of `MemoryTransactionView` by `Checkpoint` - database in the benchmarks. -- [#1468](https://github.com/FuelLabs/fuel-core/pull/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. +- [#1507](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1477): Upgraded the Rust version used in CI and containers to 1.73.0. Also includes associated Clippy changes. +- [#1469](https://github.com/FuelLabs/fuel-core/pull/1469): Replaced usage of `MemoryTransactionView` by `Checkpoint` database in the benchmarks. +- [#1468](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1466): Handling overflows during arithmetic operations. -- [#1460](https://github.com/FuelLabs/fuel-core/pull/1460): Change tracking branch from main to master for releasy - tests. +- [#1460](https://github.com/FuelLabs/fuel-core/pull/1460): Change tracking branch from main to master for releasy tests. - [#1454](https://github.com/FuelLabs/fuel-core/pull/1454): Update gas benchmarks for opcodes that append receipts. - [#1440](https://github.com/FuelLabs/fuel-core/pull/1440): Don't report reserved nodes that send invalid transactions. -- [#1439](https://github.com/FuelLabs/fuel-core/pull/1439): Reduced memory BMT consumption during creation of the - header. -- [#1434](https://github.com/FuelLabs/fuel-core/pull/1434): Continue gossiping transactions to reserved peers regardless - of gossiping reputation score. -- [#1408](https://github.com/FuelLabs/fuel-core/pull/1408): Update gas benchmarks for storage opcodes to use a - pre-populated database to get more accurate worst-case costs. -- [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): The Relayer now queries Ethereum for its latest finalized - block instead of using a configurable "finalization period" to presume finality. -- [#1397](https://github.com/FuelLabs/fuel-core/pull/1397): Improved keygen. Created a crate to be included from forc - plugins and upgraded internal library to drop requirement of protoc to build -- [#1395](https://github.com/FuelLabs/fuel-core/pull/1395): Add DependentCost benchmarks for `k256`, `s256` and `mcpi` - instructions. -- [#1393](https://github.com/FuelLabs/fuel-core/pull/1393): Increase heartbeat timeout from `2` to `60` seconds, as - suggested in [this issue](https://github.com/FuelLabs/fuel-core/issues/1330). +- [#1439](https://github.com/FuelLabs/fuel-core/pull/1439): Reduced memory BMT consumption during creation of the header. +- [#1434](https://github.com/FuelLabs/fuel-core/pull/1434): Continue gossiping transactions to reserved peers regardless of gossiping reputation score. +- [#1408](https://github.com/FuelLabs/fuel-core/pull/1408): Update gas benchmarks for storage opcodes to use a pre-populated database to get more accurate worst-case costs. +- [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): The Relayer now queries Ethereum for its latest finalized block instead of using a configurable "finalization period" to presume finality. +- [#1397](https://github.com/FuelLabs/fuel-core/pull/1397): Improved keygen. Created a crate to be included from forc plugins and upgraded internal library to drop requirement of protoc to build +- [#1395](https://github.com/FuelLabs/fuel-core/pull/1395): Add DependentCost benchmarks for `k256`, `s256` and `mcpi` instructions. +- [#1393](https://github.com/FuelLabs/fuel-core/pull/1393): Increase heartbeat timeout from `2` to `60` seconds, as suggested in [this issue](https://github.com/FuelLabs/fuel-core/issues/1330). - [#1392](https://github.com/FuelLabs/fuel-core/pull/1392): Fixed an overflow in `message_proof`. -- [#1390](https://github.com/FuelLabs/fuel-core/pull/1390): Up the `ethers` version to `2` to fix an issue - with `tungstenite`. -- [#1383](https://github.com/FuelLabs/fuel-core/pull/1383): Disallow usage of `log` crate internally in favor - of `tracing` crate. -- [#1380](https://github.com/FuelLabs/fuel-core/pull/1380): Add preliminary, hard-coded config values for heartbeat peer - reputation, removing `todo`. -- [#1377](https://github.com/FuelLabs/fuel-core/pull/1377): Remove `DiscoveryEvent` and use `KademliaEvent` directly - in `DiscoveryBehavior`. +- [#1390](https://github.com/FuelLabs/fuel-core/pull/1390): Up the `ethers` version to `2` to fix an issue with `tungstenite`. +- [#1383](https://github.com/FuelLabs/fuel-core/pull/1383): Disallow usage of `log` crate internally in favor of `tracing` crate. +- [#1380](https://github.com/FuelLabs/fuel-core/pull/1380): Add preliminary, hard-coded config values for heartbeat peer reputation, removing `todo`. +- [#1377](https://github.com/FuelLabs/fuel-core/pull/1377): Remove `DiscoveryEvent` and use `KademliaEvent` directly in `DiscoveryBehavior`. - [#1366](https://github.com/FuelLabs/fuel-core/pull/1366): Improve caching during docker builds in CI by replacing gha -- [#1358](https://github.com/FuelLabs/fuel-core/pull/1358): Upgraded the Rust version used in CI to 1.72.0. Also - includes associated Clippy changes. -- [#1349](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1342): Add error handling for P2P requests to return `None` to - requester and log error. -- [#1318](https://github.com/FuelLabs/fuel-core/pull/1318): Modified block synchronization to use asynchronous task - execution when retrieving block headers. -- [#1314](https://github.com/FuelLabs/fuel-core/pull/1314): Removed `types::ConsensusParameters` in favour - of `fuel_tx:ConsensusParameters`. -- [#1302](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/issues/1293): Parallelized the `estimate_predicates` endpoint to utilize - all available threads. -- [#1270](https://github.com/FuelLabs/fuel-core/pull/1270): Modify the way block headers are retrieved from peers to be - done in batches. +- [#1358](https://github.com/FuelLabs/fuel-core/pull/1358): Upgraded the Rust version used in CI to 1.72.0. Also includes associated Clippy changes. +- [#1349](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1342): Add error handling for P2P requests to return `None` to requester and log error. +- [#1318](https://github.com/FuelLabs/fuel-core/pull/1318): Modified block synchronization to use asynchronous task execution when retrieving block headers. +- [#1314](https://github.com/FuelLabs/fuel-core/pull/1314): Removed `types::ConsensusParameters` in favour of `fuel_tx:ConsensusParameters`. +- [#1302](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/issues/1293): Parallelized the `estimate_predicates` endpoint to utilize all available threads. +- [#1270](https://github.com/FuelLabs/fuel-core/pull/1270): Modify the way block headers are retrieved from peers to be done in batches. #### Breaking - -- [#1506](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-vm/pull/635) release. +- [#1506](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-vm/pull/635) release. - [#1470](https://github.com/FuelLabs/fuel-core/pull/1470): Divide `DependentCost` into "light" and "heavy" operations. -- [#1464](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1407): The `Mint` transaction is the last transaction in the block - instead of the first. -- [#1374](https://github.com/FuelLabs/fuel-core/pull/1374): Renamed `base_chain_height` to `da_height` and return - current relayer height instead of latest Fuel block height. +- [#1464](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1407): The `Mint` transaction is the last transaction in the block instead of the first. +- [#1374](https://github.com/FuelLabs/fuel-core/pull/1374): Renamed `base_chain_height` to `da_height` and return current relayer height instead of latest Fuel block height. - [#1367](https://github.com/FuelLabs/fuel-core/pull/1367): Update to the latest version of fuel-vm. -- [#1363](https://github.com/FuelLabs/fuel-core/pull/1363): Change message_proof api to take `nonce` instead - of `message_id` -- [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Removed the `metrics` feature flag from the fuel-core crate, - and metrics are now included by default. -- [#1339](https://github.com/FuelLabs/fuel-core/pull/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. +- [#1363](https://github.com/FuelLabs/fuel-core/pull/1363): Change message_proof api to take `nonce` instead of `message_id` +- [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Removed the `metrics` feature flag from the fuel-core crate, and metrics are now included by default. +- [#1339](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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. + - Allows GraphQL Endpoints to arbitrarily advance blocks. + - Enables debugger GraphQL Endpoints. + - Allows setting `utxo_validation` to `false`. +- [#1318](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1290): Standardize CLI args to use `-` instead of `_`. -- [#1279](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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. +- [#1279](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/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](https://github.com/FuelLabs/fuel-core/pull/1484): Removed `--network` CLI argument. Now the name of the - network is fetched form chain configuration. -- [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): Removed `relayer-da-finalization` parameter from the relayer - CLI. -- [#1338](https://github.com/FuelLabs/fuel-core/pull/1338): Updated GraphQL client to use `DependentCost` - for `k256`, `mcpi`, `s256`, `scwq`, `swwq` opcodes. -- [#1322](https://github.com/FuelLabs/fuel-core/pull/1322): The `manual_blocks_enabled` flag is removed from the CLI. - The analog is a `debug` flag. \ No newline at end of file +- [#1484](https://github.com/FuelLabs/fuel-core/pull/1484): Removed `--network` CLI argument. Now the name of the network is fetched form chain configuration. +- [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): Removed `relayer-da-finalization` parameter from the relayer CLI. +- [#1338](https://github.com/FuelLabs/fuel-core/pull/1338): Updated GraphQL client to use `DependentCost` for `k256`, `mcpi`, `s256`, `scwq`, `swwq` opcodes. +- [#1322](https://github.com/FuelLabs/fuel-core/pull/1322): The `manual_blocks_enabled` flag is removed from the CLI. The analog is a `debug` flag. \ No newline at end of file From 2f66d45f67b9a5de60215ad70fee79e86a8b33c5 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Wed, 20 Mar 2024 18:21:46 -0700 Subject: [PATCH 12/21] minor cleanup --- crates/services/relayer/src/ports/tests.rs | 2 +- crates/services/relayer/src/service/get_logs.rs | 2 +- crates/services/relayer/src/test_helpers.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/services/relayer/src/ports/tests.rs b/crates/services/relayer/src/ports/tests.rs index 68abe106e4..6190ff4c58 100644 --- a/crates/services/relayer/src/ports/tests.rs +++ b/crates/services/relayer/src/ports/tests.rs @@ -16,7 +16,7 @@ use fuel_core_storage::test_helpers::{ }; use fuel_core_types::{ entities::{ - relayer::message::Message, + Message, RelayedTransaction, }, services::relayer::Event, diff --git a/crates/services/relayer/src/service/get_logs.rs b/crates/services/relayer/src/service/get_logs.rs index c8d246857b..8a7761d198 100644 --- a/crates/services/relayer/src/service/get_logs.rs +++ b/crates/services/relayer/src/service/get_logs.rs @@ -77,10 +77,10 @@ where EthEventLog::Message(m) => { Some(Ok(Event::Message(Message::from(&m)))) } - // TODO: Log out ignored messages. EthEventLog::Transaction(tx) => { Some(Ok(Event::Transaction(RelayedTransaction::from(tx)))) } + // TODO: Log out ignored messages. EthEventLog::Ignored => None, } } diff --git a/crates/services/relayer/src/test_helpers.rs b/crates/services/relayer/src/test_helpers.rs index 6eae963bc6..84d9958724 100644 --- a/crates/services/relayer/src/test_helpers.rs +++ b/crates/services/relayer/src/test_helpers.rs @@ -52,7 +52,7 @@ impl LogTestHelper for Log { fn to_tx(&self) -> RelayedTransaction { match EthEventLog::try_from(self).unwrap() { EthEventLog::Transaction(t) => RelayedTransaction::from(t), - _ => panic!("This log does not form a message"), + _ => panic!("This log does not form a relayed transaction"), } } } From 2b2b9fae425da396eebd05478d07e2ca54188db0 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Wed, 20 Mar 2024 18:40:21 -0700 Subject: [PATCH 13/21] fix merge conflict with master --- crates/fuel-core/src/service/genesis/off_chain.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fuel-core/src/service/genesis/off_chain.rs b/crates/fuel-core/src/service/genesis/off_chain.rs index ce39163ffc..f8a1039102 100644 --- a/crates/fuel-core/src/service/genesis/off_chain.rs +++ b/crates/fuel-core/src/service/genesis/off_chain.rs @@ -21,7 +21,7 @@ use fuel_core_txpool::types::TxId; use fuel_core_types::{ entities::{ coins::coin::CompressedCoin, - message::Message, + Message, }, fuel_tx::{ Transaction, From 131aafc268e9c3356870763f405d438a7a891835 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Fri, 22 Mar 2024 07:55:30 -0700 Subject: [PATCH 14/21] Update crates/services/relayer/src/log.rs Co-authored-by: Green Baneling --- crates/services/relayer/src/log.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/services/relayer/src/log.rs b/crates/services/relayer/src/log.rs index cb9a4f6b5c..9d9d0011c7 100644 --- a/crates/services/relayer/src/log.rs +++ b/crates/services/relayer/src/log.rs @@ -124,7 +124,7 @@ impl TryFrom<&Log> for EthEventLog { } n if n == *config::ETH_FORCED_TX => { if log.topics.len() != 1 { - return Err(anyhow!("Malformed topics for Message")) + return Err(anyhow!("Malformed topics for forced Transaction")) } let raw_log = RawLog { From c9165651ade9b048f7e4e8a33e679cf5450af589 Mon Sep 17 00:00:00 2001 From: Voxelot Date: Fri, 22 Mar 2024 08:12:54 -0700 Subject: [PATCH 15/21] remove TODO --- crates/types/src/entities/relayer/transaction.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs index 949808795e..8b38275461 100644 --- a/crates/types/src/entities/relayer/transaction.rs +++ b/crates/types/src/entities/relayer/transaction.rs @@ -95,7 +95,6 @@ impl RelayedTransactionV1 { let hasher = fuel_crypto::Hasher::default() .chain(self.max_gas.to_be_bytes()) .chain(self.serialized_transaction.as_slice()); - // TODO: We need some kind of assurance from L1 that this ID is unique RelayedTransactionId((*hasher.finalize()).into()) } } From 8deb9320128a07fd804bee057d669ddade19aefb Mon Sep 17 00:00:00 2001 From: Voxelot Date: Fri, 22 Mar 2024 10:06:04 -0700 Subject: [PATCH 16/21] add relayed transactions to executor test for merkle root --- crates/fuel-core/src/executor.rs | 29 +++++++++++++++++-- crates/services/relayer/src/ports/tests.rs | 4 +-- .../types/src/entities/relayer/transaction.rs | 19 +++++++++++- crates/types/src/services/relayer.rs | 1 + 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/crates/fuel-core/src/executor.rs b/crates/fuel-core/src/executor.rs index d49b334858..be8fe87d4d 100644 --- a/crates/fuel-core/src/executor.rs +++ b/crates/fuel-core/src/executor.rs @@ -2954,7 +2954,10 @@ mod tests { }, StorageAsMut, }; - use fuel_core_types::fuel_merkle::binary::root_calculator::MerkleRootCalculator; + use fuel_core_types::{ + entities::RelayedTransaction, + fuel_merkle::binary::root_calculator::MerkleRootCalculator, + }; fn database_with_genesis_block(da_block_height: u64) -> Database { let mut db = Database::default(); @@ -2975,6 +2978,16 @@ mod tests { .expect("Should insert event"); } + fn add_events_to_relayer( + db: &mut Database, + da_height: DaBlockHeight, + events: &[Event], + ) { + db.storage::() + .insert(&da_height, events) + .expect("Should insert event"); + } + fn add_messages_to_relayer(db: &mut Database, relayer_da_height: u64) { for da_height in 0..=relayer_da_height { let mut message = Message::default(); @@ -3112,11 +3125,23 @@ mod tests { let relayer_da_height = 10u64; let mut root_calculator = MerkleRootCalculator::new(); for da_height in (genesis_da_height + 1)..=relayer_da_height { + // message let mut message = Message::default(); message.set_da_height(da_height.into()); message.set_nonce(da_height.into()); root_calculator.push(message.id().as_ref()); - add_message_to_relayer(&mut relayer_db, message); + // transaction + let mut transaction = RelayedTransaction::default(); + transaction.set_da_height(da_height.into()); + transaction.set_max_gas(da_height); + transaction.set_serialized_transaction(da_height.to_be_bytes().to_vec()); + root_calculator.push(Bytes32::from(transaction.relayed_id()).as_ref()); + // add events to relayer + add_events_to_relayer( + &mut relayer_db, + da_height.into(), + &[message.into(), transaction.into()], + ); } let producer = create_relayer_executor(on_chain_db, relayer_db); let block = test_block(block_height.into(), relayer_da_height.into(), 0); diff --git a/crates/services/relayer/src/ports/tests.rs b/crates/services/relayer/src/ports/tests.rs index 6190ff4c58..1a4b3aa3e8 100644 --- a/crates/services/relayer/src/ports/tests.rs +++ b/crates/services/relayer/src/ports/tests.rs @@ -158,7 +158,7 @@ fn insert_fails_for_events_with_different_height() { inner_test(|i| { let mut transaction = RelayedTransaction::default(); transaction.set_da_height(i.into()); - transaction.set_mas_gas(i); + transaction.set_max_gas(i); transaction.into() }) } @@ -199,7 +199,7 @@ fn insert_fails_for_events_same_height_but_on_different_height() { |i| { let mut transaction = RelayedTransaction::default(); transaction.set_da_height(last_height.into()); - transaction.set_mas_gas(i); + transaction.set_max_gas(i); transaction.into() }, last_height, diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs index 8b38275461..38cdc44a42 100644 --- a/crates/types/src/entities/relayer/transaction.rs +++ b/crates/types/src/entities/relayer/transaction.rs @@ -45,6 +45,7 @@ pub struct RelayedTransactionV1 { Hash, derive_more::Display, derive_more::From, + derive_more::Into, )] pub struct RelayedTransactionId(Bytes32); @@ -73,7 +74,7 @@ impl RelayedTransaction { } /// Set the max gas - pub fn set_mas_gas(&mut self, max_gas: u64) { + pub fn set_max_gas(&mut self, max_gas: u64) { match self { RelayedTransaction::V1(transaction) => { transaction.max_gas = max_gas; @@ -81,6 +82,22 @@ impl RelayedTransaction { } } + /// Get the canonically serialized transaction + pub fn serialized_transaction(&self) -> &[u8] { + match self { + RelayedTransaction::V1(transaction) => &transaction.serialized_transaction, + } + } + + /// Set the serialized transaction bytes + pub fn set_serialized_transaction(&mut self, serialized_bytes: Vec) { + match self { + RelayedTransaction::V1(transaction) => { + transaction.serialized_transaction = serialized_bytes; + } + } + } + /// The hash of the relayed transaction pub fn relayed_id(&self) -> RelayedTransactionId { match &self { diff --git a/crates/types/src/services/relayer.rs b/crates/types/src/services/relayer.rs index 5a66619533..ce9bdd0ae8 100644 --- a/crates/types/src/services/relayer.rs +++ b/crates/types/src/services/relayer.rs @@ -33,6 +33,7 @@ impl Event { pub fn hash(&self) -> Bytes32 { match self { Event::Message(message) => (*message.id().deref()).into(), + Event::Transaction(transaction) => transaction.relayed_id().into(), } } } From 1a0413d128adde1e13652939e90f1a36193b5273 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Fri, 22 Mar 2024 16:12:38 -0700 Subject: [PATCH 17/21] refactor tests --- crates/fuel-core/src/executor.rs | 2 +- crates/services/relayer/src/mock_db.rs | 2 +- crates/services/relayer/tests/integration.rs | 96 ++++++++++++------- .../types/src/entities/relayer/transaction.rs | 6 +- crates/types/src/services/relayer.rs | 2 +- 5 files changed, 68 insertions(+), 40 deletions(-) diff --git a/crates/fuel-core/src/executor.rs b/crates/fuel-core/src/executor.rs index be8fe87d4d..3773bd830a 100644 --- a/crates/fuel-core/src/executor.rs +++ b/crates/fuel-core/src/executor.rs @@ -3135,7 +3135,7 @@ mod tests { transaction.set_da_height(da_height.into()); transaction.set_max_gas(da_height); transaction.set_serialized_transaction(da_height.to_be_bytes().to_vec()); - root_calculator.push(Bytes32::from(transaction.relayed_id()).as_ref()); + root_calculator.push(Bytes32::from(transaction.id()).as_ref()); // add events to relayer add_events_to_relayer( &mut relayer_db, diff --git a/crates/services/relayer/src/mock_db.rs b/crates/services/relayer/src/mock_db.rs index b667de596c..7e307a6a0c 100644 --- a/crates/services/relayer/src/mock_db.rs +++ b/crates/services/relayer/src/mock_db.rs @@ -85,7 +85,7 @@ impl RelayerDb for MockDb { m.transactions .entry(transaction.da_height()) .or_default() - .insert(transaction.relayed_id(), transaction.clone()); + .insert(transaction.id(), transaction.clone()); } } } diff --git a/crates/services/relayer/tests/integration.rs b/crates/services/relayer/tests/integration.rs index 612bb95233..a47bc41828 100644 --- a/crates/services/relayer/tests/integration.rs +++ b/crates/services/relayer/tests/integration.rs @@ -1,6 +1,9 @@ #![cfg(feature = "test-helpers")] -use ethers_core::types::U256; +use ethers_core::types::{ + Log, + U256, +}; use fuel_core_relayer::{ bridge::{ MessageSentFilter, @@ -93,12 +96,8 @@ async fn stop_service_at_the_middle() { } #[tokio::test(start_paused = true)] -async fn can_get_messages() { - let mock_db = MockDb::default(); - let eth_node = MockMiddleware::default(); - - let config = Config::default(); - let contract_address = config.eth_v2_listening_contracts[0]; +#[allow(non_snake_case)] +async fn relayer__downloads_message_logs_to_events_table() { let message = |nonce: u64, block_number: u64| { let message = MessageSentFilter { nonce: U256::from_dec_str(nonce.to_string().as_str()) @@ -106,58 +105,48 @@ async fn can_get_messages() { ..Default::default() }; let mut log = message.into_log(); - log.address = contract_address; log.block_number = Some(block_number.into()); log }; + // setup mock data let logs = vec![message(1, 3), message(2, 5)]; let expected_messages: Vec<_> = logs.iter().map(|l| l.to_msg()).collect(); - eth_node.update_data(|data| data.logs_batch = vec![logs.clone()]); - // Setup the eth node with a block high enough that there - // will be some finalized blocks. - eth_node.update_data(|data| data.best_block.number = Some(100.into())); - let relayer = new_service_test(eth_node, mock_db.clone(), config); - relayer.start_and_await().await.unwrap(); - - relayer.shared.await_synced().await.unwrap(); - + let mut ctx = TestContext::new(); + // given logs + ctx.given_logs(logs); + // when the relayer runs + let mock_db = ctx.when_relayer_syncs().await; + // expect several messages in the database for msg in expected_messages { assert_eq!(mock_db.get_message(msg.id()).unwrap(), msg); } } #[tokio::test(start_paused = true)] -async fn can_get_transactions() { - let mock_db = MockDb::default(); - let eth_node = MockMiddleware::default(); - - let config = Config::default(); - let contract_address = config.eth_v2_listening_contracts[0]; +#[allow(non_snake_case)] +async fn relayer__downloads_transaction_logs_to_events_table() { let transaction = |max_gas: u64, block_number: u64| { let transaction = TransactionFilter { max_gas, ..Default::default() }; let mut log = transaction.into_log(); - log.address = contract_address; log.block_number = Some(block_number.into()); log }; + // setup mock data let logs = vec![transaction(2, 1), transaction(3, 2)]; let expected_transactions: Vec<_> = logs.iter().map(|l| l.to_tx()).collect(); - eth_node.update_data(|data| data.logs_batch = vec![logs.clone()]); - // Setup the eth node with a block high enough that there - // will be some finalized blocks. - eth_node.update_data(|data| data.best_block.number = Some(100.into())); - let relayer = new_service_test(eth_node, mock_db.clone(), config); - relayer.start_and_await().await.unwrap(); - - relayer.shared.await_synced().await.unwrap(); - + let mut ctx = TestContext::new(); + // given logs + ctx.given_logs(logs); + // when the relayer runs + let mock_db = ctx.when_relayer_syncs().await; + // expect several transaction events in the database for tx in expected_transactions { - assert_eq!(mock_db.get_transaction(&tx.relayed_id()).unwrap(), tx); + assert_eq!(mock_db.get_transaction(&tx.id()).unwrap(), tx); } } @@ -198,3 +187,42 @@ async fn deploy_height_is_set() { rx.await.unwrap(); assert_eq!(*mock_db.get_finalized_da_height().unwrap(), 54); } + +struct TestContext { + mock_db: MockDb, + eth_node: MockMiddleware, + config: Config, +} + +impl TestContext { + fn new() -> Self { + Self { + mock_db: MockDb::default(), + eth_node: MockMiddleware::default(), + config: Config::default(), + } + } + + fn given_logs(&mut self, mut logs: Vec) { + let contract_address = self.config.eth_v2_listening_contracts[0]; + for log in &mut logs { + log.address = contract_address; + } + + self.eth_node + .update_data(|data| data.logs_batch = vec![logs.clone()]); + // Setup the eth node with a block high enough that there + // will be some finalized blocks. + self.eth_node + .update_data(|data| data.best_block.number = Some(100.into())); + } + + async fn when_relayer_syncs(self) -> MockDb { + let relayer = new_service_test(self.eth_node, self.mock_db.clone(), self.config); + relayer.start_and_await().await.unwrap(); + + relayer.shared.await_synced().await.unwrap(); + + self.mock_db + } +} diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs index 38cdc44a42..b271913925 100644 --- a/crates/types/src/entities/relayer/transaction.rs +++ b/crates/types/src/entities/relayer/transaction.rs @@ -99,16 +99,16 @@ impl RelayedTransaction { } /// The hash of the relayed transaction - pub fn relayed_id(&self) -> RelayedTransactionId { + pub fn id(&self) -> RelayedTransactionId { match &self { - RelayedTransaction::V1(tx) => tx.relayed_transaction_id(), + RelayedTransaction::V1(tx) => tx.id(), } } } impl RelayedTransactionV1 { /// The hash of the relayed transaction (max_gas (big endian) || serialized_transaction) - pub fn relayed_transaction_id(&self) -> RelayedTransactionId { + pub fn id(&self) -> RelayedTransactionId { let hasher = fuel_crypto::Hasher::default() .chain(self.max_gas.to_be_bytes()) .chain(self.serialized_transaction.as_slice()); diff --git a/crates/types/src/services/relayer.rs b/crates/types/src/services/relayer.rs index ce9bdd0ae8..509ed8b9cc 100644 --- a/crates/types/src/services/relayer.rs +++ b/crates/types/src/services/relayer.rs @@ -33,7 +33,7 @@ impl Event { pub fn hash(&self) -> Bytes32 { match self { Event::Message(message) => (*message.id().deref()).into(), - Event::Transaction(transaction) => transaction.relayed_id().into(), + Event::Transaction(transaction) => transaction.id().into(), } } } From 3b7e397ee1b1e049a7fe51db3b1369c4d845a568 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Fri, 22 Mar 2024 16:18:34 -0700 Subject: [PATCH 18/21] Update crates/types/src/services/relayer.rs Co-authored-by: Brandon Vrooman --- crates/types/src/services/relayer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/types/src/services/relayer.rs b/crates/types/src/services/relayer.rs index 509ed8b9cc..8c2f4602ca 100644 --- a/crates/types/src/services/relayer.rs +++ b/crates/types/src/services/relayer.rs @@ -16,7 +16,7 @@ use std::ops::Deref; pub enum Event { /// The message event which was sent to the bridge. Message(Message), - /// A transaction that was forced included from L1 + /// A transaction that was forcibly included from L1 Transaction(RelayedTransaction), } From a8bf11f637ef0719ed4a077c924bc98f73659339 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Fri, 22 Mar 2024 16:20:00 -0700 Subject: [PATCH 19/21] explain magic topic numbers --- crates/services/relayer/src/log.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/services/relayer/src/log.rs b/crates/services/relayer/src/log.rs index 9d9d0011c7..c7dae87630 100644 --- a/crates/services/relayer/src/log.rs +++ b/crates/services/relayer/src/log.rs @@ -88,6 +88,7 @@ impl TryFrom<&Log> for EthEventLog { let log = match log.topics[0] { n if n == *config::ETH_LOG_MESSAGE => { + // event has 3 indexed fields, so it should have 4 topics if log.topics.len() != 4 { return Err(anyhow!("Malformed topics for Message")) } @@ -123,6 +124,7 @@ impl TryFrom<&Log> for EthEventLog { }) } n if n == *config::ETH_FORCED_TX => { + // event has no indexed fields, so there is only 1 topic if log.topics.len() != 1 { return Err(anyhow!("Malformed topics for forced Transaction")) } From c28f13fed996ceb82f3e9f09a3e3d6411434dd31 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Fri, 22 Mar 2024 16:26:44 -0700 Subject: [PATCH 20/21] put helper functions under test-helpers flag --- crates/types/src/entities/relayer/transaction.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs index b271913925..bf8153cb3c 100644 --- a/crates/types/src/entities/relayer/transaction.rs +++ b/crates/types/src/entities/relayer/transaction.rs @@ -50,6 +50,7 @@ pub struct RelayedTransactionV1 { pub struct RelayedTransactionId(Bytes32); impl RelayedTransaction { + #[cfg(any(test, feature = "test-helpers"))] /// Get the DA height that originated this transaction from L1 pub fn da_height(&self) -> DaBlockHeight { match self { @@ -57,6 +58,7 @@ impl RelayedTransaction { } } + #[cfg(any(test, feature = "test-helpers"))] /// Set the da height pub fn set_da_height(&mut self, height: DaBlockHeight) { match self { @@ -66,6 +68,7 @@ impl RelayedTransaction { } } + #[cfg(any(test, feature = "test-helpers"))] /// Get the max gas pub fn max_gas(&self) -> u64 { match self { @@ -73,6 +76,7 @@ impl RelayedTransaction { } } + #[cfg(any(test, feature = "test-helpers"))] /// Set the max gas pub fn set_max_gas(&mut self, max_gas: u64) { match self { @@ -82,6 +86,7 @@ impl RelayedTransaction { } } + #[cfg(any(test, feature = "test-helpers"))] /// Get the canonically serialized transaction pub fn serialized_transaction(&self) -> &[u8] { match self { @@ -89,6 +94,7 @@ impl RelayedTransaction { } } + #[cfg(any(test, feature = "test-helpers"))] /// Set the serialized transaction bytes pub fn set_serialized_transaction(&mut self, serialized_bytes: Vec) { match self { From b16688a54c4201ca3b19ed663b37b6147d40a60b Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Fri, 22 Mar 2024 16:33:16 -0700 Subject: [PATCH 21/21] fix overly restrictive feature flags --- crates/types/src/entities/relayer/transaction.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/types/src/entities/relayer/transaction.rs b/crates/types/src/entities/relayer/transaction.rs index bf8153cb3c..625705d05b 100644 --- a/crates/types/src/entities/relayer/transaction.rs +++ b/crates/types/src/entities/relayer/transaction.rs @@ -50,7 +50,13 @@ pub struct RelayedTransactionV1 { pub struct RelayedTransactionId(Bytes32); impl RelayedTransaction { - #[cfg(any(test, feature = "test-helpers"))] + /// The hash of the relayed transaction + pub fn id(&self) -> RelayedTransactionId { + match &self { + RelayedTransaction::V1(tx) => tx.id(), + } + } + /// Get the DA height that originated this transaction from L1 pub fn da_height(&self) -> DaBlockHeight { match self { @@ -103,13 +109,6 @@ impl RelayedTransaction { } } } - - /// The hash of the relayed transaction - pub fn id(&self) -> RelayedTransactionId { - match &self { - RelayedTransaction::V1(tx) => tx.id(), - } - } } impl RelayedTransactionV1 {