-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: aura don't add SystemTime::now()
#10720
Conversation
Can you file an issue please? |
cf0cda7
to
eb7405a
Compare
After thinking about this a bit I think it is possible to have consensus issues. Before: we reject timestamps if it is bigger than In this PR: Timestamp is represented as Duration and it will be platform independent (secs as Thus, both might cause consensus issues. I can revert the |
@andresilva do you have any comment on this? |
@niklasad1 I guess we also have to weigh it with how likely we think that any such blocks exist in reality. Given we can't see all chains using Aura, it's hard to judge, but we also have the nice property that Aura chains aren't really adversarial in the same way that a PoW chain is. In PoW you could cause the fork if you could mine a block with the wrong timestamp (by manipulating the system or the block directly). But in an Aura chain we have better assumptions on validator honesty but also have the property of most/all of them running a single client. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CheckedSystemTime
's aim seems to be to fix the resolution to i32
so that we don't have consensus issues, not sure if replacing this is with Duration
is worth it or not. cc @tomusdrw
Yes, expect we have the following #[cfg(not(time_checked_add))]
use time_utils::CheckedSystemTime; rust >= rust 1.34 will use the standard library and be platform dependent. If I revert Duration and explicitly use |
This commit does the following: - Prevent overflow in `verify_timestamp()` by not adding `now` to found faulty timestamp - Use explicit `CheckedSystemTime::checked_add` to prevent potential consensus issues because SystemTime is platform depedent - remove `#[cfg(not(time_checked_add))]` conditional compilation
eb7405a
to
425a96f
Compare
let found = now.checked_add(Duration::from_secs(oob.found)).ok_or(BlockError::TimestampOverflow)?; | ||
let max = oob.max.and_then(|m| now.checked_add(Duration::from_secs(m))); | ||
let min = oob.min.and_then(|m| now.checked_add(Duration::from_secs(m))); | ||
let found = CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(oob.found)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also saturate oob.found
to i32::max_value()
which could eliminate this completely?!
@niklasad1 is this good to go or are you still poking at it? |
@dvdplm good to go from my side |
…anager * master: Print warnings when using dangerous settings for ValidatorSet (#10733) ethcore/res: activate atlantis classic hf on block 8772000 (#10766) refactor: Fix indentation (#10740) Updated Bn128PairingImpl to use optimized batch pairing (#10765) fix: aura don't add `SystemTime::now()` (#10720) Initialize private tx logger only if private tx functionality is enabled (#10758) Remove unused code (#10762) Remove calls to heapsize (#10432)
…dp/fix/prevent-building-block-on-top-of-same-parent * dp/chore/aura-log-validator-set-in-epoch-manager: remove dead code Treat empty account the same as non-exist accounts in EIP-1052 (#10775) docs: Update Readme with TOC, Contributor Guideline. Update Cargo package descriptions (#10652) cleanup On second thought non-validators are allowed to report Move Engine::register_client to be before other I/O handler registration (#10767) cleanup Print warnings when using dangerous settings for ValidatorSet (#10733) ethcore/res: activate atlantis classic hf on block 8772000 (#10766) refactor: Fix indentation (#10740) Updated Bn128PairingImpl to use optimized batch pairing (#10765) fix: aura don't add `SystemTime::now()` (#10720) Initialize private tx logger only if private tx functionality is enabled (#10758) Remove unused code (#10762) Remove calls to heapsize (#10432)
This commit does the following: - Prevent overflow in `verify_timestamp()` by not adding `now` to found faulty timestamp - Use explicit `CheckedSystemTime::checked_add` to prevent potential consensus issues because SystemTime is platform depedent - remove `#[cfg(not(time_checked_add))]` conditional compilation
This commit does the following: - Prevent overflow in `verify_timestamp()` by not adding `now` to found faulty timestamp - Use explicit `CheckedSystemTime::checked_add` to prevent potential consensus issues because SystemTime is platform depedent - remove `#[cfg(not(time_checked_add))]` conditional compilation
* ethcore/res: activate atlantis classic hf on block 8772000 (#10766) * fix docker tags for publishing (#10741) * fix: aura don't add `SystemTime::now()` (#10720) This commit does the following: - Prevent overflow in `verify_timestamp()` by not adding `now` to found faulty timestamp - Use explicit `CheckedSystemTime::checked_add` to prevent potential consensus issues because SystemTime is platform depedent - remove `#[cfg(not(time_checked_add))]` conditional compilation * Update version * Treat empty account the same as non-exist accounts in EIP-1052 (#10775) * DevP2p: Get node IP address and udp port from Socket, if not included in PING packet (#10705) * get node IP address and udp port from Socket, if not included in PING packet * prevent bootnodes from being added to host nodes * code corrections * code corrections * code corrections * code corrections * docs * code corrections * code corrections * Apply suggestions from code review Co-Authored-By: David <dvdplm@gmail.com> * Add a way to signal shutdown to snapshotting threads (#10744) * Add a way to signal shutdown to snapshotting threads * Pass Progress to fat_rlps() so we can abort from there too. * Checking for abort in a single spot * Remove nightly-only weak/strong counts * fix warning * Fix tests * Add dummy impl to abort snapshots * Add another dummy impl for TestSnapshotService * Remove debugging code * Return error instead of the odd Ok(()) Switch to AtomicU64 * revert .as_bytes() change * fix build * fix build maybe
* ethcore/res: activate atlantis classic hf on block 8772000 (#10766) * fix docker tags for publishing (#10741) * merge-backports * Update version * remove clique engine from backports * Reset blockchain properly (#10669) * delete BlockDetails from COL_EXTRA * better proofs * added tests * PR suggestions * adds rpc error message for --no-ancient-blocks (#10608) * adds error message for --no-ancient-blocks, closes #10261 * Apply suggestions from code review Co-Authored-By: seunlanlege <seunlanlege@gmail.com> * Treat empty account the same as non-exist accounts in EIP-1052 (#10775) * fix: aura don't add `SystemTime::now()` (#10720) This commit does the following: - Prevent overflow in `verify_timestamp()` by not adding `now` to found faulty timestamp - Use explicit `CheckedSystemTime::checked_add` to prevent potential consensus issues because SystemTime is platform depedent - remove `#[cfg(not(time_checked_add))]` conditional compilation * DevP2p: Get node IP address and udp port from Socket, if not included in PING packet (#10705) * get node IP address and udp port from Socket, if not included in PING packet * prevent bootnodes from being added to host nodes * code corrections * code corrections * code corrections * code corrections * docs * code corrections * code corrections * Apply suggestions from code review Co-Authored-By: David <dvdplm@gmail.com> * Revert "fix: aura don't add `SystemTime::now()` (#10720)" This reverts commit f104784. * Add a way to signal shutdown to snapshotting threads (#10744) * Add a way to signal shutdown to snapshotting threads * Pass Progress to fat_rlps() so we can abort from there too. * Checking for abort in a single spot * Remove nightly-only weak/strong counts * fix warning * Fix tests * Add dummy impl to abort snapshots * Add another dummy impl for TestSnapshotService * Remove debugging code * Return error instead of the odd Ok(()) Switch to AtomicU64 * revert .as_bytes() change * fix build * fix build maybe
Attempt to close #10688
In AURA we add
SystemTime::now
again which cases a Timestamp Overflow which this fixes