From 02de19ffaa6440f263c6ee3db0476a110053a546 Mon Sep 17 00:00:00 2001 From: Jan Ferdinand Sauer Date: Fri, 2 Feb 2024 17:18:11 +0100 Subject: [PATCH] feat: provide Fiat-Shamir heuristic related info `ProofItemVariant`s Also fix intra-doc links. --- triton-tui/src/element_type_hint.rs | 2 +- triton-vm/src/program.rs | 3 +-- triton-vm/src/proof_item.rs | 9 ++++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/triton-tui/src/element_type_hint.rs b/triton-tui/src/element_type_hint.rs index d5f1c95f..99b8b868 100644 --- a/triton-tui/src/element_type_hint.rs +++ b/triton-tui/src/element_type_hint.rs @@ -24,7 +24,7 @@ pub(crate) struct ElementTypeHint { /// Does not apply to types that are not composed of multiple [`BFieldElement`][bfe]s, like `u32` or /// [`BFieldElement`][bfe] itself. /// - /// [bfe]: triton_vm::BFieldElement + /// [bfe]: triton_vm::prelude::BFieldElement pub index: Option, } diff --git a/triton-vm/src/program.rs b/triton-vm/src/program.rs index 4ae2a02f..9a1017d7 100644 --- a/triton-vm/src/program.rs +++ b/triton-vm/src/program.rs @@ -34,7 +34,7 @@ type Result = std::result::Result; /// [`profiled`](Program::profile), /// and its execution can be [`traced`](Program::trace_execution). /// -/// [`Hashing`](Program::hash) a program under [`Tip5`][tip5] yields a [`Digest`] that can be used +/// [`Hashing`](Program::hash) a program under [`Tip5`] yields a [`Digest`] that can be used /// in a [`Claim`](crate::Claim), _i.e._, is consistent with Triton VM's [program attestation]. /// /// A program may contain debug information, such as label names and breakpoints. @@ -43,7 +43,6 @@ type Result = std::result::Result; /// [BField-encoding](BFieldCodec::encode), discard this debug information. /// /// [program attestation]: https://triton-vm.org/spec/program-attestation.html -/// [tip5]: twenty_first::shared_math::tip5::Tip5 /// [label_for_address]: Program::label_for_address /// [is_breakpoint]: Program::is_breakpoint #[derive(Debug, Clone, Eq, GetSize, Serialize, Deserialize)] diff --git a/triton-vm/src/proof_item.rs b/triton-vm/src/proof_item.rs index 060d3a29..91b0f9a4 100644 --- a/triton-vm/src/proof_item.rs +++ b/triton-vm/src/proof_item.rs @@ -35,7 +35,7 @@ macro_rules! proof_items { Arbitrary )] #[strum_discriminants(name(ProofItemVariant))] - #[strum_discriminants(derive(Display, BFieldCodec))] + #[strum_discriminants(derive(Display, Arbitrary, BFieldCodec))] pub enum ProofItem { $( $variant($payload), )+ } @@ -74,6 +74,13 @@ macro_rules! proof_items { $( Self::$variant => <$payload>::static_length(), )+ } } + + /// See [`ProofItem::include_in_fiat_shamir_heuristic`]. + pub const fn include_in_fiat_shamir_heuristic(&self) -> bool { + match self { + $( Self::$variant => $in_fiat_shamir_heuristic, )+ + } + } } }; }