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
Original file line number Diff line number Diff line change
Expand Up @@ -4810,8 +4810,8 @@ mod token_pool_paid_transitions_tests {
// the batch itself decodes.
assert_matches!(
result.execution_results().as_slice(),
[StateTransitionExecutionResult::InternalError(message)]
if message.contains("TokenPurchaseFromShieldedPool") && message.contains("not active")
[StateTransitionExecutionResult::UnpaidConsensusError(ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error)))]
if error.state_transition_type().starts_with("TokenPurchaseFromShieldedPool")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use dapi_grpc::platform::v0::get_documents_request::{
GetDocumentsRequestV0, Version as GetDocumentsRequestVersion,
};
use dapi_grpc::platform::v0::GetDocumentsRequest;
use dpp::consensus::basic::BasicError;
use dpp::consensus::ConsensusError;
use dpp::block::block_info::BlockInfo;
use dpp::block::epoch::{Epoch, EpochIndex};
use dpp::consensus::codes::ErrorWithCode;
Expand Down Expand Up @@ -874,8 +876,8 @@ async fn should_not_be_active_before_protocol_version_14() {
assert!(
matches!(
&execution,
StateTransitionExecutionResult::InternalError(message)
if message.contains("ContractFeeClaim") && message.contains("not active")
StateTransitionExecutionResult::UnpaidConsensusError(ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error)))
if error.state_transition_type().starts_with("ContractFeeClaim")
),
"expected the transition to be inactive before protocol version 14, got {execution:?}"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::platform_types::state_transitions_processing_result::StateTransitionE
use crate::rpc::core::MockCoreRPCLike;
use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder};
use dpp::block::block_info::BlockInfo;
use dpp::consensus::basic::BasicError;
use dpp::consensus::codes::ErrorWithCode;
use dpp::consensus::state::state_error::StateError;
use dpp::consensus::ConsensusError;
Expand Down Expand Up @@ -1558,8 +1559,8 @@ async fn should_not_be_active_before_protocol_version_14() {
assert!(
matches!(
&execution,
StateTransitionExecutionResult::InternalError(message)
if message.contains("ContractUserModeration") && message.contains("not active")
StateTransitionExecutionResult::UnpaidConsensusError(ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error)))
if error.state_transition_type().starts_with("ContractUserModeration")
),
"expected the transition to be inactive before protocol version 14, got {execution:?}"
);
Expand All @@ -1578,10 +1579,16 @@ async fn should_not_be_active_before_protocol_version_14() {
platform_version,
)
};
let admission_error = format!("{:?}", admission.expect_err("expected inactive transition"));
assert!(admission_error.contains("StateTransitionIsNotActiveError"));
assert!(admission_error.contains("ContractUserModeration"));
assert!(admission_error.contains("current_protocol_version: 13"));
let admission = admission.expect("check_tx returns the refusal as a consensus error");
assert!(
matches!(
admission.errors.as_slice(),
[ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error))]
if error.state_transition_type().starts_with("ContractUserModeration")
&& error.current_protocol_version() == 13
),
"expected check_tx to refuse the inactive transition, got {admission:?}"
);
assert_eq!(
setup.balance(setup.owner.id(), Some(&transaction)),
owner_balance
Expand Down Expand Up @@ -1616,8 +1623,8 @@ async fn should_not_admit_a_moderated_contract_before_protocol_version_14() {
assert!(
matches!(
&execution,
StateTransitionExecutionResult::InternalError(message)
if message.contains(name) && message.contains("not active")
StateTransitionExecutionResult::UnpaidConsensusError(ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error)))
if error.state_transition_type().starts_with(name)
),
"expected {name} to be inactive before protocol version 14, got {execution:?}"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ mod tests {
use crate::test::helpers::setup::TestPlatformBuilder;
use assert_matches::assert_matches;
use dpp::block::block_info::BlockInfo;
use dpp::consensus::basic::BasicError;
use dpp::consensus::ConsensusError;
use dpp::dashcore::{Network, PrivateKey};
use dpp::identity::accessors::{IdentityGettersV0, IdentitySettersV0};
use dpp::identity::KeyType::ECDSA_SECP256K1;
Expand Down Expand Up @@ -997,7 +999,7 @@ mod tests {
// A transition carrying a group-bound key is not active before protocol version
// 14: refused by the `active_version_range` check at decode, before any
// consensus validation, with nothing charged and nothing written.
assert_matches!(processing_result.execution_results().as_slice(), [StateTransitionExecutionResult::InternalError(message)] if message.contains("IdentityCreate") && message.contains("not active"));
assert_matches!(processing_result.execution_results().as_slice(), [StateTransitionExecutionResult::UnpaidConsensusError(ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error)))] if error.state_transition_type().starts_with("IdentityCreate"));
assert_eq!(
platform
.drive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::rpc::core::MockCoreRPCLike;
use crate::test::helpers::setup::{TempPlatform, TestPlatformBuilder};
use assert_matches::assert_matches;
use dpp::block::block_info::BlockInfo;
use dpp::consensus::basic::BasicError;
use dpp::consensus::codes::ErrorWithCode;
use dpp::consensus::signature::SignatureError;
use dpp::consensus::ConsensusError;
Expand Down Expand Up @@ -756,7 +757,7 @@ async fn should_not_be_active_before_protocol_version_14() {
// `active_version_range` check, before any consensus validation.
assert_matches!(
setup.process(&transition, &tx),
StateTransitionExecutionResult::InternalError(message)
if message.contains("IdentityKeyLimitsUpdate") && message.contains("not active")
StateTransitionExecutionResult::UnpaidConsensusError(ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error)))
if error.state_transition_type().starts_with("IdentityKeyLimitsUpdate")
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ mod tests {
);
assert_matches!(
result.execution_results().as_slice(),
[StateTransitionExecutionResult::InternalError(message)]
if message.contains("IdentityTopUpFromShieldedPool") && message.contains("not active")
[StateTransitionExecutionResult::UnpaidConsensusError(ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error)))]
if error.state_transition_type().starts_with("IdentityTopUpFromShieldedPool")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,8 @@ mod tests {
// the `is_allowed` gate is the second line of defence for a decodable transition.
assert_matches!(
result.execution_results().as_slice(),
[StateTransitionExecutionResult::InternalError(message)]
if message.contains("ShieldFromIdentity") && message.contains("not active")
[StateTransitionExecutionResult::UnpaidConsensusError(ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error)))]
if error.state_transition_type().starts_with("ShieldFromIdentity")
);
}

Expand Down
Loading