From a8956b9408c43f7f80438065d793f0f03572e260 Mon Sep 17 00:00:00 2001 From: Dmitry Vagner Date: Tue, 14 Mar 2023 17:31:55 -0700 Subject: [PATCH] flip limbs --- evm/src/cpu/kernel/interpreter.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/evm/src/cpu/kernel/interpreter.rs b/evm/src/cpu/kernel/interpreter.rs index 42e67424..92a2e2ec 100644 --- a/evm/src/cpu/kernel/interpreter.rs +++ b/evm/src/cpu/kernel/interpreter.rs @@ -450,7 +450,7 @@ impl<'a> Interpreter<'a> { let y = U512::from(y0) + (U512::from(y1) << 256); let z = (x + y) % BLS_BASE; - self.push(U256(z.0[0..4].try_into().unwrap())); + self.push(U256(z.0[4..].try_into().unwrap())); } #[allow(dead_code)] @@ -464,7 +464,7 @@ impl<'a> Interpreter<'a> { let y = U512::from(y0) + (U512::from(y1) << 256); let z = (x + y) % BLS_BASE; - self.push(U256(z.0[4..].try_into().unwrap())); + self.push(U256(z.0[..4].try_into().unwrap())); } #[allow(dead_code)] @@ -476,9 +476,9 @@ impl<'a> Interpreter<'a> { let x = U512::from(x0) + (U512::from(x1) << 256); let y = U512::from(y0) + (U512::from(y1) << 256); - let z = (Fp381 {val: x} * Fp381 {val: y}).val; + let z = (Fp381 { val: x } * Fp381 { val: y }).val; - self.push(U256(z.0[0..4].try_into().unwrap())); + self.push(U256(z.0[4..].try_into().unwrap())); } #[allow(dead_code)] @@ -490,9 +490,9 @@ impl<'a> Interpreter<'a> { let x = U512::from(x0) + (U512::from(x1) << 256); let y = U512::from(y0) + (U512::from(y1) << 256); - let z = (Fp381 {val: x} * Fp381 {val: y}).val; + let z = (Fp381 { val: x } * Fp381 { val: y }).val; - self.push(U256(z.0[4..].try_into().unwrap())); + self.push(U256(z.0[..4].try_into().unwrap())); } #[allow(dead_code)] @@ -506,7 +506,7 @@ impl<'a> Interpreter<'a> { let y = U512::from(y0) + (U512::from(y1) << 256); let z = (BLS_BASE + x - y) % BLS_BASE; - self.push(U256(z.0[0..4].try_into().unwrap())); + self.push(U256(z.0[4..].try_into().unwrap())); } #[allow(dead_code)] @@ -520,7 +520,7 @@ impl<'a> Interpreter<'a> { let y = U512::from(y0) + (U512::from(y1) << 256); let z = (BLS_BASE + x - y) % BLS_BASE; - self.push(U256(z.0[4..].try_into().unwrap())); + self.push(U256(z.0[..4].try_into().unwrap())); } fn run_div(&mut self) {