Closed sr-gi closed 2 years ago
I did try running the test till it fails.
For some generated blocks, it happens that the block hash is greater than the target (0xffff
), this happens very rarely though.
A possible fix is to assure that all blockhashes are <= the constant target at block generation time (here). So if we face a block with a small hash, we discard it and repeat the process with different txs (or shuffle the txs).
I'm reopening this since we may have missed and edge case. An error regarding BlockBadProofOfWork
was recently seen on CI:
failures:
---- api::internal::tests_private_api::test_get_users stdout ----
thread 'api::internal::tests_private_api::test_get_users' panicked at 'called `Result::unwrap()` on an `Err` value: BlockSourceError { kind: Persistent, error: BlockBadProofOfWork }', teos/src/test_utils.rs:381:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
api::internal::tests_private_api::test_get_users
Ref -> https://github.com/talaia-labs/rust-teos/actions/runs/3051585175/jobs/4919990408#step:5:697-699
Lol Idk why I was surprised even though I faced this issue some weeks ago xD I have a commit that fixes it, but didn't PR that branch yet.
Not sure if that's part of a bigger PR, but I think that'd do as a standalone one.
I'd suggest to cherry-pick it and send it.
Blockchain::at_height
may pull aBlockHeader
that cannot be verified. This have been seen in CI in rare occasions.Not a big deal, but it may be nice to find the root of the error so tests do not fail randomly on CI.