feat(standards): add P2idNote bon builder, remove create() factory#3
feat(standards): add P2idNote bon builder, remove create() factory#3VAIBHAVJINDAL3012 wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThis PR refactors ChangesP2idNote Builder Refactoring
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@CHANGELOG.md`:
- Line 7: Changelog line shows an extra period in the example chain for the new
P2idNote builder; update the example under P2idNote::builder() so the call chain
uses a single dot before build (i.e., change the `..build()?` typo to a
single-dot `build()?`), ensuring the example with sender(..).target(..).build()?
and conversion via Note::from(_) is valid and copy-paste safe.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a6367466-1eca-4c2e-b413-1e671a22b63d
📒 Files selected for processing (14)
CHANGELOG.mdcrates/miden-standards/src/note/mod.rscrates/miden-standards/src/note/p2id.rscrates/miden-testing/src/kernel_tests/block/proposed_block_errors.rscrates/miden-testing/src/kernel_tests/block/proven_block_success.rscrates/miden-testing/src/kernel_tests/tx/test_account_interface.rscrates/miden-testing/src/kernel_tests/tx/test_output_note.rscrates/miden-testing/src/kernel_tests/tx/test_tx.rscrates/miden-testing/src/mock_chain/chain_builder.rscrates/miden-testing/tests/auth/hybrid_multisig.rscrates/miden-testing/tests/auth/multisig.rscrates/miden-testing/tests/auth/multisig_smart.rscrates/miden-testing/tests/scripts/p2id.rscrates/miden-testing/tests/scripts/send_note.rs
|
|
||
| ### Changes | ||
|
|
||
| - [BREAKING] Replaced `P2idNote::create` factory with a `bon`-based typestate builder. Construct via `P2idNote::builder().sender(..).target(..)..build()?` and convert with `Note::from(_)`. Added `.asset()`, `.attachment()`, `.generate_serial_number()` builder methods and a `SCRIPT_ROOT` static accessor ([#2283](https://github.com/0xMiden/protocol/issues/2283)). |
There was a problem hiding this comment.
Fix invalid builder-chain example in changelog.
Line 7 shows ...target(..)..build()?, which has an extra . and presents an invalid call chain. Please change it to ...target(..).build()? so migration instructions are copy-paste safe.
🤖 Prompt for 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.
In `@CHANGELOG.md` at line 7, Changelog line shows an extra period in the example
chain for the new P2idNote builder; update the example under P2idNote::builder()
so the call chain uses a single dot before build (i.e., change the `..build()?`
typo to a single-dot `build()?`), ensuring the example with
sender(..).target(..).build()? and conversion via Note::from(_) is valid and
copy-paste safe.
Closes 0xMiden#2283.
Summary by CodeRabbit
Release Notes
Breaking Changes
P2idNote::createfactory method with a builder-based API (P2idNote::builder()) for more flexible note construction.New Features
.asset(),.attachment(), and.generate_serial_number().P2ID_SCRIPT_ROOTconstant for public access to the P2ID script root hash.