Tree states optimization using EpochCache (#4429)

* Relocate epoch cache to BeaconState

* Optimize per block processing by pulling previous epoch & current epoch calculation up.

* Revert `get_cow` change (no performance improvement)

* Initialize `EpochCache` in epoch processing and load it from state when getting base rewards.

* Initialize `EpochCache` at start of block processing if required.

* Initialize `EpochCache` in `transition_blocks` if `exclude_cache_builds` is enabled

* Fix epoch cache initialization logic

* Remove FIXME comment.

* Cache previous & current epochs in `consensus_context.rs`.

* Move `get_base_rewards` from `ConsensusContext` to `BeaconState`.

* Update Milhouse version
This commit is contained in:
Jimmy Chen
2023-06-30 11:25:51 +10:00
committed by GitHub
parent 160bbde8a2
commit 2df714e2cd
19 changed files with 237 additions and 196 deletions

2
Cargo.lock generated
View File

@@ -5160,7 +5160,7 @@ dependencies = [
[[package]]
name = "milhouse"
version = "0.1.0"
source = "git+https://github.com/sigp/milhouse?branch=main#248bc353849c113bdf078c5a81e629285c1c0589"
source = "git+https://github.com/sigp/milhouse?branch=main#e30719aaf1e4b46e3ff1962f7370965e68fa548b"
dependencies = [
"arbitrary",
"derivative",