Skip to content

Feat/cert holder cap#92

Open
Detoo wants to merge 7 commits intofeat/partial-scripifyfrom
feat/cert-holder-cap
Open

Feat/cert holder cap#92
Detoo wants to merge 7 commits intofeat/partial-scripifyfrom
feat/cert-holder-cap

Conversation

@Detoo
Copy link
Copy Markdown
Contributor

@Detoo Detoo commented Apr 3, 2026

Highlight

  • Couldn't implement the logic in IssuanceManager because the legal holder accounting is tightly integrated in CyberCertPrinter._update(). We have no choice but to deal with CyberCertPrinter's size

TODO

  • Contract size too large
  • Edge cases when upgrading existing CyberCertPrinters with issued certs
╭--------------------------------------------------------------+------------------+-------------------+--------------------+---------------------╮
| Contract                                                     | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
+================================================================================================================================================+
| CyberCertPrinter                                             | 21,055           | 21,262            | 3,521              | 27,890              |
|--------------------------------------------------------------+------------------+-------------------+--------------------+---------------------|
| CyberCertPrinterMock                                         | 5,781            | 6,568             | 18,795             | 42,584              |
|--------------------------------------------------------------+------------------+-------------------+--------------------+---------------------|
| CyberCertPrinterStorage                                      | 6,311            | 6,343             | 18,265             | 42,809              |
|--------------------------------------------------------------+------------------+-------------------+--------------------+---------------------|

Copy link
Copy Markdown

@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: c4062e7640

ℹ️ 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".

}

if (oldOwner != address(0)) {
s.legalHolderTokenCount[oldOwner] -= 1;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent underflow when adjusting legacy holder counts

_updateLegalHolder assumes every nonzero owners[tokenId].ownerAddress already has a positive legalHolderTokenCount, but that is false right after upgrading existing printers (new counters start at zero) and after reusing a burned token id (the old owner is still stored). In those cases, s.legalHolderTokenCount[oldOwner] -= 1 underflows and reverts, so legal-owner-changing flows like transfer/assign/burn can become unusable for affected tokens.

Useful? React with 👍 / 👎.

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