Open seanyoung opened 2 years ago
Solidity uses 256 bit integer types, we would like them natively supported.
Native support for them in Rust is complicated. If we are targeting Rust too, a proper standard/crate must be defined to support these types of integers across all Rust contracts.
has anyone looked at the viability of ethnum for providing the i256
and u256
type capabilities?
has anyone looked at the viability of ethnum for providing the
i256
andu256
type capabilities?
I think this is a possibility. It works on an Anchor contract and the Rust eBPF compiler did not complain about it. It should be a temporary solution, until someone optimizes a library for BPF.
what needs to be done (or what adjustments to ethnum) to have a bpf/sbf optimized implementation?
I think this is a possibility. It works on an Anchor contract and the Rust eBPF compiler did not complain about it. It should be a temporary solution, until someone optimizes a library for BPF.
The ethnum crate leaves it up to llvm to implement optimized 256 bit arithmetic. It is up to the Solana llvm compiler team to make sure that the output is optimized for BPF.
What makes you think these routines are not optimized for BPF? The codegen should be the same as for most other 64 bit target (x86_64 has some special instructions which are useful here which are not available on BPF).
An update on this issue:
I added support for 256-bit integers on Anchor IDL and client-side code:
An update on this issue:
I added support for 256-bit integers on Anchor IDL and client-side code:
Should I open a PR to update this data structure?
Solidity uses 256 bit integer types, we would like them natively supported.