Skip to content

Commit 4fbafad

Browse files
committed
tmp(node): reject all incoming zkapps till we can verify their proof outside state machine
1 parent a21977b commit 4fbafad

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

node/src/state.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::time::Duration;
33

44
use mina_p2p_messages::v2;
55
use openmina_core::constants::PROTOCOL_VERSION;
6-
use openmina_core::transaction::{TransactionInfo, TransactionWithHash};
6+
use openmina_core::transaction::{Transaction, TransactionInfo, TransactionWithHash};
77
use rand::prelude::*;
88

99
use openmina_core::block::BlockWithHash;
@@ -534,7 +534,10 @@ impl P2p {
534534
on_p2p_channels_transaction_libp2p_received: Some(redux::callback!(
535535
on_p2p_channels_transaction_libp2p_received(transaction: Box<TransactionWithHash>) -> crate::Action {
536536
TransactionPoolAction::StartVerify {
537-
commands: std::iter::once(*transaction).collect(),
537+
commands: std::iter::once(*transaction)
538+
// TODO(SEC): remove once proof verification is done outside state machine.
539+
.filter(|v| !matches!(v.body(), Transaction::ZkappCommand(_)))
540+
.collect(),
538541
from_rpc: None
539542
}
540543
}

node/src/transaction_pool/transaction_pool_actions.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ impl redux::EnablingCondition<crate::State> for TransactionPoolAction {
7878
fn is_enabled(&self, state: &crate::State, time: redux::Timestamp) -> bool {
7979
match self {
8080
TransactionPoolAction::Candidate(a) => a.is_enabled(state, time),
81-
TransactionPoolAction::StartVerify { commands, .. } => commands
82-
.iter()
83-
.any(|cmd| !state.transaction_pool.contains(cmd.hash())),
81+
TransactionPoolAction::StartVerify { commands, .. } => {
82+
!commands.is_empty()
83+
&& commands
84+
.iter()
85+
.any(|cmd| !state.transaction_pool.contains(cmd.hash()))
86+
}
8487
TransactionPoolAction::P2pSendAll => true,
8588
TransactionPoolAction::P2pSend { peer_id } => state
8689
.p2p

0 commit comments

Comments
 (0)