@@ -49,83 +49,86 @@ type PrecompiledContract interface {
49
49
// PrecompiledContractsHomestead contains the default set of pre-compiled Ethereum
50
50
// contracts used in the Frontier and Homestead releases.
51
51
var PrecompiledContractsHomestead = map [common.Address ]PrecompiledContract {
52
- common .BytesToAddress ([]byte {1 }): & ecrecover {},
53
- common .BytesToAddress ([]byte {2 }): & sha256hash {},
54
- common .BytesToAddress ([]byte {3 }): & ripemd160hash {},
55
- common .BytesToAddress ([]byte {4 }): & dataCopy {},
52
+ common .BytesToAddress ([]byte {0x1 }): & ecrecover {},
53
+ common .BytesToAddress ([]byte {0x2 }): & sha256hash {},
54
+ common .BytesToAddress ([]byte {0x3 }): & ripemd160hash {},
55
+ common .BytesToAddress ([]byte {0x4 }): & dataCopy {},
56
56
}
57
57
58
58
// PrecompiledContractsByzantium contains the default set of pre-compiled Ethereum
59
59
// contracts used in the Byzantium release.
60
60
var PrecompiledContractsByzantium = map [common.Address ]PrecompiledContract {
61
- common .BytesToAddress ([]byte {1 }): & ecrecover {},
62
- common .BytesToAddress ([]byte {2 }): & sha256hash {},
63
- common .BytesToAddress ([]byte {3 }): & ripemd160hash {},
64
- common .BytesToAddress ([]byte {4 }): & dataCopy {},
65
- common .BytesToAddress ([]byte {5 }): & bigModExp {eip2565 : false },
66
- common .BytesToAddress ([]byte {6 }): & bn256AddByzantium {},
67
- common .BytesToAddress ([]byte {7 }): & bn256ScalarMulByzantium {},
68
- common .BytesToAddress ([]byte {8 }): & bn256PairingByzantium {},
61
+ common .BytesToAddress ([]byte {0x1 }): & ecrecover {},
62
+ common .BytesToAddress ([]byte {0x2 }): & sha256hash {},
63
+ common .BytesToAddress ([]byte {0x3 }): & ripemd160hash {},
64
+ common .BytesToAddress ([]byte {0x4 }): & dataCopy {},
65
+ common .BytesToAddress ([]byte {0x5 }): & bigModExp {eip2565 : false },
66
+ common .BytesToAddress ([]byte {0x6 }): & bn256AddByzantium {},
67
+ common .BytesToAddress ([]byte {0x7 }): & bn256ScalarMulByzantium {},
68
+ common .BytesToAddress ([]byte {0x8 }): & bn256PairingByzantium {},
69
69
}
70
70
71
71
// PrecompiledContractsIstanbul contains the default set of pre-compiled Ethereum
72
72
// contracts used in the Istanbul release.
73
73
var PrecompiledContractsIstanbul = map [common.Address ]PrecompiledContract {
74
- common .BytesToAddress ([]byte {1 }): & ecrecover {},
75
- common .BytesToAddress ([]byte {2 }): & sha256hash {},
76
- common .BytesToAddress ([]byte {3 }): & ripemd160hash {},
77
- common .BytesToAddress ([]byte {4 }): & dataCopy {},
78
- common .BytesToAddress ([]byte {5 }): & bigModExp {eip2565 : false },
79
- common .BytesToAddress ([]byte {6 }): & bn256AddIstanbul {},
80
- common .BytesToAddress ([]byte {7 }): & bn256ScalarMulIstanbul {},
81
- common .BytesToAddress ([]byte {8 }): & bn256PairingIstanbul {},
82
- common .BytesToAddress ([]byte {9 }): & blake2F {},
74
+ common .BytesToAddress ([]byte {0x1 }): & ecrecover {},
75
+ common .BytesToAddress ([]byte {0x2 }): & sha256hash {},
76
+ common .BytesToAddress ([]byte {0x3 }): & ripemd160hash {},
77
+ common .BytesToAddress ([]byte {0x4 }): & dataCopy {},
78
+ common .BytesToAddress ([]byte {0x5 }): & bigModExp {eip2565 : false },
79
+ common .BytesToAddress ([]byte {0x6 }): & bn256AddIstanbul {},
80
+ common .BytesToAddress ([]byte {0x7 }): & bn256ScalarMulIstanbul {},
81
+ common .BytesToAddress ([]byte {0x8 }): & bn256PairingIstanbul {},
82
+ common .BytesToAddress ([]byte {0x9 }): & blake2F {},
83
83
}
84
84
85
85
// PrecompiledContractsBerlin contains the default set of pre-compiled Ethereum
86
86
// contracts used in the Berlin release.
87
87
var PrecompiledContractsBerlin = map [common.Address ]PrecompiledContract {
88
- common .BytesToAddress ([]byte {1 }): & ecrecover {},
89
- common .BytesToAddress ([]byte {2 }): & sha256hash {},
90
- common .BytesToAddress ([]byte {3 }): & ripemd160hash {},
91
- common .BytesToAddress ([]byte {4 }): & dataCopy {},
92
- common .BytesToAddress ([]byte {5 }): & bigModExp {eip2565 : true },
93
- common .BytesToAddress ([]byte {6 }): & bn256AddIstanbul {},
94
- common .BytesToAddress ([]byte {7 }): & bn256ScalarMulIstanbul {},
95
- common .BytesToAddress ([]byte {8 }): & bn256PairingIstanbul {},
96
- common .BytesToAddress ([]byte {9 }): & blake2F {},
88
+ common .BytesToAddress ([]byte {0x1 }): & ecrecover {},
89
+ common .BytesToAddress ([]byte {0x2 }): & sha256hash {},
90
+ common .BytesToAddress ([]byte {0x3 }): & ripemd160hash {},
91
+ common .BytesToAddress ([]byte {0x4 }): & dataCopy {},
92
+ common .BytesToAddress ([]byte {0x5 }): & bigModExp {eip2565 : true },
93
+ common .BytesToAddress ([]byte {0x6 }): & bn256AddIstanbul {},
94
+ common .BytesToAddress ([]byte {0x7 }): & bn256ScalarMulIstanbul {},
95
+ common .BytesToAddress ([]byte {0x8 }): & bn256PairingIstanbul {},
96
+ common .BytesToAddress ([]byte {0x9 }): & blake2F {},
97
97
}
98
98
99
99
// PrecompiledContractsCancun contains the default set of pre-compiled Ethereum
100
100
// contracts used in the Cancun release.
101
101
var PrecompiledContractsCancun = map [common.Address ]PrecompiledContract {
102
- common .BytesToAddress ([]byte {1 }): & ecrecover {},
103
- common .BytesToAddress ([]byte {2 }): & sha256hash {},
104
- common .BytesToAddress ([]byte {3 }): & ripemd160hash {},
105
- common .BytesToAddress ([]byte {4 }): & dataCopy {},
106
- common .BytesToAddress ([]byte {5 }): & bigModExp {eip2565 : true },
107
- common .BytesToAddress ([]byte {6 }): & bn256AddIstanbul {},
108
- common .BytesToAddress ([]byte {7 }): & bn256ScalarMulIstanbul {},
109
- common .BytesToAddress ([]byte {8 }): & bn256PairingIstanbul {},
110
- common .BytesToAddress ([]byte {9 }): & blake2F {},
111
- common .BytesToAddress ([]byte {0x0a }): & kzgPointEvaluation {},
112
- }
113
-
114
- // PrecompiledContractsBLS contains the set of pre-compiled Ethereum
115
- // contracts specified in EIP-2537. These are exported for testing purposes.
116
- var PrecompiledContractsBLS = map [common.Address ]PrecompiledContract {
117
- common .BytesToAddress ([]byte {11 }): & bls12381G1Add {},
118
- common .BytesToAddress ([]byte {12 }): & bls12381G1Mul {},
119
- common .BytesToAddress ([]byte {13 }): & bls12381G1MultiExp {},
120
- common .BytesToAddress ([]byte {14 }): & bls12381G2Add {},
121
- common .BytesToAddress ([]byte {15 }): & bls12381G2Mul {},
122
- common .BytesToAddress ([]byte {16 }): & bls12381G2MultiExp {},
123
- common .BytesToAddress ([]byte {17 }): & bls12381Pairing {},
124
- common .BytesToAddress ([]byte {18 }): & bls12381MapG1 {},
125
- common .BytesToAddress ([]byte {19 }): & bls12381MapG2 {},
126
- }
102
+ common .BytesToAddress ([]byte {0x1 }): & ecrecover {},
103
+ common .BytesToAddress ([]byte {0x2 }): & sha256hash {},
104
+ common .BytesToAddress ([]byte {0x3 }): & ripemd160hash {},
105
+ common .BytesToAddress ([]byte {0x4 }): & dataCopy {},
106
+ common .BytesToAddress ([]byte {0x5 }): & bigModExp {eip2565 : true },
107
+ common .BytesToAddress ([]byte {0x6 }): & bn256AddIstanbul {},
108
+ common .BytesToAddress ([]byte {0x7 }): & bn256ScalarMulIstanbul {},
109
+ common .BytesToAddress ([]byte {0x8 }): & bn256PairingIstanbul {},
110
+ common .BytesToAddress ([]byte {0x9 }): & blake2F {},
111
+ common .BytesToAddress ([]byte {0xa }): & kzgPointEvaluation {},
112
+ }
113
+
114
+ // PrecompiledContractsPrague contains the set of pre-compiled Ethereum
115
+ // contracts used in the Prague release.
116
+ var PrecompiledContractsPrague = map [common.Address ]PrecompiledContract {
117
+ common .BytesToAddress ([]byte {0x0b }): & bls12381G1Add {},
118
+ common .BytesToAddress ([]byte {0x0c }): & bls12381G1Mul {},
119
+ common .BytesToAddress ([]byte {0x0d }): & bls12381G1MultiExp {},
120
+ common .BytesToAddress ([]byte {0x0e }): & bls12381G2Add {},
121
+ common .BytesToAddress ([]byte {0x0f }): & bls12381G2Mul {},
122
+ common .BytesToAddress ([]byte {0x10 }): & bls12381G2MultiExp {},
123
+ common .BytesToAddress ([]byte {0x11 }): & bls12381Pairing {},
124
+ common .BytesToAddress ([]byte {0x12 }): & bls12381MapG1 {},
125
+ common .BytesToAddress ([]byte {0x13 }): & bls12381MapG2 {},
126
+ }
127
+
128
+ var PrecompiledContractsBLS = PrecompiledContractsPrague
127
129
128
130
var (
131
+ PrecompiledAddressesPrague []common.Address
129
132
PrecompiledAddressesCancun []common.Address
130
133
PrecompiledAddressesBerlin []common.Address
131
134
PrecompiledAddressesIstanbul []common.Address
@@ -149,11 +152,16 @@ func init() {
149
152
for k := range PrecompiledContractsCancun {
150
153
PrecompiledAddressesCancun = append (PrecompiledAddressesCancun , k )
151
154
}
155
+ for k := range PrecompiledContractsPrague {
156
+ PrecompiledAddressesPrague = append (PrecompiledAddressesPrague , k )
157
+ }
152
158
}
153
159
154
160
// ActivePrecompiles returns the precompiles enabled with the current configuration.
155
161
func ActivePrecompiles (rules params.Rules ) []common.Address {
156
162
switch {
163
+ case rules .IsPrague :
164
+ return PrecompiledAddressesPrague
157
165
case rules .IsCancun :
158
166
return PrecompiledAddressesCancun
159
167
case rules .IsBerlin :
0 commit comments