From 020c6ff290b85322b3967e8a494c418dad6ccf76 Mon Sep 17 00:00:00 2001 From: Justin Traglia <95511699+jtraglia@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:53:33 -0500 Subject: [PATCH] fix: use correct bn128 mul input length (#1238) --- 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. ///