Update to latest kvdb-*: no default column, DBValue is Vec#11312
Conversation
This PR contains the changes necessary to use the `kvdb-*` crates from paritytech/parity-common#278 (so a synchronized merge is required) which drops support for the old-style rocksdb "default" column to get a smaller and less complex API. As it stands this PR is working correctly except for secret-store; we need to migrate it to use a new column family.
…ate their data instead Merge branch 'master' into dp/chore/kvdb-no-default-column * master: tx-q: enable basic verification of local transactions (#11332) remove null signatures (#11335) ethcore/res: activate agharta on classic 9573000 (#11331) [secretstore] migrate to version 4 (#11322) Enable EIP-2384 for ice age hard fork (#11281) Fix atomicity violation in network-devp2p (#11277)
|
(Looks good, but it should be put on ice till we release a new version of |
|
"default" columns does mean |
Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>
All right, then it makes sense |
…ch/parity-ethereum into dp/chore/kvdb-no-default-column * 'dp/chore/kvdb-no-default-column' of github.com:paritytech/parity-ethereum: Update ethcore/db/src/db.rs
niklasad1
left a comment
There was a problem hiding this comment.
good work David, looks good but don't forget to remove patches and update Cargo.lock before merging
kvdb-*: no default column, DBValue is Vec
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| dependencies = [ | ||
| "parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", |
There was a problem hiding this comment.
I've noticed we're using this even though we probably shouldn't (this comes as part of default features of primitive-types), but I guess it's not substantial.
There was a problem hiding this comment.
I've seen it too, it's been in there for a while now. :/
There was a problem hiding this comment.
codec has been included in the default features for a while now,
paritytech/parity-common@7989816#diff-7b2119e2b4c3e0074b53b88c21461b62
EDIT: I guess would could fix it ethereum-types
This PR started as an update in
parity-ethereumto use the newkvdbAPI that does not expose the legacy "default" column anymore. In code terms, we no longer specify columns with anOption<u32>, but use au32instead.The new
kvdb-*versions also changes the type ofDBValuefrom anElasticArray128<u8>to be simplyVec<u8>and this has caused some significant scope-drift of this PR as it was necessary to make both of these rather noisy changes at once.Notes for reviewers:
Option<u32>; anything that wasSome<123>is now123andNoneis no longer an allowed value. Smaller and less complex API.kvdb::DBValueis now aVec<u8>which is kind of nice in different ways: a little less cloning, a little nicer code here and there, a few less dependencies onkvdb, less unsafe code.secret-store(the only component ofparity-ethereumthat used the "default" column, i.e.None) and provide a means to run that migration before we landed this PR. This migration code, from PR #11322, is removed here and lives on only in the 2.6.7 release. Users withsecret-storedatabases are expected to run the migration using that version and then proceed with further upgrades. @grbIzl will revive the migration code as part of his on-going work to extractsecret-storefrom the main source tree.DBValuefromkvdbis mirrored intrie-db, which is unfortunate. This means that changing the type in one requires changing the other. This explains the need to upgrade those crates as well.It bears repeating for posterity:
Note: After this PR lands, users of
secretstoremust useparity-ethereumv2.6.7 to migrate their data and then upgrade to more recent versions. This is unfortunately necessary as the new version ofkvdb-rocksdbdoes not expose a way to access the "default" column on databases and so legacy data must be moved from the "default" column to column 0.