MCPcopy Create free account
hub / github.com/BitVM/BitVM / Fp254Impl

Interface Fp254Impl

bitvm/src/bn254/fp254impl.rs:12–604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11#[allow(clippy::declare_interior_mutable_const)]
12pub trait Fp254Impl {
13 const N_LIMBS: u32 = U254::N_LIMBS;
14 const N_BITS: u32 = U254::N_BITS;
15
16 const MODULUS: &'static str;
17 const MODULUS_LIMBS: [u32; U254::N_LIMBS as usize];
18
19 const P_PLUS_ONE_DIV2: &'static str;
20 const TWO_P_PLUS_ONE_DIV3: &'static str;
21 const P_PLUS_TWO_DIV3: &'static str;
22
23 const ADD_ONCELOCK: OnceLock<Script> = OnceLock::new();
24 const SUB_ONCELOCK: OnceLock<Script> = OnceLock::new();
25
26 type ConstantType: PrimeField;
27
28 fn modulus_as_bigint() -> BigInt {
29 BigInt::from_str_radix(Self::MODULUS, 16).unwrap()
30 }
31
32 #[inline]
33 fn copy(a: u32) -> Script {
34 U254::copy(a)
35 }
36
37 #[inline]
38 fn roll(a: u32) -> Script {
39 U254::roll(a)
40 }
41
42 #[inline]
43 fn drop() -> Script {
44 U254::drop()
45 }
46
47 #[inline]
48 fn toaltstack() -> Script {
49 U254::toaltstack()
50 }
51
52 #[inline]
53 fn fromaltstack() -> Script {
54 U254::fromaltstack()
55 }
56
57 #[inline]
58 fn zip(a: u32, b: u32) -> Script {
59 U254::zip(a, b)
60 }
61
62 #[inline]
63 fn push_modulus() -> Script {
64 U254::push_hex(Self::MODULUS)
65 }
66
67 #[inline]
68 fn push_zero() -> Script {
69 U254::push_zero()

Callers

nothing calls this directly

Implementers 2

fr.rsbitvm/src/bn254/fr.rs
fq.rsbitvm/src/bn254/fq.rs

Calls

no outgoing calls

Tested by

no test coverage detected