Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the base asset id in the metadata #781

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added
- [#781](https://github.com/FuelLabs/fuel-vm/pull/781): Added `base_asset_id` to checked metadata.

## [Version 0.54.1]

### Changed
Expand Down
32 changes: 28 additions & 4 deletions fuel-vm/src/checked_transaction/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ pub mod create {
Create,
FormatValidityChecks,
};
use fuel_types::BlockHeight;
use fuel_types::{
AssetId,
BlockHeight,
};

/// Metadata produced by checking [`fuel_tx::Create`].
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct CheckedMetadata {
/// The base asset id.
pub base_asset_id: AssetId,
/// See [`NonRetryableFreeBalances`].
pub free_balances: NonRetryableFreeBalances,
/// The block height this tx was verified with
Expand Down Expand Up @@ -114,6 +119,7 @@ pub mod create {
);

let metadata = CheckedMetadata {
base_asset_id: *consensus_params.base_asset_id(),
free_balances: NonRetryableFreeBalances(non_retryable_balances),
block_height,
min_gas: self
Expand Down Expand Up @@ -181,11 +187,16 @@ pub mod script {
FormatValidityChecks,
Script,
};
use fuel_types::BlockHeight;
use fuel_types::{
AssetId,
BlockHeight,
};

/// Metadata produced by checking [`fuel_tx::Script`].
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct CheckedMetadata {
/// The base asset id.
pub base_asset_id: AssetId,
/// See [`NonRetryableFreeBalances`].
pub non_retryable_balances: NonRetryableFreeBalances,
/// See [`RetryableAmount`].
Expand Down Expand Up @@ -217,6 +228,7 @@ pub mod script {
} = initial_free_balances(&self, consensus_params.base_asset_id())?;

let metadata = CheckedMetadata {
base_asset_id: *consensus_params.base_asset_id(),
non_retryable_balances: NonRetryableFreeBalances(non_retryable_balances),
retryable_balance: RetryableAmount {
amount: retryable_balance,
Expand Down Expand Up @@ -255,11 +267,16 @@ pub mod upgrade {
FormatValidityChecks,
Upgrade,
};
use fuel_types::BlockHeight;
use fuel_types::{
AssetId,
BlockHeight,
};

/// Metadata produced by checking [`fuel_tx::Upgrade`].
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct CheckedMetadata {
/// The base asset id.
pub base_asset_id: AssetId,
/// See [`NonRetryableFreeBalances`].
pub free_balances: NonRetryableFreeBalances,
/// The block height this tx was verified with
Expand Down Expand Up @@ -293,6 +310,7 @@ pub mod upgrade {
);

let metadata = CheckedMetadata {
base_asset_id: *consensus_params.base_asset_id(),
free_balances: NonRetryableFreeBalances(non_retryable_balances),
block_height,
min_gas: self
Expand Down Expand Up @@ -327,11 +345,16 @@ pub mod upload {
FormatValidityChecks,
Upload,
};
use fuel_types::BlockHeight;
use fuel_types::{
AssetId,
BlockHeight,
};

/// Metadata produced by checking [`fuel_tx::Upload`].
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct CheckedMetadata {
/// The base asset id.
pub base_asset_id: AssetId,
/// See [`NonRetryableFreeBalances`].
pub free_balances: NonRetryableFreeBalances,
/// The block height this tx was verified with
Expand Down Expand Up @@ -365,6 +388,7 @@ pub mod upload {
);

let metadata = CheckedMetadata {
base_asset_id: *consensus_params.base_asset_id(),
free_balances: NonRetryableFreeBalances(non_retryable_balances),
block_height,
min_gas: self
Expand Down
Loading