Skip to content

Commit

Permalink
cli: set-identity should change shred signing key
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcgee-jump committed Feb 14, 2025
1 parent 3225288 commit 0ecb0ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/app/fdctl/run/tiles/fd_shred.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@ during_housekeeping( fd_shred_ctx_t * ctx ) {
if( FD_UNLIKELY( fd_keyswitch_state_query( ctx->keyswitch )==FD_KEYSWITCH_STATE_SWITCH_PENDING ) ) {
ulong seq_must_complete = ctx->keyswitch->param;

if( FD_UNLIKELY( fd_seq_le( seq_must_complete, ctx->poh_in_expect_seq ) ) ) {
if( FD_UNLIKELY( fd_seq_lt( ctx->poh_in_expect_seq, seq_must_complete ) ) ) {
/* See fd_keyswitch.h, we need to flush any in-flight shreds from
the leader pipeline before switching key. */
FD_LOG_WARNING(( "Flushing in-flight unpublished shreds, must reach seq %lu, currently at %lu ...", seq_must_complete, ctx->poh_in_expect_seq ));
return;
}

fd_memcpy( ctx->identity_key->uc, ctx->keyswitch->bytes, 32UL );
fd_stake_ci_set_identity( ctx->stake_ci, ctx->identity_key );
fd_keyswitch_state( ctx->keyswitch, FD_KEYSWITCH_STATE_COMPLETED );
}
Expand Down
5 changes: 3 additions & 2 deletions src/app/fdctl/set_identity.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ poll_keyswitch( fd_topo_t * topo,
FD_COMPILER_MFENCE();
shred->state = FD_KEYSWITCH_STATE_SWITCH_PENDING;
FD_COMPILER_MFENCE();
FD_LOG_INFO(( "Flushing in-flight unpublished shreds..." ));
FD_LOG_INFO(( "Flushing in-flight unpublished shreds, must reach seq %lu...", *halted_seq ));
}

*state = FD_SET_IDENTITY_STATE_SHRED_FLUSH_REQUESTED;
Expand All @@ -215,8 +215,9 @@ poll_keyswitch( fd_topo_t * topo,
if( FD_LIKELY( shred->state==FD_KEYSWITCH_STATE_COMPLETED ) ) {
continue;
} else if( FD_UNLIKELY( shred->state==FD_KEYSWITCH_STATE_SWITCH_PENDING ) ) {
/* If any of the shred tiles is still pending, we need to wait. */
FD_SPIN_PAUSE();
break;
return;
} else {
FD_LOG_ERR(( "Unexpected shred:%lu keyswitch state %lu", tile->kind_id, shred->state ));
}
Expand Down

0 comments on commit 0ecb0ef

Please sign in to comment.