Skip to content

Commit

Permalink
fixup! Merge branch 'tiago/outdated-eth-nonces' (#2035)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Nov 28, 2023
1 parent a21b0fd commit 1a321b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
12 changes: 9 additions & 3 deletions apps/src/lib/node/ledger/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,7 @@ mod shell_tests {
// sent transfers to namada nonce to 5
.transfers_to_namada = InnerEthEventsQueue::new_at(5.into());

let (protocol_key, _, _) = wallet::defaults::validator_keys();
let (protocol_key, _) = wallet::defaults::validator_keys();

// only bad events
{
Expand All @@ -2432,7 +2432,10 @@ mod shell_tests {
.sign(&protocol_key, shell.chain_id.clone())
.to_bytes();
let rsp = shell.mempool_validate(&tx, Default::default());
assert!(rsp.code != 0, "Validation should have failed");
assert!(
rsp.code != ErrorCodes::Ok.into(),
"Validation should have failed"
);
}

// at least one good event
Expand All @@ -2459,7 +2462,10 @@ mod shell_tests {
.sign(&protocol_key, shell.chain_id.clone())
.to_bytes();
let rsp = shell.mempool_validate(&tx, Default::default());
assert!(rsp.code == 0, "Validation should have passed");
assert!(
rsp.code == ErrorCodes::Ok.into(),
"Validation should have passed"
);
}
}

Expand Down
10 changes: 5 additions & 5 deletions apps/src/lib/node/ledger/shell/prepare_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ mod test_prepare_proposal {
// sent transfers to namada nonce to 5
.transfers_to_namada = InnerEthEventsQueue::new_at(5.into());

let (protocol_key, _, _) = wallet::defaults::validator_keys();
let (protocol_key, _) = wallet::defaults::validator_keys();
let validator_addr = wallet::defaults::validator_address();

// test an extension containing solely events with
Expand All @@ -1418,12 +1418,12 @@ mod test_prepare_proposal {
.sign(&protocol_key, shell.chain_id.clone())
.to_bytes();
let req = RequestPrepareProposal {
txs: vec![tx],
txs: vec![tx.into()],
..Default::default()
};
let proposed_txs =
shell.prepare_proposal(req).txs.into_iter().map(|tx_bytes| {
Tx::try_from(tx_bytes.as_slice()).expect("Test failed")
Tx::try_from(tx_bytes.as_ref()).expect("Test failed")
});
// since no events with valid nonces are contained in the vote
// extension, we drop it from the proposal
Expand Down Expand Up @@ -1466,12 +1466,12 @@ mod test_prepare_proposal {
.sign(&protocol_key, shell.chain_id.clone())
.to_bytes();
let req = RequestPrepareProposal {
txs: vec![tx],
txs: vec![tx.into()],
..Default::default()
};
let proposed_txs =
shell.prepare_proposal(req).txs.into_iter().map(|tx_bytes| {
Tx::try_from(tx_bytes.as_slice()).expect("Test failed")
Tx::try_from(tx_bytes.as_ref()).expect("Test failed")
});
// find the event with the good nonce
let mut ext = 'ext: {
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/shell/process_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2136,7 +2136,7 @@ mod test_process_proposal {
// sent transfers to namada nonce to 5
.transfers_to_namada = InnerEthEventsQueue::new_at(5.into());

let (protocol_key, _, _) = wallet::defaults::validator_keys();
let (protocol_key, _) = wallet::defaults::validator_keys();

// only bad events
{
Expand Down

0 comments on commit 1a321b2

Please sign in to comment.