diff --git a/.changelog/unreleased/miscellaneous/2145-pos-vp-no-catch.md b/.changelog/unreleased/miscellaneous/2145-pos-vp-no-catch.md new file mode 100644 index 0000000000..812e6d7975 --- /dev/null +++ b/.changelog/unreleased/miscellaneous/2145-pos-vp-no-catch.md @@ -0,0 +1,2 @@ +- Removed catching of panics from PoS VP. + ([\#2145](https://github.com/anoma/namada/pull/2145)) \ No newline at end of file diff --git a/shared/src/ledger/pos/vp.rs b/shared/src/ledger/pos/vp.rs index 76607c3199..506ef489ca 100644 --- a/shared/src/ledger/pos/vp.rs +++ b/shared/src/ledger/pos/vp.rs @@ -1,7 +1,6 @@ //! Proof-of-Stake native validity predicate. use std::collections::BTreeSet; -use std::panic::{RefUnwindSafe, UnwindSafe}; use namada_core::ledger::storage_api::governance; // use borsh::BorshDeserialize; @@ -58,30 +57,6 @@ where } } -// TODO this is temporarily to run PoS native VP in a new thread to avoid -// crashing the ledger (in apps/src/lib/node/ledger/protocol/mod.rs). The -// RefCells contained within PosVP are not thread-safe, but each thread has its -// own instances. -impl UnwindSafe for PosVP<'_, DB, H, CA> -where - DB: 'static + ledger_storage::DB + for<'iter> ledger_storage::DBIter<'iter>, - H: 'static + StorageHasher, - CA: 'static + WasmCacheAccess, -{ -} - -// TODO this is temporarily to run PoS native VP in a new thread to avoid -// crashing the ledger (in apps/src/lib/node/ledger/protocol/mod.rs). The -// RefCells contained within PosVP are not thread-safe, but each thread has its -// own instances. -impl RefUnwindSafe for PosVP<'_, DB, H, CA> -where - DB: 'static + ledger_storage::DB + for<'iter> ledger_storage::DBIter<'iter>, - H: 'static + StorageHasher, - CA: 'static + WasmCacheAccess, -{ -} - impl<'a, DB, H, CA> NativeVp for PosVP<'a, DB, H, CA> where DB: 'static + ledger_storage::DB + for<'iter> ledger_storage::DBIter<'iter>, diff --git a/shared/src/ledger/protocol/mod.rs b/shared/src/ledger/protocol/mod.rs index 64021faf6b..c2ff540570 100644 --- a/shared/src/ledger/protocol/mod.rs +++ b/shared/src/ledger/protocol/mod.rs @@ -1,6 +1,5 @@ //! The ledger's protocol use std::collections::BTreeSet; -use std::panic; use borsh_ext::BorshSerializeExt; use eyre::{eyre, WrapErr}; @@ -857,26 +856,13 @@ where // and `RefUnwindSafe` in // shared/src/ledger/pos/vp.rs) let keys_changed_ref = &keys_changed; - let result = - match panic::catch_unwind(move || { - pos_ref - .validate_tx( - tx, - keys_changed_ref, - verifiers_addr_ref, - ) - .map_err(Error::PosNativeVpError) - }) { - Ok(result) => result, - Err(err) => { - tracing::error!( - "PoS native VP failed with \ - {:#?}", - err - ); - Err(Error::PosNativeVpRuntime) - } - }; + let result = pos_ref + .validate_tx( + tx, + keys_changed_ref, + verifiers_addr_ref, + ) + .map_err(Error::PosNativeVpError); // Take the gas meter and sentinel // back // out of the context