-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat(dpp): extra methods for state transitions in wasm #2401
Conversation
WalkthroughThis pull request introduces a comprehensive set of enhancements across multiple Rust and WebAssembly files, focusing on expanding the functionality of various state transition structs. The changes primarily involve adding new methods for managing user fee increases, identity contract nonces, and signature-related operations across different transition types in the Dash Platform Protocol (DPP) implementation. Additionally, new variants for the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 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 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs (1)
149-157
: Consider renaming methods for consistency.The getter and setter methods have inconsistent naming:
- Getter:
get_identity_nonce
- Setter:
set_identity_contract_nonce
Consider using consistent naming:
- pub fn get_identity_nonce(&self) -> u64 { + pub fn get_identity_contract_nonce(&self) -> u64 {packages/wasm-dpp/src/identity/state_transition/identity_topup_transition/identity_topup_transition.rs (1)
118-126
: Consider adding documentation for the user fee methodsWhile the implementation is correct and consistent with other transition types, consider adding documentation to explain:
- The purpose of user fee increases
- Valid range for the fee increase value
- Impact on transaction processing
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs
(1 hunks)packages/wasm-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs
(1 hunks)packages/wasm-dpp/src/data_contract/state_transition/data_contract_update_transition/mod.rs
(1 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs
(2 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_delete_transition.rs
(1 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_replace_transition.rs
(1 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs
(3 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/mod.rs
(1 hunks)packages/wasm-dpp/src/identity/state_transition/identity_create_transition/identity_create_transition.rs
(1 hunks)packages/wasm-dpp/src/identity/state_transition/identity_credit_transfer_transition/transition.rs
(2 hunks)packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs
(2 hunks)packages/wasm-dpp/src/identity/state_transition/identity_topup_transition/identity_topup_transition.rs
(1 hunks)packages/wasm-dpp/src/identity/state_transition/identity_update_transition/identity_update_transition.rs
(2 hunks)packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs
(8 hunks)
👮 Files not reviewed due to content moderation or server errors (5)
- packages/wasm-dpp/src/data_contract/state_transition/data_contract_create_transition/mod.rs
- packages/wasm-dpp/src/data_contract/state_transition/data_contract_update_transition/mod.rs
- packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_replace_transition.rs
- packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs
- packages/wasm-dpp/src/identity/state_transition/identity_create_transition/identity_create_transition.rs
🔇 Additional comments (16)
packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/action_type.rs (1)
42-43
: LGTM! New action types properly implemented.
The new Purchase
and UpdatePrice
variants are correctly added to the TryFrom
implementation, maintaining consistency with the existing pattern.
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_delete_transition.rs (2)
76-79
: LGTM! Identity contract nonce getter properly implemented.
The getter method correctly exposes the nonce value from the base transition.
81-88
: LGTM! Identity contract nonce setter properly implemented.
The setter method correctly handles the base transition modification with proper cloning.
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs (1)
106-130
: LGTM! Prefunded voting balance handling properly implemented.
The implementation correctly handles the prefunded voting balance, including proper null handling and JS object creation.
packages/wasm-dpp/src/identity/state_transition/identity_credit_transfer_transition/transition.rs (3)
102-110
: LGTM! User fee increase methods are well implemented.
The getter and setter for user fee increase are properly implemented with correct type conversion.
112-120
: LGTM! Identity nonce methods are properly implemented.
The getter and setter for identity nonce maintain consistency with the inner implementation.
341-344
: LGTM! Signature public key ID getter is correctly implemented.
The method properly exposes the inner signature public key ID.
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs (2)
73-81
: LGTM! User fee methods are well-implemented.
The implementation follows the established pattern across other transition types and handles types appropriately.
83-86
: LGTM! Identity nonce getter is correctly implemented.
The method properly exposes the underlying nonce value, aligning with the PR objectives.
packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs (2)
139-147
: LGTM! User fee methods are consistently implemented.
The implementation aligns with other transition types and handles types appropriately.
423-426
: LGTM! Signature public key ID getter is properly implemented.
The method follows the established pattern and correctly exposes the underlying ID.
packages/wasm-dpp/src/identity/state_transition/identity_update_transition/identity_update_transition.rs (3)
172-180
: LGTM: Well-implemented user fee methods.
The implementation is consistent with other transition types and follows Rust conventions.
182-190
: LGTM: Properly implemented nonce management methods.
The implementation correctly handles the identity contract nonce with appropriate type conversions.
435-438
: LGTM: Signature public key ID getter implementation.
The method correctly retrieves the signature public key ID.
packages/wasm-dpp/src/document/state_transition/document_batch_transition/mod.rs (1)
101-109
: LGTM! Clean implementation of user fee management methods.
The implementation follows best practices with:
- Appropriate type safety using u16 for fee values
- Consistent naming conventions
- Clean integration with the existing WASM bindings architecture
packages/wasm-dpp/src/identity/state_transition/identity_topup_transition/identity_topup_transition.rs (1)
Line range hint 85-126
: Verify consistent implementation across all transition types
The implementation of user fee and signature methods looks consistent across the reviewed files. Let's verify this pattern is followed in all transition types.
✅ Verification successful
Implementation is consistent across all transition types
The verification results show that both user fee increase and signature methods are consistently implemented across all state transition types:
-
User fee increase methods (
get_user_fee_increase
andset_user_fee_increase
) are uniformly implemented in:- Identity transitions (Create, Update, Topup, Credit Transfer, Credit Withdrawal)
- Document transitions (Batch)
- Data Contract transitions (Create, Update)
- Masternode Vote transitions
-
Signature methods (
get_signature
andget_signature_public_key_id
) follow the same pattern across:- Identity transitions
- Document transitions
- Data Contract transitions
- Masternode Vote transitions
All implementations maintain consistent return types and parameter types, with proper WASM bindings.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify consistent implementation of user fee methods across all transition types
# Search for user fee increase methods
echo "Checking user fee increase methods implementation..."
rg -A 2 "fn (get|set)_user_fee_increase" packages/wasm-dpp/src/
# Search for signature-related methods
echo "Checking signature-related methods implementation..."
rg -A 2 "fn get_signature(_public_key_id)?" packages/wasm-dpp/src/
Length of output: 14190
#[wasm_bindgen(js_name=getData)] | ||
pub fn get_data(&self) -> JsValue { | ||
match &self.0 { | ||
DocumentTransition::Create(document_create_transition) => { | ||
let json_value = document_create_transition.data().to_json_value().unwrap(); | ||
json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()).unwrap() | ||
} | ||
DocumentTransition::Replace(document_replace_transition) => { | ||
let json_value = document_replace_transition.data().to_json_value().unwrap(); | ||
json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()).unwrap() | ||
} | ||
DocumentTransition::Delete(document_delete_transition) => JsValue::null(), | ||
DocumentTransition::Transfer(document_transfer_transition) => JsValue::null(), | ||
DocumentTransition::UpdatePrice(document_update_price_transition) => JsValue::null(), | ||
DocumentTransition::Purchase(document_purchase_transition) => JsValue::null() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add error handling for JSON conversion.
While the implementation is generally good, the unwrap calls on JSON conversion could lead to runtime panics.
Consider handling potential conversion errors:
pub fn get_data(&self) -> JsValue {
match &self.0 {
DocumentTransition::Create(document_create_transition) => {
- let json_value = document_create_transition.data().to_json_value().unwrap();
- json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()).unwrap()
+ document_create_transition.data()
+ .to_json_value()
+ .and_then(|json_value|
+ json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible())
+ )
+ .unwrap_or(JsValue::null())
}
DocumentTransition::Replace(document_replace_transition) => {
- let json_value = document_replace_transition.data().to_json_value().unwrap();
- json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()).unwrap()
+ document_replace_transition.data()
+ .to_json_value()
+ .and_then(|json_value|
+ json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible())
+ )
+ .unwrap_or(JsValue::null())
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
#[wasm_bindgen(js_name=getData)] | |
pub fn get_data(&self) -> JsValue { | |
match &self.0 { | |
DocumentTransition::Create(document_create_transition) => { | |
let json_value = document_create_transition.data().to_json_value().unwrap(); | |
json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()).unwrap() | |
} | |
DocumentTransition::Replace(document_replace_transition) => { | |
let json_value = document_replace_transition.data().to_json_value().unwrap(); | |
json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()).unwrap() | |
} | |
DocumentTransition::Delete(document_delete_transition) => JsValue::null(), | |
DocumentTransition::Transfer(document_transfer_transition) => JsValue::null(), | |
DocumentTransition::UpdatePrice(document_update_price_transition) => JsValue::null(), | |
DocumentTransition::Purchase(document_purchase_transition) => JsValue::null() | |
} | |
} | |
#[wasm_bindgen(js_name=getData)] | |
pub fn get_data(&self) -> JsValue { | |
match &self.0 { | |
DocumentTransition::Create(document_create_transition) => { | |
document_create_transition.data() | |
.to_json_value() | |
.and_then(|json_value| | |
json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()) | |
) | |
.unwrap_or(JsValue::null()) | |
} | |
DocumentTransition::Replace(document_replace_transition) => { | |
document_replace_transition.data() | |
.to_json_value() | |
.and_then(|json_value| | |
json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()) | |
) | |
.unwrap_or(JsValue::null()) | |
} | |
DocumentTransition::Delete(document_delete_transition) => JsValue::null(), | |
DocumentTransition::Transfer(document_transfer_transition) => JsValue::null(), | |
DocumentTransition::UpdatePrice(document_update_price_transition) => JsValue::null(), | |
DocumentTransition::Purchase(document_purchase_transition) => JsValue::null() | |
} | |
} |
&"documentTypeName".into(), | ||
&contested_document_resource_vote_poll | ||
.document_type_name | ||
.clone() | ||
.into(), | ||
) | ||
.unwrap(); | ||
Reflect::set( | ||
&js_object, | ||
&"indexName".into(), | ||
&contested_document_resource_vote_poll | ||
.index_name | ||
.clone() | ||
.into(), | ||
) | ||
.unwrap(); | ||
|
||
let config = bincode::config::standard() | ||
.with_big_endian() | ||
.with_no_limit(); | ||
|
||
let serialized_index_values = contested_document_resource_vote_poll | ||
.index_values | ||
.iter() | ||
.map(|value| { | ||
JsValue::from(Buffer::from_bytes_owned( | ||
bincode::encode_to_vec(value, config) | ||
.expect("expected to encode value in path"), | ||
)) | ||
}); | ||
|
||
let js_array = Array::from_iter(serialized_index_values); | ||
|
||
Reflect::set(&js_object, &"indexValues".into(), &js_array.into()).unwrap(); | ||
|
||
Some(js_object) | ||
Vote::ResourceVote(vote) => { | ||
let js_object = Object::new(); | ||
|
||
Reflect::set( | ||
&js_object, | ||
&"choice".into(), | ||
&vote | ||
.resource_vote_choice() | ||
.clone() | ||
.to_string() | ||
.into(), | ||
).unwrap(); | ||
|
||
match vote.vote_poll() { | ||
VotePoll::ContestedDocumentResourceVotePoll( | ||
contested_document_resource_vote_poll, | ||
) => { | ||
let contract_id = IdentifierWrapper::from( | ||
contested_document_resource_vote_poll.contract_id.clone(), | ||
); | ||
|
||
Reflect::set(&js_object, &"contractId".into(), &contract_id.into()).unwrap(); | ||
Reflect::set( | ||
&js_object, | ||
&"documentTypeName".into(), | ||
&contested_document_resource_vote_poll | ||
.document_type_name | ||
.clone() | ||
.into(), | ||
) | ||
.unwrap(); | ||
Reflect::set( | ||
&js_object, | ||
&"indexName".into(), | ||
&contested_document_resource_vote_poll | ||
.index_name | ||
.clone() | ||
.into(), | ||
) | ||
.unwrap(); | ||
|
||
let config = bincode::config::standard() | ||
.with_big_endian() | ||
.with_no_limit(); | ||
|
||
let serialized_index_values = contested_document_resource_vote_poll | ||
.index_values | ||
.iter() | ||
.map(|value| { | ||
JsValue::from(Buffer::from_bytes_owned( | ||
bincode::encode_to_vec(value, config) | ||
.expect("expected to encode value in path"), | ||
)) | ||
}); | ||
|
||
let js_array = Array::from_iter(serialized_index_values); | ||
|
||
Reflect::set(&js_object, &"indexValues".into(), &js_array.into()).unwrap(); | ||
|
||
Some(js_object) | ||
} | ||
} | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider adding error handling for bincode operations.
The implementation of contested_document_resource_vote_poll
could be improved:
- The
expect
call on line 292 could panic. Consider proper error handling:
- bincode::encode_to_vec(value, config)
- .expect("expected to encode value in path"),
+ bincode::encode_to_vec(value, config)
+ .map_err(|e| JsError::new(&e.to_string()))?,
- The
unwrap
calls onReflect::set
should handle potential errors:
- ).unwrap();
+ ).map_err(|e| JsError::new("Failed to set choice"))?;
Committable suggestion skipped: line range outside the PR's diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs (1)
228-231
: Consider validating user fee boundaries.
Setting the user fee increase directly from user input may require logical checks (e.g., non-negative values or max limits). If your business rules allow any u16, this is fine; otherwise, consider validating.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs
(4 hunks)
🔇 Additional comments (6)
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs (6)
136-136
: Check error propagation strategy.
The use of '.with_js_error()?' is acceptable; consider whether additional context is needed (e.g., logging or descriptive error messages) for more precise debugging. Otherwise, this usage looks correct.
223-226
: Confirm safe integer range for user fee increase.
Casting to u16 may lead to data truncation if the underlying type has a larger range. Verify that the internal logic never exceeds u16.
233-236
: No implementation issues found here.
The method cleanly returns the nonce, matching the intended usage.
241-303
: Avoid panics in bincode encoding and Reflect calls.
This block uses '.expect(...)' (line 292) and '.unwrap()' multiple times. If encoding or JavaScript reflection fails, it may cause runtime panics. Here’s a recommended approach, mirroring previous feedback:
Use '.map_err(|e| JsError::new(&e.to_string()))?' instead of '.expect(...)' and safely handle Reflect errors:
- .expect("expected to encode value in path")
+ .map_err(|e| JsError::new(&e.to_string()))?
- ).unwrap();
+ ).map_err(|e| JsError::new("Failed to set choice"))?;
322-322
: No issues identified with error return.
The error message is explicit enough.
381-381
: No further comments — end of class.
Closing brace appears to match all opened blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs (1)
241-301
:⚠️ Potential issueCritical: Improve error handling in contested_document_resource_vote_poll.
The method contains multiple panic points that should be handled gracefully:
- Multiple
unwrap()
calls onReflect::set
operations could panicexpect()
call on bincode encoding could panicApply this diff to handle errors properly:
pub fn contested_document_resource_vote_poll(&self) -> Option<Object> { match self.0.vote() { Vote::ResourceVote(vote) => { - let js_object = Object::new(); + let result = (|| -> Result<Object, JsValue> { + let js_object = Object::new(); - Reflect::set( - &js_object, - &"choice".into(), - &vote - .resource_vote_choice() - .clone() - .to_string() - .into(), - ).unwrap(); + Reflect::set( + &js_object, + &"choice".into(), + &vote + .resource_vote_choice() + .clone() + .to_string() + .into(), + )?; // ... similar changes for other Reflect::set calls ... - bincode::encode_to_vec(value, config) - .expect("expected to encode value in path"), + bincode::encode_to_vec(value, config) + .map_err(|e| JsError::new(&format!("Failed to encode value: {}", e)))?, Ok(js_object) + })(); + + match result { + Ok(obj) => Some(obj), + Err(e) => { + // Consider logging the error here + None + } + } }, } }
🧹 Nitpick comments (3)
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_delete_transition.rs (1)
81-93
: LGTM! Consider optimizing base clone.The implementation of get/set identity_contract_nonce methods is correct. However, for performance optimization, consider if the base clone in
set_identity_contract_nonce
could be avoided by directly modifying the nonce if the base structure has interior mutability.packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_replace_transition.rs (1)
99-102
: LGTM! Consider trait extraction for common transition methods.The implementations are correct and maintain consistency with DocumentDeleteTransitionWasm. To improve code reuse and maintainability, consider extracting these common methods (get_entropy, get/set_identity_contract_nonce) into a shared trait that can be implemented by both transition types.
Example trait extraction:
trait TransitionNonceAndEntropy { fn get_entropy(&self) -> Vec<u8>; fn get_identity_contract_nonce(&self) -> u64; fn set_identity_contract_nonce(&mut self, nonce: u64); } impl TransitionNonceAndEntropy for DocumentReplaceTransitionWasm { // Implement methods here } impl TransitionNonceAndEntropy for DocumentDeleteTransitionWasm { // Implement methods here }Also applies to: 197-209
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs (1)
233-236
: Consider aligning method names for consistency.The JavaScript method name
getIdentityContractNonce
doesn't match its Rust implementation nameget_identity_nonce
. Consider renaming the Rust method to match the JavaScript name for better maintainability.- pub fn get_identity_nonce(&self) -> u64 { + pub fn get_identity_contract_nonce(&self) -> u64 {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs
(2 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_delete_transition.rs
(1 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_replace_transition.rs
(2 hunks)packages/wasm-dpp/src/identity/state_transition/identity_credit_transfer_transition/transition.rs
(2 hunks)packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs
(2 hunks)packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/wasm-dpp/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs
- packages/wasm-dpp/src/identity/state_transition/identity_credit_transfer_transition/transition.rs
- packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs
🔇 Additional comments (2)
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_delete_transition.rs (1)
71-74
: LGTM! Clean entropy getter implementation.
The implementation safely exposes the inner entropy as a Vec.
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs (1)
223-231
: LGTM: User fee increase methods are well-implemented.
The getter and setter methods for user fee increase are properly implemented with appropriate type conversions for the WASM boundary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs
(4 hunks)
🔇 Additional comments (4)
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs (4)
20-21
: LGTM: Required imports added correctly
The new imports are necessary for JSON conversion and document replace transition functionality.
47-63
: Add error handling for JSON conversion.
The unwrap calls on JSON conversion could lead to runtime panics.
47-63
: LGTM: Comprehensive handling of all document transition types
The method correctly implements data retrieval for all document transition variants, supporting the Platform Explorer's display requirements. The null returns for Delete, Transfer, UpdatePrice, and Purchase transitions are appropriate as these types don't carry additional data.
117-141
: LGTM: Well-implemented prefunded voting balance retrieval
The implementation:
- Properly handles error cases using Result
- Correctly processes Create transitions with prefunded balance
- Returns null for other transition types
- Creates a clean JS object structure for the Platform Explorer
#[wasm_bindgen(js_name=getEntropy)] | ||
pub fn get_revision(&self) -> Vec<u8> { | ||
match self.0.clone() { | ||
DocumentTransition::Create(document_transition) => Vec::from(document_transition.entropy()), | ||
DocumentTransition::Replace(document_transition) => Vec::from(document_transition.entropy()), | ||
DocumentTransition::Delete(document_transition) => Vec::from(document_transition.entropy()), | ||
DocumentTransition::Transfer(document_transition) => Vec::from(document_transition.entropy()), | ||
DocumentTransition::UpdatePrice(document_transition) => Vec::from(document_transition.entropy()), | ||
DocumentTransition::Purchase(document_transition) => Vec::from(document_transition.entropy()), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix method name and optimize performance
There are two issues in this implementation:
- The method is declared as
get_revision
but implements entropy functionality, which will cause a compilation error due to the duplicate method name. - The implementation unnecessarily clones the entire transition.
Apply this fix:
- pub fn get_revision(&self) -> Vec<u8> {
- match self.0.clone() {
+ pub fn get_entropy(&self) -> Vec<u8> {
+ match &self.0 {
DocumentTransition::Create(document_transition) => Vec::from(document_transition.entropy()),
DocumentTransition::Replace(document_transition) => Vec::from(document_transition.entropy()),
DocumentTransition::Delete(document_transition) => Vec::from(document_transition.entropy()),
DocumentTransition::Transfer(document_transition) => Vec::from(document_transition.entropy()),
DocumentTransition::UpdatePrice(document_transition) => Vec::from(document_transition.entropy()),
DocumentTransition::Purchase(document_transition) => Vec::from(document_transition.entropy()),
}
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
#[wasm_bindgen(js_name=getEntropy)] | |
pub fn get_revision(&self) -> Vec<u8> { | |
match self.0.clone() { | |
DocumentTransition::Create(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::Replace(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::Delete(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::Transfer(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::UpdatePrice(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::Purchase(document_transition) => Vec::from(document_transition.entropy()), | |
} | |
} | |
#[wasm_bindgen(js_name=getEntropy)] | |
pub fn get_entropy(&self) -> Vec<u8> { | |
match &self.0 { | |
DocumentTransition::Create(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::Replace(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::Delete(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::Transfer(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::UpdatePrice(document_transition) => Vec::from(document_transition.entropy()), | |
DocumentTransition::Purchase(document_transition) => Vec::from(document_transition.entropy()), | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs
(2 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs
(4 hunks)
🔇 Additional comments (4)
packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs (1)
47-48
: Clarify usage of new entropy
method in trait
The newly introduced entropy(&self) -> Vec<u8>
method changes the trait’s API. Ensure that all implementers correctly handle entropy retrieval. Confirm that external consumers of DocumentTransitionV0Methods
have migrated to the new function and are no longer calling the removed get_document_type()
function.
Would you like a shell script to search the entire codebase for references to “get_document_type” or do you plan to remove them manually?
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs (3)
47-63
: Avoid panics by handling JSON conversion errors
This code uses multiple unwrap()
calls on to_json_value()
and serialize()
, which can cause runtime panics if these operations fail.
For example, you can adopt optional handling or return an error:
- let json_value = document_create_transition.data().to_json_value().unwrap();
- json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()).unwrap()
+ let json_value_result = document_create_transition
+ .data()
+ .to_json_value()
+ .and_then(|json_value| {
+ json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible())
+ });
+ match json_value_result {
+ Ok(val) => val,
+ Err(_) => JsValue::null(), // Or return a JsValue::from_str("error") or similar
+ }
90-93
: Cross-verify the get_entropy
method
This new method delegates to the trait’s entropy()
function, which currently has a recursion bug in the Rust file. After fixing the recursion issue there, ensure that the correct entropy is returned here to avoid misbehavior or runtime errors.
110-134
: Validate numeric edge cases in prefunded voting balance
The new method get_prefunded_voting_balance
looks correct for standard usage. However, confirm that edge cases (e.g., extremely large or negative values, if any) are handled properly. Any negative balance scenario might require special logic if supported or expected by the protocol.
fn entropy(&self) -> Vec<u8> { | ||
self.entropy() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential infinite recursion
Inside fn entropy(&self) -> Vec<u8>
, calling self.entropy()
will recursively invoke itself, leading to a stack overflow. Instead, delegate to the underlying transition’s entropy. For example, you might call self.base().entropy()
or a variant-specific method.
fn entropy(&self) -> Vec<u8> {
- self.entropy()
+ match self {
+ DocumentTransition::Create(t) => t.entropy(),
+ DocumentTransition::Replace(t) => t.entropy(),
+ DocumentTransition::Delete(t) => t.entropy(),
+ DocumentTransition::Transfer(t) => t.entropy(),
+ DocumentTransition::UpdatePrice(t) => t.entropy(),
+ DocumentTransition::Purchase(t) => t.entropy(),
+ }
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
fn entropy(&self) -> Vec<u8> { | |
self.entropy() | |
} | |
fn entropy(&self) -> Vec<u8> { | |
match self { | |
DocumentTransition::Create(t) => t.entropy(), | |
DocumentTransition::Replace(t) => t.entropy(), | |
DocumentTransition::Delete(t) => t.entropy(), | |
DocumentTransition::Transfer(t) => t.entropy(), | |
DocumentTransition::UpdatePrice(t) => t.entropy(), | |
DocumentTransition::Purchase(t) => t.entropy(), | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs (1)
110-134
: Consider a more concise implementation.While the implementation is correct, it could be simplified for better readability.
Consider this more concise version:
pub fn get_prefunded_voting_balance(&self) -> Result<JsValue, JsValue> { match &self.0 { DocumentTransition::Create(create_transition) => { - let prefunded_voting_balance = create_transition.prefunded_voting_balance().clone(); - - if prefunded_voting_balance.is_none() { - return Ok(JsValue::null()) - } - - let (index_name, credits) = prefunded_voting_balance.unwrap(); - - let js_object = js_sys::Object::new(); - - js_sys::Reflect::set( - &js_object, - &JsValue::from_str(&index_name), - &JsValue::from(credits), - )?; - - Ok(JsValue::from(js_object)) + Ok(create_transition + .prefunded_voting_balance() + .map(|(index_name, credits)| { + let obj = js_sys::Object::new(); + js_sys::Reflect::set( + &obj, + &JsValue::from_str(&index_name), + &JsValue::from(credits), + ).unwrap_or_default(); + obj.into() + }) + .unwrap_or_else(|| JsValue::null())) } _ => Ok(JsValue::null()), } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs
(2 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs
(4 hunks)
🔇 Additional comments (5)
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs (3)
20-21
: LGTM: Required imports added for new functionality.
The new imports support JSON conversion and document replace transition methods.
47-63
: Add error handling for JSON conversion.
The unwrap calls on JSON conversion could lead to runtime panics.
90-93
: LGTM: Clean implementation of entropy getter.
The method correctly delegates to the inner entropy implementation.
packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs (2)
47-48
: LGTM: Clean trait method declaration.
The entropy method is well-documented and follows Rust trait conventions.
171-180
: Verify intended entropy behavior.
The implementation only returns entropy for Create transitions and None for all others. Please verify if this is the intended behavior.
✅ Verification successful
Based on the search results, I can now provide a definitive response about the intended entropy behavior:
Entropy is correctly implemented for document transitions
The implementation that returns entropy only for Create transitions and None for all others is the intended behavior. This is evidenced by:
-
The presence of test cases specifically checking entropy reuse for document creation:
test_document_creation_should_fail_if_reusing_entropy()
test_document_creation_on_contested_unique_index_should_fail_if_reusing_entropy()
-
The error message in the codebase that specifically ties entropy to document creation:
#[error("Document {document_id} is already present in a contest, entropy might be being reused")]
-
The usage pattern in the codebase shows that entropy is only used during document creation for generating unique document IDs and preventing duplicates, which explains why it's only needed for Create transitions.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for entropy usage in the codebase to verify the expected behavior
echo "Searching for entropy usage in transitions..."
rg -A 5 "entropy\(\)" --type rust
# Search for tests related to entropy
echo "Searching for entropy-related tests..."
rg -A 5 "test.*entropy" --type rust
Length of output: 29689
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (3)
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs (2)
244-249
:⚠️ Potential issueHandle potential JavaScript reflection errors.
The
unwrap()
call onReflect::set
could panic. Consider proper error handling.- .unwrap(); + .map_err(|e| JsError::new("Failed to set choice"))?;
280-292
:⚠️ Potential issueImprove error handling for bincode operations.
The
expect
call could panic. Consider proper error handling.- bincode::encode_to_vec(value, config) - .expect("expected to encode value in path"), + bincode::encode_to_vec(value, config) + .map_err(|e| JsError::new(&e.to_string()))?,packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs (1)
51-71
:⚠️ Potential issueAdd error handling for JSON conversion.
The implementation uses unwrap() calls which could lead to runtime panics.
Apply this diff to handle potential conversion errors:
pub fn get_data(&self) -> JsValue { match &self.0 { DocumentTransition::Create(document_create_transition) => { - let json_value = document_create_transition.data().to_json_value().unwrap(); - json_value - .serialize(&serde_wasm_bindgen::Serializer::json_compatible()) - .unwrap() + document_create_transition.data() + .to_json_value() + .and_then(|json_value| + json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()) + .ok() + ) + .unwrap_or(JsValue::null()) } DocumentTransition::Replace(document_replace_transition) => { - let json_value = document_replace_transition.data().to_json_value().unwrap(); - json_value - .serialize(&serde_wasm_bindgen::Serializer::json_compatible()) - .unwrap() + document_replace_transition.data() + .to_json_value() + .and_then(|json_value| + json_value.serialize(&serde_wasm_bindgen::Serializer::json_compatible()) + .ok() + ) + .unwrap_or(JsValue::null()) } _ => JsValue::null(), } }
🧹 Nitpick comments (4)
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs (2)
233-236
: Consider aligning method names for consistency.The JavaScript export name (
getIdentityContractNonce
) differs from the Rust method name (get_identity_nonce
). Consider aligning these names for better maintainability.- #[wasm_bindgen(js_name=getIdentityContractNonce)] - pub fn get_identity_nonce(&self) -> u64 { + #[wasm_bindgen(js_name=getIdentityNonce)] + pub fn get_identity_nonce(&self) -> u64 {
241-301
: Consider refactoring for better maintainability.The current implementation has deep nesting and repeated patterns. Consider extracting the object creation logic into separate functions:
- Create a helper function for setting object properties
- Extract the index values serialization logic
impl MasternodeVoteTransitionWasm { fn set_object_property(obj: &Object, key: &str, value: &JsValue) -> Result<(), JsError> { Reflect::set(obj, &key.into(), value) .map_err(|e| JsError::new(&format!("Failed to set {}: {}", key, e))) } fn serialize_index_values(values: &[impl bincode::Encode]) -> Result<Array, JsError> { let config = bincode::config::standard() .with_big_endian() .with_no_limit(); let serialized = values.iter().map(|value| { bincode::encode_to_vec(value, config) .map_err(|e| JsError::new(&e.to_string())) .map(|bytes| JsValue::from(Buffer::from_bytes_owned(bytes))) }); // Collect results and convert to Array let values: Result<Vec<_>, _> = serialized.collect(); Ok(Array::from_iter(values?)) } }packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs (2)
110-132
: Consider using map_or for more concise implementation.While the current implementation is correct, it could be more idiomatic using
map_or
.Example for get_price:
pub fn get_price(&self) -> Option<Credits> { - match &self.0 { - DocumentTransition::Create(create) => None, - DocumentTransition::Replace(_) => None, - DocumentTransition::Delete(_) => None, - DocumentTransition::Transfer(_) => None, - DocumentTransition::UpdatePrice(update_price) => Some(update_price.price()), - DocumentTransition::Purchase(purchase) => Some(purchase.price()), - } + match &self.0 { + DocumentTransition::UpdatePrice(update_price) => Some(update_price.price()), + DocumentTransition::Purchase(purchase) => Some(purchase.price()), + _ => None, + } }
149-173
: Simplify the implementation and add error handling.The current implementation can be made more concise and robust.
Apply this diff:
pub fn get_prefunded_voting_balance(&self) -> Result<JsValue, JsValue> { match &self.0 { DocumentTransition::Create(create_transition) => { - let prefunded_voting_balance = create_transition.prefunded_voting_balance().clone(); - - if prefunded_voting_balance.is_none() { - return Ok(JsValue::null()); - } - - let (index_name, credits) = prefunded_voting_balance.unwrap(); - - let js_object = js_sys::Object::new(); - - js_sys::Reflect::set( - &js_object, - &JsValue::from_str(&index_name), - &JsValue::from(credits), - )?; - - Ok(JsValue::from(js_object)) + Ok(create_transition + .prefunded_voting_balance() + .map(|(index_name, credits)| { + let js_object = js_sys::Object::new(); + js_sys::Reflect::set( + &js_object, + &JsValue::from_str(&index_name), + &JsValue::from(credits), + ) + .map(|_| js_object) + }) + .transpose()? + .map(JsValue::from) + .unwrap_or(JsValue::null())) } _ => Ok(JsValue::null()), } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs
(2 hunks)packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs
(5 hunks)packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs
⏰ Context from checks skipped due to timeout of 90000ms (20)
- GitHub Check: Rust packages (drive-abci) / Linting
- GitHub Check: Rust packages (drive-abci) / Formatting
- GitHub Check: Rust packages (drive) / Tests
- GitHub Check: Rust packages (drive) / Unused dependencies
- GitHub Check: Rust packages (drive-abci) / Check each feature
- GitHub Check: Rust packages (drive) / Linting
- GitHub Check: Rust packages (drive) / Formatting
- GitHub Check: Rust packages (dpp) / Unused dependencies
- GitHub Check: Rust packages (dpp) / Tests
- GitHub Check: Rust packages (dpp) / Linting
- GitHub Check: Rust packages (dpp) / Formatting
- GitHub Check: Rust packages (dpp) / Check each feature
- GitHub Check: Rust packages (dash-sdk) / Unused dependencies
- GitHub Check: Rust packages (dash-sdk) / Tests
- GitHub Check: Rust packages (dash-sdk) / Check each feature
- GitHub Check: Rust packages (dash-sdk) / Linting
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build JS packages / Build JS
🔇 Additional comments (4)
packages/wasm-dpp/src/voting/state_transition/masternode_vote_transition/mod.rs (1)
223-231
: LGTM! Clean implementation of user fee increase methods.The implementation properly handles the user fee increase functionality with appropriate type safety.
packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/mod.rs (3)
20-26
: LGTM! Well-organized imports.The new imports are properly scoped and necessary for the added functionality.
90-95
: LGTM! Clean implementation.The method correctly handles the version check and field access.
105-108
: LGTM! Type-safe implementation.The method correctly preserves the Option type and delegates to the inner implementation.
commit 6776651 Author: QuantumExplorer <[email protected]> Date: Sat Mar 1 22:23:41 2025 +0700 chore: update to latest dash core 37 (#2483) commit 1501103 Merge: a7c7a0f da17fc5 Author: Ivan Shumkov <[email protected]> Date: Thu Feb 27 14:21:41 2025 +0700 chore: merge master and resolve conflicts (#2481) commit da17fc5 Author: pshenmic <[email protected]> Date: Thu Feb 27 13:31:51 2025 +0700 feat(js-dash-sdk): fix tests after merge commit c7e40cb Merge: c57e8b2 f9eb069 Author: Ivan Shumkov <[email protected]> Date: Thu Feb 27 09:35:02 2025 +0700 Merge remote-tracking branch 'origin/chore/merge-master' into chore/merge-master commit c57e8b2 Author: Ivan Shumkov <[email protected]> Date: Thu Feb 27 09:34:40 2025 +0700 test(dpp): fix assertion with the same value commit 045b6fa Author: Ivan Shumkov <[email protected]> Date: Thu Feb 27 09:32:33 2025 +0700 chore(dpp): remove unnecessary type conversion commit 8160ccd Author: Ivan Shumkov <[email protected]> Date: Thu Feb 27 09:31:32 2025 +0700 chore: remove duplicated commented code commit f9eb069 Merge: 05d0085 a7c7a0f Author: pshenmic <[email protected]> Date: Wed Feb 26 20:03:00 2025 +0700 Merge branch 'v2.0-dev' into chore/merge-master commit a7c7a0f Author: pshenmic <[email protected]> Date: Wed Feb 26 19:52:02 2025 +0700 build: bump rust version to 1.85 (#2480) commit 05d0085 Merge: bcf1785 196976c Author: Ivan Shumkov <[email protected]> Date: Wed Feb 26 18:03:38 2025 +0700 Merge branch 'master' into v2.0-dev commit bcf1785 Author: lklimek <[email protected]> Date: Fri Feb 21 08:43:35 2025 +0100 feat: wasm sdk build proof-of-concept (#2405) Co-authored-by: Ivan Shumkov <[email protected]> commit 5e32426 Author: Paul DeLucia <[email protected]> Date: Thu Feb 20 19:22:52 2025 +0700 fix: token already paused unpaused and frozen validation (#2466) commit 374a036 Author: Ivan Shumkov <[email protected]> Date: Thu Feb 20 17:46:57 2025 +0700 test: fix slowdown of JS SDK unit tests (#2475) commit 1fed09b Author: Ivan Shumkov <[email protected]> Date: Thu Feb 20 13:46:36 2025 +0700 fix(dpp): invalid feature flag usage (#2477) commit 33507bb Author: Paul DeLucia <[email protected]> Date: Thu Feb 20 13:18:55 2025 +0700 fix: destroy frozen funds used wrong identity and proof verification (#2467) commit 91a9766 Author: Ivan Shumkov <[email protected]> Date: Wed Feb 19 16:57:32 2025 +0700 feat(sdk): return state transition execution error (#2454) commit cb915a7 Author: Ivan Shumkov <[email protected]> Date: Wed Feb 19 16:46:54 2025 +0700 test: fix token history contract tests (#2470) commit 04276d5 Author: Ivan Shumkov <[email protected]> Date: Tue Feb 18 21:00:05 2025 +0700 fix: xss vulnerability in mocha (#2469) commit 196976c Author: pshenmic <[email protected]> Date: Fri Feb 14 18:50:08 2025 +0700 fix(sdk)!: bigint for uint64 values (#2443) commit 0bd29a6 Author: pshenmic <[email protected]> Date: Fri Feb 14 17:29:35 2025 +0700 feat(dpp): extra methods for state transitions in wasm (#2462) commit 1eae781 Author: pshenmic <[email protected]> Date: Fri Feb 14 15:29:17 2025 +0700 chore(platform): npm audit fix (#2463) commit ddf4e67 Author: Ivan Shumkov <[email protected]> Date: Fri Feb 14 11:28:08 2025 +0700 test: fix `fetchProofForStateTransition` tests and warnings (#2460) commit d88ea46 Author: Ivan Shumkov <[email protected]> Date: Fri Feb 14 09:52:53 2025 +0700 fix(dpp): invalid imports and tests (#2459) commit 82e4d4c Merge: 125cfe7 4becf5f Author: Paul DeLucia <[email protected]> Date: Thu Feb 13 19:05:51 2025 +0700 fix: check if token is paused on token transfers (#2458) commit 4becf5f Author: pauldelucia <[email protected]> Date: Thu Feb 13 18:34:24 2025 +0700 add costs commit 907971d Merge: 9026669 125cfe7 Author: Paul DeLucia <[email protected]> Date: Thu Feb 13 18:05:06 2025 +0700 Merge branch 'v2.0-dev' into feat/token-paused-validation commit 125cfe7 Merge: 91f65c6 c286ec0 Author: Ivan Shumkov <[email protected]> Date: Thu Feb 13 15:51:46 2025 +0700 Merge branch 'v2.0-dev' into v2.0-tokens-dev commit 9026669 Author: pauldelucia <[email protected]> Date: Thu Feb 13 13:41:19 2025 +0700 feat: check if token is paused on token transfers commit c286ec0 Author: pshenmic <[email protected]> Date: Wed Feb 12 15:41:21 2025 +0700 feat(sdk): add option to request all keys (#2445) commit 91f65c6 Merge: d6b40e6 1a1c50b Author: Paul DeLucia <[email protected]> Date: Wed Feb 12 12:04:58 2025 +0700 fix: wrong order of parameters in UnauthorizedTokenActionError (#2456) commit 1a1c50b Author: pauldelucia <[email protected]> Date: Wed Feb 12 11:51:31 2025 +0700 fix: wrong order of parameters in UnauthorizedTokenActionError commit 26aff36 Author: lklimek <[email protected]> Date: Tue Feb 11 13:06:54 2025 +0100 build: bump Alpine version to 3.21 (#2074) commit 9daa195 Author: Ivan Shumkov <[email protected]> Date: Tue Feb 11 14:38:55 2025 +0700 ci: use github-hosted arm runner for release workflow (#2452) commit 2b1c252 Author: Paul DeLucia <[email protected]> Date: Tue Feb 4 16:40:34 2025 +0700 fix: proof result error for credit transfers in sdk (#2451) commit d6b40e6 Author: QuantumExplorer <[email protected]> Date: Tue Feb 4 06:49:03 2025 +0700 feat(platform): token distribution part two (#2450) commit 93f7d44 Author: Ivan Shumkov <[email protected]> Date: Wed Jan 29 14:07:55 2025 +0700 fix(dpp): invalid feature flag instructions (#2448) commit 6d5af88 Author: QuantumExplorer <[email protected]> Date: Mon Jan 27 16:59:39 2025 +0700 feat(dpp): token distribution model (#2447) commit e735313 Author: Ivan Shumkov <[email protected]> Date: Mon Jan 27 14:24:26 2025 +0700 feat: add token transitions to SDK and DAPI (#2434) commit 0743be2 Author: pshenmic <[email protected]> Date: Sun Jan 26 22:00:40 2025 +0700 feat(dpp): extra methods for state transitions in wasm (#2401) commit f609bcf Merge: 3733f56 cbddb8d Author: Ivan Shumkov <[email protected]> Date: Fri Jan 24 18:16:38 2025 +0700 Merge branch 'v2.0-dev' into v2.0-tokens-dev commit cbddb8d Author: QuantumExplorer <[email protected]> Date: Fri Jan 24 17:59:16 2025 +0700 chore(platform): make bls sig compatibility an optional feature (#2440) Co-authored-by: Ivan Shumkov <[email protected]> commit 764684b Author: Ivan Shumkov <[email protected]> Date: Fri Jan 24 17:57:27 2025 +0700 chore: ignore deprecated `lodash.get` (#2441) commit 3733f56 Author: QuantumExplorer <[email protected]> Date: Thu Jan 23 09:16:12 2025 +0700 feat(platform)!: enhance token configuration and validation mechanisms (#2439) commit 2480ceb Author: QuantumExplorer <[email protected]> Date: Wed Jan 22 16:33:13 2025 +0700 chore: dapi grpc queries (#2437) commit c9ab154 Author: QuantumExplorer <[email protected]> Date: Wed Jan 22 15:50:25 2025 +0700 feat(platform)!: improved token validation and token config update transition (#2435) commit d9647cc Author: QuantumExplorer <[email protected]> Date: Tue Jan 21 10:28:58 2025 +0700 feat: get proofs for tokens (#2433) commit e5964b8 Author: QuantumExplorer <[email protected]> Date: Mon Jan 20 23:31:50 2025 +0700 feat: group queries (#2432) commit 0220302 Author: QuantumExplorer <[email protected]> Date: Sun Jan 19 14:43:51 2025 +0700 feat(platform): proof verification for many queries and a few more queries (#2431) commit cd1527d Author: QuantumExplorer <[email protected]> Date: Fri Jan 17 19:39:37 2025 +0700 fix(dpp)!: wrapping overflow issue (#2430) commit fd7ee85 Merge: d7143cc e4e156c Author: Ivan Shumkov <[email protected]> Date: Thu Jan 16 21:45:47 2025 +0700 Merge branch 'master' into v1.9-dev commit e4e156c Author: QuantumExplorer <[email protected]> Date: Thu Jan 16 18:11:57 2025 +0700 chore(release): update change log and release v1.8.0 (#2427) Co-authored-by: Ivan Shumkov <[email protected]> commit 55a1e03 Author: QuantumExplorer <[email protected]> Date: Thu Jan 16 15:30:42 2025 +0700 feat(platform)!: token base support (#2383) commit 59bf0af Author: QuantumExplorer <[email protected]> Date: Thu Jan 16 13:10:39 2025 +0700 chore(release): bump to v1.8.0-rc.2 (#2426) commit 410eb09 Author: QuantumExplorer <[email protected]> Date: Thu Jan 16 06:31:26 2025 +0700 fix(drive-abci): rebroadcasting should not only take first 2 quorums too (#2425) commit 2abce8e Author: Ivan Shumkov <[email protected]> Date: Wed Jan 15 22:51:58 2025 +0700 chore(release): update changelog and bump version to 1.8.0-rc.1 (#2423) commit ad5f604 Author: Ivan Shumkov <[email protected]> Date: Wed Jan 15 22:14:13 2025 +0700 chore: update bls library (#2424) commit c6feb5b Author: QuantumExplorer <[email protected]> Date: Wed Jan 15 18:57:49 2025 +0700 feat(platform)!: distribute prefunded specialized balances after vote (#2422) Co-authored-by: Ivan Shumkov <[email protected]> commit 94dcbb2 Author: Ivan Shumkov <[email protected]> Date: Wed Jan 15 05:51:45 2025 +0700 chore(drive): increase withdrawal limits to 2000 Dash per day (#2287) commit 6a0aede Author: Ivan Shumkov <[email protected]> Date: Tue Jan 14 21:42:59 2025 +0700 chore: fix test suite configuration script (#2402) commit e94b7bb Author: QuantumExplorer <[email protected]> Date: Tue Jan 14 19:23:46 2025 +0700 fix(drive-abci): document purchase on mutable document from different epoch had issue (#2420) commit 4ee57a6 Author: Ivan Shumkov <[email protected]> Date: Tue Jan 14 19:12:20 2025 +0700 fix(drive): more than one key was returned when expecting only one result (#2421) commit be5cd6d Author: Ivan Shumkov <[email protected]> Date: Mon Jan 13 15:12:33 2025 +0700 fix(sdk): failed to deserialize consensus error (#2410) commit e07271e Author: Ivan Shumkov <[email protected]> Date: Mon Jan 13 14:57:08 2025 +0700 chore: resolve NPM audit warnings (#2417) commit a809df7 Author: QuantumExplorer <[email protected]> Date: Sun Jan 12 09:21:48 2025 +0700 test: unify identity versioned cost coverage (#2416) commit 6d637fe Author: Paul DeLucia <[email protected]> Date: Fri Dec 27 09:42:04 2024 -0500 fix: try DriveDocumentQuery from DocumentQuery start field (#2407) commit cfd9c4d Author: Ivan Shumkov <[email protected]> Date: Thu Dec 19 18:30:06 2024 +0700 chore(release): update changelog and bump version to 1.8.0-dev.2 (#2404) commit fecda31 Merge: 37d5732 fc7d994 Author: Ivan Shumkov <[email protected]> Date: Thu Dec 19 15:33:45 2024 +0700 Merge branch 'master' into v1.8-dev commit fc7d994 Author: Ivan Shumkov <[email protected]> Date: Thu Dec 19 14:40:44 2024 +0700 chore(release): update changelog and bump version to 1.7.1 (#2403) commit adcd3b8 Author: QuantumExplorer <[email protected]> Date: Thu Dec 19 09:54:07 2024 +0300 fix!: emergency hard fork to fix masternode voting (#2397) commit 37d5732 Author: Ivan Shumkov <[email protected]> Date: Wed Dec 18 22:24:37 2024 +0700 fix(dashmate): some group commands fail with mtime not found (#2400) commit 01a5b7a Author: Ivan Shumkov <[email protected]> Date: Wed Dec 18 20:44:44 2024 +0700 refactor(dpp): using deprecated param to init wasm module (#2399) commit c5f5878 Author: Ivan Shumkov <[email protected]> Date: Wed Dec 18 18:04:14 2024 +0700 fix(dashmate): local network starting issues (#2394) commit 71c41ff Author: Ivan Shumkov <[email protected]> Date: Wed Dec 18 18:03:55 2024 +0700 perf(dpp): reduce JS binding size by 3x (#2396) commit 21ec393 Author: lklimek <[email protected]> Date: Wed Dec 18 10:47:58 2024 +0100 build!: update rust to 1.83 - backport #2393 to v1.7 (#2398) commit d7143cc Author: lklimek <[email protected]> Date: Wed Dec 18 08:53:53 2024 +0100 build!: optimize for x86-64-v3 cpu microarchitecture (Haswell+) (#2374) commit d318b1c Author: lklimek <[email protected]> Date: Tue Dec 17 14:56:15 2024 +0100 build: bump wasm-bindgen to 0.2.99 (#2395) commit 889d192 Author: Ivan Shumkov <[email protected]> Date: Tue Dec 17 19:25:58 2024 +0700 chore(release): update changelog and bump version to 1.8.0-dev.1 (#2391) commit 8185d21 Author: lklimek <[email protected]> Date: Tue Dec 17 10:47:53 2024 +0100 feat(sdk)!: allow setting CA cert (#1924) commit 82a6217 Author: lklimek <[email protected]> Date: Tue Dec 17 02:51:18 2024 +0100 build!: update rust to 1.83 (#2393) commit 494054a Author: QuantumExplorer <[email protected]> Date: Mon Dec 16 13:47:58 2024 +0300 refactor(platform): replace bls library (#2257) Co-authored-by: Lukasz Klimek <[email protected]> commit 4c203e4 Author: lklimek <[email protected]> Date: Mon Dec 16 10:38:34 2024 +0100 test(sdk): generate test vectors using testnet (#2381) commit 0ff6b27 Author: lklimek <[email protected]> Date: Mon Dec 16 10:37:35 2024 +0100 chore: remove deprecated check_network_version.sh (#2084) commit b265bb8 Author: lklimek <[email protected]> Date: Fri Dec 13 13:25:40 2024 +0100 ci: fix artifact upload issue on release build (#2389) commit 40ae73f Author: Ivan Shumkov <[email protected]> Date: Fri Dec 13 17:35:40 2024 +0700 chore(release): update changelog and bump version to 1.7.0 (#2387) commit 257e3da Author: Ivan Shumkov <[email protected]> Date: Fri Dec 13 15:44:10 2024 +0700 chore(dashmate)!: update Core to version 22 (#2384) commit 19a4c6d Author: Ivan Shumkov <[email protected]> Date: Thu Dec 12 18:30:14 2024 +0700 chore(dashmate): set tenderdash version to 1 (#2385) commit 0e9d4dc Author: lklimek <[email protected]> Date: Thu Dec 12 11:39:35 2024 +0100 chore: address vulnerabilty GHSA-mwcw-c2x4-8c55 (#2382) Co-authored-by: Ivan Shumkov <[email protected]> commit bdae90c Author: Ivan Shumkov <[email protected]> Date: Thu Dec 12 13:36:04 2024 +0700 chore(dashmate): increase subsidy for devnet (#2353)
Issue being fixed or feature implemented
WASM bindings were missing some methods for data in the state transitions, such like identityContractNonce, userFeeIncrease, signaturePublicKeyId, prefundingVotingBalance, vote choice and such, that we use to show on the Platform Explorer (specific transaction page). We did that in the our own fork for now (which is already live in production), and with this PR I'm merging changes in the main platform dev branch.
What was done?
How Has This Been Tested?
In the integration with Platform Explorer
Breaking Changes
No
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Purchase
andUpdatePrice
for document transitions.MasternodeVoteTransition
with new methods and updated response structures.DocumentTransitionV0Methods
trait to include entropy retrieval.Bug Fixes
Documentation