Skip to content

Commit

Permalink
Include the signature length in the gas billing of the dry run.
Browse files Browse the repository at this point in the history
  • Loading branch information
steelgeek091 committed Feb 5, 2025
1 parent 61af80f commit a3dd63e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/rooch-executor/src/actor/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use rooch_types::framework::ethereum::EthereumModule;
use rooch_types::framework::transaction_validator::TransactionValidator;
use rooch_types::framework::{system_post_execute_functions, system_pre_execute_functions};
use rooch_types::multichain_id::RoochMultiChainID;
use rooch_types::transaction::authenticator::AUTH_PAYLOAD_SIZE;
use rooch_types::transaction::{
AuthenticatorInfo, L1Block, L1BlockWithBody, L1Transaction, RoochTransaction,
RoochTransactionData,
Expand Down Expand Up @@ -376,7 +377,7 @@ impl ExecutorActor {
tx_data.sequence_number,
tx_data.max_gas_amount,
tx_data.tx_hash(),
tx_data.tx_size(),
tx_data.tx_size() + AUTH_PAYLOAD_SIZE,
);

let tx_metadata = TxMeta::new_from_move_action(&tx_data.action);
Expand Down
2 changes: 2 additions & 0 deletions crates/rooch-types/src/transaction/authenticator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ use crate::{

use super::RoochTransactionData;

pub const AUTH_PAYLOAD_SIZE: u64 = 219;

/// A `Authenticator` is an abstraction of a account authenticator.
/// It is a part of `AccountAbstraction`
Expand Down
9 changes: 8 additions & 1 deletion crates/rooch/src/tx_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use moveos_types::move_std::option::MoveOption;
use moveos_types::moveos_std::gas_schedule::GasScheduleConfig;
use moveos_types::moveos_std::object::ObjectMeta;
use moveos_types::moveos_std::tx_context::TxContext;
use moveos_types::moveos_std::tx_meta::TxMeta;
use moveos_types::transaction::{
MoveAction, RawTransactionOutput, VMErrorInfo, VerifiedMoveAction, VerifiedMoveOSTransaction,
};
Expand All @@ -34,6 +35,7 @@ use rooch_rpc_client::{Client, ClientResolver};
use rooch_types::address::{BitcoinAddress, MultiChainAddress};
use rooch_types::framework::auth_validator::{BuiltinAuthValidator, TxValidateResult};
use rooch_types::framework::system_pre_execute_functions;
use rooch_types::transaction::authenticator::AUTH_PAYLOAD_SIZE;
use rooch_types::transaction::RoochTransactionData;
use std::rc::Rc;
use std::str::FromStr;
Expand All @@ -55,7 +57,9 @@ pub fn execute_tx_locally(
GasScheduleConfig::CLI_DEFAULT_MAX_GAS_AMOUNT,
true,
);
gas_meter.charge_io_write(tx.tx_size()).unwrap();
gas_meter
.charge_io_write(tx.tx_size() + AUTH_PAYLOAD_SIZE)
.unwrap();

let mut moveos_session = MoveOSSession::new(
move_mv.inner(),
Expand Down Expand Up @@ -235,6 +239,9 @@ fn convert_to_verified_tx(
tx_data.tx_size(),
);

let tx_metadata = TxMeta::new_from_move_action(&tx_data.action);
tx_ctx.add(tx_metadata).unwrap();

let mut bitcoin_address = BitcoinAddress::from_str("18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX")?;

let user_multi_chain_address: MultiChainAddress = tx_data.sender.into();
Expand Down

0 comments on commit a3dd63e

Please sign in to comment.