This kind of snowballed out of control as I had to refactor time management in a way that unties it from relying on +1 everywhere. The gist is that I introduced two new traits:
TimeRead to represent shared read-only view on time
TimeExclusive to represent exclusive writeable view on time
Sealing blocks requires a TimeExclusive instance to be passed now and we have some flexibility in what we can pass. This fixes a few TOCTOU bugs that we used to have (we rely on clock not progressing between us constructing the new block and applying it, which was not always the case before but it is not with TimeExclusive). This also made mine_blocks more robust as it enforces the provided offsets now.
New functionality is covered with an e2e test, but the refactoring is critically lacking in tests. I am open to adding some tests for the time module, but have already spent too much time on this so might just add this to the long list of TODOs.
What :computer:
Closes #423
This kind of snowballed out of control as I had to refactor time management in a way that unties it from relying on
+1
everywhere. The gist is that I introduced two new traits:TimeRead
to represent shared read-only view on timeTimeExclusive
to represent exclusive writeable view on timeSealing blocks requires a
TimeExclusive
instance to be passed now and we have some flexibility in what we can pass. This fixes a few TOCTOU bugs that we used to have (we rely on clock not progressing between us constructing the new block and applying it, which was not always the case before but it is not withTimeExclusive
). This also mademine_blocks
more robust as it enforces the provided offsets now.Additionally this PR removes time from snapshot state (See https://github.com/matter-labs/era-test-node/issues/414 why I think this is movement in the right direction)
New functionality is covered with an e2e test, but the refactoring is critically lacking in tests. I am open to adding some tests for the
time
module, but have already spent too much time on this so might just add this to the long list of TODOs.Why :hand:
Feature parity with anvil