Auto-detect Core asset vs collection for plugin add/update - #130
Conversation
When adding or updating plugins, resolve the address as an asset first and fall back to a collection instead of failing with "Unable to fetch asset". The --collection flag remains as an explicit override. Co-authored-by: MarkSackerberg <MarkSackerberg@users.noreply.github.com>
Genesis account creation can exceed Solana's 200k default compute budget under Node 24 CI. Prepend setComputeUnitLimit (400k) in the shared send path so heavier Metaplex transactions stop failing flakily. Co-authored-by: MarkSackerberg <MarkSackerberg@users.noreply.github.com>
A global compute-unit limit pushed near-full transactions (e.g. add presale bucket) over Solana's size cap. Scope the 400k CU limit to Genesis initialize only, where create was flaking on the 200k default. Co-authored-by: MarkSackerberg <MarkSackerberg@users.noreply.github.com>
WalkthroughCore plugin commands now auto-resolve asset or collection targets and pass the resolved type through add/update flows. Genesis initialization transactions now include a 400,000 compute-unit limit, with tests covering collection auto-detection. ChangesCore account resolution
Genesis compute budget
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant resolveCoreAccount
participant CoreFetch
participant PluginBatch
CLI->>resolveCoreAccount: resolve target address
resolveCoreAccount->>CoreFetch: fetch asset or collection
CoreFetch-->>resolveCoreAccount: resolved account data
resolveCoreAccount-->>CLI: isCollection and collectionId
CLI->>PluginBatch: add or update plugins with resolved values
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
2334cac to
87288dd
Compare
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/core/plugins/add.ts`:
- Around line 57-60: Update the pluginSelector calls in
src/commands/core/plugins/add.ts lines 57-60 and
src/commands/core/plugins/update.ts lines 56-60 to combine the resolved
Asset/Collection filter with the authority-managed constraint, rather than
allowing managedBy to override filter. Ensure each wizard only presents plugins
matching both the requested plugin type and authority ownership.
- Around line 3-7: Fix lint ordering in src/commands/core/plugins/add.ts (lines
3-7 and 25-36) and src/commands/core/plugins/update.ts (lines 3-7 and 25-30):
reorder imports and imported specifiers, use the node:fs module specifier, order
static declarations consistently, and arrange flag properties according to the
project’s lint rules.
In `@src/lib/core/fetch/resolveCoreAccount.ts`:
- Around line 1-12: Resolve lint violations across the new core-account resolver
module: rename resolveCoreAccount.ts to kebab-case, update all command imports
and references to the renamed module, and correct import ordering, type/object
member ordering, and required blank-line padding. Use the existing symbols from
the resolver and its command consumers without changing behavior.
- Around line 38-55: The fetches in the account-resolution flow should not
convert RPC or network rejections into null results. Remove the catch handlers
from safeFetchAssetV1 and safeFetchCollectionV1, while preserving the existing
null checks and corresponding missing-account errors for genuinely absent Core
accounts.
In `@src/lib/genesis/operations.ts`:
- Around line 30-32: Use a single shared compute-unit limit: export
GENESIS_CREATE_COMPUTE_UNIT_LIMIT from src/lib/genesis/operations.ts at lines
30-32, then remove the duplicate declaration and import the shared constant in
src/commands/genesis/create.ts at lines 18-20.
In `@test/commands/core/core.plugins.test.ts`:
- Line 44: Update the added integration tests at the referenced timeout
declarations to use numeric separators, such as 30_000 or 45_000, and reorder
each destructuring pattern so code appears before stderr. Apply these lint fixes
consistently across all affected tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c5e42161-0e37-41bb-be17-5ab3386f8727
📒 Files selected for processing (6)
src/commands/core/plugins/add.tssrc/commands/core/plugins/update.tssrc/commands/genesis/create.tssrc/lib/core/fetch/resolveCoreAccount.tssrc/lib/genesis/operations.tstest/commands/core/core.plugins.test.ts
Resolve asset vs collection via a single getAccount + Key check so RPC failures are not swallowed as missing accounts. Export the Genesis create compute-unit limit from operations and reuse it in the command. Co-authored-by: MarkSackerberg <MarkSackerberg@users.noreply.github.com>
Summary
mplx core plugins addandupdatepreviously assumed the address was an asset unless--collectionwas passed. Passing a collection address without the flag failed withUnable to fetch asset.This change introduces
resolveCoreAccount, which:--collectionas an explicit override (collection only)getAccount+ accountKeycheckThis mirrors the auto-detect pattern already used by
genesis bucket fetchwhen--typeis omitted.Also prepends a 400k compute unit limit on Genesis create only (shared
GENESIS_CREATE_COMPUTE_UNIT_LIMIT). Create was flaking on Node 24 CI withComputational budget exceededat Solana's 200k default. A global CU limit was tried and rejected because it pushed near-full txs (e.g. add presale bucket) over the transaction size cap.Replaces closed PR #129 (GitHub had stuck the PR head on an intermediate commit).
Usage
Test plan