Skip to content

Commit

Permalink
Add ecMulG2 precompile (#220)
Browse files Browse the repository at this point in the history
* add ecmulg2 precompile

* remove console_log

* add gas reports

* fmt

* add ecmulg2 report to build.rs
  • Loading branch information
ColoCarletti authored Feb 2, 2024
1 parent f5e645b commit 9469bb6
Show file tree
Hide file tree
Showing 6 changed files with 997 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .test-node-subtree/scripts/refresh_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ for contract in "${contracts[@]}"; do
cp $SRC_DIR/$contract.sol/$contract.json $DST_DIR
done

precompiles=("EcAdd" "EcMul" "EcPairing" "Ecrecover" "Keccak256" "ModExp" "P256VERIFY" "SHA256" "secp256k1VERIFY")
precompiles=("EcAdd" "EcMul" "EcPairing" "Ecrecover" "Keccak256" "ModExp" "P256VERIFY" "SHA256" "secp256k1VERIFY" "EcMulG2")

for precompile in "${precompiles[@]}"; do
cp etc/system-contracts/contracts/precompiles/artifacts/$precompile.yul/$precompile.yul.zbin $DST_DIR
Expand Down
11 changes: 11 additions & 0 deletions .test-node-subtree/src/deps/system_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ pub const ECMUL_PRECOMPILE_ADDRESS: Address = H160([
0x00, 0x00, 0x00, 0x07,
]);

/// The `ecMulG2` system contract address.
pub const ECMUL_G2_PRECOMPILE_ADDRESS: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0B,
]);

/// The `ecPairing` system contract address.
pub const ECPAIRING_PRECOMPILE_ADDRESS: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -155,6 +161,11 @@ pub static COMPILED_IN_SYSTEM_CONTRACTS: Lazy<Vec<DeployedContract>> = Lazy::new
ECMUL_PRECOMPILE_ADDRESS,
include_bytes!("contracts/EcMul.yul.zbin").to_vec(),
),
(
"ECMUL_G2_PRECOMPILE_ADDRESS",
ECMUL_G2_PRECOMPILE_ADDRESS,
include_bytes!("contracts/EcMulG2.yul.zbin").to_vec(),
),
(
"ECPAIRING_PRECOMPILE_ADDRESS",
ECPAIRING_PRECOMPILE_ADDRESS,
Expand Down
Loading

0 comments on commit 9469bb6

Please sign in to comment.