Skip to content

Commit

Permalink
fix: converting to smaller size type
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Aug 14, 2024
1 parent 63a2a39 commit 4474eb2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion packages/rs-drive-abci/src/abci/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct AbciConfig {

/// Maximum time limit (in ms) to process state transitions to prepare proposal
#[serde(default, deserialize_with = "from_opt_str_or_number")]
pub proposer_tx_processing_time_limit: Option<TimestampMillis>,
pub proposer_tx_processing_time_limit: Option<u16>,
}

impl AbciConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ where
// set and if we have exceeded it.
let execution_result = if proposing_state_transitions
&& timer.map_or(false, |timer| {
timer.elapsed().as_millis() as TimestampMillis
> self
.config
.abci
.proposer_tx_processing_time_limit
.unwrap_or(TimestampMillis::MAX)
}) {
timer.elapsed().as_millis()
> self
.config
.abci
.proposer_tx_processing_time_limit
.unwrap_or(u16::MAX) as u128
}) {
StateTransitionExecutionResult::NotExecuted(NotExecutedReason::ProposerRanOutOfTime)
} else {
match decoded_state_transition {
Expand Down Expand Up @@ -126,24 +126,24 @@ where
state_transition,
Some(transaction),
)
.map(|validation_result| {
self.process_validation_result_v0(
.map(|validation_result| {
self.process_validation_result_v0(
raw_state_transition,
&state_transition_name,
validation_result,
block_info,
transaction,
platform_version,
platform_ref.state.previous_fee_versions(),
)
.unwrap_or_else(error_to_internal_error_execution_result)
})
.map_err(|error| StateTransitionAwareError {
error,
raw_state_transition,
&state_transition_name,
validation_result,
block_info,
transaction,
platform_version,
platform_ref.state.previous_fee_versions(),
)
.unwrap_or_else(error_to_internal_error_execution_result)
})
.map_err(|error| StateTransitionAwareError {
error,
raw_state_transition,
state_transition_name: Some(state_transition_name.to_string()),
})
.unwrap_or_else(error_to_internal_error_execution_result);
state_transition_name: Some(state_transition_name.to_string()),
})
.unwrap_or_else(error_to_internal_error_execution_result);

// Store metrics
let elapsed_time = start_time.elapsed() + decoding_elapsed_time;
Expand All @@ -167,10 +167,10 @@ where
execution_result
}
DecodedStateTransition::InvalidEncoding(InvalidStateTransition {
raw,
error,
elapsed_time: decoding_elapsed_time,
}) => {
raw,
error,
elapsed_time: decoding_elapsed_time,
}) => {
if tracing::enabled!(tracing::Level::DEBUG) {
let st_hash = hex::encode(hash_single(raw));

Expand Down Expand Up @@ -290,11 +290,11 @@ where
let state_transition_execution_result = match event_execution_result {
EventExecutionResult::SuccessfulPaidExecution(estimated_fees, actual_fees)
| EventExecutionResult::UnsuccessfulPaidExecution(estimated_fees, actual_fees, _) =>
{
if tracing::enabled!(tracing::Level::DEBUG) {
let st_hash = hex::encode(hash_single(raw_state_transition));
{
if tracing::enabled!(tracing::Level::DEBUG) {
let st_hash = hex::encode(hash_single(raw_state_transition));

tracing::debug!(
tracing::debug!(
error = ?first_consensus_error,
st_hash,
?estimated_fees,
Expand All @@ -304,13 +304,13 @@ where
st_hash,
&first_consensus_error
);
}
}

StateTransitionExecutionResult::PaidConsensusError(
first_consensus_error,
actual_fees,
)
}
StateTransitionExecutionResult::PaidConsensusError(
first_consensus_error,
actual_fees,
)
}
EventExecutionResult::SuccessfulFreeExecution => {
if tracing::enabled!(tracing::Level::DEBUG) {
let st_hash = hex::encode(hash_single(raw_state_transition));
Expand Down

0 comments on commit 4474eb2

Please sign in to comment.