From f75c5096e91aaa5c65f52a0668cb711899d878db Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 28 Mar 2024 11:24:17 -0500 Subject: [PATCH] fix: use correct bn128 mul input length --- crates/precompile/src/bn128.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/precompile/src/bn128.rs b/crates/precompile/src/bn128.rs index c243e7e477..6d45240973 100644 --- a/crates/precompile/src/bn128.rs +++ b/crates/precompile/src/bn128.rs @@ -92,13 +92,17 @@ pub mod pair { } /// Input length for the add operation. -pub const ADD_INPUT_LEN: usize = 128; +/// `ADD` takes two uncompressed G1 points (64 bytes each). +pub const ADD_INPUT_LEN: usize = 64 + 64; /// Input length for the multiplication operation. -pub const MUL_INPUT_LEN: usize = 128; +/// `MUL` takes an uncompressed G1 point (64 bytes) and scalar (32 bytes). +pub const MUL_INPUT_LEN: usize = 64 + 32; /// Pair element length. -pub const PAIR_ELEMENT_LEN: usize = 192; +/// `PAIR` elements are composed of an uncompressed G1 point (64 bytes) and an uncompressed G2 point +/// (128 bytes). +pub const PAIR_ELEMENT_LEN: usize = 64 + 128; /// Reads a single `Fq` from the input slice. ///