Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/rs-dpp/src/data_contract/serialized_version/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ impl DataContractInSerializationFormat {
&& v1_self.document_schemas == v1_other.document_schemas
&& v1_self.groups == v1_other.groups
&& v1_self.tokens == v1_other.tokens
&& v1_self.keywords == v1_other.keywords
&& v1_self.description == v1_other.description
}
// Cross-version comparisons return false
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,8 @@ mod tests {
use dpp::data_contract::change_control_rules::authorized_action_takers::AuthorizedActionTakers;
use dpp::data_contract::change_control_rules::ChangeControlRules;
use dpp::data_contract::change_control_rules::v0::ChangeControlRulesV0;
use dpp::state_transition::proof_result::StateTransitionProofResult;
use drive::drive::Drive;

#[test]
fn test_data_contract_update_can_add_new_token() {
Expand Down Expand Up @@ -1288,7 +1290,7 @@ mod tests {

let data_contract_update_transition =
DataContractUpdateTransition::new_from_data_contract(
updated_data_contract,
updated_data_contract.clone(),
&identity.into_partial_identity_info(),
key.id(),
2,
Expand Down Expand Up @@ -1328,6 +1330,27 @@ mod tests {
.commit_transaction(transaction)
.unwrap()
.expect("expected to commit transaction");

// Prove & verify
let proof = platform
.drive
.prove_state_transition(&data_contract_update_transition, None, platform_version)
.expect("expect to prove state transition");
let (_root_hash, result) = Drive::verify_state_transition_was_executed_with_proof(
&data_contract_update_transition,
&BlockInfo::default(),
proof.data.as_ref().expect("expected data"),
&|_| Ok(None),
platform_version,
)
.unwrap_or_else(|e| {
panic!(
"expect to verify state transition proof {}, error is {}",
hex::encode(proof.data.expect("expected data")),
e
)
});
assert_matches!(result, StateTransitionProofResult::VerifiedDataContract(_));
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ impl Drive {
let contract_for_serialization: DataContractInSerializationFormat = contract
.clone()
.try_into_platform_versioned(platform_version)?;
if &contract_for_serialization != data_contract_update.data_contract() {
if !contract_for_serialization
.eq_without_auto_fields(data_contract_update.data_contract())
{
return Err(Error::Proof(ProofError::IncorrectProof(format!("proof of state transition execution did not contain exact expected contract after update with id {}", data_contract_update.data_contract().id()))));
}
Ok((root_hash, VerifiedDataContract(contract)))
Expand Down
Loading