diff --git a/playground/.gitignore b/playground/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/playground/.gitignore @@ -0,0 +1 @@ +/target diff --git a/playground/Cargo.lock b/playground/Cargo.lock new file mode 100644 index 00000000..33aaf3ce --- /dev/null +++ b/playground/Cargo.lock @@ -0,0 +1,194 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "lambdaworks-math" +version = "0.1.3" +source = "git+https://github.com/lambdaclass/lambdaworks#2331562d67a5d6da23dab690c4688d0ad1071bac" +dependencies = [ + "rayon", + "thiserror", +] + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "playground" +version = "0.1.0" +dependencies = [ + "lambdaworks-math", +] + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rayon" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "syn" +version = "2.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" diff --git a/playground/Cargo.toml b/playground/Cargo.toml new file mode 100644 index 00000000..d5fcbdbc --- /dev/null +++ b/playground/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "playground" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +lambdaworks-math ={ git = "https://github.com/lambdaclass/lambdaworks"} diff --git a/playground/src/main.rs b/playground/src/main.rs new file mode 100644 index 00000000..4568a6f7 --- /dev/null +++ b/playground/src/main.rs @@ -0,0 +1,16 @@ +use lambdaworks_math::{field::{fields::montgomery_backed_prime_fields::{IsModulus, U256PrimeField}, element::FieldElement}, unsigned_integer::element::{U256, UnsignedInteger}}; + +#[derive(Clone, Debug)] +struct AltBn128Modulus; +impl IsModulus for AltBn128Modulus { + const MODULUS: U256 = UnsignedInteger::from_hex_unchecked( + "30644E72E131A029B85045B68181585D97816A916871CA8D3C208C16D87CFD47", + ); +} + +type AltBn128PrimeField = U256PrimeField; +type AltBn128FieldElement = FieldElement; + +fn main() { + println!("{:?}", AltBn128FieldElement::from(3).value().to_string()) +} diff --git a/precompiles/EcAdd.yul b/precompiles/EcAdd.yul index 952a85ef..30bffdc5 100644 --- a/precompiles/EcAdd.yul +++ b/precompiles/EcAdd.yul @@ -2,238 +2,331 @@ object "EcAdd" { code { } object "EcAdd_deployed" { code { - //////////////////////////////////////////////////////////////// - // CONSTANTS - //////////////////////////////////////////////////////////////// - - function ZERO() -> zero { - zero := 0x0 - } - - function ONE() -> one { - one := 0x1 - } - - // Group order of alt_bn128, see https://eips.ethereum.org/EIPS/eip-196 - function ALT_BN128_GROUP_ORDER() -> ret { - ret := 21888242871839275222246405745257275088696311157297823662689037894645226208583 - } - - // //////////////////////////////////////////////////////////////// - // HELPER FUNCTIONS - // //////////////////////////////////////////////////////////////// - - // @dev Packs precompile parameters into one word. - // Note: functions expect to work with 32/64 bits unsigned integers. - // Caller should ensure the type matching before! - function unsafePackPrecompileParams( - uint32_inputOffsetInWords, - uint32_inputLengthInWords, - uint32_outputOffsetInWords, - uint32_outputLengthInWords, - uint64_perPrecompileInterpreted - ) -> rawParams { - rawParams := uint32_inputOffsetInWords - rawParams := or(rawParams, shl(32, uint32_inputLengthInWords)) - rawParams := or(rawParams, shl(64, uint32_outputOffsetInWords)) - rawParams := or(rawParams, shl(96, uint32_outputLengthInWords)) - rawParams := or(rawParams, shl(192, uint64_perPrecompileInterpreted)) - } - - /// @dev Executes the `precompileCall` opcode. - function precompileCall(precompileParams, gasToBurn) -> ret { - // Compiler simulation for calling `precompileCall` opcode - ret := verbatim_2i_1o("precompile", precompileParams, gasToBurn) - } - - // Returns 1 if (x, y) is in the curve, 0 otherwise - function pointIsInCurve( - uint256_x, - uint256_y, - ) -> ret { - let y_squared := mulmod(uint256_y, uint256_y, ALT_BN128_GROUP_ORDER()) - let x_squared := mulmod(uint256_x, uint256_x, ALT_BN128_GROUP_ORDER()) - let x_qubed := mulmod(x_squared, uint256_x, ALT_BN128_GROUP_ORDER()) - let x_qubed_plus_three := addmod(x_qubed, 3, ALT_BN128_GROUP_ORDER()) - - ret := eq(y_squared, x_qubed_plus_three) - } - - function invmod(uint256_base, uint256_modulus) -> inv { - inv := powmod(uint256_base, sub(uint256_modulus, 2), uint256_modulus) - } - - function divmod(uint256_dividend, uint256_divisor, uint256_modulus) -> quotient { - quotient := mulmod(uint256_dividend, invmod(uint256_divisor, uint256_modulus), uint256_modulus) - } - - function powmod( - uint256_base, - uint256_exponent, - uint256_modulus, - ) -> pow { - pow := 1 - let base := mod(uint256_base, uint256_modulus) - let exponent := uint256_exponent - for { } gt(exponent, ZERO()) { } { - if mod(exponent, 2) { - pow := mulmod(pow, base, uint256_modulus) - } - exponent := shr(1, exponent) - base := mulmod(base, base, uint256_modulus) + //////////////////////////////////////////////////////////////// + // CONSTANTS + //////////////////////////////////////////////////////////////// + + function ZERO() -> zero { + zero := 0x0 + } + + function ONE() -> one { + one := 0x1 + } + + // Group order of alt_bn128, see https://eips.ethereum.org/EIPS/eip-196 + function ALT_BN128_GROUP_ORDER() -> ret { + ret := 21888242871839275222246405745257275088696311157297823662689037894645226208583 + } + + function R2_MOD_ALT_BN128_GROUP_ORDER() -> ret { + ret := 3096616502983703923843567936837374451735540968419076528771170197431451843209 + } + + function N_PRIME() -> ret { + ret := 111032442853175714102588374283752698368366046808579839647964533820976443843465 + } + + // //////////////////////////////////////////////////////////////// + // HELPER FUNCTIONS + // //////////////////////////////////////////////////////////////// + + /// @dev Executes the `precompileCall` opcode. + function precompileCall(precompileParams, gasToBurn) -> ret { + // Compiler simulation for calling `precompileCall` opcode + ret := verbatim_2i_1o("precompile", precompileParams, gasToBurn) + } + + function burnGas() { + // Precompiles that do not have a circuit counterpart + // will burn the provided gas by calling this function. + precompileCall(0, gas()) + } + + function getHighestHalfOfMultiplication(multiplicand, multiplier) -> ret { + ret := verbatim_2i_1o("mul_high", multiplicand, multiplier) + } + + function submod(minuend, subtrahend, modulus) -> difference { + difference := addmod(minuend, sub(modulus, subtrahend), modulus) + } + + function overflowingAdd(augend, addend) -> sum, overflowed { + sum := add(augend, addend) + overflowed := or(lt(sum, augend), lt(sum, addend)) + } + + // Returns 1 if (x, y) is in the curve, 0 otherwise + function pointIsInCurve(x, y) -> ret { + let y_squared := mulmod(y, y, ALT_BN128_GROUP_ORDER()) + let x_squared := mulmod(x, x, ALT_BN128_GROUP_ORDER()) + let x_qubed := mulmod(x_squared, x, ALT_BN128_GROUP_ORDER()) + let x_qubed_plus_three := addmod(x_qubed, 3, ALT_BN128_GROUP_ORDER()) + + ret := eq(y_squared, x_qubed_plus_three) + } + + function isInfinity(x, y) -> ret { + ret := and(eq(x, ZERO()), eq(y, ZERO())) + } + + function isOnGroupOrder(num) -> ret { + ret := lt(num, sub(ALT_BN128_GROUP_ORDER(), ONE())) + } + + function binaryExtendedEuclideanAlgorithm(base) -> inv { + // Precomputation of 1 << 255 + let mask := 57896044618658097711785492504343953926634992332820282019728792003956564819968 + let modulus := ALT_BN128_GROUP_ORDER() + // modulus >> 255 == 0 -> modulus & 1 << 255 == 0 + let modulusHasSpareBits := iszero(and(modulus, mask)) + + let u := base + let v := modulus + // Avoids unnecessary reduction step. + let b := R2_MOD_ALT_BN128_GROUP_ORDER() + let c := ZERO() + + for {} and(iszero(eq(u, ONE())), iszero(eq(v, ONE()))) {} { + for {} iszero(and(u, ONE())) {} { + u := shr(1, u) + let currentB := b + switch and(currentB, ONE()) + case 0 { + b := shr(1, b) } - } - - function submod( - uint256_minuend, - uint256_subtrahend, - uint256_modulus, - ) -> difference { - difference := addmod(uint256_minuend, sub(uint256_modulus, uint256_subtrahend), uint256_modulus) - } - - function isInfinity( - uint256_x, - uint256_y, - ) -> ret { - ret := and(eq(uint256_x, ZERO()), eq(uint256_y, ZERO())) - } - - function isOnGroupOrder(num) -> ret { - ret := iszero(gt(num, sub(ALT_BN128_GROUP_ORDER(), ONE()))) - } - - function burnGas() { - let precompileParams := unsafePackPrecompileParams( - 0, // input offset in words - 4, // input length in words (x1, y1, x2, y2) - 0, // output offset in words - 2, // output length in words (x3, y3) - 0 // No special meaning - ) - let gasToPay := gas() - - // Precompiles that do not have a circuit counterpart - // will burn the provided gas by calling this function. - precompileCall(precompileParams, gasToPay) - } - - //////////////////////////////////////////////////////////////// - // FALLBACK - //////////////////////////////////////////////////////////////// - - // Retrieve the coordinates from the calldata - let x1 := calldataload(0) - let y1 := calldataload(32) - let x2 := calldataload(64) - let y2 := calldataload(96) - - - if and(isInfinity(x1, y1), isInfinity(x2, y2)) { - // Infinity + Infinity = Infinity - mstore(0, ZERO()) - mstore(32, ZERO()) - return(0, 64) - } - if and(isInfinity(x1, y1), iszero(isInfinity(x2, y2))) { - // Infinity + P = P - - // Ensure that the coordinates are between 0 and the group order. - if or(iszero(isOnGroupOrder(x2)), iszero(isOnGroupOrder(y2))) { - burnGas() - revert(0, 0) + case 1 { + let newB := add(b, modulus) + let carry := or(lt(newB, b), lt(newB, modulus)) + b := shr(1, newB) + + if and(iszero(modulusHasSpareBits), carry) { + b := or(b, mask) + } } - - // Ensure that the point is in the curve (Y^2 = X^3 + 3). - if iszero(pointIsInCurve(x2, y2)) { - burnGas() - revert(0, 0) - } - - mstore(0, x2) - mstore(32, y2) - return(0, 64) - } - if and(iszero(isInfinity(x1, y1)), isInfinity(x2, y2)) { - // P + Infinity = P - - // Ensure that the coordinates are between 0 and the group order. - if or(iszero(isOnGroupOrder(x1)), iszero(isOnGroupOrder(y1))) { - burnGas() - revert(0, 0) + } + + for {} iszero(and(v, ONE())) {} { + v := shr(1, v) + let currentC := c + switch and(currentC, ONE()) + case 0 { + c := shr(1, c) } - - // Ensure that the point is in the curve (Y^2 = X^3 + 3). - if iszero(pointIsInCurve(x1, y1)) { - burnGas() - revert(0, 0) + case 1 { + let newC := add(c, modulus) + let carry := or(lt(newC, c), lt(newC, modulus)) + c := shr(1, newC) + + if and(iszero(modulusHasSpareBits), carry) { + c := or(c, mask) + } } + } - mstore(0, x1) - mstore(32, y1) - return(0, 64) - } - if and(eq(x1, x2), eq(submod(0, y1, ALT_BN128_GROUP_ORDER()), y2)) { - // P + (-P) = Infinity - mstore(0, ZERO()) - mstore(32, ZERO()) - return(0, 64) - } - if and(eq(x1, x2), eq(y1, y2)) { - // P + P = 2P - - // Ensure that the coordinates are between 0 and the group order. - if or(iszero(isOnGroupOrder(x1)), iszero(isOnGroupOrder(y1))) { - burnGas() - revert(0, 0) + switch gt(v, u) + case 0 { + u := sub(u, v) + if lt(b, c) { + b := add(b, modulus) } - - // Ensure that the points are in the curve (Y^2 = X^3 + 3). - if iszero(pointIsInCurve(x1, y1)) { - burnGas() - revert(0, 0) + b := sub(b, c) + } + case 1 { + v := sub(v, u) + if lt(c, b) { + c := add(c, modulus) } - - // (3 * x1^2 + a) / (2 * y1) - let slope := divmod(mulmod(3, mulmod(x1, x1, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()), addmod(y1, y1, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) - // x3 = slope^2 - 2 * x1 - let x3 := submod(mulmod(slope, slope, ALT_BN128_GROUP_ORDER()), addmod(x1, x1, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) - // y3 = slope * (x1 - x3) - y1 - let y3 := submod(mulmod(slope, submod(x1, x3, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()), y1, ALT_BN128_GROUP_ORDER()) - - mstore(0, x3) - mstore(32, y3) - return(0, 64) - } - if and(eq(x1, x2), and(iszero(eq(y1, y2)), iszero(eq(y1, submod(0, y2, ALT_BN128_GROUP_ORDER()))))) { - burnGas() - revert(0, 0) - } - - // P1 + P2 = P3 - - // Ensure that the coordinates are between 0 and the group order. - if or(iszero(isOnGroupOrder(x1)), iszero(isOnGroupOrder(y1)), iszero(isOnGroupOrder(x2)), iszero(isOnGroupOrder(y2))) { - burnGas() - revert(0, 0) - } - - // Ensure that the points are in the curve (Y^2 = X^3 + 3). - if or(iszero(pointIsInCurve(x1, y1)), iszero(pointIsInCurve(x2, y2))) { - burnGas() - revert(0, 0) - } - - // (y2 - y1) / (x2 - x1) - let slope := divmod(submod(y2, y1, ALT_BN128_GROUP_ORDER()), submod(x2, x1, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) - // x3 = slope^2 - x1 - x2 - let x3 := submod(mulmod(slope, slope, ALT_BN128_GROUP_ORDER()), addmod(x1, x2, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) - // y3 = slope * (x1 - x3) - y1 - let y3 := submod(mulmod(slope, submod(x1, x3, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()), y1, ALT_BN128_GROUP_ORDER()) - - mstore(0, x3) - mstore(32, y3) - return(0, 64) + c := sub(c, b) + } + } + + switch eq(u, ONE()) + case 0 { + inv := c + } + case 1 { + inv := b + } + } + + // https://en.wikipedia.org/wiki/Montgomery_modular_multiplication//The_REDC_algorithm + function REDC(lowestHalfOfT, higherHalfOfT) -> S { + let q := mul(lowestHalfOfT, N_PRIME()) + let aHigh := add(higherHalfOfT, getHighestHalfOfMultiplication(q, ALT_BN128_GROUP_ORDER())) + let aLow, overflowed := overflowingAdd(lowestHalfOfT, mul(q, ALT_BN128_GROUP_ORDER())) + if overflowed { + aHigh := add(aHigh, ONE()) + } + S := aHigh + if iszero(lt(aHigh, ALT_BN128_GROUP_ORDER())) { + S := sub(aHigh, ALT_BN128_GROUP_ORDER()) + } + } + + // Transforming into the Montgomery form -> REDC((a mod N)(R2 mod N)) + function intoMontgomeryForm(a) -> ret { + let higherHalf := getHighestHalfOfMultiplication(mod(a, ALT_BN128_GROUP_ORDER()), R2_MOD_ALT_BN128_GROUP_ORDER()) + let lowestHalf := mul(mod(a, ALT_BN128_GROUP_ORDER()), R2_MOD_ALT_BN128_GROUP_ORDER()) + ret := REDC(lowestHalf, higherHalf) + } + + // Transforming out of the Montgomery form -> REDC(a * R mod N) + function outOfMontgomeryForm(m) -> ret { + let higherHalfOf := ZERO() + let lowestHalf := m + ret := REDC(lowestHalf, higherHalfOf) + } + + // Multipling field elements in Montgomery form -> REDC((a * R mod N)(b * R mod N)) + function montgomeryMul(multiplicand, multiplier) -> ret { + let higherHalfOfProduct := getHighestHalfOfMultiplication(multiplicand, multiplier) + let lowestHalfOfProduct := mul(multiplicand, multiplier) + ret := REDC(lowestHalfOfProduct, higherHalfOfProduct) + } + + function montgomeryModularInverse(a) -> invmod { + invmod := binaryExtendedEuclideanAlgorithm(a) + } + + function montgomeryDiv(dividend, divisor) -> quotient { + quotient := montgomeryMul(dividend, montgomeryModularInverse(divisor)) + } + + //////////////////////////////////////////////////////////////// + // FALLBACK + //////////////////////////////////////////////////////////////// + + // Retrieve the coordinates from the calldata + let x1 := calldataload(0) + let y1 := calldataload(32) + let x2 := calldataload(64) + let y2 := calldataload(96) + + let p1IsInfinity := isInfinity(x1, y1) + let p2IsInfinity := isInfinity(x2, y2) + + if and(p1IsInfinity, p2IsInfinity) { + // Infinity + Infinity = Infinity + mstore(0, ZERO()) + mstore(32, ZERO()) + return(0, 64) + } + if and(p1IsInfinity, iszero(p2IsInfinity)) { + // Infinity + P = P + + // Ensure that the coordinates are between 0 and the group order. + if or(iszero(isOnGroupOrder(x2)), iszero(isOnGroupOrder(y2))) { + burnGas() + revert(0, 0) + } + + // Ensure that the point is in the curve (Y^2 = X^3 + 3). + if iszero(pointIsInCurve(x2, y2)) { + burnGas() + revert(0, 0) + } + + mstore(0, x2) + mstore(32, y2) + return(0, 64) + } + if and(iszero(p1IsInfinity), p2IsInfinity) { + // P + Infinity = P + + // Ensure that the coordinates are between 0 and the group order. + if or(iszero(isOnGroupOrder(x1)), iszero(isOnGroupOrder(y1))) { + burnGas() + revert(0, 0) + } + + // Ensure that the point is in the curve (Y^2 = X^3 + 3). + if iszero(pointIsInCurve(x1, y1)) { + burnGas() + revert(0, 0) + } + + mstore(0, x1) + mstore(32, y1) + return(0, 64) + } + + // Ensure that the coordinates are between 0 and the group order. + if or(iszero(isOnGroupOrder(x1)), iszero(isOnGroupOrder(y1))) { + burnGas() + revert(0, 0) + } + + // Ensure that the coordinates are between 0 and the group order. + if or(iszero(isOnGroupOrder(x2)), iszero(isOnGroupOrder(y2))) { + burnGas() + revert(0, 0) + } + + // Ensure that the points are in the curve (Y^2 = X^3 + 3). + if or(iszero(pointIsInCurve(x1, y1)), iszero(pointIsInCurve(x2, y2))) { + burnGas() + revert(0, 0) + } + + // There's no need for transforming into Montgomery form + // for this case. + if and(eq(x1, x2), eq(submod(0, y1, ALT_BN128_GROUP_ORDER()), y2)) { + // P + (-P) = Infinity + + mstore(0, ZERO()) + mstore(32, ZERO()) + return(0, 64) + } + // There's no need for transforming into Montgomery form + // for this case. + if and(eq(x1, x2), and(iszero(eq(y1, y2)), iszero(eq(y1, submod(0, y2, ALT_BN128_GROUP_ORDER()))))) { + burnGas() + revert(0, 0) + } + + if and(eq(x1, x2), eq(y1, y2)) { + // P + P = 2P + + let x := intoMontgomeryForm(x1) + let y := intoMontgomeryForm(y1) + + // (3 * x1^2 + a) / (2 * y1) + let x1_squared := montgomeryMul(x, x) + let slope := montgomeryDiv(addmod(x1_squared, addmod(x1_squared, x1_squared, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()), addmod(y, y, ALT_BN128_GROUP_ORDER())) + // x3 = slope^2 - 2 * x1 + let x3 := submod(montgomeryMul(slope, slope), addmod(x, x, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) + // y3 = slope * (x1 - x3) - y1 + let y3 := submod(montgomeryMul(slope, submod(x, x3, ALT_BN128_GROUP_ORDER())), y, ALT_BN128_GROUP_ORDER()) + + x3 := outOfMontgomeryForm(x3) + y3 := outOfMontgomeryForm(y3) + + mstore(0, x3) + mstore(32, y3) + return(0, 64) + } + + // P1 + P2 = P3 + + x1 := intoMontgomeryForm(x1) + y1 := intoMontgomeryForm(y1) + x2 := intoMontgomeryForm(x2) + y2 := intoMontgomeryForm(y2) + + // (y2 - y1) / (x2 - x1) + let slope := montgomeryDiv(submod(y2, y1, ALT_BN128_GROUP_ORDER()), submod(x2, x1, ALT_BN128_GROUP_ORDER())) + // x3 = slope^2 - x1 - x2 + let x3 := submod(montgomeryMul(slope, slope), addmod(x1, x2, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) + // y3 = slope * (x1 - x3) - y1 + let y3 := submod(montgomeryMul(slope, submod(x1, x3, ALT_BN128_GROUP_ORDER())), y1, ALT_BN128_GROUP_ORDER()) + + x3 := outOfMontgomeryForm(x3) + y3 := outOfMontgomeryForm(y3) + + mstore(0, x3) + mstore(32, y3) + return(0, 64) } } } diff --git a/precompiles/EcMul.yul b/precompiles/EcMul.yul index cb93864e..9e262914 100644 --- a/precompiles/EcMul.yul +++ b/precompiles/EcMul.yul @@ -2,239 +2,376 @@ object "EcMul" { code { } object "EcMul_deployed" { code { - //////////////////////////////////////////////////////////////// - // CONSTANTS - //////////////////////////////////////////////////////////////// - - function ZERO() -> zero { - zero := 0x0 - } - - function ONE() -> one { - one := 0x1 - } - - function TWO() -> two { - two := 0x2 - } - - function THREE() -> three { - three := 0x3 - } - - // Group order of alt_bn128, see https://eips.ethereum.org/EIPS/eip-196 - function ALT_BN128_GROUP_ORDER() -> ret { - ret := 21888242871839275222246405745257275088696311157297823662689037894645226208583 - } - - // //////////////////////////////////////////////////////////////// - // HELPER FUNCTIONS - // //////////////////////////////////////////////////////////////// - - // @dev Packs precompile parameters into one word. - // Note: functions expect to work with 32/64 bits unsigned integers. - // Caller should ensure the type matching before! - function unsafePackPrecompileParams( - uint32_inputOffsetInWords, - uint32_inputLengthInWords, - uint32_outputOffsetInWords, - uint32_outputLengthInWords, - uint64_perPrecompileInterpreted - ) -> rawParams { - rawParams := uint32_inputOffsetInWords - rawParams := or(rawParams, shl(32, uint32_inputLengthInWords)) - rawParams := or(rawParams, shl(64, uint32_outputOffsetInWords)) - rawParams := or(rawParams, shl(96, uint32_outputLengthInWords)) - rawParams := or(rawParams, shl(192, uint64_perPrecompileInterpreted)) - } - - /// @dev Executes the `precompileCall` opcode. - function precompileCall(precompileParams, gasToBurn) -> ret { - // Compiler simulation for calling `precompileCall` opcode - ret := verbatim_2i_1o("precompile", precompileParams, gasToBurn) - } - - // Returns 1 if (x, y) is in the curve, 0 otherwise - function pointIsInCurve( - sint256_x, - sint256_y, - ) -> ret { - let y_squared := mulmod(sint256_y, sint256_y, ALT_BN128_GROUP_ORDER()) - let x_squared := mulmod(sint256_x, sint256_x, ALT_BN128_GROUP_ORDER()) - let x_qubed := mulmod(x_squared, sint256_x, ALT_BN128_GROUP_ORDER()) - let x_qubed_plus_three := addmod(x_qubed, THREE(), ALT_BN128_GROUP_ORDER()) - - ret := eq(y_squared, x_qubed_plus_three) - } - - function invmod(uint256_base, uint256_modulus) -> inv { - inv := powmod(uint256_base, sub(uint256_modulus, 2), uint256_modulus) - } - - function divmod(uint256_dividend, uint256_divisor, uint256_modulus) -> quotient { - quotient := mulmod(uint256_dividend, invmod(uint256_divisor, uint256_modulus), uint256_modulus) - } - - function powmod( - uint256_base, - uint256_exponent, - uint256_modulus, - ) -> pow { - pow := 1 - let base := mod(uint256_base, uint256_modulus) - let exponent := uint256_exponent - for { } gt(exponent, ZERO()) { } { - if eq(mod(exponent, 2), ONE()) { - pow := mulmod(pow, base, uint256_modulus) - } - exponent := shr(1, exponent) - base := mulmod(base, base, uint256_modulus) - } - } - - function submod( - uint256_minuend, - uint256_subtrahend, - uint256_modulus, - ) -> difference { - difference := addmod(uint256_minuend, sub(uint256_modulus, uint256_subtrahend), uint256_modulus) - } - - function isInfinity( - sint256_x, - sint256_y, - ) -> ret { - ret := and(eq(sint256_x, ZERO()), eq(sint256_y, ZERO())) - } - - function double(sint256_x, sint256_y) -> x, y { - if isInfinity(sint256_x, sint256_y) { - x := ZERO() - y := ZERO() + //////////////////////////////////////////////////////////////// + // CONSTANTS + //////////////////////////////////////////////////////////////// + + function ZERO() -> zero { + zero := 0x00 + } + + function ONE() -> one { + one := 0x01 + } + + function TWO() -> two { + two := 0x02 + } + + function THREE() -> three { + three := 0x03 + } + + function MONTGOMERY_ONE() -> m_one { + m_one := 6350874878119819312338956282401532409788428879151445726012394534686998597021 + } + + // Group order of alt_bn128, see https://eips.ethereum.org/EIPS/eip-196 + function ALT_BN128_GROUP_ORDER() -> ret { + ret := 21888242871839275222246405745257275088696311157297823662689037894645226208583 + } + + function ALT_BN128_GROUP_ORDER_MINUS_ONE() -> ret { + ret := 21888242871839275222246405745257275088696311157297823662689037894645226208582 + } + + function R2_MOD_ALT_BN128_GROUP_ORDER() -> ret { + ret := 3096616502983703923843567936837374451735540968419076528771170197431451843209 + } + + function N_PRIME() -> ret { + ret := 111032442853175714102588374283752698368366046808579839647964533820976443843465 + } + + // //////////////////////////////////////////////////////////////// + // HELPER FUNCTIONS + // //////////////////////////////////////////////////////////////// + + /// @dev Executes the `precompileCall` opcode. + function precompileCall(precompileParams, gasToBurn) -> ret { + // Compiler simulation for calling `precompileCall` opcode + ret := verbatim_2i_1o("precompile", precompileParams, gasToBurn) + } + + function burnGas() { + // Precompiles that do not have a circuit counterpart + // will burn the provided gas by calling this function. + precompileCall(0, gas()) + } + + function getHighestHalfOfMultiplication(multiplicand, multiplier) -> ret { + ret := verbatim_2i_1o("mul_high", multiplicand, multiplier) + } + + function submod(minuend, subtrahend, modulus) -> difference { + difference := addmod(minuend, sub(modulus, subtrahend), modulus) + } + + function overflowingAdd(augend, addend) -> sum, overflowed { + sum := add(augend, addend) + overflowed := or(lt(sum, augend), lt(sum, addend)) + } + + // Returns 1 if (x, y) is in the curve, 0 otherwise + function pointIsInCurve(x, y) -> ret { + let ySquared := mulmod(y, y, ALT_BN128_GROUP_ORDER()) + let xSquared := mulmod(x, x, ALT_BN128_GROUP_ORDER()) + let xQubed := mulmod(xSquared, x, ALT_BN128_GROUP_ORDER()) + let xQubedPlusThree := addmod(xQubed, THREE(), ALT_BN128_GROUP_ORDER()) + + ret := eq(ySquared, xQubedPlusThree) + } + + function isInfinity(x, y) -> ret { + ret := and(iszero(x), iszero(y)) + } + + function isOnGroupOrder(num) -> ret { + ret := lt(num, ALT_BN128_GROUP_ORDER_MINUS_ONE()) + } + + function lsbIsOne(x) -> ret { + ret := and(x, ONE()) + } + + function binaryExtendedEuclideanAlgorithm(base) -> inv { + // Precomputation of 1 << 255 + let mask := 57896044618658097711785492504343953926634992332820282019728792003956564819968 + let modulus := ALT_BN128_GROUP_ORDER() + // modulus >> 255 == 0 -> modulus & 1 << 255 == 0 + let modulusHasSpareBits := iszero(and(modulus, mask)) + + let u := base + let v := modulus + // Avoids unnecessary reduction step. + let b := R2_MOD_ALT_BN128_GROUP_ORDER() + let c := ZERO() + + for {} and(iszero(eq(u, ONE())), iszero(eq(v, ONE()))) {} { + for {} iszero(and(u, ONE())) {} { + u := shr(1, u) + let current := b + switch and(current, ONE()) + case 0 { + b := shr(1, b) } - if iszero(isInfinity(sint256_x, sint256_y)) { - // (3 * sint256_x^2 + a) / (2 * sint256_y) - let slope := divmod(mulmod(3, mulmod(sint256_x, sint256_x, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()), addmod(sint256_y, sint256_y, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) - // x = slope^2 - 2 * x - x := submod(mulmod(slope, slope, ALT_BN128_GROUP_ORDER()), addmod(sint256_x, sint256_x, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) - // y = slope * (sint256_x - x) - sint256_y - y := submod(mulmod(slope, submod(sint256_x, x, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()), sint256_y, ALT_BN128_GROUP_ORDER()) + case 1 { + let newB := add(b, modulus) + let carry := or(lt(newB, b), lt(newB, modulus)) + b := shr(1, newB) + + if and(iszero(modulusHasSpareBits), carry) { + b := or(b, mask) + } } - } - - function isOnGroupOrder(num) -> ret { - ret := iszero(gt(num, sub(ALT_BN128_GROUP_ORDER(), ONE()))) - } - - function burnGas() { - let precompileParams := unsafePackPrecompileParams( - 0, // input offset in words - 3, // input length in words (x, y, scalar) - 0, // output offset in words - 2, // output length in words (x2, y2) - 0 // No special meaning - ) - let gasToPay := gas() - - // Precompiles that do not have a circuit counterpart - // will burn the provided gas by calling this function. - precompileCall(precompileParams, gasToPay) - } - - //////////////////////////////////////////////////////////////// - // FALLBACK - //////////////////////////////////////////////////////////////// - - // Retrieve the coordinates from the calldata - let x := calldataload(0) - let y := calldataload(32) - let scalar := calldataload(64) - - if isInfinity(x, y) { - // Infinity * scalar = Infinity - mstore(0, ZERO()) - mstore(32, ZERO()) - return(0, 64) - } - if eq(scalar, ZERO()) { - // P * 0 = Infinity - mstore(0, ZERO()) - mstore(32, ZERO()) - return(0, 64) - } - if eq(scalar, ONE()) { - // P * 1 = P - - // Ensure that the coordinates are between 0 and the group order. - if or(iszero(isOnGroupOrder(x)), iszero(isOnGroupOrder(y))) { - burnGas() - revert(0, 0) + } + + for {} iszero(and(v, ONE())) {} { + v := shr(1, v) + let current := c + switch and(current, ONE()) + case 0 { + c := shr(1, c) } + case 1 { + let newC := add(c, modulus) + let carry := or(lt(newC, c), lt(newC, modulus)) + c := shr(1, newC) - // Ensure that the point is in the curve (Y^2 = X^3 + 3). - if iszero(pointIsInCurve(x, y)) { - burnGas() - revert(0, 0) + if and(iszero(modulusHasSpareBits), carry) { + c := or(c, mask) + } } + } - mstore(0, x) - mstore(32, y) - return(0, 64) - } - if eq(scalar, TWO()) { - let x2, y2 := double(x, y) - mstore(0, x2) - mstore(32, y2) - return(0, 64) - } - - // Ensure that the coordinates are between 0 and the group order. - if or(iszero(isOnGroupOrder(x)), iszero(isOnGroupOrder(y))) { - burnGas() - revert(0, 0) - } - - // Ensure that the point is in the curve (Y^2 = X^3 + 3). - if iszero(pointIsInCurve(x, y)) { - burnGas() - revert(0, 0) - } - - let x2 := x - let y2 := y - for { let i := 2 } lt(i, scalar) { i := add(i, 1) } { - if and(eq(x, x2), eq(y, y2)) { - // Double - x2, y2 := double(x2, y2) + switch gt(v, u) + case 0 { + u := sub(u, v) + if lt(b, c) { + b := add(b, modulus) + } + b := sub(b, c) + } + case 1 { + v := sub(v, u) + if lt(c, b) { + c := add(c, modulus) } - if or(iszero(eq(x, x2)), iszero(eq(y, y2))) { - // (y2 - y) / (x2 - x) - let slope := divmod( - submod(y2, y, ALT_BN128_GROUP_ORDER()), - submod(x2, x, ALT_BN128_GROUP_ORDER()), - ALT_BN128_GROUP_ORDER() - ) - // x2 = slope^2 - (x + x2) - x2 := submod( - // slope^2 - mulmod(slope, slope, ALT_BN128_GROUP_ORDER()), - // (x + x2) - addmod(x, x2, ALT_BN128_GROUP_ORDER()), - ALT_BN128_GROUP_ORDER() - ) - // y2 = slope * (x - x2) - y - y2 := submod( - // slope * (x - x2) - mulmod(slope, submod(x, x2, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()), - y, - ALT_BN128_GROUP_ORDER() - ) + c := sub(c, b) + } + } + + switch eq(u, ONE()) + case 0 { + inv := c + } + case 1 { + inv := b + } + } + + // https://en.wikipedia.org/wiki/Montgomery_modular_multiplication//The_REDC_algorithm + function REDC(lowestHalfOfT, higherHalfOfT) -> S { + let m := mul(lowestHalfOfT, N_PRIME()) + let hi := add(higherHalfOfT, getHighestHalfOfMultiplication(m, ALT_BN128_GROUP_ORDER())) + let lo, overflowed := overflowingAdd(lowestHalfOfT, mul(m, ALT_BN128_GROUP_ORDER())) + if overflowed { + hi := add(hi, ONE()) + } + S := hi + if iszero(lt(hi, ALT_BN128_GROUP_ORDER())) { + S := sub(hi, ALT_BN128_GROUP_ORDER()) + } + } + + // Transforming into the Montgomery form -> REDC((a mod N)(R2 mod N)) + function intoMontgomeryForm(a) -> ret { + let hi := getHighestHalfOfMultiplication(mod(a, ALT_BN128_GROUP_ORDER()), R2_MOD_ALT_BN128_GROUP_ORDER()) + let lo := mul(mod(a, ALT_BN128_GROUP_ORDER()), R2_MOD_ALT_BN128_GROUP_ORDER()) + ret := REDC(lo, hi) + } + + // Transforming out of the Montgomery form -> REDC(a * R mod N) + function outOfMontgomeryForm(m) -> ret { + let hi := ZERO() + let lo := m + ret := REDC(lo, hi) + } + + // Multipling field elements in Montgomery form -> REDC((a * R mod N)(b * R mod N)) + function montgomeryMul(multiplicand, multiplier) -> ret { + let hi := getHighestHalfOfMultiplication(multiplicand, multiplier) + let lo := mul(multiplicand, multiplier) + ret := REDC(lo, hi) + } + + function montgomeryModExp(base, exponent) -> pow { + pow := MONTGOMERY_ONE() + let aux := exponent + for { } gt(aux, ZERO()) { } { + if mod(aux, 2) { + pow := montgomeryMul(pow, base) } - } + aux := shr(1, aux) + base := montgomeryMul(base, base) + } + } + + function montgomeryModularInverse(a) -> invmod { + invmod := binaryExtendedEuclideanAlgorithm(a) + } + + function montgomeryDiv(dividend, divisor) -> quotient { + quotient := montgomeryMul(dividend, montgomeryModularInverse(divisor)) + } + + function montgomeryDouble(x, y) -> newX, newY { + switch isInfinity(x, y) + case 0 { + // (3 * x^2 + a) / (2 * y) + let xSquared := montgomeryMul(x, x) + let slope := montgomeryDiv(addmod(xSquared, addmod(xSquared, xSquared, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()), addmod(y, y, ALT_BN128_GROUP_ORDER())) + // x = slope^2 - 2 * x + newX := submod(montgomeryMul(slope, slope), addmod(x, x, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) + // y = slope * (x - x) - y + newY := submod(montgomeryMul(slope, submod(x, newX, ALT_BN128_GROUP_ORDER())), y, ALT_BN128_GROUP_ORDER()) + } + case 1 { + newX := ZERO() + newY := ZERO() + } + } + + //////////////////////////////////////////////////////////////// + // FALLBACK + //////////////////////////////////////////////////////////////// + + // Retrieve the coordinates from the calldata + let x := calldataload(0) + let y := calldataload(32) + let scalar := calldataload(64) + + if isInfinity(x, y) { + // Infinity * scalar = Infinity + mstore(0, ZERO()) + mstore(32, ZERO()) + return(0, 64) + } + + // Ensure that the coordinates are between 0 and the group order. + if or(iszero(isOnGroupOrder(x)), iszero(isOnGroupOrder(y))) { + burnGas() + revert(0, 0) + } + + // Ensure that the point is in the curve (Y^2 = X^3 + 3). + if iszero(pointIsInCurve(x, y)) { + burnGas() + revert(0, 0) + } + + if eq(scalar, ZERO()) { + // P * 0 = Infinity + mstore(0, ZERO()) + mstore(32, ZERO()) + return(0, 64) + } + if eq(scalar, ONE()) { + // P * 1 = P + mstore(0, x) + mstore(32, y) + return(0, 64) + } + + x := intoMontgomeryForm(x) + y := intoMontgomeryForm(y) + + if eq(scalar, TWO()) { + let x2, y2 := montgomeryDouble(x, y) + + x2 := outOfMontgomeryForm(x2) + y2 := outOfMontgomeryForm(y2) + + mstore(0, x2) + mstore(32, y2) + return(0, 64) + } + + let x2 := x + let y2 := y + let xRes := ZERO() + let yRes := ZERO() + for {} scalar {} { + if lsbIsOne(scalar) { + if and(isInfinity(xRes, yRes), isInfinity(x2, y2)) { + // Infinity + Infinity = Infinity + xRes := ZERO() + yRes := ZERO() + + x2, y2 := montgomeryDouble(x2, y2) + // Check next bit + scalar := shr(1, scalar) + break + } + if and(isInfinity(xRes, yRes), iszero(isInfinity(x2, y2))) { + // Infinity + P = P + xRes := x2 + yRes := y2 + + x2, y2 := montgomeryDouble(x2, y2) + // Check next bit + scalar := shr(1, scalar) + continue + } + if and(iszero(isInfinity(xRes, yRes)), isInfinity(x2, y2)) { + // P + Infinity = P + break + } + if and(eq(xRes, x2), eq(submod(ZERO(), yRes, ALT_BN128_GROUP_ORDER()), y2)) { + // P + (-P) = Infinity + xRes := ZERO() + yRes := ZERO() + + x2, y2 := montgomeryDouble(x2, y2) + // Check next bit + scalar := shr(1, scalar) + continue + } + if and(eq(xRes, x2), eq(yRes, y2)) { + // P + P = 2P + xRes, yRes := montgomeryDouble(xRes, yRes) + + x2 := xRes + y2 := yRes + // Check next bit + scalar := shr(1, scalar) + continue + } + + // P1 + P2 = P3 + + // (y2 - y1) / (x2 - x1) + let slope := montgomeryDiv(submod(y2, yRes, ALT_BN128_GROUP_ORDER()), submod(x2, xRes, ALT_BN128_GROUP_ORDER())) + // x3 = slope^2 - x1 - x2 + let x3 := submod(montgomeryMul(slope, slope), addmod(xRes, x2, ALT_BN128_GROUP_ORDER()), ALT_BN128_GROUP_ORDER()) + // y3 = slope * (x1 - x3) - y1 + let y3 := submod(montgomeryMul(slope, submod(xRes, x3, ALT_BN128_GROUP_ORDER())), yRes, ALT_BN128_GROUP_ORDER()) + + xRes := x3 + yRes := y3 + } + + x2, y2 := montgomeryDouble(x2, y2) + // Check next bit + scalar := shr(1, scalar) + } + + xRes := outOfMontgomeryForm(xRes) + yRes := outOfMontgomeryForm(yRes) - mstore(0, x2) - mstore(32, y2) - return(0, 64) + mstore(0, xRes) + mstore(32, yRes) + return(0, 64) } } } diff --git a/precompiles/Modexp.yul b/precompiles/Modexp.yul index 055ac636..6a5078ab 100644 --- a/precompiles/Modexp.yul +++ b/precompiles/Modexp.yul @@ -18,31 +18,26 @@ object "ModExp" { two := 0x2 } + function WORD_SIZE() -> word { + word := 0x20 + } + ////////////////////////////////////////////////////////////////// // HELPER FUNCTIONS ////////////////////////////////////////////////////////////////// - // @dev Packs precompile parameters into one word. - // Note: functions expect to work with 32/64 bits unsigned integers. - // Caller should ensure the type matching before! - function unsafePackPrecompileParams( - uint32_inputOffsetInWords, - uint32_inputLengthInWords, - uint32_outputOffsetInWords, - uint32_outputLengthInWords, - uint64_perPrecompileInterpreted - ) -> rawParams { - rawParams := uint32_inputOffsetInWords - rawParams := or(rawParams, shl(32, uint32_inputLengthInWords)) - rawParams := or(rawParams, shl(64, uint32_outputOffsetInWords)) - rawParams := or(rawParams, shl(96, uint32_outputLengthInWords)) - rawParams := or(rawParams, shl(192, uint64_perPrecompileInterpreted)) - } - - /// @dev Executes the `precompileCall` opcode. - function precompileCall(precompileParams, gasToBurn) -> ret { - // Compiler simulation for calling `precompileCall` opcode - ret := verbatim_2i_1o("precompile", precompileParams, gasToBurn) + function exponentIsZero(exponent_limbs, exponent_pointer) -> isZero { + isZero := ZERO() + let next_limb_pointer := exponent_pointer + for { let limb_number := ZERO() } lt(limb_number, exponent_limbs) { limb_number := add(limb_number, ONE()) } { + let limb := mload(next_limb_pointer) + isZero := or(isZero, limb) + if isZero { + break + } + next_limb_pointer := add(next_limb_pointer, WORD_SIZE()) + } + isZero := iszero(isZero) } //////////////////////////////////////////////////////////////// @@ -50,57 +45,154 @@ object "ModExp" { //////////////////////////////////////////////////////////////// let base_length := calldataload(0) - mstore(0, base_length) - let exponent_length := calldataload(32) - mstore(32, exponent_length) - let modulus_length := calldataload(64) - mstore(64, modulus_length) - let base_length_pointer := 96 - calldatacopy(add(96, sub(32, base_length)), base_length_pointer, base_length) - - let exponent_length_pointer := add(base_length_pointer, base_length) - calldatacopy(add(128, sub(32, exponent_length)), exponent_length_pointer, exponent_length) - - let modulus_length_pointer := add(exponent_length_pointer, exponent_length) - calldatacopy(add(160, sub(32, modulus_length)), modulus_length_pointer, modulus_length) + if lt(calldatasize(), 96) { + return(0, 0) + } + + // Handle a special case when both the base and mod length is zero + if and(iszero(base_length), iszero(modulus_length)) { + return(0, 0) + } + + let base_pointer := 96 + let base_padding := sub(WORD_SIZE(), base_length) + let padded_base_pointer := add(96, base_padding) + calldatacopy(padded_base_pointer, base_pointer, base_length) + let base := mload(base_pointer) - let base := mload(96) - let exponent := mload(128) - let modulus := mload(160) + // As the exponent length could be more than 32 bytes we + // decided to represent the exponent with limbs. Because + // of that, we keep track of a calldata pointer and a memory + // pointer. + // + // The calldata pointer keeps track of the real exponent length + // (which could not be divisible by the word size). + // The memory pointer keeps track of the adjusted exponent length + // (which is always divisible by the word size). + // + // There is a special case to handle when the leftmost limb of + // the exponent has less than 32 bytes in the calldata (e.g. if + // the calldata has 33 bytes in the calldata, in our limbs + // representation it should have 64 bytes). Here is where it + // it could be a difference between the real exponent length and + // the adjusted exponent length. + // + // For the amount of limbs, if the exponent length is divisible + // by the word size, then we just divide it by the word size. + // If not, we divide and then add the remainder limb (this is + // the case when the leftmost limb has less than 32 bytes). + // + // In the special case, the memory exponent pointer and the + // calldata exponent pointer are outphased. That's why after + // loading the exponent from the calldata, we still need to + // compute two pointers for the modulus. + let calldata_exponent_pointer := add(base_pointer, base_length) + let memory_exponent_pointer := add(base_pointer, WORD_SIZE()) + let exponent_limbs := ZERO() + switch iszero(mod(exponent_length, WORD_SIZE())) + case 0 { + exponent_limbs := add(div(exponent_length, WORD_SIZE()), ONE()) + } + case 1 { + exponent_limbs := div(exponent_length, WORD_SIZE()) + } + // The exponent expected length given the amount of limbs. + let adjusted_exponent_length := mul(WORD_SIZE(), exponent_limbs) + let calldata_next_limb_pointer := calldata_exponent_pointer + let memory_next_limb_pointer := memory_exponent_pointer + for { let limb_number := 0 } lt(limb_number, exponent_limbs) { limb_number := add(limb_number, ONE()) } { + // The msb of the leftmost limb could be one. + // This left-pads with zeros the leftmost limbs to achieve 32 bytes. + if iszero(limb_number) { + // The amount of zeros to left-pad. + let padding := sub(adjusted_exponent_length, exponent_length) + // This is either 0 or > 0 if there are any zeros to pad. + let padded_exponent_pointer := add(memory_exponent_pointer, padding) + let amount_of_bytes_for_first_limb := sub(WORD_SIZE(), padding) + calldatacopy(padded_exponent_pointer, calldata_exponent_pointer, amount_of_bytes_for_first_limb) + calldata_next_limb_pointer := add(calldata_exponent_pointer, amount_of_bytes_for_first_limb) + memory_next_limb_pointer := add(memory_exponent_pointer, WORD_SIZE()) + continue + } + calldatacopy(memory_next_limb_pointer, calldata_next_limb_pointer, WORD_SIZE()) + calldata_next_limb_pointer := add(calldata_next_limb_pointer, WORD_SIZE()) + memory_next_limb_pointer := add(memory_next_limb_pointer, WORD_SIZE()) + } + + let calldata_modulus_pointer := add(calldata_exponent_pointer, exponent_length) + let memory_modulus_pointer := add(memory_exponent_pointer, adjusted_exponent_length) + calldatacopy(add(memory_modulus_pointer, sub(WORD_SIZE(), modulus_length)), calldata_modulus_pointer, modulus_length) + + let modulus := mload(memory_modulus_pointer) // 1^exponent % modulus = 1 if eq(base, ONE()) { - mstore(196, ONE()) - return(196, modulus_length) + mstore(0, ONE()) + let unpadding := sub(WORD_SIZE(), modulus_length) + return(unpadding, modulus_length) + } + + // base^exponent % 0 = 0 + if iszero(modulus) { + mstore(0, ZERO()) + return(0, modulus_length) } // base^0 % modulus = 1 - if iszero(exponent) { - mstore(196, ONE()) - return(196, modulus_length) + if exponentIsZero(exponent_length, memory_exponent_pointer) { + mstore(0, ONE()) + let unpadding := sub(WORD_SIZE(), modulus_length) + return(unpadding, modulus_length) } - // base^exponent % 0 = 0 - if iszero(modulus) { - mstore(196, ZERO()) - return(196, modulus_length) + // 0^exponent % modulus = 0 + if iszero(base) { + mstore(0, ZERO()) + return(0, modulus_length) } - let pow := 1 - base := mod(base, modulus) - for { let i := 0 } gt(exponent, ZERO()) { i := add(i, 1) } { - if eq(mod(exponent, TWO()), ONE()) { - pow := mulmod(pow, base, modulus) + switch eq(exponent_limbs, ONE()) + // Special case of one limb, we load the hole word. + case 1 { + let pow := 1 + // If we have one limb, then the exponent has 32 bytes and it is + // located in 0x + let exponent := mload(memory_exponent_pointer) + base := mod(base, modulus) + for { let i := 0 } gt(exponent, ZERO()) { i := add(i, 1) } { + if eq(mod(exponent, TWO()), ONE()) { + pow := mulmod(pow, base, modulus) + } + exponent := shr(1, exponent) + base := mulmod(base, base, modulus) } - exponent := shr(1, exponent) - base := mulmod(base, base, modulus) + + mstore(0, pow) + let unpadding := sub(WORD_SIZE(), modulus_length) + return(unpadding, modulus_length) + } + case 0 { + let pow := 1 + base := mod(base, modulus) + let next_limb_pointer := memory_exponent_pointer + for { let limb_number := 0 } lt(limb_number, exponent_limbs) { limb_number := add(limb_number, ONE()) } { + let current_limb := mload(next_limb_pointer) + for { let i := 0 } gt(current_limb, ZERO()) { i := add(i, 1) } { + if eq(mod(current_limb, TWO()), ONE()) { + pow := mulmod(pow, base, modulus) + } + current_limb := shr(1, current_limb) + base := mulmod(base, base, modulus) + } + next_limb_pointer := add(next_limb_pointer, WORD_SIZE()) + } + mstore(0, pow) + let unpadding := sub(WORD_SIZE(), modulus_length) + return(unpadding, modulus_length) } - - mstore(196, pow) - return(196, modulus_length) } } } diff --git a/precompiles/Montgomery.yul b/precompiles/Montgomery.yul new file mode 100644 index 00000000..2c8bcd7e --- /dev/null +++ b/precompiles/Montgomery.yul @@ -0,0 +1,266 @@ +object "Montgomery" { + code { } + object "Montgomery_deployed" { + code { + //////////////////////////////////////////////////////////////// + // CONSTANTS + //////////////////////////////////////////////////////////////// + + function ZERO() -> zero { + zero := 0x0 + } + + function ONE() -> one { + one := 0x1 + } + + function TWO() -> two { + two := 0x2 + } + + function THREE() -> three { + three := 0x3 + } + + function MONTGOMERY_ONE() -> m_one { + m_one := 6350874878119819312338956282401532409788428879151445726012394534686998597021 + } + + function MONTGOMERY_TWO() -> m_two { + m_two := 12701749756239638624677912564803064819576857758302891452024789069373997194042 + } + + function MONTGOMERY_THREE() -> m_three { + m_three := 19052624634359457937016868847204597229365286637454337178037183604060995791063 + } + + // Group order of alt_bn128, see https://eips.ethereum.org/EIPS/eip-196 + function ALT_BN128_GROUP_ORDER() -> ret { + ret := 21888242871839275222246405745257275088696311157297823662689037894645226208583 + } + + function R2_MOD_ALT_BN128_GROUP_ORDER() -> ret { + ret := 3096616502983703923843567936837374451735540968419076528771170197431451843209 + } + + function R3_MOD_ALT_BN128_GROUP_ORDER() -> ret { + ret := 14921786541159648185948152738563080959093619838510245177710943249661917737183 + } + + function N_PRIME() -> ret { + ret := 111032442853175714102588374283752698368366046808579839647964533820976443843465 + } + + // CONSOLE.LOG Caller + // It prints 'val' in the node console and it works using the 'mem'+0x40 memory sector + function console_log(mem, val) -> { + let log_address := 0x000000000000000000636F6e736F6c652e6c6f67 + // load the free memory pointer + let freeMemPointer := mload(mem) + // store the function selector of log(uint256) in memory + mstore(freeMemPointer, 0xf82c50f1) + // store the first argument of log(uint256) in the next memory slot + mstore(add(freeMemPointer, 0x20), val) + // call the console.log contract + if iszero(staticcall(gas(),log_address,add(freeMemPointer, 28),add(freeMemPointer, 0x40),0x00,0x00)) { + revert(0,0) + } + } + + function binaryExtendedEuclideanAlgorithm(base) -> inv { + // Precomputation of 1 << 255 + let mask := 57896044618658097711785492504343953926634992332820282019728792003956564819968 + let modulus := ALT_BN128_GROUP_ORDER() + // modulus >> 255 == 0 -> modulus & 1 << 255 == 0 + let modulusHasSpareBits := iszero(and(modulus, mask)) + + let u := base + let v := modulus + // Avoids unnecessary reduction step. + let b := R2_MOD_ALT_BN128_GROUP_ORDER() + let c := ZERO() + + for {} and(iszero(eq(u, ONE())), iszero(eq(v, ONE()))) {} { + for {} iszero(and(u, ONE())) {} { + u := shr(1, u) + let current_b := b + let current_b_is_odd := and(current_b, ONE()) + if iszero(current_b_is_odd) { + b := shr(1, b) + } + if current_b_is_odd { + let new_b := add(b, modulus) + let carry := or(lt(new_b, b), lt(new_b, modulus)) + b := shr(1, new_b) + + if and(iszero(modulusHasSpareBits), carry) { + b := or(b, mask) + } + } + } + + for {} iszero(and(v, ONE())) {} { + v := shr(1, v) + let current_c := c + let current_c_is_odd := and(current_c, ONE()) + if iszero(current_c_is_odd) { + c := shr(1, c) + } + if current_c_is_odd { + let new_c := add(c, modulus) + let carry := or(lt(new_c, c), lt(new_c, modulus)) + c := shr(1, new_c) + + if and(iszero(modulusHasSpareBits), carry) { + c := or(c, mask) + } + } + } + + switch gt(v, u) + case 0 { + u := sub(u, v) + if lt(b, c) { + b := add(b, modulus) + } + b := sub(b, c) + } + case 1 { + v := sub(v, u) + if lt(c, b) { + c := add(c, modulus) + } + c := sub(c, b) + } + } + + switch eq(u, ONE()) + case 0 { + inv := c + } + case 1 { + inv := b + } + } + + function overflowingAdd(augend, addend) -> sum, overflowed { + sum := add(augend, addend) + overflowed := or(lt(sum, augend), lt(sum, addend)) + } + + function getHighestHalfOfMultiplication(multiplicand, multiplier) -> ret { + ret := verbatim_2i_1o("mul_high", multiplicand, multiplier) + } + + // https://en.wikipedia.org/wiki/Montgomery_modular_multiplication//The_REDC_algorithm + function REDC(lowest_half_of_T, higher_half_of_T) -> S { + let q := mul(lowest_half_of_T, N_PRIME()) + let a_high := add(higher_half_of_T, getHighestHalfOfMultiplication(q, ALT_BN128_GROUP_ORDER())) + let a_low, overflowed := overflowingAdd(lowest_half_of_T, mul(q, ALT_BN128_GROUP_ORDER())) + if overflowed { + a_high := add(a_high, ONE()) + } + S := a_high + if iszero(lt(a_high, ALT_BN128_GROUP_ORDER())) { + S := sub(a_high, ALT_BN128_GROUP_ORDER()) + } + } + + // Transforming into the Montgomery form -> REDC((a mod N)(R2 mod N)) + function intoMontgomeryForm(a) -> ret { + let higher_half_of_a := getHighestHalfOfMultiplication(mod(a, ALT_BN128_GROUP_ORDER()), R2_MOD_ALT_BN128_GROUP_ORDER()) + let lowest_half_of_a := mul(mod(a, ALT_BN128_GROUP_ORDER()), R2_MOD_ALT_BN128_GROUP_ORDER()) + ret := REDC(lowest_half_of_a, higher_half_of_a) + } + + // Transforming out of the Montgomery form -> REDC(a * R mod N) + function outOfMontgomeryForm(m) -> ret { + let higher_half_of_m := ZERO() + let lowest_half_of_m := m + ret := REDC(lowest_half_of_m, higher_half_of_m) + } + + // Multipling field elements in Montgomery form -> REDC((a * R mod N)(b * R mod N)) + function montgomeryMul(multiplicand, multiplier) -> ret { + let higher_half_of_product := getHighestHalfOfMultiplication(multiplicand, multiplier) + let lowest_half_of_product := mul(multiplicand, multiplier) + ret := REDC(lowest_half_of_product, higher_half_of_product) + } + + function montgomeryModExp( + base, + exponent + ) -> pow { + pow := MONTGOMERY_ONE() + let aux_exponent := exponent + for { } gt(aux_exponent, ZERO()) { } { + if mod(aux_exponent, TWO()) { + pow := montgomeryMul(pow, base) + } + aux_exponent := shr(1, aux_exponent) + base := montgomeryMul(base, base) + } + } + + function montgomeryModularInverse(a) -> invmod { + invmod := binaryExtendedEuclideanAlgorithm(a) + } + + function montgomeryDiv(dividend, divisor) -> quotient { + quotient := montgomeryMul(dividend, montgomeryModularInverse(divisor)) + } + + let N := ALT_BN128_GROUP_ORDER() + let a := THREE() + let a_mont := intoMontgomeryForm(a) + + // a + console_log(0x00, a) + // a in montgomery form + console_log(0x40, a_mont) + // a in montgomery form into regular form + console_log(0x80, outOfMontgomeryForm(a_mont)) + + /* Addition */ + let sum_mont := addmod(a_mont, a_mont, N) + console_log(0xc0, addmod(a, a, N)) + // a * a in montgomery form + console_log(0x100, sum_mont) + // a * a in montgomery form into montgomery form + console_log(0x140, outOfMontgomeryForm(sum_mont)) + + /* Multiplication */ + + let prod_mont := montgomeryMul(a_mont, a_mont) + console_log(0x180, mulmod(a, a, N)) + // a * a in montgomery form + console_log(0x1c0, prod_mont) + // a * a in montgomery form into montgomery form + console_log(0x200, outOfMontgomeryForm(prod_mont)) + + /* Modular Exponentiation */ + let pow_mont := montgomeryModExp(a_mont, 3) + console_log(0x240, mulmod(a, mulmod(a, a, N), N)) + // a ** 3 in montgomery form + console_log(0x280, pow_mont) + // a ** 3 in montgomery form into montgomery form + console_log(0x2c0, outOfMontgomeryForm(pow_mont)) + + /* Modular Inverse */ + let a_inv_mont := montgomeryModularInverse(a_mont) + // a^-1 into montgomery form + console_log(0x340, a_inv_mont) + // a^-1 out of montgomery form + console_log(0x3c0, outOfMontgomeryForm(a_inv_mont)) + + /* Division */ + // a // a + console_log(0x4c0, div(a, a)) + // a // a in montgomery form + let div_mont := montgomeryDiv(a_mont, a_mont) + console_log(0x500, div_mont) + // a // a out of montgomery form + console_log(0x540, outOfMontgomeryForm(div_mont)) + } + } +} diff --git a/scripts/double_and_add.py b/scripts/double_and_add.py new file mode 100644 index 00000000..9ca6034b --- /dev/null +++ b/scripts/double_and_add.py @@ -0,0 +1,67 @@ +import sys + +def is_infinity(x, y): + if x == 0 and y == 0: + return True + +def inv_mod(a, mod): + return pow(a, mod - 2, mod) + +def add_mod(a,b,mod): + return (a + b) % mod + +def sub_mod(a,b,mod): + return add_mod(a, mod - b, mod) + +def div_mod(a,b,mod): + return mul_mod(a, inv_mod(b, mod), mod) + +def mul_mod(a,b,mod): + return (a * b) % mod + +def point_add(x1, y1, x2, y2, mod): + if is_infinity(x1, y1) and is_infinity(x2, y2): + return (0, 0) + if is_infinity(x1, y1) and not is_infinity(x2, y2): + return (x2, y2) + if not is_infinity(x1, y1) and is_infinity(x2, y2): + return (x1, y1) + if x1 == x2 and sub_mod(0, y1, mod) == y2: + return (0, 0) + if x1 == x2 and y1 == y2: + return point_double(x1, y1, mod) + + m = div_mod(sub_mod(y2, y1, mod), sub_mod(x2, x1, mod), mod) + ret_x = sub_mod(mul_mod(m, m, mod), add_mod(x1, x2, mod), mod) + ret_y = sub_mod(mul_mod(m, sub_mod(x1, ret_x, mod), mod), y1, mod) + return (ret_x, ret_y) + + +def point_double(x, y, mod): + if is_infinity(x, y): + return 0, 0 + + m = div_mod(mul_mod(3, mul_mod(x, x, mod), mod), add_mod(y, y, mod), mod) + ret_x = sub_mod(mul_mod(m, m, mod), add_mod(x, x, mod), mod) + ret_y = sub_mod(mul_mod(m, sub_mod(x,ret_x,mod), mod), y, mod) + return (ret_x, ret_y) + +def is_even(x): + return x % 2 == 0 + +def main(): + multiplier = int(sys.argv[1]) + mod = 21888242871839275222246405745257275088696311157297823662689037894645226208583 + res = (0, 0) + p = (1,2) + + while multiplier > 0: + if not is_even(multiplier): + res = point_add(res[0], res[1], p[0], p[1], mod) + p = point_double(p[0], p[1], mod) + + multiplier = multiplier >> 1 + print(res) + +if __name__ == '__main__': + main() diff --git a/scripts/modexp_gas_cost.py b/scripts/modexp_gas_cost.py new file mode 100644 index 00000000..f768a5cb --- /dev/null +++ b/scripts/modexp_gas_cost.py @@ -0,0 +1,37 @@ +import math + +GQUADDIVISOR = 20 + +def adjusted_exponent_length(length_of_EXPONENT, EXPONENT): + if length_of_EXPONENT <= 32 and EXPONENT == 0: + return 0 + elif length_of_EXPONENT <= 32 and EXPONENT: + aux_exp = EXPONENT + index_of_highest_bit = 0 + i = 0 + while aux_exp > 0: + aux_exp >>= 1 + if aux_exp & 1: + index_of_highest_bit = i + i += 1 + return index_of_highest_bit + 1 + elif length_of_EXPONENT > 32: + return 8 * (length_of_EXPONENT - 32) + +def mult_complexity(x): + if x <= 64: return x ** 2 + elif x <= 1024: return x ** 2 // 4 + 96 * x - 3072 + else: return x ** 2 // 16 + 480 * x - 199680 + +def modexpGasCost(length_of_BASE, length_of_EXPONENT, length_of_MODULUS, EXPONENT): + return math.floor(mult_complexity(max(length_of_MODULUS, length_of_BASE)) * max(adjusted_exponent_length(length_of_EXPONENT, EXPONENT), 1) / GQUADDIVISOR) + +def main(): + length_of_BASE = 1 + length_of_EXPONENT = 32 + length_of_MODULUS = 32 + EXPONENT = 115792089237316195423570985008687907853269984665640564039457584007908834671662 + print(modexpGasCost(length_of_BASE, length_of_EXPONENT, length_of_MODULUS, EXPONENT)) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/scripts/montgomery_reduction.py b/scripts/montgomery_reduction.py new file mode 100644 index 00000000..d1e1d6cf --- /dev/null +++ b/scripts/montgomery_reduction.py @@ -0,0 +1,141 @@ +import math + +# 2^256 +R = 115792089237316195423570985008687907853269984665640564039457584007913129639936 +R_PRIME = 20988524275117001072002809824448087578619730785600314334253784976379291040311 +# R^2 = (2^256)^2 = 2^512 +R2 = 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096 +# R^3 = (2^256)^3 = 2^768 +R3 = 1552518092300708935148979488462502555256886017116696611139052038026050952686376886330878408828646477950487730697131073206171580044114814391444287275041181139204454976020849905550265285631598444825262999193716468750892846853816057856 +# R3 % N +R3_MOD_N = 14921786541159648185948152738563080959093619838510245177710943249661917737183 +# Fp +N = 21888242871839275222246405745257275088696311157297823662689037894645226208583 +# R2 % N +R2_MOD_N = 3096616502983703923843567936837374451735540968419076528771170197431451843209 +# N' -> NN' ≡ −1 mod R +N_PRIME = 111032442853175714102588374283752698368366046808579839647964533820976443843465 + +# Extended euclidean algorithm to find modular inverses for integers. +def prime_field_inv(a, modulus): + if a == 0: + return 0 + lm, hm = 1, 0 + low, high = a % modulus, modulus + while low > 1: + r = high // low + nm, new = hm - lm * r, high - low * r + lm, low, hm, high = nm, new, lm, low + return lm % modulus + +def binary_extended_euclidean_algorithm(a, modulus): + modulus_has_spare_bits = modulus >> 255 == 0 + + u = a + v = modulus + b = R2_MOD_N + c = 0 + + while u != 1 and v != 1: + while u & 1 == 0: + u >>= 1 + if b & 1 == 0: + b >>= 1 + else: + b += modulus + carry = b >> 256 + b >>= 1 + if not modulus_has_spare_bits and carry > 0: + b |= 1 << 255 + + while v & 1 == 0: + v >>= 1 + if c & 1 == 0: + c >>= 1 + else: + c += modulus + carry = c >> 256 + c >>= 1 + if not modulus_has_spare_bits and carry > 0: + c |= 1 << 255 + if v <= u: + u -= v + if b < c: + b += modulus + b -= c + else: + v -= u + if c < b: + c += modulus + c -= b + + if u == 1: + return b + + return c +# Montgomery reduction algorithm +def REDC(n): + m = (n % R) * N_PRIME % R + t = ((m * N) + n) // R + if t >= N: + t -= N + return t + +# REDC((a mod N)(R2 mod N)) +def into_montgomery_form(a): + return REDC((a % N) * R2_MOD_N) + +# REDC(aR mod N) +def from_montgomery_form(a_mont): + return REDC(a_mont) + +# REDC((aR mod N)(bR mod N)) +def montgomery_multiplication(a_mont, b_mont): + return REDC(a_mont * b_mont) + +# REDC((a mod N)(R2 mod N)) +def into_montgomery_form_naive(a): + return a * R % N + +def montgomery_modular_exponentiation(base, exponent): + pow = into_montgomery_form(1) + while exponent > 0: + if exponent % 2 == 1: + pow = montgomery_multiplication(pow, base) + exponent = exponent >> 1 + base = montgomery_multiplication(base, base) + return pow + +def montgomery_modular_inverse(a): + a_inv = prime_field_inv(a, N) + return REDC(a_inv * R3_MOD_N) + +def optimized_montgomery_modular_inverse(a): + return binary_extended_euclidean_algorithm(a, N) + +def main(): + a = 3 + a_mont = into_montgomery_form(a) + print(a) + print(hex(a_mont)) + print(from_montgomery_form(a_mont)) + + a_prod = a * a + print(a_prod) + a_prod_mont = montgomery_multiplication(a_mont, a_mont) + print(hex(a_prod_mont)) + print(from_montgomery_form(a_prod_mont)) + + print(a**3 % N) + a_pow_3 = montgomery_modular_exponentiation(a_mont, 3) + print(hex(a_pow_3)) + print(from_montgomery_form(a_pow_3)) + + print(a // a) + a_inv_mont = montgomery_modular_inverse(a_mont) + a_times_a_inv = montgomery_multiplication(a_mont, a_inv_mont) + print(hex(a_times_a_inv)) + print(from_montgomery_form(a_times_a_inv)) + +if __name__ == '__main__': + main() diff --git a/scripts/test_case_gen.py b/scripts/test_case_gen.py new file mode 100644 index 00000000..89d469b5 --- /dev/null +++ b/scripts/test_case_gen.py @@ -0,0 +1,112 @@ +import io +import os +import json +import enum +import re + +TEST_DIRS = [ + '/Users/ivanlitteri/Lambda/tests/GeneralStateTests/stZeroKnowledge', + '/Users/ivanlitteri/Lambda/tests/GeneralStateTests/stZeroKnowledge2', + '/Users/ivanlitteri/Lambda/tests/GeneralStateTests/stPreCompiledContracts', + '/Users/ivanlitteri/Lambda/tests/GeneralStateTests/stPreCompiledContracts2' +] + +ParserState = enum.Enum('ParserState', ['INPUT', 'NOT_INPUT']) + +def write_imports(test_file: io.TextIOWrapper, precompile): + test_file.write("use hex;\n") + test_file.write(f"use zksync_web3_rs::{{zks_utils::{precompile}, types::Bytes}};\n") + test_file.write("\n") + test_file.write("mod test_utils;\n") + test_file.write("use test_utils::{eth_call, era_call};\n") + test_file.write("\n") + +def write_test_case(precompile, test_case_data, test_file: io.TextIOWrapper): + if "comment" in test_case_data: + test_file.write("// " + test_case_data["comment"] + "\n") + test_file.write("#[tokio::test]\n") + test_file.write("async fn " + test_case_data["name"] + "() {\n") + test_file.write(f"\tlet eth_response = eth_call({precompile}, None, Some(Bytes::from(hex::decode(\"{test_case_data['calldata']}\").unwrap()))).await.unwrap();\n".replace("\'", "\"")) + test_file.write(f"\tlet era_response = era_call({precompile}, None, Some(Bytes::from(hex::decode(\"{test_case_data['calldata']}\").unwrap()))).await.unwrap();\n".replace("\'", "\"")) + if "comment" not in test_case_data: + test_file.write(f"\tassert_eq!(eth_response, era_response);\n") + else: + test_file.write(f"\tassert_eq!(eth_response, era_response, \"{test_case_data['comment']}\");\n") + test_file.write("}\n") + test_file.write("\n") + +def write_test_suit(precompile: str, test_suit_data, test_file: io.TextIOWrapper): + precompile_address = "ECADD_PRECOMPILE_ADDRESS" if precompile == "ecadd" else "ECMUL_PRECOMPILE_ADDRESS" if precompile == "ecmul" else "ECPAIRING_PRECOMPILE_ADDRESS" if precompile == "ecpairing" else "MODEXP_PRECOMPILE_ADDRESS" if precompile == "modexp" else None + write_imports(test_file, precompile_address) + for test_case in test_suit_data: + write_test_case(precompile_address, test_case, test_file) + +def main(): + tests_data: dict(str, list) = {} + # Open a json file + for test_dir in TEST_DIRS: + for entry in os.scandir(test_dir): + if entry.is_dir(): + continue + with open(test_dir + '/' + entry.name, 'r') as entry_file: + data = json.load(entry_file) + + test_name = list(data.keys())[0] + precompile = "ecadd" if "ecadd" in test_name else "ecmul" if "ecmul" in test_name else "ecpairing" if "ecpairing" in test_name else "modexp" if "modexp" in test_name else None + if not precompile: + continue + comment: str = data[test_name]["_info"]["comment"] + parameters = [] + calldata = data[test_name]["transaction"]["data"] + + # Parse ecadd input + if precompile == "ecadd": + # points = re.findall(r"\([0-9]+, [0-9]+\)", comment) + # for point in points: + # x, y = point[1:-1].split(", ") + # parameters.append(x) + # parameters.append(y) + + # Skips "0x" and the first 136 bytes + calldata = calldata[0][138:] + # Parse ecmul input + elif precompile == "ecmul": + # point = re.findall(r"\([0-9]+, [0-9]+\)", comment)[0] + # factor = re.findall(r"factor [0-9]+ into", comment)[0].replace("factor ", "").replace(" into", "") + # x, y = point[1:-1].split(", ") + # parameters.append(x) + # parameters.append(y) + # parameters.append(factor) + + # Skips "0x" and the first 136 bytes + calldata = calldata[0][138:] + # Parse modexp input + elif precompile == "modexp": + if len(calldata) > 1: + for i in range(len(calldata)): + if precompile not in tests_data: + tests_data[precompile] = [] + tests_data[precompile].append({ + "name": test_name.replace("-", "_") + f"_{i}", + "parameters": parameters, + "calldata": calldata[i][2:], + }) + continue + elif precompile == "ecpairing": + continue + + if precompile not in tests_data: + tests_data[precompile] = [] + tests_data[precompile].append({ + "name": test_name.replace("-", "_"), + "comment": comment, + "parameters": parameters, + "calldata": calldata, + }) + + for precompile, precompile_test_data in tests_data.items(): + with open(f'/Users/ivanlitteri/Lambda/zksync_era_precompiles/tests/tests/{precompile}_tests.rs', 'w') as test_file: + write_test_suit(precompile, precompile_test_data, test_file) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/tests/Cargo.lock b/tests/Cargo.lock index c6993779..f0ff1e8b 100644 --- a/tests/Cargo.lock +++ b/tests/Cargo.lock @@ -1005,7 +1005,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84ebb401ba97c6f5af278c2c9936c4546cad75dec464b439ae6df249906f4caa" dependencies = [ "ethers-core", - "ethers-solc", "reqwest", "semver", "serde", @@ -3587,14 +3586,13 @@ dependencies = [ [[package]] name = "zksync-web3-rs" version = "0.1.0" -source = "git+https://www.github.com/LambdaClass/zksync-web3-rs?branch=support_precompile_calls#8516c9d6d5eccf8de9b210df8fc4f2b1f519ea6f" +source = "git+https://www.github.com/LambdaClass/zksync-web3-rs#54c2145cee69bbc5e2f55c6bdfc5662ef250cd0c" dependencies = [ "async-trait", "clap", "env_logger", "ethers", "ethers-contract", - "eyre", "hex", "log", "serde", @@ -3608,6 +3606,7 @@ dependencies = [ name = "zksync_era_precompiles" version = "0.1.0" dependencies = [ + "hex", "tokio", "zksync-web3-rs", ] diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 8fa5257c..87089bdf 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -6,8 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -zksync-web3-rs = { git = "https://www.github.com/LambdaClass/zksync-web3-rs", branch = "support_precompile_calls" } +zksync-web3-rs = { git = "https://www.github.com/LambdaClass/zksync-web3-rs" } tokio = { version = "1.11.0", features = ["full"] } +hex = "0.4" [profile.test] opt-level = 3 diff --git a/tests/ec_add_tests.rs b/tests/ec_add_tests.rs deleted file mode 100644 index a3119b95..00000000 --- a/tests/ec_add_tests.rs +++ /dev/null @@ -1,288 +0,0 @@ -use zksync_web3_rs::{zks_provider::ZKSProvider, zks_utils::ECADD_PRECOMPILE_ADDRESS}; - -mod test_utils; -use test_utils::{eth_provider, era_provider}; - -#[tokio::test] -async fn test_valid_points_addition() { - /* P + P = 2P */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "1".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P + P = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "1".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P + P = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P + P should result on 2P"); - - /* P1 + P2 = P3 */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "1368015179489954701390400359078579693043519447331113978918064868415326638035".to_string(), - "9918110051302171585080402603319702774565515993150576347155970296011118125764".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P1 + P2 = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "1368015179489954701390400359078579693043519447331113978918064868415326638035".to_string(), - "9918110051302171585080402603319702774565515993150576347155970296011118125764".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P1 + P2 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P2 + P1 should result on P3"); - - /* P2 + P1 = P3 */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1368015179489954701390400359078579693043519447331113978918064868415326638035".to_string(), - "9918110051302171585080402603319702774565515993150576347155970296011118125764".to_string(), - "1".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P2 + P1 = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1368015179489954701390400359078579693043519447331113978918064868415326638035".to_string(), - "9918110051302171585080402603319702774565515993150576347155970296011118125764".to_string(), - "1".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P2 + P1 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P2 + P1 should result on P3"); -} - -#[tokio::test] -async fn test_adding_infinity() { - /* P + Infinity = Infinity */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "0".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P + Infinity = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "0".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P + Infinity = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P + Infinity should result on P"); - - /* Infinity + P = Infinity */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "1".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] Infinity + P = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "1".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] Infinity + P = {era_response:?}"); - - assert_eq!(eth_response, era_response, "Infinity + P should result on P"); - - /* Infinity + Infinity = Infinity */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "0".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] Infinity + Infinity = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "0".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] Infinity + Infinity = {era_response:?}"); - - assert_eq!(eth_response, era_response, "Infinity + Infinity should result on Infinity"); -} - -#[tokio::test] -#[ignore = "invalid points addition is handled different in L1 than in L2"] -async fn test_invalid_points_addition() { - let eth_response = ZKSProvider::call( - ð_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "1".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - let era_response = ZKSProvider::call( - &era_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "1".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - - assert_eq!(eth_response, era_response); - - let eth_response = ZKSProvider::call( - ð_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "0".to_string(), - "1".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - let era_response = ZKSProvider::call( - &era_provider(), - ECADD_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "0".to_string(), - "1".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - assert_eq!(eth_response, era_response); -} \ No newline at end of file diff --git a/tests/ec_mul_tests.rs b/tests/ec_mul_tests.rs deleted file mode 100644 index 0e2c1d33..00000000 --- a/tests/ec_mul_tests.rs +++ /dev/null @@ -1,282 +0,0 @@ -use zksync_web3_rs::{zks_provider::ZKSProvider, zks_utils::ECMUL_PRECOMPILE_ADDRESS}; - -mod test_utils; -use test_utils::{eth_provider, era_provider}; - -#[tokio::test] -async fn test_valid_point_scalar_multiplication() { - /* P * 0 = Infinity */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P * 0 = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P * 0 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P * 0 should result on Infinity"); - - /* P * 1 = P */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "1".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P * 1 = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "1".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P * 1 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P * 1 should result on P"); - - /* P * 2 = 2P */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P * 2 = {era_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P * 2 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P * 2 should result on 2P"); - - /* P * 3 = 3P */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "3".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P * 3 = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "1".to_string(), - "2".to_string(), - "3".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P * 3 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P * 3 should result on 3P"); -} - -#[tokio::test] -async fn test_infinity_scalar_multiplication() { - /* P * 0 = Infinity */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P * 0 = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "0".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P * 0 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P * 0 should result on Infinity"); - - /* P * 1 = P */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "1".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P * 1 = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "1".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P * 1 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P * 1 should result on P"); - - /* P * 2 = 2P */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P * 2 = {era_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "2".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P * 2 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P * 2 should result on 2P"); - - /* P * 3 = 3P */ - - let eth_response = ZKSProvider::call( - ð_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "3".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L1] P * 3 = {eth_response:?}"); - - let era_response = ZKSProvider::call( - &era_provider(), - ECMUL_PRECOMPILE_ADDRESS, - "", - Some(vec![ - "0".to_string(), - "0".to_string(), - "3".to_string(), - ]), - ) - .await - .unwrap(); - - println!("[L2] P * 3 = {era_response:?}"); - - assert_eq!(eth_response, era_response, "P * 3 should result on 3P"); -} diff --git a/tests/tests/ecadd_tests.rs b/tests/tests/ecadd_tests.rs new file mode 100644 index 00000000..a96160da --- /dev/null +++ b/tests/tests/ecadd_tests.rs @@ -0,0 +1,286 @@ +use hex; +use zksync_web3_rs::{zks_utils::ECADD_PRECOMPILE_ADDRESS, types::Bytes}; + +mod test_utils; +use test_utils::{eth_call, era_call}; + +// Puts the points (6, 9) and (19274124, 124124) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_6_9_19274124_124124_25000_128() { + assert!(eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000126198c000000000000000000000000000000000000000000000000000000000001e4dc").unwrap()))).await.is_err()); + assert!(era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000126198c000000000000000000000000000000000000000000000000000000000001e4dc").unwrap()))).await.is_err()); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 0 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_21000_0() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 0 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_1_2_0_0_21000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_25000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (0, 3) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_0_3_1_2_25000_128() { + assert!(eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); + assert!(era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); +} + +// Puts the points (0, 0) and (1, 3) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_0_0_1_3_25000_128() { + assert!(eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); + assert!(era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); +} + +// Puts the points (0, 0) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_0_0_1_2_25000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 64 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_25000_64() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 64 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (1, 2) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_1_2_1_2_21000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (1, 3) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 80 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_1_3_0_0_25000_80() { + assert!(eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_1_2_0_0_25000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_21000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 80 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_25000_80() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 80 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) and (10744596414106452074759370245733544594153395043370666422502510773307029471145, 21039565435327757486054843320102702720990930294403178719740356721829973864651) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_1145_3932_1145_4651_21000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa92e83f8d734803fc370eba25ed1f6b8768bd6d83887b87165fc2434fe11a830cb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa92e83f8d734803fc370eba25ed1f6b8768bd6d83887b87165fc2434fe11a830cb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) and (10744596414106452074759370245733544594153395043370666422502510773307029471145, 21039565435327757486054843320102702720990930294403178719740356721829973864651) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (0, 0) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_0_0_1_2_21000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (1, 2) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_1_2_1_2_25000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 64 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_1_2_0_0_25000_64() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 64 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) and (1624070059937464756887933993293429854168590106605707304006200119738501412969, 3269329550605213075043232856820720631601935657990457502777101397807070461336) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_1145_3932_2969_1336_21000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) and (1624070059937464756887933993293429854168590106605707304006200119738501412969, 3269329550605213075043232856820720631601935657990457502777101397807070461336) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (6, 9) and (19274124, 124124) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_6_9_19274124_124124_21000_128() { + assert!(eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000126198c000000000000000000000000000000000000000000000000000000000001e4dc").unwrap()))).await.is_err()); + assert!(era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000126198c000000000000000000000000000000000000000000000000000000000001e4dc").unwrap()))).await.is_err()); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_21000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (0, 3) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_0_3_1_2_21000_128() { + assert!(eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); + assert!(era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); +} + +// Puts the points (0, 0) and (1, 3) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_0_0_1_3_21000_128() { + assert!(eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); + assert!(era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); +} + +// Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_1_2_0_0_25000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (1, 3) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_1_3_0_0_21000_80() { + assert!(eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the points (1, 2) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_1_2_1_2_25000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 0 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_25000_0() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 0 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (0, 0) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_0_0_1_2_21000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_21000_64() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_21000_80() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_0_0_0_0_25000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_1_2_0_0_21000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (1, 2) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_1_2_1_2_21000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 21000 bytes"); +} + +// Puts the points (0, 0) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_0_0_1_2_25000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (0, 0) and (1, 2) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) and (10744596414106452074759370245733544594153395043370666422502510773307029471145, 21039565435327757486054843320102702720990930294403178719740356721829973864651) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_1145_3932_1145_4651_25000_192() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa92e83f8d734803fc370eba25ed1f6b8768bd6d83887b87165fc2434fe11a830cb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa92e83f8d734803fc370eba25ed1f6b8768bd6d83887b87165fc2434fe11a830cb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) and (10744596414106452074759370245733544594153395043370666422502510773307029471145, 21039565435327757486054843320102702720990930294403178719740356721829973864651) into the ECADD precompile, truncating or expanding the input data to 192 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) and (1624070059937464756887933993293429854168590106605707304006200119738501412969, 3269329550605213075043232856820720631601935657990457502777101397807070461336) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes +#[tokio::test] +async fn ecadd_1145_3932_2969_1336_25000_128() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) and (1624070059937464756887933993293429854168590106605707304006200119738501412969, 3269329550605213075043232856820720631601935657990457502777101397807070461336) into the ECADD precompile, truncating or expanding the input data to 128 bytes. Gives the execution 25000 bytes"); +} + +// Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecadd_1_2_0_0_21000_64() { + let eth_response = eth_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECADD_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the points (1, 2) and (0, 0) into the ECADD precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes"); +} + diff --git a/tests/tests/ecmul_tests.rs b/tests/tests/ecmul_tests.rs new file mode 100644 index 00000000..56c620ba --- /dev/null +++ b/tests/tests/ecmul_tests.rs @@ -0,0 +1,1482 @@ +use hex; +use zksync_web3_rs::{zks_utils::ECMUL_PRECOMPILE_ADDRESS, types::Bytes}; + +mod test_utils; +use test_utils::{eth_call, era_call}; + +// Puts the point (1, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_0_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_5616_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_0_28000_64() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_5616_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_5617_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_5616_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_0_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_1_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_5616_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_5616_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 3) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_9_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_5617_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_340282366920938463463374607431768211456_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_2_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_1_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_9935_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_5617_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_340282366920938463463374607431768211456_21000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_2_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 3) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_9_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1456_21000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_0_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1456_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_0_28000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_5617_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_9_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_9935_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_5617_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_1_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_9935_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_9935_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_0_28000_64() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_9935_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_9935_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_9935_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_9_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_5617_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_340282366920938463463374607431768211456_28000_80() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_2_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_340282366920938463463374607431768211456_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_5616_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_2_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_9_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_0_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_2_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_5617_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_0_28000_80() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_9_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_9_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_5617_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_5616_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_0_21000_64() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_5616_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_1_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_2_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_340282366920938463463374607431768211456_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_9935_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_340282366920938463463374607431768211456_28000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_9935_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 3) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_2_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_340282366920938463463374607431768211456_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_340282366920938463463374607431768211456_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_2_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_0_21000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1456_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_0_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_9935_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1456_28000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_9935_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 3) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_9_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_5617_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_9935_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1456_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_0_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_2_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_0_21000_64() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_5617_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_0_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1456_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_9_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_5616_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_340282366920938463463374607431768211456_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_9_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_340282366920938463463374607431768211456_21000_80() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_340282366920938463463374607431768211456_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_5617_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_5616_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_2_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_0_21000_80() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_5617_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_9_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_3_340282366920938463463374607431768211456_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_3_0_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_5616_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_616_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_7827_6598_9_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_7827_6598_1_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_340282366920938463463374607431768211456_28000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_0_21000_64() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_1_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_340282366920938463463374607431768211456_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 40 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_0_28000_40() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 40 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_5616_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_9_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 3) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_2_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_1_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_0_28000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_9935_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_0_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_1_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_9_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_9_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_2_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_0_28000_64() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_0_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_9935_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_5616_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_9_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 0 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_0_21000_0() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 0 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 3) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_1_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_2_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_0_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_2_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_340282366920938463463374607431768211456_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_0_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_2_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_0_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_0_28000_80() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_0_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_5617_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_340282366920938463463374607431768211456_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_2_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_1_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_5617_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_340282366920938463463374607431768211456_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_340282366920938463463374607431768211456_21000_80() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_0_28000_64() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_1_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_0_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_1_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_0_21000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_340282366920938463463374607431768211456_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 40 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_0_21000_40() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 40 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_5616_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_0_28000_64() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_340282366920938463463374607431768211456_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 0 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_0_28000_0() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 0 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_340282366920938463463374607431768211456_21000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 3) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_2_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_5616_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_2_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_5616_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_0_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 3) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_9935_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.is_err()); +} + +// Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_0_21000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_340282366920938463463374607431768211456_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_1_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_5616_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_5616_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_2_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_9_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_5617_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_2_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 2 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_9935_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_5617_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_0_21000_64() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_5617_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_9_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495616 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_5616_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_5617_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 3) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_1_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_1_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_9935_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_9935_21000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 3) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_9_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_0_21000_80() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_9935_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_0_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_1_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 9 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_9_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_9935_28000_128() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 115792089237316195423570985008687907853269984665640564039457584007913129639935 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_5617_21000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_0_5617_21000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 21888242871839275222246405745257275088548364400416034343698204186575808495617 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_1_2_0_21000_64() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 64 bytes. Gives the execution 21000 bytes"); +} + +// Puts the point (0, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_340282366920938463463374607431768211456_28000_80() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 21000 bytes +#[tokio::test] +async fn ecmul_0_3_0_21000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 3) and the factor 340282366920938463463374607431768211456 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_340282366920938463463374607431768211456_28000_96() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000").unwrap()))).await.is_err()); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_0_28000_80() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 80 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (1, 2) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_1_2_1_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (1, 2) and the factor 1 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_0_0_28000_96() { + let eth_response = eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response, "Puts the point (0, 0) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 96 bytes. Gives the execution 28000 bytes"); +} + +// Puts the point (0, 3) and the factor 0 into the ECMUL precompile, truncating or expanding the input data to 128 bytes. Gives the execution 28000 bytes +#[tokio::test] +async fn ecmul_0_3_0_28000_128() { + assert!(eth_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + assert!(era_call(ECMUL_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); +} + diff --git a/tests/tests/modexp_tests.rs b/tests/tests/modexp_tests.rs new file mode 100644 index 00000000..b5217f2b --- /dev/null +++ b/tests/tests/modexp_tests.rs @@ -0,0 +1,1241 @@ +use hex; +use zksync_web3_rs::{zks_utils::MODEXP_PRECOMPILE_ADDRESS, types::Bytes}; + +mod test_utils; +use test_utils::{eth_call, era_call}; + +#[tokio::test] +async fn modexp_0() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002003fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002003fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_1() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexp_2() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +#[tokio::test] +async fn modexp_3() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002003ffff800000000000000000000000000000000000000000000000000000000000000007").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002003ffff800000000000000000000000000000000000000000000000000000000000000007").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_4() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002003ffff80").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002003ffff80").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_5() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002003").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002003").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_6() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020038000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020038000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_7() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000080").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000080").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_8() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_9() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000101").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000101").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_10() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000304").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000304").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_11() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001020004").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001020004").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_12() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001020300").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001020300").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_13() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010304").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010304").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_14() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010204").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010204").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_15() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000203").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000203").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_16() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000202030006").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000202030006").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_17() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001020306").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001020306").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_18() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002020300").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002020300").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_19() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000202030000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000202030000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_20() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020203").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020203").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_21() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002023003").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002023003").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_22() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020230").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020230").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_23() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000202").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000202").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_24() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_25() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001001001010010").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001001001010010").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_26() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000064").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000064").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_27() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000020200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030006").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000020200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030006").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_28() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[])); +} + +#[tokio::test] +async fn modexp_29() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_30() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_31() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010035ee4e488f45e64d2f07becd54646357381d32f30b74c299a8c25d5202c04938ef6c4764a04f10fc908b78c4486886000f6d290251a79681a83b950c7e5c37351").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010035ee4e488f45e64d2f07becd54646357381d32f30b74c299a8c25d5202c04938ef6c4764a04f10fc908b78c4486886000f6d290251a79681a83b950c7e5c37351").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_32() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000cd935b43e42204fcbfb734a6e27735e8e90204fcc1fd2727bb040f9eecb").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000cd935b43e42204fcbfb734a6e27735e8e90204fcc1fd2727bb040f9eecb").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_33() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000060846813a8d2d451387340fa0597c6545ae63").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000060846813a8d2d451387340fa0597c6545ae63").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_34() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000d02534f82b1013f20d9c7d18d62cd95674d2e013f20d9c7d18d62cd95674d2f").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000d02534f82b1013f20d9c7d18d62cd95674d2e013f20d9c7d18d62cd95674d2f").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexp_35() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000120785e45de3d6be050ba3c4d33ff0bb2d010ace3b1dfe9c49f4c7a8075102fa19a86c010ace3b1dfe9c49f4c7a8075102fa19a86d").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000120785e45de3d6be050ba3c4d33ff0bb2d010ace3b1dfe9c49f4c7a8075102fa19a86c010ace3b1dfe9c49f4c7a8075102fa19a86d").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x` because of mod length being 0. +#[tokio::test] +async fn modexp_36() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000ff2a1e5300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000ff2a1e5300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[])); +} + +#[tokio::test] +async fn modexp_37() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010001").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010001").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +#[tokio::test] +async fn modexpTests_0() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_1() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_2() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_3() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_4() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_5() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_6() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_7() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_8() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_9() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_10() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 1_048_578. +#[tokio::test] +async fn modexpTests_11() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 1_048_578])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_12() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_13() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_14() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_15() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_16() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +#[tokio::test] +async fn modexpTests_17() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_18() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_19() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_20() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_21() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_22() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_23() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_24() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_25() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_26() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_27() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 1.048.578. +#[tokio::test] +async fn modexpTests_28() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 1_048_578])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_29() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_30() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_31() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_32() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_33() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +#[tokio::test] +async fn modexpTests_34() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_35() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_36() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_37() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_38() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_39() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_40() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_41() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_42() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_43() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_44() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_45() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 1.048.578. +#[tokio::test] +async fn modexpTests_46() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 1_048_578])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_47() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_48() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_49() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_50() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_51() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +#[tokio::test] +async fn modexpTests_52() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_53() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_54() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 16. +#[tokio::test] +async fn modexpTests_55() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 16])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 32. +#[tokio::test] +async fn modexpTests_56() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 32])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 64. +#[tokio::test] +async fn modexpTests_57() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 64])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 100. +#[tokio::test] +async fn modexpTests_58() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 100])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 128. +#[tokio::test] +async fn modexpTests_59() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 128])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 4.097. +#[tokio::test] +async fn modexpTests_60() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 4_097])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 1.048.578 +#[tokio::test] +async fn modexpTests_61() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 1_048_578])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_62() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_63() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_64() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_65() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff00000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff00000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_66() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +#[tokio::test] +async fn modexpTests_67() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_68() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_69() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_70() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_71() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_72() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_73() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_74() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_75() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_76() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_77() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 1.048.578. +#[tokio::test] +async fn modexpTests_78() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 1_048_578])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_79() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_80() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_81() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_82() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_83() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +#[tokio::test] +async fn modexpTests_84() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_85() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_86() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_87() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000004").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_88() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_89() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000010").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_90() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_91() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_92() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_93() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_94() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000001001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 1.048.578 +#[tokio::test] +async fn modexpTests_95() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000100002").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 1_048_578])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_96() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000010000004").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_97() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000001000000008").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_98() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000ffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_99() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000ffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpTests_100() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000ffffffffffffffff").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +#[tokio::test] +async fn modexpTests_101() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_102() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_103() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_104() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_105() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_106() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_107() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_108() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_109() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_110() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_111() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_112() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +#[tokio::test] +async fn modexpTests_113() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000064").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 39.936. +#[tokio::test] +async fn modexpTests_114() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000009c00").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000009c00").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 39_936])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 11.579. +#[tokio::test] +async fn modexpTests_115() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000071140000000000000000000000000000000000000000000000000000000000002d3b").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000071140000000000000000000000000000000000000000000000000000000000002d3b").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 11_579])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 37.111. +#[tokio::test] +async fn modexpTests_116() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000090f700000000000000000000000000000000000000000000000000000000000090f7").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000090f700000000000000000000000000000000000000000000000000000000000090f7").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 37_111])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 37.111. +#[tokio::test] +async fn modexpTests_117() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000e7f00000000000000000000000000000000000000000000000000000000000090f7").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000e7f00000000000000000000000000000000000000000000000000000000000090f7").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 37_111])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 2.401. +#[tokio::test] +async fn modexpTests_118() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000009610000000000000000000000000000000000000000000000000000000000000961").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000009610000000000000000000000000000000000000000000000000000000000000961").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 2_401])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 22000. +#[tokio::test] +async fn modexpTests_119() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000578b00000000000000000000000000000000000000000000000000000000000055f0").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000009100000000000000000000000000000000000000000000000000000000000000578b00000000000000000000000000000000000000000000000000000000000055f0").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 22000])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x` because of mod length being 0. +#[tokio::test] +async fn modexpTests_120() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000090f70000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000090f70000000000000000000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00` because of mod length being 1. +#[tokio::test] +async fn modexpTests_121() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000090f70000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000090f70000000000000000000000000000000000000000000000000000000000000001").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 37.111. +#[tokio::test] +async fn modexpTests_122() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000090f700000000000000000000000000000000000000000000000000000000000090f7").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000090f700000000000000000000000000000000000000000000000000000000000090f7").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 37_111])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 97. +#[tokio::test] +async fn modexpTests_123() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000001bd000000000000000000000000000000000000000000000000000000000000090f70000000000000000000000000000000000000000000000000000000000000061").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000001bd000000000000000000000000000000000000000000000000000000000000090f70000000000000000000000000000000000000000000000000000000000000061").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 97])); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 97. +#[tokio::test] +async fn modexpTests_124() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000090f70000000000000000000000000000000000000000000000000000000000000061").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000910000000000000000000000000000000000000000000000000000000000000090f70000000000000000000000000000000000000000000000000000000000000061").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 97])); +} + +#[tokio::test] +async fn modexpTests_125() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000d7a1").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000009c000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000d7a1").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x00...000` because of mod length being 42.965 +#[tokio::test] +async fn modexpTests_126() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000d796000000000000000000000000000000000000000000000000000000000000d796000000000000000000000000000000000000000000000000000000000000a7d5").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("000000000000000000000000000000000000000000000000000000000000d796000000000000000000000000000000000000000000000000000000000000d796000000000000000000000000000000000000000000000000000000000000a7d5").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(vec![0; 42_965])); +} + +#[tokio::test] +async fn modexpRandomInput_0() { + let eth_response = eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000").unwrap()))).await.unwrap(); + assert_eq!(eth_response, era_response); +} + + +// This test fails on L1 with "out of gas" error and success on L2 returning `0x` because of mod length being 0. +#[tokio::test] +async fn modexpRandomInput_1() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000008000000000000000000000000000000000000000000000000000000000000400000000000000000000000a").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("00000000008000000000000000000000000000000000000000000000000000000000000400000000000000000000000a").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[])); +} + +// This test fails on L1 with "out of gas" error and is reverted on L2 returning `0x00`. +#[tokio::test] +async fn modexpRandomInput_2() { + assert!(eth_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001147000000000000000000000000000000000000000000000000000000000061660350000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.is_err()); + let era_response = era_call(MODEXP_PRECOMPILE_ADDRESS, None, Some(Bytes::from(hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001147000000000000000000000000000000000000000000000000000000000061660350000000000000000000000000000000000000000000000000000000000000008").unwrap()))).await.unwrap(); + assert_eq!(era_response, Bytes::from(&[0])); +} + diff --git a/tests/tests/test_utils.rs b/tests/tests/test_utils.rs index 92230990..3cd04746 100644 --- a/tests/tests/test_utils.rs +++ b/tests/tests/test_utils.rs @@ -1,17 +1,92 @@ use std::env; -use zksync_web3_rs::providers::{Http, Provider}; +use zksync_web3_rs::{ + providers::{Http, Middleware, Provider, ProviderError}, + types::{ + transaction::eip2718::TypedTransaction, Address, Bytes, Eip1559TransactionRequest, + }, + zks_utils::{ECADD_PRECOMPILE_ADDRESS, ECMUL_PRECOMPILE_ADDRESS}, +}; -static DEFAULT_L1_PROVIDER_URL: &str = "http://localhost:8545"; -static DEFAULT_L2_PROVIDER_URL: &str = "http://localhost:3050"; +static DEFAULT_L1_PROVIDER_URL: &str = "http://65.21.140.36:8545"; +static DEFAULT_L2_PROVIDER_URL: &str = "http://localhost:8011"; pub fn eth_provider() -> Provider { - let url: String = env::var("ZKSYNC_WEB3_RS_L1_PROVIDER_URL") - .unwrap_or(DEFAULT_L1_PROVIDER_URL.to_owned()); + let url: String = + env::var("ZKSYNC_WEB3_RS_L1_PROVIDER_URL").unwrap_or(DEFAULT_L1_PROVIDER_URL.to_owned()); Provider::try_from(url).unwrap() } pub fn era_provider() -> Provider { - let url: String = env::var("ZKSYNC_WEB3_RS_L2_PROVIDER_URL") - .unwrap_or(DEFAULT_L2_PROVIDER_URL.to_owned()); + let url: String = + env::var("ZKSYNC_WEB3_RS_L2_PROVIDER_URL").unwrap_or(DEFAULT_L2_PROVIDER_URL.to_owned()); Provider::try_from(url).unwrap() -} \ No newline at end of file +} + +pub async fn eth_call( + precompile_address: Address, + inputs: Option<&[&str]>, + data: Option, +) -> Result { + call(precompile_address, inputs, data, ð_provider()).await +} + +pub async fn era_call( + precompile_address: Address, + inputs: Option<&[&str]>, + data: Option, +) -> Result { + let response = call(precompile_address, inputs, data, &era_provider()).await?; + + // This check was necessary because the revert from yul returns `0x00` and is not being parsed as an error in the node side when it should be. + if (precompile_address == ECMUL_PRECOMPILE_ADDRESS + || precompile_address == ECADD_PRECOMPILE_ADDRESS) + && response.len() == 1 + { + return Err(ProviderError::CustomError("Reverted".to_owned())); + }; + Ok(response) +} + +pub async fn call( + precompile_address: Address, + _inputs: Option<&[&str]>, + data: Option, + provider: &Provider, +) -> Result { + if let Some(data) = data { + let request = Eip1559TransactionRequest::new() + .to(precompile_address) + .data(data); + let transaction: TypedTransaction = request.into(); + let encoded_output = Middleware::call(&provider, &transaction, None).await?; + Ok(encoded_output) + } else { + panic!("inputs or data must be provided") + } +} + +pub async fn eth_raw_call( + precompile_address: Address, + data: Bytes, +) -> Result { + raw_call(precompile_address, data, ð_provider()).await +} + +pub async fn era_raw_call( + precompile_address: Address, + data: Bytes, +) -> Result { + raw_call(precompile_address, data, &era_provider()).await +} + +pub async fn raw_call( + precompile_address: Address, + data: Bytes, + provider: &Provider, +) -> Result { + let request = Eip1559TransactionRequest::new() + .to(precompile_address) + .data(data); + let transaction: TypedTransaction = request.into(); + Middleware::call(&provider, &transaction, None).await +}