Skip to content

Commit

Permalink
Cleanup more, update CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchTurner committed Apr 19, 2024
1 parent a5c0ff0 commit 6e1762e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 62 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Description of the upcoming release here.
- [1842](https://github.com/FuelLabs/fuel-core/pull/1842): Ignore RUSTSEC-2024-0336: `rustls::ConnectionCommon::complete_io` could fall into an infinite loop based on network

### Changed

- [#1847](https://github.com/FuelLabs/fuel-core/pull/1847): Simplify the validation interface to use `Block`
- [#1837](https://github.com/FuelLabs/fuel-core/pull/1837): Refactor the executor and separate validation from the other use cases

## [Version 0.25.1]
Expand All @@ -40,6 +40,7 @@ Description of the upcoming release here.

### Changed

- [#1837](https://github.com/FuelLabs/fuel-core/pull/1837): Refactor the executor and separate validation from the other use cases
- [#1833](https://github.com/FuelLabs/fuel-core/pull/1833): Regenesis of `SpentMessages` and `ProcessedTransactions`.
- [#1830](https://github.com/FuelLabs/fuel-core/pull/1830): Use versioning enum for WASM executor input and output.
- [#1816](https://github.com/FuelLabs/fuel-core/pull/1816): Updated the upgradable executor to fetch the state transition bytecode from the database when the version doesn't match a native one. This change enables the WASM executor in the "production" build and requires a `wasm32-unknown-unknown` target.
Expand Down
72 changes: 11 additions & 61 deletions crates/services/executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,32 +531,6 @@ where

debug_assert!(block.transactions.is_empty());

// let forced_transactions = self.get_relayed_txs(&block.header, &mut data)?;
// let relayed_tx_iter = forced_transactions.into_iter();
// for transaction in relayed_tx_iter {
// const RELAYED_GAS_PRICE: Word = 0;
// let transaction = MaybeCheckedTransaction::CheckedTransaction(transaction);
// let tx_id = transaction.id(&self.consensus_params.chain_id());
// match self.execute_transaction_and_commit(
// block,
// &mut thread_block_transaction,
// &mut data,
// transaction,
// RELAYED_GAS_PRICE,
// coinbase_contract_id,
// execution_kind,
// ) {
// Ok(_) => {}
// Err(err) => {
// let event = ExecutorEvent::ForcedTransactionFailed {
// id: tx_id.into(),
// block_height,
// failure: err.to_string(),
// };
// data.events.push(event);
// }
// }
// }
self.process_relayed_txs(
forced_transactions,
block,
Expand Down Expand Up @@ -702,11 +676,7 @@ where
let execution_kind = ExecutionKind::Validation;

let (gas_price, coinbase_contract_id) =
if let Some(Transaction::Mint(mint)) = transactions.last() {
(*mint.gas_price(), mint.input_contract().contract_id)
} else {
return Err(ExecutorError::MintMissing)
};
Self::get_coinbase_info_from_mint_tx(&transactions)?;

let block_header = partial_block.header;
let forced_transactions = self.get_relayed_txs(&block_header, &mut data)?;
Expand All @@ -726,32 +696,6 @@ where

debug_assert!(partial_block.transactions.is_empty());

// let forced_transactions = self.get_relayed_txs(&block_header, &mut data)?;
// let relayed_tx_iter = forced_transactions.into_iter();
// for transaction in relayed_tx_iter {
// const RELAYED_GAS_PRICE: Word = 0;
// let transaction = MaybeCheckedTransaction::CheckedTransaction(transaction);
// let tx_id = transaction.id(&self.consensus_params.chain_id());
// match self.execute_transaction_and_commit(
// &mut partial_block,
// &mut thread_block_transaction,
// &mut data,
// transaction,
// RELAYED_GAS_PRICE,
// coinbase_contract_id,
// execution_kind,
// ) {
// Ok(_) => {}
// Err(err) => {
// let event = ExecutorEvent::ForcedTransactionFailed {
// id: tx_id.into(),
// block_height: *block_height,
// failure: err.to_string(),
// };
// data.events.push(event);
// }
// }
// }
self.process_relayed_txs(
forced_transactions,
&mut partial_block,
Expand Down Expand Up @@ -782,14 +726,20 @@ where
self.block_st_transaction
.commit_changes(block_with_relayer_data_transaction.into_changes())?;

if !data.found_mint {
return Err(ExecutorError::MintMissing)
}

data.changes = self.block_st_transaction.into_changes();
Ok(data)
}

fn get_coinbase_info_from_mint_tx(
transactions: &[Transaction],
) -> ExecutorResult<(u64, ContractId)> {
if let Some(Transaction::Mint(mint)) = transactions.last() {
Ok((*mint.gas_price(), mint.input_contract().contract_id))
} else {
Err(ExecutorError::MintMissing)
}
}

fn process_relayed_txs(
&self,
forced_transactions: Vec<CheckedTransaction>,
Expand Down

0 comments on commit 6e1762e

Please sign in to comment.