Skip to content

Commit

Permalink
rename the converter function and add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
steelgeek091 committed Feb 5, 2025
1 parent a3dd63e commit 411b6c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 7 additions & 3 deletions crates/rooch-executor/src/actor/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,18 +366,22 @@ impl ExecutorActor {
Ok(vm_result)
}

pub fn convert_to_verified_tx(
pub fn convert_to_verified_tx_for_dry_run(
&self,
tx_data: RoochTransactionData,
) -> Result<VerifiedMoveOSTransaction> {
let root = self.root.clone();

// The dry run supports unsigned transactions, but when calculating the transaction size,
// the length of the signature part needs to be included.
let tx_size = tx_data.tx_size() + AUTH_PAYLOAD_SIZE;

let mut tx_ctx = TxContext::new(
tx_data.sender.into(),
tx_data.sequence_number,
tx_data.max_gas_amount,
tx_data.tx_hash(),
tx_data.tx_size() + AUTH_PAYLOAD_SIZE,
tx_size,
);

let tx_metadata = TxMeta::new_from_move_action(&tx_data.action);
Expand Down Expand Up @@ -545,7 +549,7 @@ impl Handler<ConvertL2TransactionData> for ExecutorActor {
msg: ConvertL2TransactionData,
_ctx: &mut ActorContext,
) -> Result<VerifiedMoveOSTransaction> {
self.convert_to_verified_tx(msg.tx_data)
self.convert_to_verified_tx_for_dry_run(msg.tx_data)
}
}

Expand Down
9 changes: 6 additions & 3 deletions crates/rooch/src/tx_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ pub fn execute_tx_locally(
GasScheduleConfig::CLI_DEFAULT_MAX_GAS_AMOUNT,
true,
);
gas_meter
.charge_io_write(tx.tx_size() + AUTH_PAYLOAD_SIZE)
.unwrap();

// The dry run supports unsigned transactions, but when calculating the transaction size,
// the length of the signature part needs to be included.
let tx_size = tx.tx_size() + AUTH_PAYLOAD_SIZE;

gas_meter.charge_io_write(tx_size).unwrap();

let mut moveos_session = MoveOSSession::new(
move_mv.inner(),
Expand Down

0 comments on commit 411b6c6

Please sign in to comment.