From 0e7e6705d8bd20ce89021983ac5c3c5c1790c853 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Wed, 18 Sep 2024 16:37:03 -0600 Subject: [PATCH] fix(merkle): fix overflow in to_scalar_index for nodes at depth 64 --- src/merkle/index.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/merkle/index.rs b/src/merkle/index.rs index 104ceb4..ff717ec 100644 --- a/src/merkle/index.rs +++ b/src/merkle/index.rs @@ -114,8 +114,8 @@ impl NodeIndex { /// Returns the scalar representation of the depth/value pair. /// /// It is computed as `2^depth + value`. - pub const fn to_scalar_index(&self) -> u64 { - (1 << self.depth as u64) + self.value + pub const fn to_scalar_index(&self) -> u128 { + (1 << self.depth as u64) + (self.value as u128) } /// Returns the depth of the current instance.