Skip to content

enclave: attest floor-rejected bid prices - #45

Closed
josephmilla wants to merge 4 commits into
mainfrom
cxd-3155-attested-floor-rejected-bids
Closed

enclave: attest floor-rejected bid prices#45
josephmilla wants to merge 4 commits into
mainfrom
cxd-3155-attested-floor-rejected-bids

Conversation

@josephmilla

@josephmilla josephmilla commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Context

  • Encrypted floor-rejected bids previously lost their trusted prices before downstream analytics could record them.
  • The signed attestation now carries only each rejected bid ID and adjusted price, while retaining legacy response IDs.
  • Duplicate bid IDs and payloads beyond four rejected bids or 1024 encoded bytes fail closed before attestation.
  • Deploy this producer change before enabling the matching consumer that reads floor_rejected_bids from attestation user data.

Testing

  • mise run test: covers adjusted encrypted prices, legacy IDs, duplicate rejection, and attestation limits.
  • mise run lint: reports no issues across the changed core, enclave, and API packages.
  • git diff --check origin/main...HEAD: no whitespace errors in the committed diff.
  • Enclave deployment: required before consumers can observe nonzero encrypted rejection prices.

@josephmilla
josephmilla requested a review from Copilot July 25, 2026 12:02
@josephmilla
josephmilla marked this pull request as ready for review July 25, 2026 12:02
@josephmilla
josephmilla requested a review from nickpell as a code owner July 25, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates enclave attestation user data so that floor-rejected bids retain a trusted (post-adjustment) price for downstream analytics, while keeping the attestation payload bounded and unambiguous.

Changes:

  • Add an attested representation of floor-rejected bids (ID + adjusted price) to AuctionAttestationUserData.
  • Thread floor-rejected bids through enclave proof generation and fail closed when the rejected-bid count or attestation user-data size exceeds limits.
  • Extend core auction results to retain the full adjusted floor-rejected bids (not just IDs) and add duplicate bid ID validation in enclave request handling.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
enclaveapi/types.go Adds AttestedFloorRejectedBid and embeds floor-rejected bid attest data in auction attestation user data.
enclaveapi/types_test.go Adds JSON marshaling coverage for floor_rejected_bids and field-shape expectations.
enclave/proofs.go Threads floor-rejected bids into attestation, enforces max count and max user-data byte size pre-attest.
enclave/proofs_test.go Adds tests ensuring limit checks fail before calling the enclave attester.
enclave/auction.go Rejects duplicate bid IDs early; passes floor-rejected bid details into proof generation.
enclave/auction_test.go Adds tests for duplicate ID rejection and for attesting adjusted floor-rejected bid prices without leaking other bid fields.
core/types.go Extends AuctionResult with FloorRejectedBids to carry adjusted rejected bid values.
core/floorenforcement.go Refactors floor enforcement to partition bids and enable capturing rejected bid structs.
core/auction.go Captures both floor-rejected bid IDs and full adjusted floor-rejected bids in auction results.
core/auction_test.go Adds test ensuring floor-rejected bids in results reflect adjusted (not original) values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/floorenforcement.go
Comment on lines +30 to 33
func partitionBidsByFloor(bids []CoreBid, floor float64) (eligible, rejected []CoreBid) {
eligibleBids := make([]CoreBid, 0, len(bids))
rejectedIDs := make([]string, 0)
rejectedBids := make([]CoreBid, 0)

@josephmilla
josephmilla deleted the cxd-3155-attested-floor-rejected-bids branch July 25, 2026 15:50
@josephmilla

Copy link
Copy Markdown
Contributor Author

Superseded by a follow-up PR after renaming the head branch for public hygiene.

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