Skip to content

centralize core types and use generic failure reasons - #4

Merged
nickpell merged 1 commit into
mainfrom
nick/unify
Nov 21, 2025
Merged

nickpell merged 1 commit into
mainfrom
nick/unify

Conversation

@nickpell

@nickpell nickpell commented Nov 20, 2025 •

Copy link
Copy Markdown
Member

Centralize core types and use generic failure reasons

Reorganizes the core package by consolidating all exported types into types.go and removes sensitive price information from bid exclusion reasons that could leak into attestation documents.

Changes

Code Organization:

  • Create core/types.go centralizing all exported types (CoreBid, AuctionResult, ExcludedBid, etc.)
  • Remove type definitions from individual implementation files (auction.go, auctionranking.go, bidadjustments.go, floorenforcement.go)
  • Remove unused types and constants (CoreAdjustment, BidAdjustmentConfig, CoreCurrencyConverter, adjustment type constants)

Price Information Improvements:

  • Change ExcludedBid.Reason from detailed messages to generic codes
  • Simplify floor enforcement to return []string (bid IDs) instead of []ExcludedBid objects
  • Update AuctionResult.FloorRejectedBidIDs from []ExcludedBid to []string
  • Update EnclaveAuctionResponse.FloorRejectedBidIDs field type to match

Why

Information Control: Bid exclusion reasons appear in attestation documents and API responses. Detailed error messages containing prices or error details leaks sensitive information. Only winner/runner-up prices should be visible.

Simplicity: Floor-rejected bids don't need detailed ExcludedBid objects—the field name floor_rejected_bid_ids makes the reason self-explanatory. Returning just IDs reduces response size and API surface.

Testing

  • All existing tests pass (go test ./...)
  • Updated test expectations to match new exclusion reason format
  • Verified no price information leaks in any ExcludedBid.Reason fields

@nickpell
nickpell marked this pull request as ready for review November 20, 2025 03:57

@peterldowns peterldowns left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems reasonable to me. Looks like good groundwork for eventually using derived types for the different things that are currently all string as well!

@nickpell
nickpell merged commit a3c5f39 into main Nov 21, 2025
@nickpell
nickpell deleted the nick/unify branch November 21, 2025 00:33
nickpell added a commit that referenced this pull request Oct 13, 2026
…, fix doc comments, drop the TCP healthcheck (#103)

## Summary

- **Auction failure logging (`enclave/server.go`):** the server logged
`INFO: Auction processed successfully with TEE attestation data` after
every `ProcessAuction` call, including the two cases where
`ProcessAuction` returns `Success: false` without logging anything (a
negative `bid_floor`, an invalid deal list). The success line is now
logged only when the response succeeded; otherwise the server logs
`ERROR: Auction failed: <message>`. The response sent to the host is
unchanged.
- **`TestProcessAuction_BidFloorZero`:** the test claimed "all bids pass
(no floor enforcement)" but checked only the attested bid hash count,
which includes floor-rejected bids, so it could not fail if a zero floor
rejected a bid. It now also asserts `response.FloorRejected` is empty.
- **Doc comments (`core/types.go`):** `AuctionResult.RunnerUp` is nil
when fewer than two bidders have an eligible bid, because ranking keeps
only each bidder's highest bid (two eligible bids from one bidder still
give no runner-up); the comment said "less than 2 valid bids". The
`ExcludedBid` comment listed floor rejections, which are reported in
`FloorRejected` instead; it now lists the exclusion reasons the enclave
uses.
- **Enclave image (`enclave/Dockerfile`):** removes `EXPOSE 5000` and
the `HEALTHCHECK` that pinged `127.0.0.1:5000` with `nc`. The server
listens only on vsock, so the probe could never pass, and the image is
used only as `nitro-cli build-enclave` input, where Docker health checks
never run. `nmap-ncat` stays installed. The image config changes, so the
EIF PCRs may change (the server change alters the binary in any case);
`update-pcrs` records the new values after merge.

## Notes for reviewers

- The `ExcludedBid` comment dates from #4, which moved floor rejections
out of `ExcludedBid` into a separate list in the same change; the
comment kept the old wording.
- Open #44, #46 and #102 touch `enclave/auction_test.go`,
`core/types.go` and `enclave/Dockerfile` on other lines. A trial merge
of each with this branch produces no conflicts beyond those each already
has with `main`.

## Pre-merge checklist

- [x] Build passes (`go build ./...`, `go vet ./...`; Docker Build green
on this branch; a local build of the image shows `Healthcheck` and
`ExposedPorts` null with `nc` still present)
- [x] Lint passes (`golangci-lint run`: 0 issues)
- [x] Tests pass (`go test -count=1 ./...`; with a zero floor made to
reject a bid, the new `FloorRejected` assertion fails while the existing
bid hash count check still passes)
- [x] Diff contains no unintended changes

## Post-deploy/apply verification

- [ ] The next EIF build on `main` after merge is green
- [ ] `update-pcrs` commits the new PCR measurements for the merge
commit
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.

2 participants