Skip to content

fix(market-making): handle bootstrap ladder overlap - #127

Open
prd-carapulse[bot] wants to merge 1 commit into
mainfrom
hermes/bootstrap-crossing-sell
Open

fix(market-making): handle bootstrap ladder overlap#127
prd-carapulse[bot] wants to merge 1 commit into
mainfrom
hermes/bootstrap-crossing-sell

Conversation

@prd-carapulse

@prd-carapulse prd-carapulse Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Why

The premium-adjusted bootstrap buy can intentionally meet the maker's highest-rate ladder sell. Treating that known overlap as a generic negative spread prevents bootstrap from accounting for liquidity the maker already has resting on the opposite side.

Behavior

  • Selects only the unique highest-rate indexed sell owned by the ladder strategy.
  • Derives its current effective rate from the actual sell tick, maturity, and current block timestamp, while preserving that exact protocol tick for publication.
  • Sizes the bootstrap publication as expected bootstrap assets minus the sell group's remaining maxAssets - consumed capacity.
  • Skips publication when that remainder is zero or negative.
  • Applies the same adjusted request in live and --readonly modes.

Safety boundaries

  • Unknown ownership, tied or duplicate highest-rate sells, pending ladder offers without indexed size, malformed or missing rate/size evidence, pre-existing crossed books, and crossings against any other offer still fail closed with negative-spread.
  • Replacement groups are still selected before validation; adjusted publications are prepared and durably reserved before invalidation.
  • Failed invalidations and publication outcomes retain the existing reservation cleanup and ambiguity behavior.

Verification

  • bun install --frozen-lockfile with Bun 1.3.12
  • Focused bootstrap/read-only tests: 92 passed
  • Market-making typecheck: passed
  • bun lint: 0 warnings, 0 errors
  • bun format: passed
  • JSDoc inventory and TypeDoc build: passed; generated index verified
  • Full bun test after bun run build: 1,419 passed, 3 skipped; fork-only failures remain because RPC_URL_8453 is not configured
  • RED observed before implementation; one assertion was intentionally broken and confirmed failing, then restored

Requested by: <@U02N5KRFDB9>

@julien-devatom
julien-devatom marked this pull request as ready for review August 5, 2026 09:22

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 3 potential issues.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment thread bots/market-making/src/infrastructure/bootstrap/bootstrap-overlap.utils.ts Outdated
Comment thread bots/market-making/src/infrastructure/bootstrap/production-bootstrap.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dafd5b251f

鈩癸笍 About Codex in GitHub

Codex has been enabled to automatically 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 馃憤.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread bots/market-making/src/infrastructure/bootstrap/bootstrap-make.service.ts Outdated
Comment thread bots/market-making/src/infrastructure/bootstrap/bootstrap-groups.utils.ts Outdated
@prd-carapulse prd-carapulse Bot closed this Aug 6, 2026
@prd-carapulse
prd-carapulse Bot force-pushed the hermes/bootstrap-crossing-sell branch from 5d22677 to ddd8b88 Compare August 6, 2026 07:06
@prd-carapulse prd-carapulse Bot reopened this Aug 6, 2026
@prd-carapulse

prd-carapulse Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a6463b16e

鈩癸笍 About Codex in GitHub

Codex has been enabled to automatically 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 馃憤.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread bots/market-making/src/infrastructure/setup-state/viem-setup-state.service.ts Outdated
Comment thread bots/market-making/src/infrastructure/ladder/production-ladder.ts
Comment thread bots/market-making/src/infrastructure/bootstrap/production-bootstrap.ts Outdated
@prd-carapulse

prd-carapulse Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06a26d5c69

鈩癸笍 About Codex in GitHub

Codex has been enabled to automatically 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 馃憤.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread bots/market-making/src/infrastructure/bootstrap/production-bootstrap.ts Outdated
Comment thread bots/market-making/src/infrastructure/bootstrap/bootstrap-make.service.ts Outdated
Comment thread bots/market-making/src/infrastructure/setup-state/viem-setup-state.utils.ts Outdated
@prd-carapulse

prd-carapulse Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 576855f3d9

鈩癸笍 About Codex in GitHub

Codex has been enabled to automatically 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 馃憤.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread bots/market-making/src/infrastructure/bootstrap/production-bootstrap.ts Outdated
Rebase the overlap fix onto current main, preserve durable bootstrap ownership during conflict resolution, remove the stale merged helper, and cover fully-overlapped reservation planning.
@prd-carapulse
prd-carapulse Bot force-pushed the hermes/bootstrap-crossing-sell branch from 9e1fcfe to 3a73459 Compare August 7, 2026 07:25
@prd-carapulse

prd-carapulse Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 3a7345973d

鈩癸笍 About Codex in GitHub

Codex has been enabled to automatically 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 馃憤.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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