nim-codex/codex
Eric df6b9c6760
Workaround for Hardhat last block timestamp bug (#644)
* Workaround for Hardhat timestamp bug

Likely due to a Hardhat bug in which the callbacks for subscription events are called and awaited before updating its local understanding of the last block time, Hardhat will report a block time in the `newHeads` event that is generally 1 second before the time reported from `getLatestBlock.timestamp`. This was causing issues with the OnChainClock's offset and therefore the `now()` used by the `OnChainClock` would sometimes be off by a second (or more), causing tests to fail.

This commit introduce a `codex_use_hardhat` compilation flag, that when set, will always get the latest block timestamp from Hardhat via the `getLatestBlock.timestamp` RPC call for `OnChainClock.now` calls. Otherwise, the last block timestamp reported in the `newHeads` event will be used.

Update the docker dist tests compilation flag for simulated proof failures (it was not correct), and explicitly add the `codex_use_hardhat=false` for clarity.

* enable simulated proof failures for coverage

* comment out failing test on linux -- will be replaced

* bump codex contracts eth

* add back clock offset for non-hardhat cases

* bump codex-contracts-eth

increases pointer by 67 blocks each period increase

* Add `codex_use_hardhat` flag to coverage tests
2023-12-20 08:06:24 +11:00
..
blockexchange Dont dial self (#633) 2023-11-27 10:25:53 -08:00
contracts Workaround for Hardhat last block timestamp bug (#644) 2023-12-20 08:06:24 +11:00
erasure Light cleanup (#616) 2023-11-14 09:52:27 -08:00
manifest Verifiable manifests (#642) 2023-12-12 08:11:54 +00:00
merkletree Light cleanup (#616) 2023-11-14 09:52:27 -08:00
node refactor: move expiry update from fetchBatched (#634) 2023-11-28 22:04:11 +01:00
purchasing Rename metrics (#478) (#603) 2023-11-03 17:21:54 +02:00
rest Adds endpoint to expose quota information (#652) 2023-12-14 10:57:16 +00:00
sales feat: cleanup returning availability (#650) 2023-12-13 20:58:17 +01:00
stores Dont dial self (#633) 2023-11-27 10:25:53 -08:00
streams Blockexchange uses merkle root and index to fetch blocks (#566) 2023-11-14 13:02:17 +01:00
utils chore: improve log information (#656) 2023-12-19 04:29:18 +00:00
blockexchange.nim Change every dagger to codex (#102) 2022-05-19 13:56:03 -06:00
blocktype.nim Light cleanup (#616) 2023-11-14 09:52:27 -08:00
chunker.nim Plumbing in conf types (#472) 2023-07-06 16:23:27 -07:00
clock.nim feat: update expiry when data downloaded and slot filled (#619) 2023-11-22 10:09:12 +00:00
codex.nim Adds endpoint to expose quota information (#652) 2023-12-14 10:57:16 +00:00
conf.nim Workaround for Hardhat last block timestamp bug (#644) 2023-12-20 08:06:24 +11:00
contracts.nim feat: contract address management (#405) 2023-05-03 09:24:25 +02:00
discovery.nim Dont dial self (#633) 2023-11-27 10:25:53 -08:00
erasure.nim Improving proc/func formatting consistency (#454) 2023-06-22 08:11:18 -07:00
errors.nim refactor: move expiry update from fetchBatched (#634) 2023-11-28 22:04:11 +01:00
formats.nim Bump deps take2 (#492) 2023-08-01 16:47:57 -07:00
manifest.nim Change every dagger to codex (#102) 2022-05-19 13:56:03 -06:00
market.nim chore: improve log information (#656) 2023-12-19 04:29:18 +00:00
merkletree.nim Blockexchange uses merkle root and index to fetch blocks (#566) 2023-11-14 13:02:17 +01:00
namespaces.nim Blockexchange uses merkle root and index to fetch blocks (#566) 2023-11-14 13:02:17 +01:00
node.nim Add challenge to prove callback (#649) 2023-12-11 11:29:15 +01:00
periods.nim Validator (#387) 2023-04-19 15:06:00 +02:00
purchasing.nim Storage/purchases endpoint (#609) 2023-11-13 11:30:27 +00:00
rng.nim track latest nim-libp2p's master branch (#248) 2022-11-02 11:40:28 -06:00
sales.nim sales was never marked as running and caused a hang (#655) 2023-12-19 01:28:17 +00:00
storageproofs.nim Validator (#387) 2023-04-19 15:06:00 +02:00
stores.nim Blockexchange uses merkle root and index to fetch blocks (#566) 2023-11-14 13:02:17 +01:00
streams.nim adding AsyncStreamWrapper (#110) 2022-06-14 09:19:35 -06:00
systemclock.nim Blockstore maintenance (#347) 2023-03-08 16:04:54 +01:00
units.nim Plumbing in conf types (#472) 2023-07-06 16:23:27 -07:00
utils.nim Blockexchange uses merkle root and index to fetch blocks (#566) 2023-11-14 13:02:17 +01:00
validation.nim chore: improve log information (#656) 2023-12-19 04:29:18 +00:00