@nomicfoundation/edr 0.12.0-next.9 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coverage.sol +38 -0
- package/dist/src/ts/coverage.d.ts +6 -0
- package/dist/src/ts/coverage.d.ts.map +1 -0
- package/dist/src/ts/coverage.js +51 -0
- package/dist/src/ts/coverage.js.map +1 -0
- package/index.d.ts +286 -27
- package/index.js +6 -2
- package/package.json +21 -19
- package/src/account.rs +0 -124
- package/src/block.rs +0 -28
- package/src/call_override.rs +0 -116
- package/src/cast.rs +0 -165
- package/src/chains/generic.rs +0 -58
- package/src/chains/l1.rs +0 -268
- package/src/chains/op.rs +0 -424
- package/src/chains.rs +0 -7
- package/src/config.rs +0 -700
- package/src/context.rs +0 -447
- package/src/contract_decoder.rs +0 -57
- package/src/debug_trace.rs +0 -40
- package/src/gas_report.rs +0 -92
- package/src/instrument.rs +0 -109
- package/src/lib.rs +0 -50
- package/src/log.rs +0 -28
- package/src/logger.rs +0 -120
- package/src/mock/time.rs +0 -134
- package/src/mock.rs +0 -71
- package/src/precompile.rs +0 -50
- package/src/provider/factory.rs +0 -22
- package/src/provider/response.rs +0 -73
- package/src/provider.rs +0 -162
- package/src/result.rs +0 -212
- package/src/scenarios.rs +0 -53
- package/src/serde.rs +0 -57
- package/src/solidity_tests/artifact.rs +0 -184
- package/src/solidity_tests/config.rs +0 -793
- package/src/solidity_tests/factory.rs +0 -22
- package/src/solidity_tests/l1.rs +0 -68
- package/src/solidity_tests/op.rs +0 -69
- package/src/solidity_tests/runner.rs +0 -51
- package/src/solidity_tests/test_results.rs +0 -736
- package/src/solidity_tests.rs +0 -56
- package/src/subscription.rs +0 -32
- package/src/trace/debug.rs +0 -61
- package/src/trace/exit.rs +0 -89
- package/src/trace/library_utils.rs +0 -11
- package/src/trace/model.rs +0 -59
- package/src/trace/return_data.rs +0 -96
- package/src/trace/solidity_stack_trace.rs +0 -869
- package/src/trace.rs +0 -199
- package/src/ts/solidity_tests.ts +0 -46
- package/src/withdrawal.rs +0 -49
package/src/chains/op.rs
DELETED
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
use std::{str::FromStr, sync::Arc};
|
|
2
|
-
|
|
3
|
-
use edr_napi_core::{
|
|
4
|
-
logger::Logger,
|
|
5
|
-
provider::{SyncProvider, SyncProviderFactory},
|
|
6
|
-
subscription::subscriber_callback_for_chain_spec,
|
|
7
|
-
};
|
|
8
|
-
use edr_op::{
|
|
9
|
-
predeploys::{
|
|
10
|
-
gas_price_oracle_code_ecotone, gas_price_oracle_code_fjord, gas_price_oracle_code_isthmus,
|
|
11
|
-
GAS_PRICE_ORACLE_ADDRESS,
|
|
12
|
-
},
|
|
13
|
-
OpChainSpec,
|
|
14
|
-
};
|
|
15
|
-
use edr_primitives::hex;
|
|
16
|
-
use edr_provider::time::CurrentTime;
|
|
17
|
-
use edr_solidity::contract_decoder::ContractDecoder;
|
|
18
|
-
use napi::{
|
|
19
|
-
bindgen_prelude::{BigInt, Uint8Array},
|
|
20
|
-
tokio::runtime,
|
|
21
|
-
};
|
|
22
|
-
use napi_derive::napi;
|
|
23
|
-
|
|
24
|
-
use crate::{
|
|
25
|
-
account::{AccountOverride, StorageSlot},
|
|
26
|
-
provider::ProviderFactory,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
pub struct OpProviderFactory;
|
|
30
|
-
|
|
31
|
-
impl SyncProviderFactory for OpProviderFactory {
|
|
32
|
-
fn create_provider(
|
|
33
|
-
&self,
|
|
34
|
-
runtime: runtime::Handle,
|
|
35
|
-
provider_config: edr_napi_core::provider::Config,
|
|
36
|
-
logger_config: edr_napi_core::logger::Config,
|
|
37
|
-
subscription_callback: edr_napi_core::subscription::Callback,
|
|
38
|
-
contract_decoder: Arc<ContractDecoder>,
|
|
39
|
-
) -> napi::Result<Arc<dyn SyncProvider>> {
|
|
40
|
-
let logger =
|
|
41
|
-
Logger::<OpChainSpec, CurrentTime>::new(logger_config, Arc::clone(&contract_decoder))?;
|
|
42
|
-
|
|
43
|
-
let provider_config =
|
|
44
|
-
edr_provider::ProviderConfig::<edr_op::Hardfork>::try_from(provider_config)?;
|
|
45
|
-
|
|
46
|
-
let provider = edr_provider::Provider::<OpChainSpec>::new(
|
|
47
|
-
runtime.clone(),
|
|
48
|
-
Box::new(logger),
|
|
49
|
-
subscriber_callback_for_chain_spec::<OpChainSpec, CurrentTime>(subscription_callback),
|
|
50
|
-
provider_config,
|
|
51
|
-
contract_decoder,
|
|
52
|
-
CurrentTime,
|
|
53
|
-
)
|
|
54
|
-
.map_err(|error| napi::Error::new(napi::Status::GenericFailure, error.to_string()))?;
|
|
55
|
-
|
|
56
|
-
Ok(Arc::new(provider))
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/// Enumeration of supported OP hardforks.
|
|
61
|
-
#[napi]
|
|
62
|
-
pub enum OpHardfork {
|
|
63
|
-
Bedrock = 100,
|
|
64
|
-
Regolith = 101,
|
|
65
|
-
Canyon = 102,
|
|
66
|
-
Ecotone = 103,
|
|
67
|
-
Fjord = 104,
|
|
68
|
-
Granite = 105,
|
|
69
|
-
Holocene = 106,
|
|
70
|
-
Isthmus = 107,
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
impl From<OpHardfork> for edr_op::Hardfork {
|
|
74
|
-
fn from(hardfork: OpHardfork) -> Self {
|
|
75
|
-
match hardfork {
|
|
76
|
-
OpHardfork::Bedrock => edr_op::Hardfork::BEDROCK,
|
|
77
|
-
OpHardfork::Regolith => edr_op::Hardfork::REGOLITH,
|
|
78
|
-
OpHardfork::Canyon => edr_op::Hardfork::CANYON,
|
|
79
|
-
OpHardfork::Ecotone => edr_op::Hardfork::ECOTONE,
|
|
80
|
-
OpHardfork::Fjord => edr_op::Hardfork::FJORD,
|
|
81
|
-
OpHardfork::Granite => edr_op::Hardfork::GRANITE,
|
|
82
|
-
OpHardfork::Holocene => edr_op::Hardfork::HOLOCENE,
|
|
83
|
-
OpHardfork::Isthmus => edr_op::Hardfork::ISTHMUS,
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
impl FromStr for OpHardfork {
|
|
89
|
-
type Err = napi::Error;
|
|
90
|
-
|
|
91
|
-
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
92
|
-
match s {
|
|
93
|
-
edr_op::hardfork::name::BEDROCK => Ok(OpHardfork::Bedrock),
|
|
94
|
-
edr_op::hardfork::name::REGOLITH => Ok(OpHardfork::Regolith),
|
|
95
|
-
edr_op::hardfork::name::CANYON => Ok(OpHardfork::Canyon),
|
|
96
|
-
edr_op::hardfork::name::ECOTONE => Ok(OpHardfork::Ecotone),
|
|
97
|
-
edr_op::hardfork::name::FJORD => Ok(OpHardfork::Fjord),
|
|
98
|
-
edr_op::hardfork::name::GRANITE => Ok(OpHardfork::Granite),
|
|
99
|
-
edr_op::hardfork::name::HOLOCENE => Ok(OpHardfork::Holocene),
|
|
100
|
-
edr_op::hardfork::name::ISTHMUS => Ok(OpHardfork::Isthmus),
|
|
101
|
-
_ => Err(napi::Error::new(
|
|
102
|
-
napi::Status::InvalidArg,
|
|
103
|
-
format!("The provided OP hardfork `{s}` is not supported."),
|
|
104
|
-
)),
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/// Tries to parse the provided string to create an [`OpHardfork`]
|
|
110
|
-
/// instance.
|
|
111
|
-
///
|
|
112
|
-
/// Returns an error if the string does not match any known hardfork.
|
|
113
|
-
#[napi(catch_unwind)]
|
|
114
|
-
pub fn op_hardfork_from_string(hardfork: String) -> napi::Result<OpHardfork> {
|
|
115
|
-
hardfork.parse()
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/// Returns the string representation of the provided OP hardfork.
|
|
119
|
-
#[napi(catch_unwind)]
|
|
120
|
-
pub fn op_hardfork_to_string(hardfork: OpHardfork) -> &'static str {
|
|
121
|
-
match hardfork {
|
|
122
|
-
OpHardfork::Bedrock => edr_op::hardfork::name::BEDROCK,
|
|
123
|
-
OpHardfork::Regolith => edr_op::hardfork::name::REGOLITH,
|
|
124
|
-
OpHardfork::Canyon => edr_op::hardfork::name::CANYON,
|
|
125
|
-
OpHardfork::Ecotone => edr_op::hardfork::name::ECOTONE,
|
|
126
|
-
OpHardfork::Fjord => edr_op::hardfork::name::FJORD,
|
|
127
|
-
OpHardfork::Granite => edr_op::hardfork::name::GRANITE,
|
|
128
|
-
OpHardfork::Holocene => edr_op::hardfork::name::HOLOCENE,
|
|
129
|
-
OpHardfork::Isthmus => edr_op::hardfork::name::ISTHMUS,
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/// Returns the latest supported OP hardfork.
|
|
134
|
-
///
|
|
135
|
-
/// The returned value will be updated after each network upgrade.
|
|
136
|
-
#[napi(catch_unwind)]
|
|
137
|
-
pub fn op_latest_hardfork() -> OpHardfork {
|
|
138
|
-
OpHardfork::Holocene
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
#[napi]
|
|
142
|
-
pub const OP_CHAIN_TYPE: &str = edr_op::CHAIN_TYPE;
|
|
143
|
-
|
|
144
|
-
#[napi(catch_unwind)]
|
|
145
|
-
pub fn op_genesis_state(hardfork: OpHardfork) -> Vec<AccountOverride> {
|
|
146
|
-
let l1_block_code = hex::decode(include_str!("../../data/op/predeploys/l1_block.txt"))
|
|
147
|
-
.expect("The bytecode for the L1Block predeploy should be a valid hex string");
|
|
148
|
-
let l1_block = AccountOverride {
|
|
149
|
-
address: hex!("4200000000000000000000000000000000000015").into(),
|
|
150
|
-
balance: Some(BigInt::from(0u64)),
|
|
151
|
-
nonce: Some(BigInt::from(0u64)),
|
|
152
|
-
code: Some(l1_block_code.into()),
|
|
153
|
-
storage: Some(vec![
|
|
154
|
-
StorageSlot {
|
|
155
|
-
index: BigInt::from(0u64),
|
|
156
|
-
// uint64 public number = 1
|
|
157
|
-
// uint64 public timestamp = 1
|
|
158
|
-
value: BigInt {
|
|
159
|
-
words: vec![
|
|
160
|
-
0x0000000000000001_u64, // least significative
|
|
161
|
-
0x0000000000000001_u64,
|
|
162
|
-
],
|
|
163
|
-
sign_bit: false,
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
StorageSlot {
|
|
167
|
-
index: BigInt::from(1u64),
|
|
168
|
-
// uint256 baseFee = 10 gwei
|
|
169
|
-
value: BigInt::from(0x00000002540be400_u64),
|
|
170
|
-
},
|
|
171
|
-
StorageSlot {
|
|
172
|
-
index: BigInt::from(2u64),
|
|
173
|
-
// bytes32 hash = 0
|
|
174
|
-
value: BigInt::from(0u64),
|
|
175
|
-
},
|
|
176
|
-
StorageSlot {
|
|
177
|
-
index: BigInt::from(3u64),
|
|
178
|
-
// uint64 sequenceNumber = 0
|
|
179
|
-
// uint32 blobBaseFeeScalar = 1014213
|
|
180
|
-
// uint32 baseFeeScalar = 5227
|
|
181
|
-
value: BigInt {
|
|
182
|
-
words: vec![
|
|
183
|
-
0x0000000000000000_u64, // least significative
|
|
184
|
-
0x0000000000000000_u64,
|
|
185
|
-
0x00000000000f79c5_u64,
|
|
186
|
-
0x000000000000146b_u64,
|
|
187
|
-
],
|
|
188
|
-
sign_bit: false,
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
StorageSlot {
|
|
192
|
-
index: BigInt::from(4u64),
|
|
193
|
-
// bytes32 batcherHash = 0
|
|
194
|
-
value: BigInt::from(0u64),
|
|
195
|
-
},
|
|
196
|
-
StorageSlot {
|
|
197
|
-
index: BigInt::from(5u64),
|
|
198
|
-
// uint256 l1FeeOverhead = 0
|
|
199
|
-
value: BigInt::from(0u64),
|
|
200
|
-
},
|
|
201
|
-
StorageSlot {
|
|
202
|
-
index: BigInt::from(6u64),
|
|
203
|
-
// uint256 l1FeeScalar = 0
|
|
204
|
-
value: BigInt::from(0u64),
|
|
205
|
-
},
|
|
206
|
-
StorageSlot {
|
|
207
|
-
index: BigInt::from(7u64),
|
|
208
|
-
// uint256 blobBaseFee = 10 gwei
|
|
209
|
-
value: BigInt::from(0x00000002540be400_u64),
|
|
210
|
-
},
|
|
211
|
-
]),
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
/* The rest of the predeploys use a stubbed bytecode that reverts with a
|
|
215
|
-
message indicating that the predeploy is not supported. For each of
|
|
216
|
-
them, the Solidity code that generates the bytecode is:
|
|
217
|
-
|
|
218
|
-
// SPDX-License-Identifier: Unlicense
|
|
219
|
-
pragma solidity ^0.8.0;
|
|
220
|
-
|
|
221
|
-
contract NotSupported {
|
|
222
|
-
fallback() external payable {
|
|
223
|
-
revert("Predeploy <PredeployName> is not supported.");
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
*/
|
|
227
|
-
let stubbed_predeploys_data = vec![
|
|
228
|
-
(
|
|
229
|
-
"LegacyMessagePasser",
|
|
230
|
-
hex!("4200000000000000000000000000000000000000"),
|
|
231
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b60006048602f8360bf565b91507f5072656465706c6f79204c65676163794d65737361676550617373657220697360008301527f206e6f7420737570706f727465642e00000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea26469706673582212206ba272e31c33ce6fe2612b534c5aa5ed8905e1bed8a757ff1a74cc06509a17f664736f6c63430008000033",
|
|
232
|
-
),
|
|
233
|
-
(
|
|
234
|
-
"DeployerWhitelist",
|
|
235
|
-
hex!("4200000000000000000000000000000000000002"),
|
|
236
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b60006048602d8360bf565b91507f5072656465706c6f79204465706c6f79657257686974656c697374206973206e60008301527f6f7420737570706f727465642e000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea26469706673582212206af5fc0549e5db963a08cb2864cbbf5c4e27efb08219fc0e29bda83f84b121ac64736f6c63430008000033",
|
|
237
|
-
),
|
|
238
|
-
(
|
|
239
|
-
"LegacyERC20ETH",
|
|
240
|
-
hex!("DeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000"),
|
|
241
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b60006048602a8360bf565b91507f5072656465706c6f79204c65676163794552433230455448206973206e6f742060008301527f737570706f727465642e000000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea264697066735822122054e7f9d6c12400d5b4b67aed39be8c44a8b1461519e96a0e7764c69417239c7964736f6c63430008000033",
|
|
242
|
-
),
|
|
243
|
-
(
|
|
244
|
-
"WETH9",
|
|
245
|
-
hex!("4200000000000000000000000000000000000006"),
|
|
246
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b6000604860218360bf565b91507f5072656465706c6f79205745544839206973206e6f7420737570706f7274656460008301527f2e000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea2646970667358221220860ec43d585e1b040780713555b6fc492d748c73586bdb8f2b9af441c4452dbf64736f6c63430008000033",
|
|
247
|
-
),
|
|
248
|
-
(
|
|
249
|
-
"L2CrossDomainMessenger",
|
|
250
|
-
hex!("4200000000000000000000000000000000000007"),
|
|
251
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b6000604860328360bf565b91507f5072656465706c6f79204c3243726f7373446f6d61696e4d657373656e67657260008301527f206973206e6f7420737570706f727465642e00000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea26469706673582212200fadec69889de49a1a3a14d4e7e477e00921681e12650f510863d0077c16f58864736f6c63430008000033",
|
|
252
|
-
),
|
|
253
|
-
(
|
|
254
|
-
"L2StandardBridge",
|
|
255
|
-
hex!("4200000000000000000000000000000000000010"),
|
|
256
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b60006048602c8360bf565b91507f5072656465706c6f79204c325374616e64617264427269646765206973206e6f60008301527f7420737570706f727465642e00000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea2646970667358221220ce5c24ee894b04d974b95cd204ab35f85906430ba6f49d1ea70d3d0c9c204cb764736f6c63430008000033",
|
|
257
|
-
),
|
|
258
|
-
(
|
|
259
|
-
"SequencerFeeVault",
|
|
260
|
-
hex!("4200000000000000000000000000000000000011"),
|
|
261
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b60006048602d8360bf565b91507f5072656465706c6f792053657175656e6365724665655661756c74206973206e60008301527f6f7420737570706f727465642e000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea26469706673582212203990ed752a94bb02bd5162fef116c1b62079e8207c5164b3ae5a115f5cf0b31164736f6c63430008000033",
|
|
262
|
-
),
|
|
263
|
-
(
|
|
264
|
-
"OptimismMintableERC20Factory",
|
|
265
|
-
hex!("4200000000000000000000000000000000000012"),
|
|
266
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b6000604860388360bf565b91507f5072656465706c6f79204f7074696d69736d4d696e7461626c6545524332304660008301527f6163746f7279206973206e6f7420737570706f727465642e00000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea2646970667358221220240605543d69b93641a24f1d153969c3969089a04a162fc9f18f95de926b385564736f6c63430008000033",
|
|
267
|
-
),
|
|
268
|
-
(
|
|
269
|
-
"L1BlockNumber",
|
|
270
|
-
hex!("4200000000000000000000000000000000000013"),
|
|
271
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b6000604860298360bf565b91507f5072656465706c6f79204c31426c6f636b4e756d626572206973206e6f74207360008301527f7570706f727465642e00000000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea264697066735822122099ba6da366313d162bab19a497fab2200808ddd24935b9f8be496c3622110b1164736f6c63430008000033",
|
|
272
|
-
),
|
|
273
|
-
(
|
|
274
|
-
"GovernanceToken",
|
|
275
|
-
hex!("4200000000000000000000000000000000000042"),
|
|
276
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b60006048602b8360bf565b91507f5072656465706c6f7920476f7665726e616e6365546f6b656e206973206e6f7460008301527f20737570706f727465642e0000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea26469706673582212205a22322e97c15d3a28eb86abac215ed31bcf6e0cf562e2679ce5fb3495953cfc64736f6c63430008000033",
|
|
277
|
-
),
|
|
278
|
-
(
|
|
279
|
-
"L2ToL1MessagePasser",
|
|
280
|
-
hex!("4200000000000000000000000000000000000016"),
|
|
281
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b60006048602f8360bf565b91507f5072656465706c6f79204c32546f4c314d65737361676550617373657220697360008301527f206e6f7420737570706f727465642e00000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea26469706673582212205b2ed2ecc932d0e4a45e97ae7ac256e58848453ac06733b27890587962871a1864736f6c63430008000033",
|
|
282
|
-
),
|
|
283
|
-
(
|
|
284
|
-
"L2ERC721Bridge",
|
|
285
|
-
hex!("4200000000000000000000000000000000000014"),
|
|
286
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b60006048602a8360bf565b91507f5072656465706c6f79204c32455243373231427269646765206973206e6f742060008301527f737570706f727465642e000000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea26469706673582212203f9de306b34383b29e9dfb174fd424d7e11d31e8859d0e96a2aa3a46609e826c64736f6c63430008000033",
|
|
287
|
-
),
|
|
288
|
-
(
|
|
289
|
-
"OptimismMintableERC721Factory",
|
|
290
|
-
hex!("4200000000000000000000000000000000000017"),
|
|
291
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b6000604860398360bf565b91507f5072656465706c6f79204f7074696d69736d4d696e7461626c6545524337323160008301527f466163746f7279206973206e6f7420737570706f727465642e000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea264697066735822122033131ae0c34f3246f5031971388431bd1dfb1b92d6b08d92a0a905911c1eeeeb64736f6c63430008000033",
|
|
292
|
-
),
|
|
293
|
-
(
|
|
294
|
-
"ProxyAdmin",
|
|
295
|
-
hex!("4200000000000000000000000000000000000018"),
|
|
296
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b6000604860268360bf565b91507f5072656465706c6f792050726f787941646d696e206973206e6f74207375707060008301527f6f727465642e00000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea2646970667358221220c7b191ff1b21c73fb6a26fd1e972d6844631a700b7a316ca2d9e04905af44dbb64736f6c63430008000033",
|
|
297
|
-
),
|
|
298
|
-
(
|
|
299
|
-
"BaseFeeVault",
|
|
300
|
-
hex!("4200000000000000000000000000000000000019"),
|
|
301
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b6000604860288360bf565b91507f5072656465706c6f7920426173654665655661756c74206973206e6f7420737560008301527f70706f727465642e0000000000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea2646970667358221220535ae2b8a6393c0be4de1dce095f5e17fc0c7a46b40ac7793db894328f1799e764736f6c63430008000033",
|
|
302
|
-
),
|
|
303
|
-
(
|
|
304
|
-
"L1FeeVault",
|
|
305
|
-
hex!("420000000000000000000000000000000000001a"),
|
|
306
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b6000604860268360bf565b91507f5072656465706c6f79204c314665655661756c74206973206e6f74207375707060008301527f6f727465642e00000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea2646970667358221220dac6ab093c79da782b6e98ec67c48758f6c1cb80cba58e080c114a9b8c93befc64736f6c63430008000033",
|
|
307
|
-
),
|
|
308
|
-
(
|
|
309
|
-
"SchemaRegistry",
|
|
310
|
-
hex!("4200000000000000000000000000000000000020"),
|
|
311
|
-
"0x60806040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040160349060a1565b60405180910390fd5b60006048602a8360bf565b91507f5072656465706c6f7920536368656d615265676973747279206973206e6f742060008301527f737570706f727465642e000000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050818103600083015260b881603d565b9050919050565b60008282526020820190509291505056fea2646970667358221220b3daf5355920b581943cabb92a7cc67123467fdd1b054cb0c5f0e587c08da1be64736f6c63430008000033",
|
|
312
|
-
),
|
|
313
|
-
(
|
|
314
|
-
"EAS",
|
|
315
|
-
hex!("4200000000000000000000000000000000000021"),
|
|
316
|
-
"0x60806040526040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401603490607b565b60405180910390fd5b60006048601f836099565b91507f5072656465706c6f7920454153206973206e6f7420737570706f727465642e006000830152602082019050919050565b60006020820190508181036000830152609281603d565b9050919050565b60008282526020820190509291505056fea2646970667358221220afa6c1aa54a8b3f4f979e1297db5838a94353f3b77b5ecc164da19db26ea89f564736f6c63430008000033",
|
|
317
|
-
),
|
|
318
|
-
];
|
|
319
|
-
|
|
320
|
-
let stubbed_predeploys = stubbed_predeploys_data
|
|
321
|
-
.iter()
|
|
322
|
-
.map(|(name, address, code)| AccountOverride {
|
|
323
|
-
address: address.into(),
|
|
324
|
-
balance: Some(BigInt::from(0u64)),
|
|
325
|
-
nonce: Some(BigInt::from(0u64)),
|
|
326
|
-
code: Some(
|
|
327
|
-
hex::decode(code)
|
|
328
|
-
.unwrap_or_else(|e| panic!("The bytecode for the {name} predeploy should be a valid hex string, got error: {e}"))
|
|
329
|
-
.into(),
|
|
330
|
-
),
|
|
331
|
-
storage: Some(vec![]),
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
let predeploys = vec![gas_price_oracle_override(hardfork.into()), l1_block];
|
|
335
|
-
|
|
336
|
-
predeploys.into_iter().chain(stubbed_predeploys).collect()
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
#[napi(catch_unwind)]
|
|
340
|
-
pub fn op_provider_factory() -> ProviderFactory {
|
|
341
|
-
let factory: Arc<dyn SyncProviderFactory> = Arc::new(OpProviderFactory);
|
|
342
|
-
factory.into()
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
fn gas_price_oracle_override(hardfork: edr_op::Hardfork) -> AccountOverride {
|
|
346
|
-
if hardfork >= edr_op::Hardfork::ISTHMUS {
|
|
347
|
-
gas_price_oracle_isthmus()
|
|
348
|
-
} else if hardfork >= edr_op::Hardfork::FJORD {
|
|
349
|
-
gas_price_oracle_fjord()
|
|
350
|
-
} else {
|
|
351
|
-
gas_price_oracle_ecotone()
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
fn gas_price_oracle_ecotone() -> AccountOverride {
|
|
356
|
-
AccountOverride {
|
|
357
|
-
address: Uint8Array::with_data_copied(GAS_PRICE_ORACLE_ADDRESS),
|
|
358
|
-
balance: None,
|
|
359
|
-
nonce: None,
|
|
360
|
-
code: Some(gas_price_oracle_code_ecotone().into()),
|
|
361
|
-
storage: Some(vec![StorageSlot {
|
|
362
|
-
index: BigInt::from(0u64),
|
|
363
|
-
// bool isEcotone = true
|
|
364
|
-
value: BigInt::from(
|
|
365
|
-
0x0000000000000000000000000000000000000000000000000000000000000001u64,
|
|
366
|
-
),
|
|
367
|
-
}]),
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
fn gas_price_oracle_fjord() -> AccountOverride {
|
|
372
|
-
AccountOverride {
|
|
373
|
-
address: Uint8Array::with_data_copied(GAS_PRICE_ORACLE_ADDRESS),
|
|
374
|
-
balance: None,
|
|
375
|
-
nonce: None,
|
|
376
|
-
code: Some(gas_price_oracle_code_fjord().into()),
|
|
377
|
-
storage: Some(vec![StorageSlot {
|
|
378
|
-
index: BigInt::from(0u64),
|
|
379
|
-
// bool isEcotone = true
|
|
380
|
-
// bool isFjord = true
|
|
381
|
-
value: BigInt::from(
|
|
382
|
-
0x0000000000000000000000000000000000000000000000000000000000000101u64,
|
|
383
|
-
),
|
|
384
|
-
}]),
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
fn gas_price_oracle_isthmus() -> AccountOverride {
|
|
389
|
-
AccountOverride {
|
|
390
|
-
address: Uint8Array::with_data_copied(GAS_PRICE_ORACLE_ADDRESS),
|
|
391
|
-
balance: None,
|
|
392
|
-
nonce: None,
|
|
393
|
-
code: Some(gas_price_oracle_code_isthmus().into()),
|
|
394
|
-
storage: Some(vec![StorageSlot {
|
|
395
|
-
index: BigInt::from(0u64),
|
|
396
|
-
// bool isEcotone = true
|
|
397
|
-
// bool isFjord = true
|
|
398
|
-
// bool isIsthmus = true
|
|
399
|
-
value: BigInt::from(
|
|
400
|
-
0x0000000000000000000000000000000000000000000000000000000000010101u64,
|
|
401
|
-
),
|
|
402
|
-
}]),
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
macro_rules! export_spec_id {
|
|
407
|
-
($($variant:ident,)*) => {
|
|
408
|
-
$(
|
|
409
|
-
#[napi]
|
|
410
|
-
pub const $variant: &str = edr_op::hardfork::name::$variant;
|
|
411
|
-
)*
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
export_spec_id! {
|
|
416
|
-
BEDROCK,
|
|
417
|
-
REGOLITH,
|
|
418
|
-
CANYON,
|
|
419
|
-
ECOTONE,
|
|
420
|
-
FJORD,
|
|
421
|
-
GRANITE,
|
|
422
|
-
HOLOCENE,
|
|
423
|
-
ISTHMUS,
|
|
424
|
-
}
|