entropy_api/
instruction.rs1use steel::*;
2
3#[repr(u8)]
4#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
5pub enum EntropyInstruction {
6 Open = 0,
7 Close = 1,
8 Next = 2,
9 Reveal = 4,
10 Sample = 5,
11 Update = 6,
12}
13
14#[repr(C)]
15#[derive(Clone, Copy, Debug, Pod, Zeroable)]
16pub struct Open {
17 pub id: [u8; 8],
19
20 pub commit: [u8; 32],
22
23 pub is_auto: [u8; 8],
25
26 pub samples: [u8; 8],
28
29 pub end_at: [u8; 8],
31}
32
33#[repr(C)]
34#[derive(Clone, Copy, Debug, Pod, Zeroable)]
35pub struct Close {}
36
37#[repr(C)]
38#[derive(Clone, Copy, Debug, Pod, Zeroable)]
39pub struct Next {
40 pub end_at: [u8; 8],
41}
42
43#[repr(C)]
44#[derive(Clone, Copy, Debug, Pod, Zeroable)]
45pub struct Reveal {
46 pub seed: [u8; 32],
47}
48
49#[repr(C)]
50#[derive(Clone, Copy, Debug, Pod, Zeroable)]
51pub struct Sample {}
52
53#[repr(C)]
54#[derive(Clone, Copy, Debug, Pod, Zeroable)]
55pub struct Update {
56 pub end_at: [u8; 8],
57}
58
59instruction!(EntropyInstruction, Open);
60instruction!(EntropyInstruction, Close);
61instruction!(EntropyInstruction, Next);
62instruction!(EntropyInstruction, Reveal);
63instruction!(EntropyInstruction, Sample);
64instruction!(EntropyInstruction, Update);