Skip to content

Commit fca22d8

Browse files
author
Jannis Pohlmann
committed
graph: Add unsigned vs. signed comment to From<U128> for BigInt
1 parent 52ed327 commit fca22d8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

graph/src/data/store/scalar.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ impl From<i32> for BigInt {
8282
}
8383

8484
impl From<U128> for BigInt {
85+
/// This implementation assumes that U128 represents an unsigned U128,
86+
/// and not a signed U128 (aka int128 in Solidity). Right now, this is
87+
/// all we need (for block numbers). If it ever becomes necessary to
88+
/// handle signed U128s, we should add the same
89+
/// `{to,from}_{signed,unsigned}_u128` methods that we have for U256.
8590
fn from(n: U128) -> BigInt {
8691
let mut bytes: [u8; 16] = [0; 16];
8792
n.to_little_endian(&mut bytes);

0 commit comments

Comments
 (0)