feat(core): add isDaoOutputLimitExceeded utility for NervosDAO 64-output guard#359
feat(core): add isDaoOutputLimitExceeded utility for NervosDAO 64-output guard#359phroi wants to merge 1 commit intockb-devrel:masterfrom
Conversation
🦋 Changeset detectedLatest commit: 1e12565 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for liveccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for appccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for apiccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary of ChangesHello @phroi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial early warning system for NervosDAO transactions. It addresses the issue of transactions silently failing on-chain when they exceed the 64-output limit, which previously led to wasted fees and user frustration. By implementing a new validation function and integrating it into the transaction completion process, the system now proactively identifies and flags such invalid transactions, significantly improving the user experience and reliability of DAO operations. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces a crucial check for NervosDAO transactions to prevent silent failures due to exceeding the 64-output limit. This is a significant improvement for user experience and transaction reliability. The implementation correctly integrates the check into the completeFee method and provides a clear error message. The ErrorNervosDaoOutputLimit class is well-defined. The changes are well-documented and appear to be robust.
✅ Deploy Preview for docsccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
395860e to
8e63e3a
Compare
|
@Hanssen0 @ashuralyk all green, feel free to review 🤗 Phroi %28 |
Thank you for your contribution! It's indeed a confusing problem that might occur when a miscomposed transaction is sent. For the description Of course, checking only when it fails also means that it fails later, after users sign the transaction. But considering that this checking doesn't correct a miscomposed transaction, a failure almost certainly indicates that the application logic needs to be corrected for a correct transaction, so failing earlier won't make things better here. To me, this seems like an "error message translator" that is hardcoded into CCC. It's definitely worth investigating how to make script error codes more readable to users. |
8e63e3a to
ca08649
Compare
45ee9bb to
1e12565
Compare
|
Hey @Hanssen0!! Thank you for the review! 🤗 Fun fact: my first attempt actually had this wired into adding outputs to the transaction, only later I tought about it and moved it to So I reworked the PR: dropped the automatic check and the custom error class entirely. Now it's just Phroi %32 |

Why
NervosDAO transactions silently fail on-chain when they exceed 64 outputs. There is no early warning: the transaction gets rejected by the DAO script during verification.
Changes
isDaoOutputLimitExceeded(tx, client)utility inpackages/core/src/ckb/transaction.ts: returnstruewhen a DAO transaction has >64 outputsfalsewhen outputs <= 64