Skip to content

feat: publish endpoint#62

Open
mgpai22 wants to merge 3 commits intomainfrom
feat/publish-endpoint-and-fixes
Open

feat: publish endpoint#62
mgpai22 wants to merge 3 commits intomainfrom
feat/publish-endpoint-and-fixes

Conversation

@mgpai22
Copy link
Member

@mgpai22 mgpai22 commented Feb 5, 2026

No description provided.

Add a new POST /publish API endpoint that allows publishing custom oracle
data on-chain immediately, bypassing the regular updateInterval. The
endpoint accepts a JSON payload with oracle data items, builds and submits
a recreate transaction, and returns the transaction hash synchronously.

Key components:
- ImmediatePublishRequest/Response message types for actor communication
- Global actor registry to route API requests to chain-event-processor
- handleImmediatePublish method with full trie diff, cloud upload, and tx flow
- Input conflict detection to prevent double-spend with pending transactions
- 60-second timeout on the synchronous response channel
…ale loop

After a successful immediate publish, the old validator UTxO is consumed.
Without clearing the cached reference, the regular publish flow would
reuse the stale UTxO and fail repeatedly until the cache expired.
Persist publish records to the database when data is published via the
immediate publish endpoint, tracking pending→confirmed status transitions.

Adds GET /publish/history with filters (object_id, tx_hash, date range)
and DISTINCT ON deduplication for latest-per-object default view.

Components:
- PublishRecord model with GORM tags and indexes
- CreatePublishRecords/ConfirmPublishRecords database methods
- QueryPublishHistory with expand_history toggle and pagination
- Swagger docs regenerated for the new endpoint
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e3c286158

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +818 to +821
case types.ImmediatePublishRequest:
metrics.RecordActorMessage("ChainEventProcessor", "ImmediatePublishRequest")
s.logger.Infow("received ImmediatePublishRequest", "data_count", len(msg.Data))
go s.handleImmediatePublish(msg)

Choose a reason for hiding this comment

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

P2 Badge Avoid spawning goroutine that touches actor state

Launching handleImmediatePublish in a goroutine breaks the actor’s single-threaded execution model. The handler reads actor fields like lastSuccessfullyIndexedBlockNum/lastSuccessfullyIndexedSlot and uses other actor-owned resources while Receive may be mutating them concurrently during block processing. This introduces data races and can lead to inconsistent publish behavior under concurrent requests. Consider handling the publish request synchronously in the actor loop or copying the needed state into the request before starting a goroutine, with proper synchronization.

Useful? React with 👍 / 👎.

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.

1 participant