0xSpaceShard / starknet-devnet-rs

A local testnet for Starknet... in Rust
https://0xspaceshard.github.io/starknet-devnet-rs/
MIT License
107 stars 62 forks source link

Periodic block generation tests are flaky #550

Closed FabijanC closed 3 months ago

FabijanC commented 3 months ago

As witnessed here: https://app.circleci.com/pipelines/github/0xSpaceShard/starknet-devnet-rs/2281/workflows/162119c5-a0de-411c-9dbc-698486da8b3d/jobs/3439

Problem

The problem is in the fact that in --block-generation-on <INTERVAL>, a new block is generated right after the genesis block. This is done on a separate thread, and in the workflow linked above, it lagged a bit, so the first of the five executed transactions was included in this first periodic block, while the remaining for were included in the expected second periodic block.

Solution

We could try things that involve longer generation periods and additional sleeps. But what seems like the best solution is to stop this initial block generation.

mikiw commented 3 months ago

wasn't this fixed in this PR https://github.com/0xSpaceShard/starknet-devnet-rs/pull/541/commits/5ea8085143e890669c3ab4ea6b54c0868699b92a

mikiw commented 3 months ago

TODO: rethink genesis block + instant first periodic block, maybe use delay_for from tokio library

FabijanC commented 3 months ago

wasn't this fixed in this PR 5ea8085

It was fixed, also with an improvement in this commit: https://github.com/0xSpaceShard/starknet-devnet-rs/pull/541/commits/349cf8a8ddacb4bd581eace00e61c6ee1a9bbe7d

But looking at the other periodic block generation tests, I wouldn't be surprised if any of them start failing all of a sudden because of the same reason.