bcdd960ab1
## Proposed Changes Reduce post-merge disk usage by not storing finalized execution payloads in Lighthouse's database. ⚠️ **This is achieved in a backwards-incompatible way for networks that have already merged** ⚠️. Kiln users and shadow fork enjoyers will be unable to downgrade after running the code from this PR. The upgrade migration may take several minutes to run, and can't be aborted after it begins. The main changes are: - New column in the database called `ExecPayload`, keyed by beacon block root. - The `BeaconBlock` column now stores blinded blocks only. - Lots of places that previously used full blocks now use blinded blocks, e.g. analytics APIs, block replay in the DB, etc. - On finalization: - `prune_abanonded_forks` deletes non-canonical payloads whilst deleting non-canonical blocks. - `migrate_db` deletes finalized canonical payloads whilst deleting finalized states. - Conversions between blinded and full blocks are implemented in a compositional way, duplicating some work from Sean's PR #3134. - The execution layer has a new `get_payload_by_block_hash` method that reconstructs a payload using the EE's `eth_getBlockByHash` call. - I've tested manually that it works on Kiln, using Geth and Nethermind. - This isn't necessarily the most efficient method, and new engine APIs are being discussed to improve this: https://github.com/ethereum/execution-apis/pull/146. - We're depending on the `ethers` master branch, due to lots of recent changes. We're also using a workaround for https://github.com/gakonst/ethers-rs/issues/1134. - Payload reconstruction is used in the HTTP API via `BeaconChain::get_block`, which is now `async`. Due to the `async` fn, the `blocking_json` wrapper has been removed. - Payload reconstruction is used in network RPC to serve blocks-by-{root,range} responses. Here the `async` adjustment is messier, although I think I've managed to come up with a reasonable compromise: the handlers take the `SendOnDrop` by value so that they can drop it on _task completion_ (after the `fn` returns). Still, this is introducing disk reads onto core executor threads, which may have a negative performance impact (thoughts appreciated). ## Additional Info - [x] For performance it would be great to remove the cloning of full blocks when converting them to blinded blocks to write to disk. I'm going to experiment with a `put_block` API that takes the block by value, breaks it into a blinded block and a payload, stores the blinded block, and then re-assembles the full block for the caller. - [x] We should measure the latency of blocks-by-root and blocks-by-range responses. - [x] We should add integration tests that stress the payload reconstruction (basic tests done, issue for more extensive tests: https://github.com/sigp/lighthouse/issues/3159) - [x] We should (manually) test the schema v9 migration from several prior versions, particularly as blocks have changed on disk and some migrations rely on being able to load blocks. Co-authored-by: Paul Hauner <paul@paulhauner.com>
70 lines
2.0 KiB
TOML
70 lines
2.0 KiB
TOML
[package]
|
|
name = "types"
|
|
version = "0.2.0"
|
|
authors = ["Paul Hauner <paul@paulhauner.com>", "Age Manning <Age@AgeManning.com>"]
|
|
edition = "2021"
|
|
|
|
[[bench]]
|
|
name = "benches"
|
|
harness = false
|
|
|
|
[dependencies]
|
|
bls = { path = "../../crypto/bls" }
|
|
compare_fields = { path = "../../common/compare_fields" }
|
|
compare_fields_derive = { path = "../../common/compare_fields_derive" }
|
|
eth2_interop_keypairs = { path = "../../common/eth2_interop_keypairs" }
|
|
ethereum-types = "0.12.1"
|
|
eth2_hashing = "0.3.0"
|
|
hex = "0.4.2"
|
|
int_to_bytes = { path = "../int_to_bytes" }
|
|
log = "0.4.11"
|
|
rayon = "1.4.1"
|
|
rand = "0.8.5"
|
|
safe_arith = { path = "../safe_arith" }
|
|
serde = {version = "1.0.116" , features = ["rc"] }
|
|
serde_derive = "1.0.116"
|
|
slog = "2.5.2"
|
|
eth2_ssz = "0.4.1"
|
|
eth2_ssz_derive = "0.3.0"
|
|
eth2_ssz_types = "0.2.2"
|
|
swap_or_not_shuffle = { path = "../swap_or_not_shuffle" }
|
|
test_random_derive = { path = "../../common/test_random_derive" }
|
|
tree_hash = "0.4.1"
|
|
tree_hash_derive = "0.4.0"
|
|
rand_xorshift = "0.3.0"
|
|
cached_tree_hash = { path = "../cached_tree_hash" }
|
|
serde_yaml = "0.8.13"
|
|
tempfile = "3.1.0"
|
|
derivative = "2.1.1"
|
|
rusqlite = { version = "0.25.3", features = ["bundled"], optional = true }
|
|
arbitrary = { version = "1.0", features = ["derive"], optional = true }
|
|
eth2_serde_utils = "0.1.1"
|
|
regex = "1.5.5"
|
|
lazy_static = "1.4.0"
|
|
parking_lot = "0.12.0"
|
|
itertools = "0.10.0"
|
|
superstruct = "0.5.0"
|
|
serde_json = "1.0.74"
|
|
smallvec = "1.8.0"
|
|
|
|
[dev-dependencies]
|
|
criterion = "0.3.3"
|
|
beacon_chain = { path = "../../beacon_node/beacon_chain" }
|
|
eth2_interop_keypairs = { path = "../../common/eth2_interop_keypairs" }
|
|
state_processing = { path = "../state_processing" }
|
|
|
|
[features]
|
|
default = ["sqlite", "legacy-arith"]
|
|
# Allow saturating arithmetic on slots and epochs. Enabled by default, but deprecated.
|
|
legacy-arith = []
|
|
sqlite = ["rusqlite"]
|
|
arbitrary-fuzz = [
|
|
"arbitrary",
|
|
"ethereum-types/arbitrary",
|
|
"bls/arbitrary",
|
|
"eth2_ssz/arbitrary",
|
|
"eth2_ssz_types/arbitrary",
|
|
"swap_or_not_shuffle/arbitrary",
|
|
"tree_hash/arbitrary",
|
|
]
|