Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline validation #3448

Merged
merged 10 commits into from
Jul 5, 2024
Prev Previous commit
Next Next commit
Moves allowed txs check in process_proposal before the check on fees
  • Loading branch information
grarco committed Jun 26, 2024
commit 9b5fd30aae691c2459718c8fb7d737adb7d2d39b
33 changes: 18 additions & 15 deletions crates/node/src/shell/process_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,24 @@ where
};
}

// Validate the inner txs after. Even if the batch is non-atomic
// we still reject it if just one of the inner txs is
// invalid
for cmt in tx.commitments() {
// Tx allowlist
if let Err(err) =
check_tx_allowed(&tx.batch_ref_tx(cmt), &self.state)
{
return TxResult {
code: ResultCode::TxNotAllowlisted.into(),
info: format!(
"Tx code didn't pass the allowlist check: {}",
err
),
};
}
}

// Check that the fee payer has sufficient balance.
if let Err(e) = process_proposal_fee_check(
&wrapper,
Expand All @@ -478,21 +496,6 @@ where
};
}

for cmt in tx.commitments() {
// Tx allowlist
if let Err(err) =
check_tx_allowed(&tx.batch_ref_tx(cmt), &self.state)
{
return TxResult {
code: ResultCode::TxNotAllowlisted.into(),
info: format!(
"Tx code didn't pass the allowlist check: {}",
err
),
};
}
}

TxResult {
code: ResultCode::Ok.into(),
info: "Process proposal accepted this transaction".into(),
Expand Down