Skip to content

fix: preserve existing ERC-8021 service codes when stamping builder code #199

Closed

Description

@steipete

Problem

withBuilderCodeServiceCode() replaces an existing builder-code.info.s array with only BlockRun's code:

info: { ...(existing.info ?? {}), s: [BLOCKRUN_SERVICE_CODE] },

ERC-8021 Schema 2 defines s as an array of related service codes. If another layer already added service attribution, the new ClawRouter hook erases it before settlement.

Reproduction

const extensions = withBuilderCodeServiceCode({
  "builder-code": { info: { a: "app", s: ["bc_existing"] } },
});

// Current: ["bc_5hucoh0l"]
// Expected: ["bc_existing", "bc_5hucoh0l"]

Suggested fix

Append BLOCKRUN_SERVICE_CODE to an existing valid info.s array, deduplicate it, and retain the current non-mutating behavior. Add a regression test covering an existing service code and an already-present BlockRun code.

Found while validating openclaw/crabpot#198. The new focused tests and the full upstream suite pass, but none covers pre-existing s attribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions