|
121 | 121 |
|
122 | 122 | stateRoots: KvStoreRef # (Slot, BlockRoot) -> StateRoot |
123 | 123 |
|
| 124 | + envelopes: KvStoreRef # (BlockRoot -> SignedExecutionPayloadEnvelope) |
| 125 | + |
124 | 126 | statesNoVal: array[ConsensusFork, KvStoreRef] # StateRoot -> ForkBeaconStateNoImmutableValidators |
125 | 127 |
|
126 | 128 | stateDiffs: KvStoreRef ##\ |
@@ -604,6 +606,10 @@ proc new*(T: type BeaconChainDB, |
604 | 606 | if cfg.FULU_FORK_EPOCH != FAR_FUTURE_EPOCH: |
605 | 607 | columns = kvStore db.openKvStore("fulu_columns").expectDb() |
606 | 608 |
|
| 609 | + var envelopes: KvStoreRef |
| 610 | + if cfg.GLOAS_FORK_EPOCH != FAR_FUTURE_EPOCH: |
| 611 | + envelopes = kvStore db.openKvStore("gloas_envelopes").expectDb() |
| 612 | + |
607 | 613 | let quarantine = db.initQuarantineDB().expectDb() |
608 | 614 |
|
609 | 615 | # Versions prior to 1.4.0 (altair) stored validators in `immutable_validators` |
@@ -642,6 +648,7 @@ proc new*(T: type BeaconChainDB, |
642 | 648 | blocks: blocks, |
643 | 649 | blobs: blobs, |
644 | 650 | columns: columns, |
| 651 | + envelopes: envelopes, |
645 | 652 | stateRoots: stateRoots, |
646 | 653 | statesNoVal: statesNoVal, |
647 | 654 | stateDiffs: stateDiffs, |
@@ -866,6 +873,14 @@ proc delDataColumnSidecar*( |
866 | 873 | root: Eth2Digest, index: ColumnIndex): bool = |
867 | 874 | db.columns.del(columnkey(root, index)).expectDb() |
868 | 875 |
|
| 876 | +proc putExecutionPayloadEnvelope*( |
| 877 | + db: BeaconChainDB, value: SignedExecutionPayloadEnvelope) = |
| 878 | + template key: untyped = value.message.beacon_block_root |
| 879 | + db.envelopes.putSZSSZ(key.data, value) |
| 880 | + |
| 881 | +proc delExecutionPayloadEnvelope*(db: BeaconChainDB, root: Eth2Digest): bool = |
| 882 | + db.envelopes.del(root.data).expectDb() |
| 883 | + |
869 | 884 | proc updateImmutableValidators*( |
870 | 885 | db: BeaconChainDB, validators: openArray[Validator]) = |
871 | 886 | # Must be called before storing a state that references the new validators |
@@ -1078,6 +1093,13 @@ proc getDataColumnSidecar*(db: BeaconChainDB, root: Eth2Digest, index: ColumnInd |
1078 | 1093 | return false |
1079 | 1094 | db.columns.getSZSSZ(columnkey(root, index), value) == GetResult.found |
1080 | 1095 |
|
| 1096 | +proc getExecutionPayloadEnvelope*( |
| 1097 | + db: BeaconChainDB, root: Eth2Digest, |
| 1098 | + value: var TrustedSignedExecutionPayloadEnvelope): bool = |
| 1099 | + if db.envelopes == nil: |
| 1100 | + return false |
| 1101 | + db.envelopes.getSZSSZ(root.data, value) == GetResult.found |
| 1102 | + |
1081 | 1103 | proc getBlockSZ*[X: ForkyTrustedSignedBeaconBlock]( |
1082 | 1104 | db: BeaconChainDB, key: Eth2Digest, |
1083 | 1105 | data: var seq[byte], T: typedesc[X]): bool = |
|
0 commit comments