Skip to content

Commit

Permalink
add eth_evm prefix to EVM modexp result size helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Vindaar committed Jul 5, 2024
1 parent c20bb7c commit 599fb40
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion constantine-go/constantine.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ func EvmSha256(inputs []byte) (result Bytes32, err error) {
func EvmModexp(inputs []byte) (result []byte, err error) {
var size C.uint64_t
// Call Nim function to determine correct size to allocate for `result`
status := C.ctt_modexp_result_size(&size,
status := C.ctt_eth_evm_modexp_result_size(&size,
(*C.byte)(getAddr(inputs)),
(C.size_t)(len(inputs)),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn evm_modexp(inputs: &[u8]) -> Result<Vec<u8>, ctt_evm_status> {
// Call Nim function to determine correct size to allocate for `result`
unsafe {
let mut size = 0u64;
let status = ctt_modexp_result_size(
let status = ctt_eth_evm_modexp_result_size(
&mut size,
inputs.as_ptr() as *const byte,
inputs.len() as usize,
Expand Down
2 changes: 1 addition & 1 deletion constantine-rust/constantine-sys/src/bindings32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5200,7 +5200,7 @@ extern "C" {
extern "C" {
#[must_use]
#[doc = " Helper for `eth_evm_modexp`. Returns the size required to be allocated based on the\n given input. Call this function first, then allocate space for the result buffer\n in the call to `eth_evm_modexp` based on this function's result.\n\n The size depends on the `modulusLen`, which is the third 32 bytes,\n `inputs == [baseLen { 32 bytes }, exponentLen { 32 bytes }, modulusLen { 32 bytes }, ... ]`\n in `inputs`.\n\n The associated modulus length in bytes is the size required by the\n result to `eth_evm_modexp`."]
pub fn ctt_modexp_result_size(
pub fn ctt_eth_evm_modexp_result_size(
size: *mut u64,
inputs: *const byte,
inputs_len: usize,
Expand Down
2 changes: 1 addition & 1 deletion constantine-rust/constantine-sys/src/bindings64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5200,7 +5200,7 @@ extern "C" {
extern "C" {
#[must_use]
#[doc = " Helper for `eth_evm_modexp`. Returns the size required to be allocated based on the\n given input. Call this function first, then allocate space for the result buffer\n in the call to `eth_evm_modexp` based on this function's result.\n\n The size depends on the `modulusLen`, which is the third 32 bytes,\n `inputs == [baseLen { 32 bytes }, exponentLen { 32 bytes }, modulusLen { 32 bytes }, ... ]`\n in `inputs`.\n\n The associated modulus length in bytes is the size required by the\n result to `eth_evm_modexp`."]
pub fn ctt_modexp_result_size(
pub fn ctt_eth_evm_modexp_result_size(
size: *mut u64,
inputs: *const byte,
inputs_len: usize,
Expand Down
2 changes: 1 addition & 1 deletion constantine/ethereum_evm_precompiles.nim
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func eth_evm_sha256*(r: var openArray[byte], inputs: openArray[byte]): CttEVMSta
sha256.hash(cast[ptr array[32, byte]](r[0].addr)[], inputs)
return cttEVM_Success

func modexp_result_size*(size: var uint64, inputs: openArray[byte]): CttEVMStatus {.noInline, tags:[Alloca, Vartime], libPrefix: prefix_ffi, meter.} =
func eth_evm_modexp_result_size*(size: var uint64, inputs: openArray[byte]): CttEVMStatus {.noInline, tags:[Alloca, Vartime], libPrefix: prefix_ffi, meter.} =
## Helper for `eth_evm_modexp`. Returns the size required to be allocated based on the
## given input. Call this function first, then allocate space for the result buffer
## in the call to `eth_evm_modexp` based on the value stored in `size` after the call.
Expand Down
2 changes: 1 addition & 1 deletion include/constantine/protocols/ethereum_evm_precompiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ctt_evm_status ctt_eth_evm_sha256(
* The associated modulus length in bytes is the size required by the
* result to `eth_evm_modexp`.
*/
ctt_evm_status ctt_modexp_result_size(
ctt_evm_status ctt_eth_evm_modexp_result_size(
uint64_t* size,
const byte* inputs, size_t inputs_len
) __attribute__((warn_unused_result));
Expand Down

0 comments on commit 599fb40

Please sign in to comment.