Skip to content

Commit

Permalink
fixup! Merge branch 'grarco/tx-expiration-update' (#2315)
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Dec 29, 2023
1 parent 8ec42cf commit 4fa2263
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions apps/src/lib/node/ledger/shell/process_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ where
if block_time > tx_expiration =>
{
TxResult {
code: ErrorCodes::ExpiredDecryptedTx
code: ResultCode::ExpiredDecryptedTx
.into(),
info: format!(
"Tx expired at {:#?}, block time: \
Expand All @@ -561,7 +561,7 @@ where
}
}
_ => TxResult {
code: ErrorCodes::Ok.into(),
code: ResultCode::Ok.into(),
info: "Process Proposal accepted this \
tranasction"
.into(),
Expand Down Expand Up @@ -1776,7 +1776,7 @@ mod test_process_proposal {
let mut wrapper =
Tx::from_type(TxType::Wrapper(Box::new(WrapperTx::new(
Fee {
amount_per_gas_unit: 1.into(),
amount_per_gas_unit: DenominatedAmount::native(1.into()),
token: shell.wl_storage.storage.native_token.clone(),
},
keypair.ref_to(),
Expand Down Expand Up @@ -1808,7 +1808,7 @@ mod test_process_proposal {
assert_eq!(txs.len(), 1);
assert_eq!(
txs[0].result.code,
u32::from(ErrorCodes::ExpiredDecryptedTx)
u32::from(ResultCode::ExpiredDecryptedTx)
);
}
Err(_) => panic!("Test failed"),
Expand Down
4 changes: 3 additions & 1 deletion core/src/types/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ pub enum ResultCode {
InvalidVoteExtension = 13,
/// Tx is too large
TooLarge = 14,
/// Decrypted tx is expired
ExpiredDecryptedTx = 15,
// =========================================================================
// WARN: These codes shouldn't be changed between version!
}
Expand All @@ -96,7 +98,7 @@ impl ResultCode {
// NOTE: pattern match on all `ResultCode` variants, in order
// to catch potential bugs when adding new codes
match self {
Ok | WasmRuntimeError => true,
Ok | WasmRuntimeError | ExpiredDecryptedTx => true,
InvalidTx | InvalidSig | InvalidOrder | ExtraTxs
| Undecryptable | AllocationError | ReplayTx | InvalidChainId
| ExpiredTx | TxGasLimit | FeeError | InvalidVoteExtension
Expand Down

0 comments on commit 4fa2263

Please sign in to comment.