Skip to content

Fix the way BlockchainTest and StateTest handle invalid transactions  #3

@marioevz

Description

@marioevz

Right now with #2, intrinsically invalid transactions (not reverting transactions) are removed from the block before execution.

We need to change this behavior to leave the transactions in the block to properly test that blocks with a certain type of invalid transactions are correctly rejected.

This affects the way that StateTest operates, as it bundles all transactions into a single block and then compares the cumulative post-state that results from the execution of all transactions in sequence.

This means that if we leave invalid transactions in the block, the entire block will be rejected and nothing will be tested.

We could solve this issue of two ways.

Assuming that we have Tx1..TxN within a StateTest, and also each Tx is contained in a separate block, we can have:

a)

flowchart LR;
G --> B1[Tx1];
B1[Tx1] --> B2[Tx2];
B2[Tx2] --> ...;
... --> BN[TxN];
Loading

Where each transaction block is on top of the previous transaction.

b)

flowchart TD;
G --> B1[Tx1];
G --> B1'[Tx2];
G --> ...;
G --> B1'''[TxN];
Loading

Where all blocks are at height G+1

(a) makes writing state tests more complicated, because the tester has to account for the previous transactions to calculate the full post-state. With (b), every transaction is isolated and writing the verification post-state is easier (every transaction could have a different verification post-state).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions