From 4fa2263153e0d7ff817b2517c9d91d1751d799f3 Mon Sep 17 00:00:00 2001 From: brentstone Date: Thu, 28 Dec 2023 19:28:15 -0800 Subject: [PATCH] fixup! Merge branch 'grarco/tx-expiration-update' (#2315) --- apps/src/lib/node/ledger/shell/process_proposal.rs | 8 ++++---- core/src/types/transaction/mod.rs | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/src/lib/node/ledger/shell/process_proposal.rs b/apps/src/lib/node/ledger/shell/process_proposal.rs index 0acf9701d4..bc828b034b 100644 --- a/apps/src/lib/node/ledger/shell/process_proposal.rs +++ b/apps/src/lib/node/ledger/shell/process_proposal.rs @@ -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: \ @@ -561,7 +561,7 @@ where } } _ => TxResult { - code: ErrorCodes::Ok.into(), + code: ResultCode::Ok.into(), info: "Process Proposal accepted this \ tranasction" .into(), @@ -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(), @@ -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"), diff --git a/core/src/types/transaction/mod.rs b/core/src/types/transaction/mod.rs index 1019b208d9..95b32b473f 100644 --- a/core/src/types/transaction/mod.rs +++ b/core/src/types/transaction/mod.rs @@ -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! } @@ -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