From 02819234b7919a00e381e353834c543a7706c557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Tue, 13 Nov 2018 00:11:24 +0000 Subject: [PATCH 1/2] ethcore: use Machine::verify_transaction on parent block also fixes off-by-one activation of transaction permission contract --- ethcore/src/machine.rs | 4 ++-- ethcore/src/verification/verification.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index c74cc6bf4d1..47cea85059b 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -371,11 +371,11 @@ impl EthereumMachine { } /// Does verification of the transaction against the parent state. - pub fn verify_transaction(&self, t: &SignedTransaction, header: &Header, client: &C) + pub fn verify_transaction(&self, t: &SignedTransaction, parent: &Header, client: &C) -> Result<(), transaction::Error> { if let Some(ref filter) = self.tx_filter.as_ref() { - if !filter.transaction_allowed(header.parent_hash(), header.number(), t, client) { + if !filter.transaction_allowed(&parent.hash(), parent.number() + 1, t, client) { return Err(transaction::Error::NotAllowed.into()) } } diff --git a/ethcore/src/verification/verification.rs b/ethcore/src/verification/verification.rs index 2d8c17a67a2..3fe64ad25b6 100644 --- a/ethcore/src/verification/verification.rs +++ b/ethcore/src/verification/verification.rs @@ -147,7 +147,7 @@ pub fn verify_block_family(header: &Header, parent: verify_uncles(params.block, params.block_provider, engine)?; for tx in ¶ms.block.transactions { - engine.machine().verify_transaction(tx, header, params.client)?; + engine.machine().verify_transaction(tx, parent, params.client)?; } Ok(()) From 135c2a5d71ad8934421665d76baa43eaa137cff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Tue, 13 Nov 2018 11:00:49 +0000 Subject: [PATCH 2/2] ethcore: clarify call to verify_transaction --- ethcore/src/verification/verification.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ethcore/src/verification/verification.rs b/ethcore/src/verification/verification.rs index 3fe64ad25b6..3bfe30a4495 100644 --- a/ethcore/src/verification/verification.rs +++ b/ethcore/src/verification/verification.rs @@ -147,6 +147,8 @@ pub fn verify_block_family(header: &Header, parent: verify_uncles(params.block, params.block_provider, engine)?; for tx in ¶ms.block.transactions { + // transactions are verified against the parent header since the current + // state wasn't available when the tx was created engine.machine().verify_transaction(tx, parent, params.client)?; }