Skip to content

fix: identity registration events to use keyper-set-index#691

Open
blockchainluffy wants to merge 2 commits intomainfrom
feat/registration-events-use-keyperset-index
Open

fix: identity registration events to use keyper-set-index#691
blockchainluffy wants to merge 2 commits intomainfrom
feat/registration-events-use-keyperset-index

Conversation

@blockchainluffy
Copy link
Copy Markdown
Contributor

@blockchainluffy blockchainluffy commented Apr 3, 2026

closes #692

@blockchainluffy blockchainluffy marked this pull request as ready for review April 8, 2026 07:28
@blockchainluffy blockchainluffy marked this pull request as draft April 8, 2026 07:59
@blockchainluffy blockchainluffy marked this pull request as ready for review April 14, 2026 10:33
continue
}
eonStruct, err := coreKeyperDB.GetEon(ctx, eon)
eonStruct, decryptable, err := kpr.resolveDecryptableEon(ctx, coreKeyperDB, eon)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signature is

func (kpr *Keyper) resolveDecryptableEon(
    ctx context.Context,
	coreKeyperDB *corekeyperdatabase.Queries,
	keyperConfigIndex int64
) (corekeyperdatabase.Eon, bool, error) {…}

In other words: here we implicitly cast between keyperConfigIndex and eon.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is honestly puzzling to me, because eon is a value contained in FiredTrigger of service db and should not be a "keyperConfigIndex" kind? Or should not need resolution into a corekeyperdatabase.Eon?

Could it be that the triple return is actually superfluous, because the call does not "resolve" the eon, but only verifies "decryptability", given the current keyper and active keyper set?

Copy link
Copy Markdown
Contributor

@konradkonrad konradkonrad Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha, we "resolve" eon properties such as ActivationBlockNumber that we need later on. So I guess we're resolving a type.

IOW: if we want to avoid the odd cast, we might want to consider changing the argument name to eonNumber, because the value we're handling is not strictly a keyperSetIndex keyperConfigIndex but rather the numeric for a specific eon, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think renaming the parameter to eonNumber would be correct here. This PR is changing the semantics of the even eon field. The incoming value is no longer being treated as a real core eon number; it is being treated as the submitted keyper-set/config index from the registry event, and resolveDecryptableEon() then resolves the latest eon record for that set. So the oddity is not the function signature, it’s that the service DB field is still named Eon even though this PR changes its semantics. If we want to reduce confusion, the cleaner follow-up is to rename the internal shutter-service representation at the ingestion boundary (e.g. keyperConfigIndex / submittedKeyperConfigIndex) and keep “eon” only for the resolved corekeyperdatabase.Eon. We should do the same on the API side as well: if the API is submitting a keyper-set/config index, we should name it that way there too, rather than continuing to call it eon and relying on implicit reinterpretation downstream.

// don't trigger if we're not part of the keyper set
_, isKeyper, err := coreKeyperDB.GetKeyperIndex(ctx, keyperConfigIndex, kpr.config.GetAddress())
if err != nil {
if err == pgx.ErrNoRows {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check won’t fire as intended as GetKeyperIndex() wraps the underlying GetBatchConfig() error, so when the batch config is missing the returned error is not == pgx.ErrNoRows. We should use errors.Is(err,pgx.ErrNoRows) here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eon from identity registration events should be treated as keyperset index and use latest eon for the same keyperset index

3 participants