-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
It looks like @seunlanlege signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
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.
Looks sane, any chance we could get a test for it? We should really try to make something to prevent from breaking it in the future again.
please could you look at this again? |
ethcore/src/client/client.rs
Outdated
&**self.db.read().key_value(), | ||
::db::COL_EXTRA, | ||
&*best_block_hash | ||
).ok_or("block was previously imported; best_block_details should exist; qed")?; |
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.
can this block be removed in the meantime?
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.
don't understand the question.
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 do schedule it for deletion in db_transaction
above, but it''s not yet comitted, so the block indeed should be there.
However this is an Err
not expect, so a proof is not even needed in that case.
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.
Sorry I meant if the block could be deleted from a separate thread/process. Looks like in this case we're using rocksdb, which doesn't allow read/write from multiple processes and this method is only used in cli, so this is the only thread doing mutation, right? But if change our db backend to lmdb, this is something to keep in mind.
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.
Looks good to me after @ordian's comments are addressed.
ethcore/src/client/client.rs
Outdated
&**self.db.read().key_value(), | ||
::db::COL_EXTRA, | ||
&*best_block_hash | ||
).ok_or("block was previously imported; best_block_details should exist; qed")?; |
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 do schedule it for deletion in db_transaction
above, but it''s not yet comitted, so the block indeed should be there.
However this is an Err
not expect, so a proof is not even needed in that case.
to fix cargo audit, merge with master |
3a20ab9
to
5e59935
Compare
.ok_or("Attempted to reset past genesis block")?; | ||
let mut blocks_to_delete = Vec::with_capacity(num as usize); | ||
let mut best_block_hash = self.chain.read().best_block_hash(); | ||
let mut batch = DBTransaction::with_capacity(blocks_to_delete.len()); |
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.
damn, this should've been DBTransaction::with_capacity(blocks_to_delete.capacity())
, shouldn't be much of a problem. this code runs in cli so the cost of resizing the buffer is negligible.
* delete BlockDetails from COL_EXTRA * better proofs * added tests * PR suggestions
* version: bump beta to 2.5.2 * [CI] allow cargo audit to fail (#10676) * [CI] allow cargo audit to fail * [.gitlab-ci.yml] add a comment about cargo audit * [Cargo.lock] cargo update -p protobuf * Reset blockchain properly (#10669) * delete BlockDetails from COL_EXTRA * better proofs * added tests * PR suggestions * new image (#10673) * Update publishing (#10644) * docker images are now built on k8s: test run * copy check_sync.sh in build-linux job * copy scripts/docker/hub/* in build-linux job * removed cache var * cleanup, no more nightly dockers * cleanup in dockerfile * some new tags * removed sccsche debug log, cleanup * no_gits, new artifacts dir, changed scripts. Test run. * define version once * one source for TRACK * stop kovan onchain updates * moved changes for two images to a new branch * rename Dockerfile * no need in libudev-dev * enable lto for release builds (#10717) * Use RUSTFLAGS to set the optimization level (#10719) * Use RUSTFLAGS to set the optimization level Cargo has a [quirk]() in how configuration settings are propagated when `cargo test` runs: local code respect the settings in `[profile.test]` but all dependencies use the `[profile.dev]` settings. Here we force `opt-level=3` for all dependencies. * Remove unused profile settings * Maybe like this? * Turn off incremental compilation * Remove colors; try again with overflow-checks on * Use quiet CI machine * Turn overflow checking back on * Be explicit about what options we use * Remove "quiet machine" override * ethcore: enable ECIP-1054 for classic (#10731) * config: enable atlantis on ethereum classic * config: enable atlantis on morden classic * config: enable atlantis on morden classic * config: enable atlantis on kotti classic * ethcore: move kotti fork block to 0xAEF49 * ethcore: move morden fork block to 0x4829BA * ethcore: move classic fork block to 0x81B320 * remove trailing comma * remove trailing comma * fix chainspec * ethcore: move classic fork block to 0x7fffffffffffffff
@soc1c It seems v2.4.7-stable does not include the fix. |
* delete BlockDetails from COL_EXTRA * better proofs * added tests * PR suggestions
* 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 <[email protected]> * 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 <[email protected]> * 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
Previously the reset blockchain feature wrongly assumed that the block hashes were the keys for
BlockDetails
in COL_EXTRA that has been corrected.Also, there was a known issue with the reset feature where deleted blocks wouldn't be imported again because they were a "known child" of an existing block
that has also been corrected.
Should fix #10665