(context: E, cfg: EngineConfig<C, S, O>)
| 122 | #[cfg(feature = "permissioned")] |
| 123 | pub paused: Arc<AtomicBool>, |
| 124 | } |
| 125 | |
| 126 | impl< |
| 127 | E: BufferPooler + Clock + GClock + Rng + CryptoRng + Spawner + Storage + Metrics + Network, |
| 128 | C: EngineClient, |
| 129 | O: NetworkOracle<PublicKey> + Blocker<PublicKey = S::PublicKey> + Provider<PublicKey = PublicKey>, |
| 130 | S: Signer<PublicKey = PublicKey>, |
| 131 | > Engine<E, C, O, S> |
| 132 | where |
| 133 | MultisigScheme: Scheme<summit_types::Digest, PublicKey = S::PublicKey>, |
| 134 | { |
| 135 | pub async fn new(context: E, cfg: EngineConfig<C, S, O>) -> Self { |
| 136 | let blocks_per_epoch = cfg.blocks_per_epoch; |
| 137 | |
| 138 | // The key this node identifies itself by: the derived child key in |
| 139 | // observer mode (the live P2P identity), the master node key otherwise. |
| 140 | // Using the master key on an observer would make the resolver exclude |
| 141 | // the parent validator as "self" and skip it as a backfill source. |
| 142 | let node_public_key = cfg |
| 143 | .observer_network_key |
| 144 | .clone() |
| 145 | .unwrap_or_else(|| cfg.key_store.node_key.public_key()); |
| 146 | |
| 147 | // Live consensus + p2p domain, bound to immutable chain identity (the |
| 148 | // genesis config digest + protocol version) so consensus certificates |
| 149 | // and peer handshakes cannot verify across deployments that merely reuse |
| 150 | // the same namespace and validator keys. The finalizer keeps the raw |
| 151 | // namespace because deposit_signature_domain folds in the genesis hash |
| 152 | // itself. |
| 153 | let consensus_domain = summit_types::chain_domain(cfg.config_digest).to_vec(); |
| 154 | |
| 155 | let page_cache = CacheRef::from_pooler( |
| 156 | &context, |
| 157 | NonZero::new(BUFFER_POOL_PAGE_SIZE).unwrap(), |
| 158 | BUFFER_POOL_CAPACITY, |
| 159 | ); |
| 160 | |
| 161 | let scheme_provider = if cfg.force_verifier_only { |
| 162 | SummitSchemeProvider::verifier_only(consensus_domain.clone()) |
| 163 | } else { |
| 164 | let encoded = cfg.key_store.consensus_key.encode(); |
| 165 | let private_scalar = group::Private::decode(&mut encoded.as_ref()) |
| 166 | .expect("failed to extract scalar from private key"); |
| 167 | SummitSchemeProvider::new(private_scalar, consensus_domain.clone()) |
| 168 | }; |
| 169 | |
| 170 | let cancellation_token = CancellationToken::new(); |
| 171 | #[cfg(feature = "permissioned")] |
| 172 | let paused = Arc::new(AtomicBool::new(false)); |
| 173 | |
| 174 | // create finalizer |
| 175 | let (finalizer, initial_state, finalizer_mailbox, finalizer_state_query) = Finalizer::new( |
| 176 | context.with_label("finalizer"), |
| 177 | FinalizerConfig { |
| 178 | mailbox_size: cfg.mailbox_size, |
| 179 | db_prefix: cfg.partition_prefix.clone(), |
| 180 | engine_client: cfg.engine_client.clone(), |
| 181 | oracle: cfg.oracle.clone(), |
nothing calls this directly
no test coverage detected