Skip to content

Commit a617b34

Browse files
committed
test: include IbcRelay actions
1 parent b2dabdb commit a617b34

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

crates/core/transaction/tests/generate_transaction_signing_test_vectors.rs

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@ use std::fs::File;
33
use decaf377::{Fq, Fr};
44
use decaf377_rdsa::{SigningKey, SpendAuth, VerificationKey, VerificationKeyBytes};
55
use ed25519_consensus::SigningKey as Ed25519SigningKey;
6+
use ibc_types::core::{
7+
channel::{msgs::MsgRecvPacket, packet::Sequence, ChannelId, Packet, PortId},
8+
client::Height,
9+
commitment::MerkleProof,
10+
};
11+
use ibc_types::timestamp::Timestamp;
612
use penumbra_asset::asset::Id;
713
use penumbra_dex::{
814
swap::{SwapPlaintext, SwapPlan},
915
swap_claim::SwapClaimPlan,
1016
BatchSwapOutputData, TradingPair,
1117
};
1218
use penumbra_fee::Fee;
19+
use penumbra_ibc::IbcRelay;
1320
use penumbra_keys::keys::{Bip44Path, SeedPhrase, SpendKey};
1421
use penumbra_keys::{Address, FullViewingKey};
1522
use penumbra_num::Amount;
@@ -278,6 +285,39 @@ fn swap_claim_plan_strategy() -> impl Strategy<Value = SwapClaimPlan> {
278285
)
279286
}
280287

288+
fn sequence_strategy() -> impl Strategy<Value = Sequence> {
289+
(4001..2000000000u64).prop_map(Sequence)
290+
}
291+
292+
fn ibc_action_strategy() -> impl Strategy<Value = IbcRelay> {
293+
(
294+
sequence_strategy(),
295+
0..1000000000u64,
296+
0..1000000000u64,
297+
address_strategy(),
298+
)
299+
.prop_map(|(sequence, revision_number, revision_height, src)| {
300+
IbcRelay::RecvPacket(MsgRecvPacket {
301+
packet: Packet {
302+
sequence,
303+
port_on_a: PortId::default(),
304+
chan_on_a: ChannelId::default(),
305+
port_on_b: PortId::default(),
306+
chan_on_b: ChannelId::default(),
307+
data: vec![],
308+
timeout_height_on_b: ibc_types::core::channel::TimeoutHeight::At(
309+
Height::new(revision_number, revision_height).expect("test value"),
310+
),
311+
timeout_timestamp_on_b: Timestamp::now(),
312+
},
313+
proof_commitment_on_a: MerkleProof { proofs: vec![] },
314+
proof_height_on_a: Height::new(revision_number, revision_height)
315+
.expect("test value"),
316+
signer: src.to_string(),
317+
})
318+
})
319+
}
320+
281321
fn action_plan_strategy(fvk: &FullViewingKey) -> impl Strategy<Value = ActionPlan> {
282322
prop_oneof![
283323
spend_plan_strategy(fvk).prop_map(ActionPlan::Spend),
@@ -287,7 +327,8 @@ fn action_plan_strategy(fvk: &FullViewingKey) -> impl Strategy<Value = ActionPla
287327
undelegate_claim_plan_strategy().prop_map(ActionPlan::UndelegateClaim),
288328
validator_definition_strategy().prop_map(ActionPlan::ValidatorDefinition),
289329
swap_plan_strategy().prop_map(ActionPlan::Swap),
290-
swap_claim_plan_strategy().prop_map(ActionPlan::SwapClaim), //ibc_action_strategy().prop_map(ActionPlan::IbcAction),
330+
swap_claim_plan_strategy().prop_map(ActionPlan::SwapClaim),
331+
ibc_action_strategy().prop_map(ActionPlan::IbcAction),
291332
]
292333
}
293334

0 commit comments

Comments
 (0)