Răsfoiți Sursa

Revert "[validator/verification] Reject massive txs"

This reverts commit a0636984e4669bbef3935db6287d835aea3526b4.
y 2 ani în urmă
părinte
comite
d70dc7da65
2 a modificat fișierele cu 3 adăugiri și 17 ștergeri
  1. 1 1
      src/runtime/vm_runtime.rs
  2. 2 16
      src/validator/verification.rs

+ 1 - 1
src/runtime/vm_runtime.rs

@@ -45,7 +45,7 @@ use crate::{
 const MEMORY: &str = "memory";
 
 /// Gas limit for a contract
-pub const GAS_LIMIT: u64 = 400_000_000;
+const GAS_LIMIT: u64 = 400_000_000;
 
 #[derive(Clone, Copy, PartialEq)]
 pub enum ContractSection {

+ 2 - 16
src/validator/verification.rs

@@ -204,11 +204,12 @@ pub async fn verify_producer_transaction(
     let tx_hash = tx.hash()?;
     debug!(target: "validator::verification::verify_producer_transaction", "Validating proposal transaction {}", tx_hash);
 
-    // Producer transactions must contain a single, non-empty call
+    // Producer transactions must contain a single, non-empty call 
     if tx.calls.len() != 1 || tx.calls[0].data.is_empty() {
         return Err(TxVerifyFailed::ErroneousTxs(vec![tx.clone()]).into())
     }
 
+
     // Verify call based on version
     let call = &tx.calls[0];
     match block_version {
@@ -336,21 +337,6 @@ pub async fn verify_transaction(
     let tx_hash = tx.hash()?;
     debug!(target: "validator::verification::verify_transaction", "Validating transaction {}", tx_hash);
 
-    // Ensure that the number of transaction calls does not exceed the
-    // maximum limit.
-    // As of now, each opcode is worth 1 gas. Each tx call will contain at
-    // least one opcode. Therefore, if a transaction has a number of calls
-    // that exceeds the GAS_LIMIT (defined by the [`Runtime`]), it is
-    // guaranteed to run out gas and ultimately fail.
-    // Instead of wasting time executing all those calls, we can reject
-    // the transaction early.
-    // Note: this limit could be reduced as each call is likely to contain
-    // much more than one opcode.
-    if tx.calls.len() as u64 > GAS_LIMIT {
-        error!(target: "validator::verification::verify_transaction", "Transaction contains too many calls");
-        return Err(TxVerifyFailed::ErroneousTxs(vec![tx.clone()]).into())
-    }
-
     // Table of public inputs used for ZK proof verification
     let mut zkp_table = vec![];
     // Table of public keys used for signature verification