onflow / flow-go

A fast, secure, and developer-friendly blockchain built to support the next generation of games, apps, and the digital assets that power them.
GNU Affero General Public License v3.0
531 stars 170 forks source link

[EVM] Side-effect integration testing #5748

Open sideninja opened 2 months ago

sideninja commented 2 months ago

Executing EVM transactions with different combinations of modifications to the state can lead to unwanted side-effects between transactions. With the introduction of Cadence arch and batch transactions that risk increased.

We want to have a set of tests that focus on detecting how a combination of different interactions should not have unpredicted side-effects.

We should write tests that run a different combination (possibly at random) with batch transactions and different Cadence arch interactions and make sure the state after is as expected.

sideninja commented 2 months ago

maybe if you have time just add an extra test in emulator or evm with a sequence of transactions (each emit an event and update a value) like this: Successful, Invalid, Successful, Failed, Successful Then we can check no side effect across transactions.

sideninja commented 2 months ago

Update the test contract and add a function that adds prime numbers to the list of numbers, the sum of those numbers at the end should be exactly what we predict, because the sum only contains a sublist of numbers from transactions that should be added and not those that shouldn't (fail, invalid etc)

sideninja commented 2 months ago

Test the storage method for Refund, it's being called by EVM itself and we should check that is being properly handled with no unexpected side-effects.