1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Shared constants, discriminators, domain tags, and account state layout
//! for the WinterWallet program. Used by both the on-chain program and
//! off-chain clients to eliminate constant drift.
use declare_id;
declare_id!;
// ── Winternitz parameters ────────────────────────────────────────────
/// Number of Winternitz message scalars (N). Total scalars = N + 2.
pub const WINTERNITZ_SCALARS: usize = 22;
/// Total scalars including the two checksum scalars.
pub const TOTAL_SCALARS: usize = WINTERNITZ_SCALARS + 2;
/// Signature byte length: `(N + 2) * 32`.
pub const SIGNATURE_LEN: usize = TOTAL_SCALARS * 32;
// ── Domain tags ──────────────────────────────────────────────────────
/// Domain tag for the Initialize preimage.
pub const WINTERWALLET_INITIALIZE: & = b"WINTERWALLET_INITIALIZE";
/// Domain tag for the Advance preimage.
pub const WINTERWALLET_ADVANCE: & = b"WINTERWALLET_ADVANCE";
// ── PDA ──────────────────────────────────────────────────────────────
/// PDA seed prefix.
pub const WINTERWALLET_SEED: & = b"winterwallet";
// ── Instruction discriminators ───────────────────────────────────────
/// Instruction discriminator bytes matching the on-chain `match` arms.
// ── Advance limits ───────────────────────────────────────────────────
/// Upper bound on trailing accounts an Advance instruction can commit to.
/// Sizes the stack-allocated signature-preimage buffer used during recovery.
pub const MAX_PASSTHROUGH_ACCOUNTS: usize = 128;
/// Upper bound on account metas per inner CPI'd instruction inside Advance.
pub const MAX_CPI_INSTRUCTION_ACCOUNTS: usize = 16;
// ── Account state layout ─────────────────────────────────────────────
/// On-chain WinterWallet account data length: `id(32) + root(32) + bump(1)`.
pub const WALLET_ACCOUNT_LEN: usize = 65;
/// Byte offset of the `id` field in the WinterWallet account.
pub const WALLET_ID_OFFSET: usize = 0;
/// Byte offset of the `root` field in the WinterWallet account.
pub const WALLET_ROOT_OFFSET: usize = 32;
/// Byte offset of the `bump` field in the WinterWallet account.
pub const WALLET_BUMP_OFFSET: usize = 64;