Skip to content

Commit

Permalink
Upgrade to the fuel-vm 0.45.0 (FuelLabs#1600)
Browse files Browse the repository at this point in the history
Closes FuelLabs#1544

Addresses breaking changes from
FuelLabs/fuel-vm#654

---------

Co-authored-by: Turner <[email protected]>
  • Loading branch information
Dentosal and MitchTurner authored Jan 31, 2024
1 parent 3c55250 commit fe17693
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 64 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Description of the upcoming release here.

### Changed

- [#1600](https://github.com/FuelLabs/fuel-core/pull/1600): Upgrade to fuel-vm 0.44.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.
- [#1613](https://github.com/FuelLabs/fuel-core/pull/1613): Add api endpoint to retrieve a message by its nonce.
Expand Down
32 changes: 16 additions & 16 deletions Cargo.lock

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

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

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

# Common dependencies
anyhow = "1.0"
Expand Down
14 changes: 3 additions & 11 deletions crates/client/src/client/schema/tx/transparent_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ impl TryFrom<Transaction> for fuel_tx::Transaction {
.collect(),
);
create.into()
} else {
} else if tx.is_mint {
let tx_pointer: fuel_tx::TxPointer = tx
.tx_pointer
.ok_or_else(|| ConversionError::MissingField("tx_pointer".to_string()))?
Expand Down Expand Up @@ -279,16 +279,8 @@ impl TryFrom<Transaction> for fuel_tx::Transaction {
.into(),
);
mint.into()
};

// This `match` block is added here to enforce compilation error if a new variant
// is added into the `fuel_tx::Transaction` enum.
//
// If you face a compilation error, please update the code above and add a new variant below.
match tx {
fuel_tx::Transaction::Script(_) => {}
fuel_tx::Transaction::Create(_) => {}
fuel_tx::Transaction::Mint(_) => {}
} else {
return Err(ConversionError::UnknownVariant("Transaction"));
};

Ok(tx)
Expand Down
3 changes: 2 additions & 1 deletion crates/fuel-core/src/graphql_api/worker_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ where
inputs = tx.inputs().as_slice();
outputs = tx.outputs().as_slice();
}
Transaction::Mint(_) => continue,
_ => continue,
}
self.persist_owners_index(
block_height,
Expand Down Expand Up @@ -143,6 +143,7 @@ where
owners.push(to);
}
Output::Contract(_) | Output::ContractCreated { .. } => {}
_ => {}
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/fuel-core/src/schema/tx/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ impl From<&fuel_tx::Input> for Input {
predicate: HexString(predicate.clone()),
predicate_data: HexString(predicate_data.clone()),
}),
input => todo!("No mapping for input {input:?}"),
}
}
}
Expand Down
14 changes: 10 additions & 4 deletions crates/fuel-core/src/schema/tx/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub enum Output {
ContractCreated(ContractCreated),
}

pub type OutputConversionError = String;

pub struct CoinOutput {
to: fuel_types::Address,
amount: Word,
Expand Down Expand Up @@ -119,9 +121,11 @@ impl ContractCreated {
}
}

impl From<&fuel_tx::Output> for Output {
fn from(output: &fuel_tx::Output) -> Self {
match output {
impl TryFrom<&fuel_tx::Output> for Output {
type Error = OutputConversionError;

fn try_from(output: &fuel_tx::Output) -> Result<Self, Self::Error> {
let val = match output {
fuel_tx::Output::Coin {
to,
amount,
Expand Down Expand Up @@ -157,7 +161,9 @@ impl From<&fuel_tx::Output> for Output {
contract_id: *contract_id,
state_root: *state_root,
}),
}
_ => return Err(format!("Unsupported output type: {:?}", output)),
};
Ok(val)
}
}

Expand Down
Loading

0 comments on commit fe17693

Please sign in to comment.