nautilus_lighter/signing/mod.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.
3// https://nautechsystems.io
4//
5// Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6// You may not use this file except in compliance with the License.
7// You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! Lighter L2 transaction signing.
17//!
18//! Lighter signs transactions with **Schnorr signatures over the ecgfp5 curve**
19//! (Pornin, 2022), defined over the quintic extension field of the Goldilocks
20//! prime `p = 2^64 - 2^32 + 1`, with **Poseidon2** as the binding hash.
21//!
22//! This module is an original in-tree Rust implementation written from public
23//! specifications and permissively licensed references. For the field and
24//! curve, Thomas Pornin's MIT-licensed Rust code at
25//! [`pornin/ecgfp5`](https://github.com/pornin/ecgfp5) serves as a reading
26//! reference alongside the curve's design paper. For Poseidon2 and the Schnorr
27//! binding Lighter applies, the Go library
28//! [`elliottech/poseidon_crypto`](https://github.com/elliottech/poseidon_crypto)
29//! is the behavioural reference: parameter sets (round constants, MDS matrices)
30//! are pulled from there as facts, and test vectors derived from it are
31//! reproduced as fixtures so equivalence with the upstream behaviour is
32//! verifiable end-to-end.
33//!
34//! Pornin's reference stays in the publish=false fuzz crate so the crates.io
35//! package graph does not depend on a git source. The `fuzz_pornin_diff_*`
36//! targets assert public algebra operations (`Fp5` add/sub/mul/neg/invert,
37//! `Scalar` add/sub/mul/neg, `Point` decode/double/add, scalar mul on
38//! arbitrary bases) byte-for-byte against the reference. The two
39//! implementations share no code lineage:
40//! Pornin's accompanies the design paper (IACR ePrint 2022/274) and has
41//! been public and reused by downstream zero-knowledge projects since
42//! 2022; ours is written from the paper using his code as a reading
43//! reference. A bug that slips the differential gate would have to be
44//! present in both implementations in the same way, which is concretely
45//! unlikely rather than merely theoretically possible.
46//!
47//! The official `lighter-go` and `lighter-python` SDKs wrap a closed-source
48//! compiled signer; round-trip testing against testnet provides the final
49//! correctness gate for what the Lighter sequencer accepts.
50//!
51//! See `crates/adapters/lighter/licenses/THIRD_PARTY_LICENSES.md` for the
52//! attribution covering reference parameters and test vectors.
53
54pub mod auth_token;
55pub mod curve;
56pub mod field;
57pub mod hash;
58pub mod nonce;
59pub mod schnorr;
60pub mod tx;
61
62#[cfg(test)]
63pub(crate) mod fixtures;