@nomicfoundation/edr 0.3.3 → 0.3.4

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/Cargo.toml CHANGED
@@ -29,6 +29,7 @@ parking_lot = { version = "0.12.1", default-features = false }
29
29
  lazy_static = { version = "1.4.0", features = [] }
30
30
  rand = { version = "0.8.4", optional = true }
31
31
  serde = { version = "1.0.189", features = ["derive"] }
32
+ mimalloc = { version = "0.1.39", default-features = false }
32
33
 
33
34
  [target.x86_64-unknown-linux-gnu.dependencies]
34
35
  openssl-sys = { version = "0.9.93", features = ["vendored"] }
@@ -46,7 +47,7 @@ openssl-sys = { version = "0.9.93", features = ["vendored"] }
46
47
  napi-build = "2.0.1"
47
48
 
48
49
  [features]
49
- tracing = ["edr_evm/tracing"]
50
+ tracing = ["edr_evm/tracing", "edr_provider/tracing"]
50
51
  scenarios = ["rand"]
51
52
 
52
53
  [profile.release]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomicfoundation/edr",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -43,15 +43,15 @@
43
43
  "node": ">= 18"
44
44
  },
45
45
  "optionalDependencies": {
46
- "@nomicfoundation/edr-win32-x64-msvc": "0.3.3",
47
- "@nomicfoundation/edr-darwin-x64": "0.3.3",
48
- "@nomicfoundation/edr-linux-x64-gnu": "0.3.3",
49
- "@nomicfoundation/edr-darwin-arm64": "0.3.3",
50
- "@nomicfoundation/edr-win32-arm64-msvc": "0.3.3",
51
- "@nomicfoundation/edr-linux-arm64-gnu": "0.3.3",
52
- "@nomicfoundation/edr-linux-arm64-musl": "0.3.3",
53
- "@nomicfoundation/edr-linux-x64-musl": "0.3.3",
54
- "@nomicfoundation/edr-win32-ia32-msvc": "0.3.3"
46
+ "@nomicfoundation/edr-win32-x64-msvc": "0.3.4",
47
+ "@nomicfoundation/edr-darwin-x64": "0.3.4",
48
+ "@nomicfoundation/edr-linux-x64-gnu": "0.3.4",
49
+ "@nomicfoundation/edr-darwin-arm64": "0.3.4",
50
+ "@nomicfoundation/edr-win32-arm64-msvc": "0.3.4",
51
+ "@nomicfoundation/edr-linux-arm64-gnu": "0.3.4",
52
+ "@nomicfoundation/edr-linux-arm64-musl": "0.3.4",
53
+ "@nomicfoundation/edr-linux-x64-musl": "0.3.4",
54
+ "@nomicfoundation/edr-win32-ia32-msvc": "0.3.4"
55
55
  },
56
56
  "scripts": {
57
57
  "artifacts": "napi artifacts",
package/src/lib.rs CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  //! NAPI bindings for the EDR EVM
4
4
 
5
+ #[global_allocator]
6
+ static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
7
+
5
8
  mod account;
6
9
  mod block;
7
10
  mod call_override;
@@ -1,4 +1,5 @@
1
1
  use std::{
2
+ num::NonZeroU64,
2
3
  path::PathBuf,
3
4
  time::{Duration, SystemTime},
4
5
  };
@@ -172,7 +173,15 @@ impl TryFrom<MiningConfig> for edr_provider::MiningConfig {
172
173
  .map(|interval| {
173
174
  let interval = match interval {
174
175
  Either::A(interval) => {
175
- edr_provider::IntervalConfig::Fixed(interval.try_cast()?)
176
+ let interval = interval.try_cast()?;
177
+ let interval = NonZeroU64::new(interval).ok_or_else(|| {
178
+ napi::Error::new(
179
+ napi::Status::GenericFailure,
180
+ "Interval must be greater than 0",
181
+ )
182
+ })?;
183
+
184
+ edr_provider::IntervalConfig::Fixed(interval)
176
185
  }
177
186
  Either::B(IntervalRange { min, max }) => edr_provider::IntervalConfig::Range {
178
187
  min: min.try_cast()?,
@@ -225,6 +234,14 @@ impl TryFrom<ProviderConfig> for edr_provider::ProviderConfig {
225
234
  )
226
235
  .collect::<napi::Result<_>>()?;
227
236
 
237
+ let block_gas_limit =
238
+ NonZeroU64::new(value.block_gas_limit.try_cast()?).ok_or_else(|| {
239
+ napi::Error::new(
240
+ napi::Status::GenericFailure,
241
+ "Block gas limit must be greater than 0",
242
+ )
243
+ })?;
244
+
228
245
  Ok(Self {
229
246
  accounts: value
230
247
  .genesis_accounts
@@ -235,7 +252,7 @@ impl TryFrom<ProviderConfig> for edr_provider::ProviderConfig {
235
252
  allow_unlimited_contract_size: value.allow_unlimited_contract_size,
236
253
  bail_on_call_failure: value.bail_on_call_failure,
237
254
  bail_on_transaction_failure: value.bail_on_transaction_failure,
238
- block_gas_limit: value.block_gas_limit.try_cast()?,
255
+ block_gas_limit,
239
256
  cache_dir: PathBuf::from(
240
257
  value
241
258
  .cache_dir