Page MenuHomePhabricator

[Chronik] Clear OP_RETURN scripts from script index, enable DB upgrade to version 13
ClosedPublic

Authored by tobias_ruck on Sat, Oct 19, 22:41.

Details

Summary

Deletes all OP_RETURN scripts from the DB (using ranges). Also report on oversized (and thus unspendable Scripts). We might want to not add those to the DB in the future, too.

Also, we enable the DB upgrade to version 13, this is currently disabled until all upgrades are in place.

This way, we have all three upgrades in one batch:

  • Add the missing MINT VAULT txs (patched out in D16916), using the (later deleted) OP_RETURNs still indexed in the DB
  • Fixing invalidly compressed P2PK scripts (patched out in D16899)
  • Removing the OP_RETURN scripts (patched out in D16917)

Depends on D16938.

Test Plan
  1. Make a backup of the Chronik DB
  2. Build using ninja
  3. Run node (using -debug=chronik), it should upgrade automatically to 13
  4. It should now update first the MINT VAULT txs, then the P2PK scripts, then remove the OP_RETURNs

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

Tail of the build log:

    Checking chronik-plugin-common v0.1.0 (/work/chronik/chronik-plugin-common)
    Checking chronik-plugin v0.1.0 (/work/chronik/chronik-plugin)
    Checking toml_datetime v0.6.6
    Checking serde_spanned v0.6.6
   Compiling prost-build v0.11.9
   Compiling pyo3 v0.22.2
    Checking sync_wrapper v0.1.2
    Checking seahash v4.1.0
    Checking winnow v0.6.13
    Checking mime v0.3.17
    Checking hyper v1.2.0
    Checking topo_sort v0.4.0
    Checking axum-core v0.4.3
    Checking tower v0.4.13
    Checking tokio-tungstenite v0.21.0
    Checking memoffset v0.9.1
    Checking serde_json v1.0.115
    Checking serde_urlencoded v0.7.1
    Checking hyper-util v0.1.3
    Checking futures-executor v0.3.30
    Checking serde_path_to_error v0.1.16
    Checking unindent v0.2.3
    Checking sync_wrapper v1.0.1
    Checking matchit v0.7.3
    Checking base64 v0.21.7
    Checking unicode-segmentation v1.11.0
    Checking futures v0.3.30
    Checking tower-http v0.5.2
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking convert_case v0.6.0
    Checking toml_edit v0.22.14
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.5
   Compiling pyo3-macros v0.22.2
    Checking toml v0.8.14
    Checking chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
    Checking rocksdb v0.21.0
    Checking chronik-db v0.1.0 (/work/chronik/chronik-db)
error: mutable key type
   --> chronik/chronik-db/src/io/upgrade.rs:219:9
    |
219 |         let mut scripts_not_to_upgrade = HashSet::new();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mutable_key_type
    = note: `-D clippy::mutable-key-type` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::mutable_key_type)]`

error: mutable key type
   --> chronik/chronik-db/src/io/upgrade.rs:220:9
    |
220 |         let mut scripts_to_upgrade = HashSet::new();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mutable_key_type

error: could not compile `chronik-db` (lib) due to 2 previous errors
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1
This revision is now accepted and ready to land.Sun, Oct 20, 08:17