juno icon indicating copy to clipboard operation
juno copied to clipboard

Implement basic `uint128` type

Open joshklop opened this issue 1 year ago • 3 comments

Or use third-party package if there's a good one. I think net contains an un-exported uint128 implementation we can use as inspiration.

Context: https://github.com/NethermindEth/juno/pull/1447#discussion_r1402009510

joshklop avatar Nov 22 '23 13:11 joshklop

hey @joshklop - just to be clear, you'd like to see a uint128 type implementation similar to this implementation in the net package? https://go.dev/src/net/netip/uint128.go

sarabrajsingh avatar Nov 22 '23 22:11 sarabrajsingh

Hi! Something similar would make sense (struct with hi, lo uint64s). There is no need to implement receivers and methods we wouldn't use in Juno; adapter functions/receivers to convert to/from felt.Felts are probably all we want right now.

joshklop avatar Nov 22 '23 22:11 joshklop

@joshklop - i threw up a quick wip pr - https://github.com/NethermindEth/juno/pull/1452 - let me know if this is the direction you'd like to see from the implementation. if it's good then I can continue swapping out felt.Felt or the new uint128 type wherever MaxPricePerUnit exists.

sarabrajsingh avatar Nov 23 '23 07:11 sarabrajsingh