Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
darthsiroftardis committed Jan 17, 2025
1 parent 9343ddb commit 4ecdfdc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions types/src/chainspec/transaction_config/transaction_v1_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,22 @@ impl TransactionV1Config {
maybe_adequate_lane_index.map(|index| buckets[index].id)
}

pub fn get_max_serialized_length_for_wasm(&self) -> u64 {
self.get_wasm_lanes_ordered_by_transaction_size()
.iter()
.map(|lane_def| lane_def.max_transaction_length)
.max()
.unwrap_or(0u64)
}

pub fn get_max_payment_limit_for_wasm(&self) -> u64 {
self.get_wasm_lanes_ordered_by_gas_limit()
.iter()
.map(|lane_def| lane_def.max_transaction_gas_limit)
.max()
.unwrap_or(0u64)
}

pub fn get_wasm_lane_id_by_payment_limited(
&self,
gas_limit: u64,
Expand Down
4 changes: 2 additions & 2 deletions types/src/transaction/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ impl Deploy {
// InstallUpgrade doesn't rely on the size of transaction
let max_transaction_size = config
.transaction_v1_config
.get_max_serialized_length(LARGE_WASM_LANE_ID);
.get_max_serialized_length_for_wasm();
self.is_valid_size(max_transaction_size as u32)?;

let header = self.header();
Expand Down Expand Up @@ -484,7 +484,7 @@ impl Deploy {

let wasm_lane_limit = config
.transaction_v1_config
.get_max_transaction_gas_limit(LARGE_WASM_LANE_ID);
.get_max_payment_limit_for_wasm();
let wasm_lane_limit_as_gas = Gas::new(wasm_lane_limit);
if gas_limit > wasm_lane_limit_as_gas {
debug!(
Expand Down

0 comments on commit 4ecdfdc

Please sign in to comment.