Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ docker-build: ## 🐳 Build the Docker image
-t ghcr.io/lambdaclass/ethlambda:$(DOCKER_TAG) .
@echo

LEAN_SPEC_COMMIT_HASH:=ad9a3226f55e1ba143e0991010ff1f6c2de62941
LEAN_SPEC_COMMIT_HASH:=d39d10195414921e979e2fdd43723d89cee13c8b

leanSpec:
git clone https://github.com/leanEthereum/leanSpec.git --single-branch
Expand Down
18 changes: 18 additions & 0 deletions crates/blockchain/src/key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use ethlambda_types::{
primitives::{H256, HashTreeRoot as _},
signature::{ValidatorSecretKey, ValidatorSignature},
};
use tracing::info;

use crate::metrics;

Expand Down Expand Up @@ -102,6 +103,23 @@ impl KeyManager {
.get_mut(&validator_id)
.ok_or(KeyManagerError::ValidatorKeyNotFound(validator_id))?;

// Advance XMSS key preparation window if the slot is outside the current window.
// Each bottom tree covers 65,536 slots; the window holds 2 at a time.
// Multiple advances may be needed if the node was offline for an extended period.
if !secret_key.is_prepared_for(slot) {
info!(validator_id, slot, "Advancing XMSS key preparation window");
while !secret_key.is_prepared_for(slot) {
let before = secret_key.get_prepared_interval();
secret_key.advance_preparation();
if secret_key.get_prepared_interval() == before {
return Err(KeyManagerError::SigningError(format!(
"XMSS key exhausted for validator {validator_id}: \
slot {slot} is beyond the key's activation interval"
)));
}
}
}

let signature: ValidatorSignature = {
let _timing = metrics::time_pq_sig_attestation_signing();
secret_key
Expand Down
Loading
Loading