-
Notifications
You must be signed in to change notification settings - Fork 44
fix(platform): unique token keeps history documents #2506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis pull request simplifies the method signatures used for generating and building historical documents across several modules. The changes remove redundant parameters such as Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Client
participant Transition as TokenTransition
participant DocGen as DocumentGenerator
Caller->>Transition: historical_document_id(owner_id)
Transition->>Transition: derive owner_nonce internally via identity_contract_nonce()
Transition->>DocGen: generate_document_id using token_id
DocGen-->>Transition: Return DocumentID
Transition-->>Caller: Return DocumentID
sequenceDiagram
participant Caller as Client
participant Transition as TokenTransition
participant Builder as DocumentBuilder
Caller->>Transition: build_historical_document(token_id, owner_id, block_info, platform_version)
Transition->>Transition: derive owner_nonce internally
Transition->>Builder: Build document with formatted name ("history_" prefix)
Builder-->>Transition: Return Document
Transition-->>Caller: Return Document
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (7)
💤 Files with no reviewable changes (1)
🧰 Additional context used🧬 Code Definitions (1)packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/mod.rs (3)
⏰ Context from checks skipped due to timeout of 90000ms (20)
🔇 Additional comments (8)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Issue being fixed or feature implemented
Historical documents for token events were using the same document ids based on the token history contract, and identity contract nonce for the token contract, but this meant that if a user would send token A, then send token B the second transaction would use the same document id to try to store info on the transaction.
What was done?
Historical document id now looks like:
fn historical_document_id(&self, owner_id: Identifier) -> Identifier { let token_id = self.token_id(); let name = self.historical_document_type_name(); let owner_nonce = self.identity_contract_nonce(); Document::generate_document_id_v0( &token_id, &owner_id, format!("history_{}", name).as_str(), owner_nonce.to_be_bytes().as_slice(), ) }
How Has This Been Tested?
Not tested, but tests still pass.
Breaking Changes
Breaking, (but previous was failing). It's shouldn't be considered breaking compared to 1.8.
Checklist:
For repository code-owners and collaborators only