Skip to content

Service cache not invalidated after owner ack, causing prolonged request failures #437

@Ravenyjh

Description

@Ravenyjh

Problem

When a provider's TEE signer has not been acknowledged by the owner, incoming requests correctly fail with "service not acknowledge the tee signer". However, the service state (TeeSignerAcknowledged: false) gets cached for 15 minutes in serviceCache. Even after the owner acknowledges the TEE signer on-chain, all subsequent requests continue to fail until the cache expires.

Root Cause

ValidateRequestWithEstimatedFee in request.go:298-324 uses serviceCache (15-min TTL) to check TeeSignerAcknowledged. There is no mechanism to invalidate this cache when the owner performs an ack on-chain. The only cache clearing happens in SyncService() (service.go:65), which is called when the provider syncs its own config — not triggered by ack events.

Impact

  1. Request layer: All user requests fail for up to 15 minutes after the owner acks, even though the on-chain state is already correct.
  2. Settlement layer: ensureTeeSignerReady() in settlement_processor.go provides a guard, but if settlement somehow proceeds with NO_TEE_SIGNER status, it's treated as a permanent failure (settlement_tee.go:579-592), deleting all pending requests for the affected user — resulting in lost fees.

Affected Code

  • api/inference/internal/ctrl/request.go:298-328 — cached service check
  • api/inference/internal/ctrl/service.go:24-42GetCachedService() with no ack-aware invalidation
  • api/inference/internal/ctrl/settlement_tee.go:579-592 — permanent failure handling deletes all pending requests

Possible Solutions

  • Watch for ProviderTEESignerAcknowledged on-chain events and invalidate serviceCache upon receipt
  • Reduce cache TTL for unacknowledged services (e.g., use short TTL when TeeSignerAcknowledged == false)
  • Bypass cache when service is in unacknowledged state, always fetching fresh from contract

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions