Skip to content

Commit fcb7cf5

Browse files
committed
update mapping precompiles
1 parent a6cacd1 commit fcb7cf5

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

cairo/ethereum/prague/vm/precompiled_contracts/mapping.cairo

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,20 @@ from ethereum.prague.vm.precompiled_contracts.ecrecover import ecrecover
1414
from ethereum.prague.vm.precompiled_contracts.blake2f import blake2f
1515
from ethereum.prague.vm.precompiled_contracts.point_evaluation import point_evaluation
1616
from ethereum.prague.vm.precompiled_contracts.ripemd160 import ripemd160
17+
from ethereum.prague.vm.precompiled_contracts.bls12_381.bls12_381_g1 import (
18+
bls12_g1_add,
19+
bls12_g1_msm,
20+
bls12_map_fp_to_g1,
21+
)
22+
from ethereum.prague.vm.precompiled_contracts.bls12_381.bls12_381_g2 import (
23+
bls12_g2_add,
24+
bls12_g2_msm,
25+
bls12_map_fp2_to_g2,
26+
)
27+
from ethereum.prague.vm.precompiled_contracts.bls12_381.bls12_381_pairing import bls12_pairing
1728
from cairo_core.control_flow import raise
18-
// currently 10 precompiles.
19-
const N_PRECOMPILES = 10;
29+
// currently 17 precompiles.
30+
const N_PRECOMPILES = 17;
2031
const HIGHEST_PRECOMPILE_LEADING_BYTE = 0x0a;
2132

2233
// count 3 steps per index: precompile_address, call, precompile_fn
@@ -104,6 +115,20 @@ func precompile_table_lookup{range_check_ptr}(address: felt) -> (felt, felt) {
104115
call blake2f; // BLAKE2F
105116
dw 0xa00000000000000000000000000000000000000;
106117
call point_evaluation; // POINT_EVALUATION
118+
dw 0xb00000000000000000000000000000000000000;
119+
call bls12_g1_add; // BLS12_G1ADD
120+
dw 0xc00000000000000000000000000000000000000;
121+
call bls12_g1_msm; // BLS12_G1MSM
122+
dw 0xd00000000000000000000000000000000000000;
123+
call bls12_g2_add; // BLS12_G2ADD
124+
dw 0xe00000000000000000000000000000000000000;
125+
call bls12_g2_msm; // BLS12_G2MSM
126+
dw 0xf00000000000000000000000000000000000000;
127+
call bls12_pairing; // BLS12_PAIRING_CHECK
128+
dw 0x100000000000000000000000000000000000000;
129+
call bls12_map_fp_to_g1; // BLS12_MAP_FP_TO_G1
130+
dw 0x110000000000000000000000000000000000000;
131+
call bls12_map_fp2_to_g2; // BLS12_MAP_FP2_TO_G2
107132
// not reached.
108133
ret;
109134
}

0 commit comments

Comments
 (0)