Skip to content

Commit

Permalink
fixup! Merge branch 'grarco/masp-no-transfer-dep' (#3232)
Browse files Browse the repository at this point in the history
evil 3232
  • Loading branch information
grarco committed May 24, 2024
1 parent 37dd21e commit 19e7899
Show file tree
Hide file tree
Showing 2 changed files with 283 additions and 210 deletions.
53 changes: 25 additions & 28 deletions crates/namada/src/ledger/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use namada_state::StorageWrite;
use namada_token::event::{TokenEvent, TokenOperation, UserAccount};
use namada_tx::data::protocol::{ProtocolTx, ProtocolTxType};
use namada_tx::data::{
BatchResults, BatchedTxResult, ExtendedTxResult, TxResult,
VpStatusFlags, VpsResult, WrapperTx,
BatchResults, BatchedTxResult, ExtendedTxResult, TxResult, VpStatusFlags,
VpsResult, WrapperTx,
};
use namada_tx::{BatchedTxRef, Tx};
use namada_vote_ext::EthereumTxData;
Expand Down Expand Up @@ -225,31 +225,29 @@ where
vp_wasm_cache,
tx_wasm_cache,
} => {
if let Some(mut tx_result) = wrapper_tx_result {
if let Some(tx_result) = wrapper_tx_result {
// TODO(namada#2597): handle masp fee payment in the first inner
// tx if necessary
// Replay protection check on the batch
let tx_hash = tx.raw_header_hash();
if state.write_log().has_replay_protection_entry(&tx_hash) {
// If the same batch has already been committed in
// this block, skip execution and return
return Err(DispatchError {
error: Error::ReplayAttempt(tx_hash),
tx_result: None,
});
}

dispatch_inner_txs(
tx,
tx_result,
tx_index,
tx_gas_meter,
state,
vp_wasm_cache,
tx_wasm_cache,
)

// Replay protection check on the batch
let tx_hash = tx.raw_header_hash();
if state.write_log().has_replay_protection_entry(&tx_hash) {
// If the same batch has already been committed in
// this block, skip execution and return
return Err(DispatchError {
error: Error::ReplayAttempt(tx_hash),
tx_result: None,
});
}

dispatch_inner_txs(
tx,
tx_result,
tx_index,
tx_gas_meter,
state,
vp_wasm_cache,
tx_wasm_cache,
)
} else {
// Governance proposal. We don't allow tx batches in this case,
// just take the first one
Expand All @@ -273,8 +271,7 @@ where
.collect(),
),
}
.to_extended_result(None))
)
.to_extended_result(None))
}
}
DispatchArgs::Protocol(protocol_tx) => {
Expand Down Expand Up @@ -308,13 +305,13 @@ where
)
.map_err(|e| Error::WrapperRunnerError(e.to_string()))?;

Ok(tx_result)
Ok(tx_result.to_extended_result(None))
}
}
}

fn dispatch_inner_txs<'a, D, H, CA>(
tx: Tx,
tx: &Tx,
tx_result: TxResult<Error>,
tx_index: TxIndex,
tx_gas_meter: &'a RefCell<TxGasMeter>,
Expand Down
Loading

0 comments on commit 19e7899

Please sign in to comment.