Skip to content

feat: publish endpoint and fixes#61

Closed
mgpai22 wants to merge 6 commits intomainfrom
feat/publish-endpoint-and-fixes
Closed

feat: publish endpoint and fixes#61
mgpai22 wants to merge 6 commits intomainfrom
feat/publish-endpoint-and-fixes

Conversation

@mgpai22
Copy link
Member

@mgpai22 mgpai22 commented Feb 5, 2026

No description provided.

The upstream Apollo fork updated the Base.ChainContext interface,
changing EvaluateTx([]byte) to EvaluateTx([]byte, []UTxO.UTxO).
Pass additionalUtxos through to the provider.
The scalar-go library requires absolute URLs for WithSpecURL but the
spec is served from the same server. Read the spec file at startup and
pass it via WithSpecBytes to avoid the invalid scheme error.
- Remove .git/ from .dockerignore so git describe works in builds
- Install gojq in Dockerfile for Makefile ldflags version extraction
- Fix entrypoint config path to /data/config.yaml
- Add init service for assets directory permissions
- Add postgres healthcheck with pg_isready
- Mount gcp.json credential file
- Use postgres service name in config.example.yaml
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 races actor state

Spawning handleImmediatePublish in a goroutine breaks the actor’s single-threaded state model: the handler reads fields like lastSuccessfullyIndexedSlot/lastSuccessfullyIndexedBlockNum that are also mutated in the actor loop. If a publish request arrives while block events are updating those fields, this introduces a data race and can result in inconsistent sync checks or incorrect submissionBlockHeight passed to pending-tx tracking. Running the handler inside the actor loop or protecting shared fields with synchronization would avoid these races.

Useful? React with 👍 / 👎.

@mgpai22 mgpai22 closed this Feb 5, 2026
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