@nomicfoundation/edr 0.3.4 → 0.3.6
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 +6 -6
- package/index.js +25 -10
- package/package.json +14 -17
- package/src/context.rs +3 -2
- package/src/provider.rs +18 -12
package/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "edr_napi"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.5"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
|
|
6
6
|
[lib]
|
|
@@ -16,10 +16,10 @@ log = { version = "0.4.20", default-features = false }
|
|
|
16
16
|
# The `async` feature ensures that a tokio runtime is available
|
|
17
17
|
napi = { version = "2.16.0", default-features = false, features = ["async", "error_anyhow", "napi8", "serde-json"] }
|
|
18
18
|
napi-derive = "2.16.0"
|
|
19
|
-
edr_defaults = { version = "0.
|
|
20
|
-
edr_evm = { version = "0.
|
|
21
|
-
edr_eth = { version = "0.
|
|
22
|
-
edr_provider = { version = "0.
|
|
19
|
+
edr_defaults = { version = "0.3.5", path = "../edr_defaults" }
|
|
20
|
+
edr_evm = { version = "0.3.5", path = "../edr_evm", features = ["tracing"]}
|
|
21
|
+
edr_eth = { version = "0.3.5", path = "../edr_eth" }
|
|
22
|
+
edr_provider = { version = "0.3.5", path = "../edr_provider" }
|
|
23
23
|
serde_json = { version = "1.0.85", default-features = false, features = ["alloc"] }
|
|
24
24
|
thiserror = { version = "1.0.37", default-features = false }
|
|
25
25
|
tracing = { version = "0.1.37", default-features = false, features = ["std"] }
|
|
@@ -29,7 +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
|
+
mimalloc = { version = "0.1.39", default-features = false, features = ["local_dynamic_tls"] }
|
|
33
33
|
|
|
34
34
|
[target.x86_64-unknown-linux-gnu.dependencies]
|
|
35
35
|
openssl-sys = { version = "0.9.93", features = ["vendored"] }
|
package/index.js
CHANGED
|
@@ -224,17 +224,32 @@ switch (platform) {
|
|
|
224
224
|
}
|
|
225
225
|
break
|
|
226
226
|
case 'arm':
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
227
|
+
if (isMusl()) {
|
|
228
|
+
localFileExisted = existsSync(
|
|
229
|
+
join(__dirname, 'edr.linux-arm-musleabihf.node')
|
|
230
|
+
)
|
|
231
|
+
try {
|
|
232
|
+
if (localFileExisted) {
|
|
233
|
+
nativeBinding = require('./edr.linux-arm-musleabihf.node')
|
|
234
|
+
} else {
|
|
235
|
+
nativeBinding = require('@nomicfoundation/edr-linux-arm-musleabihf')
|
|
236
|
+
}
|
|
237
|
+
} catch (e) {
|
|
238
|
+
loadError = e
|
|
239
|
+
}
|
|
240
|
+
} else {
|
|
241
|
+
localFileExisted = existsSync(
|
|
242
|
+
join(__dirname, 'edr.linux-arm-gnueabihf.node')
|
|
243
|
+
)
|
|
244
|
+
try {
|
|
245
|
+
if (localFileExisted) {
|
|
246
|
+
nativeBinding = require('./edr.linux-arm-gnueabihf.node')
|
|
247
|
+
} else {
|
|
248
|
+
nativeBinding = require('@nomicfoundation/edr-linux-arm-gnueabihf')
|
|
249
|
+
}
|
|
250
|
+
} catch (e) {
|
|
251
|
+
loadError = e
|
|
235
252
|
}
|
|
236
|
-
} catch (e) {
|
|
237
|
-
loadError = e
|
|
238
253
|
}
|
|
239
254
|
break
|
|
240
255
|
case 'riscv64':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomicfoundation/edr",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"src/"
|
|
12
12
|
],
|
|
13
13
|
"repository": {
|
|
14
|
-
"url": "https://github.com/NomicFoundation/
|
|
14
|
+
"url": "https://github.com/NomicFoundation/edr.git",
|
|
15
15
|
"type": "git"
|
|
16
16
|
},
|
|
17
17
|
"napi": {
|
|
@@ -19,17 +19,15 @@
|
|
|
19
19
|
"triples": {
|
|
20
20
|
"additional": [
|
|
21
21
|
"aarch64-apple-darwin",
|
|
22
|
-
"aarch64-pc-windows-msvc",
|
|
23
22
|
"aarch64-unknown-linux-gnu",
|
|
24
23
|
"aarch64-unknown-linux-musl",
|
|
25
|
-
"x86_64-unknown-linux-musl"
|
|
26
|
-
"i686-pc-windows-msvc"
|
|
24
|
+
"x86_64-unknown-linux-musl"
|
|
27
25
|
]
|
|
28
26
|
}
|
|
29
27
|
},
|
|
30
28
|
"license": "MIT",
|
|
31
29
|
"devDependencies": {
|
|
32
|
-
"@napi-rs/cli": "^2.
|
|
30
|
+
"@napi-rs/cli": "^2.18.1",
|
|
33
31
|
"@types/chai": "^4.2.0",
|
|
34
32
|
"@types/chai-as-promised": "^7.1.8",
|
|
35
33
|
"@types/mocha": ">=9.1.0",
|
|
@@ -37,28 +35,27 @@
|
|
|
37
35
|
"chai": "^4.3.6",
|
|
38
36
|
"chai-as-promised": "^7.1.1",
|
|
39
37
|
"mocha": "^10.0.0",
|
|
38
|
+
"ts-node": "^10.8.0",
|
|
40
39
|
"typescript": "~4.5.2"
|
|
41
40
|
},
|
|
42
41
|
"engines": {
|
|
43
42
|
"node": ">= 18"
|
|
44
43
|
},
|
|
45
44
|
"optionalDependencies": {
|
|
46
|
-
"@nomicfoundation/edr-win32-x64-msvc": "0.3.
|
|
47
|
-
"@nomicfoundation/edr-darwin-x64": "0.3.
|
|
48
|
-
"@nomicfoundation/edr-linux-x64-gnu": "0.3.
|
|
49
|
-
"@nomicfoundation/edr-darwin-arm64": "0.3.
|
|
50
|
-
"@nomicfoundation/edr-
|
|
51
|
-
"@nomicfoundation/edr-linux-arm64-
|
|
52
|
-
"@nomicfoundation/edr-linux-
|
|
53
|
-
"@nomicfoundation/edr-linux-x64-musl": "0.3.4",
|
|
54
|
-
"@nomicfoundation/edr-win32-ia32-msvc": "0.3.4"
|
|
45
|
+
"@nomicfoundation/edr-win32-x64-msvc": "0.3.6",
|
|
46
|
+
"@nomicfoundation/edr-darwin-x64": "0.3.6",
|
|
47
|
+
"@nomicfoundation/edr-linux-x64-gnu": "0.3.6",
|
|
48
|
+
"@nomicfoundation/edr-darwin-arm64": "0.3.6",
|
|
49
|
+
"@nomicfoundation/edr-linux-arm64-gnu": "0.3.6",
|
|
50
|
+
"@nomicfoundation/edr-linux-arm64-musl": "0.3.6",
|
|
51
|
+
"@nomicfoundation/edr-linux-x64-musl": "0.3.6"
|
|
55
52
|
},
|
|
56
53
|
"scripts": {
|
|
57
54
|
"artifacts": "napi artifacts",
|
|
58
55
|
"build": "napi build --platform --release",
|
|
59
56
|
"build:debug": "napi build --platform",
|
|
60
|
-
"build:tracing": "napi build --release --features tracing",
|
|
61
|
-
"build:scenarios": "napi build --release --features scenarios",
|
|
57
|
+
"build:tracing": "napi build --platform --release --features tracing",
|
|
58
|
+
"build:scenarios": "napi build --platform --release --features scenarios",
|
|
62
59
|
"universal": "napi universal",
|
|
63
60
|
"version": "napi version",
|
|
64
61
|
"pretest": "pnpm build",
|
package/src/context.rs
CHANGED
|
@@ -34,6 +34,7 @@ impl EdrContext {
|
|
|
34
34
|
|
|
35
35
|
#[derive(Debug)]
|
|
36
36
|
pub struct Context {
|
|
37
|
+
_subscriber_guard: tracing::subscriber::DefaultGuard,
|
|
37
38
|
#[cfg(feature = "tracing")]
|
|
38
39
|
_tracing_write_guard: tracing_flame::FlushGuard<std::io::BufWriter<std::fs::File>>,
|
|
39
40
|
}
|
|
@@ -63,10 +64,10 @@ impl Context {
|
|
|
63
64
|
#[cfg(feature = "tracing")]
|
|
64
65
|
let subscriber = subscriber.with(flame_layer);
|
|
65
66
|
|
|
66
|
-
tracing::subscriber::
|
|
67
|
-
.expect("Could not set global default tracing subscriber");
|
|
67
|
+
let subscriber_guard = tracing::subscriber::set_default(subscriber);
|
|
68
68
|
|
|
69
69
|
Ok(Self {
|
|
70
|
+
_subscriber_guard: subscriber_guard,
|
|
70
71
|
#[cfg(feature = "tracing")]
|
|
71
72
|
_tracing_write_guard: guard,
|
|
72
73
|
})
|
package/src/provider.rs
CHANGED
|
@@ -3,7 +3,7 @@ mod config;
|
|
|
3
3
|
use std::sync::Arc;
|
|
4
4
|
|
|
5
5
|
use edr_eth::remote::jsonrpc;
|
|
6
|
-
use edr_provider::InvalidRequestReason;
|
|
6
|
+
use edr_provider::{time::CurrentTime, InvalidRequestReason};
|
|
7
7
|
use napi::{tokio::runtime, Env, JsFunction, JsObject, Status};
|
|
8
8
|
use napi_derive::napi;
|
|
9
9
|
|
|
@@ -52,17 +52,23 @@ impl Provider {
|
|
|
52
52
|
edr_provider::Logger::is_enabled(&*logger),
|
|
53
53
|
))?;
|
|
54
54
|
|
|
55
|
-
let result = edr_provider::Provider::new(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
let result = edr_provider::Provider::new(
|
|
56
|
+
runtime,
|
|
57
|
+
logger,
|
|
58
|
+
subscriber_callback,
|
|
59
|
+
config,
|
|
60
|
+
CurrentTime,
|
|
61
|
+
)
|
|
62
|
+
.map_or_else(
|
|
63
|
+
|error| Err(napi::Error::new(Status::GenericFailure, error.to_string())),
|
|
64
|
+
|provider| {
|
|
65
|
+
Ok(Provider {
|
|
66
|
+
provider: Arc::new(provider),
|
|
67
|
+
#[cfg(feature = "scenarios")]
|
|
68
|
+
scenario_file,
|
|
69
|
+
})
|
|
70
|
+
},
|
|
71
|
+
);
|
|
66
72
|
|
|
67
73
|
deferred.resolve(|_env| result);
|
|
68
74
|
Ok::<_, napi::Error>(())
|