Skip to content

Commit

Permalink
Reuse upstream proof_size_base_cost() (#1521)
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest authored Jun 27, 2024
1 parent 1ae7f7e commit 52d94ba
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions pallet/ethtx-forwarder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,9 @@ impl<T: Config> Pallet<T> {
transaction_data.gas_limit.unique_saturated_into(),
true,
) {
weight_limit if weight_limit.proof_size() > 0 =>
(Some(weight_limit), Some(proof_size_base_cost(&transaction))),
weight_limit if weight_limit.proof_size() > 0 => {
(Some(weight_limit), Some(transaction_data.proof_size_base_cost()))
},
_ => (None, None),
};

Expand Down Expand Up @@ -290,17 +291,6 @@ impl From<TransactionValidationError> for TxErrorWrapper {
}
}

// TODO: Reuse the frontier implementation
fn proof_size_base_cost(transaction: &Transaction) -> u64 {
transaction
.encode()
.len()
// pallet index
.saturating_add(1)
// call index
.saturating_add(1) as u64
}

#[derive(Clone, Debug, PartialEq, Eq, Encode, Decode, TypeInfo)]
pub struct ForwardRequest {
pub tx_type: TxType,
Expand Down

0 comments on commit 52d94ba

Please sign in to comment.