Modularize validator store (#6705)

- Create trait `ValidatorStore` with all functions used by the `validator_services`
- Make `validator_services` generic on `S: ValidatorStore`
- Introduce `LighthouseValidatorStore`, which has identical functionality to the old `ValidatorStore`
- Remove dependencies (especially `environment`) from `validator_services` and `beacon_node_fallback` in order to be able to cleanly use them in Anchor
This commit is contained in:
Daniel Knopik
2025-05-07 05:43:33 +02:00
committed by GitHub
parent beb0ce68bd
commit 3d92e3663b
42 changed files with 2010 additions and 1622 deletions

View File

@@ -12,7 +12,7 @@ use std::sync::Arc;
use task_executor::TaskExecutor;
use types::*;
use url::Url;
use web3signer::{ForkInfo, SigningRequest, SigningResponse};
use web3signer::{ForkInfo, MessageType, SigningRequest, SigningResponse};
pub use web3signer::Web3SignerObject;
@@ -152,8 +152,13 @@ impl SigningMethod {
genesis_validators_root,
});
self.get_signature_from_root(signable_message, signing_root, executor, fork_info)
.await
self.get_signature_from_root::<E, Payload>(
signable_message,
signing_root,
executor,
fork_info,
)
.await
}
pub async fn get_signature_from_root<E: EthSpec, Payload: AbstractExecPayload<E>>(
@@ -227,11 +232,7 @@ impl SigningMethod {
// Determine the Web3Signer message type.
let message_type = object.message_type();
if matches!(
object,
Web3SignerObject::Deposit { .. } | Web3SignerObject::ValidatorRegistration(_)
) && fork_info.is_some()
if matches!(message_type, MessageType::ValidatorRegistration) && fork_info.is_some()
{
return Err(Error::GenesisForkVersionRequired);
}