@nomicfoundation/edr 0.12.0-next.3 → 0.12.0-next.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/index.d.ts +29 -7
- package/package.json +8 -8
- package/src/mock/time.rs +12 -1
- package/src/solidity_tests/config.rs +41 -10
package/index.d.ts
CHANGED
|
@@ -812,14 +812,36 @@ export interface PathPermission {
|
|
|
812
812
|
/** The targeted path guarded by the permission */
|
|
813
813
|
path: string
|
|
814
814
|
}
|
|
815
|
-
/**
|
|
815
|
+
/**
|
|
816
|
+
* Determines the level of file system access for the given path.
|
|
817
|
+
*
|
|
818
|
+
* Exact path matching is used for file permissions. Prefix matching is used
|
|
819
|
+
* for directory permissions.
|
|
820
|
+
*
|
|
821
|
+
* Giving write access to configuration files, source files or executables
|
|
822
|
+
* in a project is considered dangerous, because it can be used by malicious
|
|
823
|
+
* Solidity dependencies to escape the EVM sandbox. It is therefore
|
|
824
|
+
* recommended to give write access to specific safe files only. If write
|
|
825
|
+
* access to a directory is needed, please make sure that it doesn't contain
|
|
826
|
+
* configuration files, source files or executables neither in the top level
|
|
827
|
+
* directory, nor in any subdirectories.
|
|
828
|
+
*/
|
|
816
829
|
export enum FsAccessPermission {
|
|
817
|
-
/**
|
|
818
|
-
|
|
819
|
-
/** Only reading
|
|
820
|
-
|
|
821
|
-
/** Only writing
|
|
822
|
-
|
|
830
|
+
/** Allows reading and writing the file */
|
|
831
|
+
ReadWriteFile = 0,
|
|
832
|
+
/** Only allows reading the file */
|
|
833
|
+
ReadFile = 1,
|
|
834
|
+
/** Only allows writing the file */
|
|
835
|
+
WriteFile = 2,
|
|
836
|
+
/**
|
|
837
|
+
* Allows reading and writing all files in the directory and its
|
|
838
|
+
* subdirectories
|
|
839
|
+
*/
|
|
840
|
+
DangerouslyReadWriteDirectory = 3,
|
|
841
|
+
/** Allows reading all files in the directory and its subdirectories */
|
|
842
|
+
ReadDirectory = 4,
|
|
843
|
+
/** Allows writing all files in the directory and its subdirectories */
|
|
844
|
+
DangerouslyWriteDirectory = 5
|
|
823
845
|
}
|
|
824
846
|
export interface AddressLabel {
|
|
825
847
|
/** The address to label */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomicfoundation/edr",
|
|
3
|
-
"version": "0.12.0-next.
|
|
3
|
+
"version": "0.12.0-next.4",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@napi-rs/cli": "^2.18.4",
|
|
6
6
|
"@nomicfoundation/ethereumjs-util": "^9.0.4",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"repository": "NomicFoundation/edr.git",
|
|
60
60
|
"types": "index.d.ts",
|
|
61
61
|
"optionalDependencies": {
|
|
62
|
-
"@nomicfoundation/edr-darwin-arm64": "0.12.0-next.
|
|
63
|
-
"@nomicfoundation/edr-darwin-x64": "0.12.0-next.
|
|
64
|
-
"@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.
|
|
65
|
-
"@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.
|
|
66
|
-
"@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.
|
|
67
|
-
"@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.
|
|
68
|
-
"@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.
|
|
62
|
+
"@nomicfoundation/edr-darwin-arm64": "0.12.0-next.4",
|
|
63
|
+
"@nomicfoundation/edr-darwin-x64": "0.12.0-next.4",
|
|
64
|
+
"@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.4",
|
|
65
|
+
"@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.4",
|
|
66
|
+
"@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.4",
|
|
67
|
+
"@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.4",
|
|
68
|
+
"@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.4"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"artifacts": "napi artifacts",
|
package/src/mock/time.rs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
use std::sync::Arc;
|
|
2
2
|
|
|
3
|
+
use edr_eth::{spec::ChainSpec, B256};
|
|
4
|
+
use edr_evm::spec::RuntimeSpec;
|
|
3
5
|
use edr_generic::GenericChainSpec;
|
|
4
6
|
use edr_napi_core::logger::Logger;
|
|
7
|
+
use edr_rpc_eth::RpcSpec;
|
|
5
8
|
use edr_solidity::contract_decoder::ContractDecoder;
|
|
6
9
|
use napi::{bindgen_prelude::BigInt, tokio::runtime, Env, JsObject};
|
|
7
10
|
use napi_derive::napi;
|
|
@@ -106,7 +109,15 @@ pub fn create_provider_with_mock_timer(
|
|
|
106
109
|
edr_provider::Provider::<GenericChainSpec, Arc<edr_provider::time::MockTime>>::new(
|
|
107
110
|
runtime.clone(),
|
|
108
111
|
Box::new(logger),
|
|
109
|
-
Box::new(move |event|
|
|
112
|
+
Box::new(move |event| {
|
|
113
|
+
let event = edr_napi_core::subscription::SubscriptionEvent::new::<
|
|
114
|
+
<GenericChainSpec as RuntimeSpec>::Block,
|
|
115
|
+
<GenericChainSpec as RpcSpec>::RpcBlock<B256>,
|
|
116
|
+
<GenericChainSpec as ChainSpec>::SignedTransaction,
|
|
117
|
+
>(event);
|
|
118
|
+
|
|
119
|
+
subscription_callback.call(event);
|
|
120
|
+
}),
|
|
110
121
|
provider_config,
|
|
111
122
|
contract_decoder.clone(),
|
|
112
123
|
timer,
|
|
@@ -657,24 +657,55 @@ impl From<PathPermission> for foundry_cheatcodes::PathPermission {
|
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
659
|
|
|
660
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Determines the level of file system access for the given path.
|
|
662
|
+
*
|
|
663
|
+
* Exact path matching is used for file permissions. Prefix matching is used
|
|
664
|
+
* for directory permissions.
|
|
665
|
+
*
|
|
666
|
+
* Giving write access to configuration files, source files or executables
|
|
667
|
+
* in a project is considered dangerous, because it can be used by malicious
|
|
668
|
+
* Solidity dependencies to escape the EVM sandbox. It is therefore
|
|
669
|
+
* recommended to give write access to specific safe files only. If write
|
|
670
|
+
* access to a directory is needed, please make sure that it doesn't contain
|
|
671
|
+
* configuration files, source files or executables neither in the top level
|
|
672
|
+
* directory, nor in any subdirectories.
|
|
673
|
+
*/
|
|
661
674
|
#[napi]
|
|
662
675
|
#[derive(Debug, serde::Serialize)]
|
|
663
676
|
pub enum FsAccessPermission {
|
|
664
|
-
///
|
|
665
|
-
|
|
666
|
-
/// Only reading
|
|
667
|
-
|
|
668
|
-
/// Only writing
|
|
669
|
-
|
|
677
|
+
/// Allows reading and writing the file
|
|
678
|
+
ReadWriteFile,
|
|
679
|
+
/// Only allows reading the file
|
|
680
|
+
ReadFile,
|
|
681
|
+
/// Only allows writing the file
|
|
682
|
+
WriteFile,
|
|
683
|
+
/// Allows reading and writing all files in the directory and its
|
|
684
|
+
/// subdirectories
|
|
685
|
+
DangerouslyReadWriteDirectory,
|
|
686
|
+
/// Allows reading all files in the directory and its subdirectories
|
|
687
|
+
ReadDirectory,
|
|
688
|
+
/// Allows writing all files in the directory and its subdirectories
|
|
689
|
+
DangerouslyWriteDirectory,
|
|
670
690
|
}
|
|
671
691
|
|
|
672
692
|
impl From<FsAccessPermission> for foundry_cheatcodes::FsAccessPermission {
|
|
673
693
|
fn from(value: FsAccessPermission) -> Self {
|
|
674
694
|
match value {
|
|
675
|
-
FsAccessPermission::
|
|
676
|
-
|
|
677
|
-
|
|
695
|
+
FsAccessPermission::ReadWriteFile => {
|
|
696
|
+
foundry_cheatcodes::FsAccessPermission::ReadWriteFile
|
|
697
|
+
}
|
|
698
|
+
FsAccessPermission::ReadFile => foundry_cheatcodes::FsAccessPermission::ReadFile,
|
|
699
|
+
FsAccessPermission::WriteFile => foundry_cheatcodes::FsAccessPermission::WriteFile,
|
|
700
|
+
FsAccessPermission::DangerouslyReadWriteDirectory => {
|
|
701
|
+
foundry_cheatcodes::FsAccessPermission::DangerouslyReadWriteDirectory
|
|
702
|
+
}
|
|
703
|
+
FsAccessPermission::ReadDirectory => {
|
|
704
|
+
foundry_cheatcodes::FsAccessPermission::ReadDirectory
|
|
705
|
+
}
|
|
706
|
+
FsAccessPermission::DangerouslyWriteDirectory => {
|
|
707
|
+
foundry_cheatcodes::FsAccessPermission::DangerouslyWriteDirectory
|
|
708
|
+
}
|
|
678
709
|
}
|
|
679
710
|
}
|
|
680
711
|
}
|