Skip to content

Commit 9a273df

Browse files
committed
refactor: sandbox_client in sandbox crate
1 parent 31f9bb3 commit 9a273df

File tree

11 files changed

+146
-121
lines changed

11 files changed

+146
-121
lines changed

Cargo.lock

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/e2e/Cargo.toml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ categories.workspace = true
1515
include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
1616

1717
[dependencies]
18-
ink_e2e_macro = { workspace = true, default-features = true }
1918
ink = { workspace = true, default-features = true }
2019
ink_env = { workspace = true, default-features = true }
2120
ink_primitives = { workspace = true, default-features = true }
2221
ink_revive_types = { workspace = true, default-features = true }
23-
ink_sandbox = { version = "=6.0.0-alpha.4", path = "../sandbox", optional = true }
2422

2523
cargo_metadata = { workspace = true }
2624
contract-build = { workspace = true }
@@ -60,7 +58,6 @@ scale-info = { workspace = true, features = ["derive"] }
6058
default = [ "std" ]
6159
std = [
6260
"impl-serde/std",
63-
"ink_e2e_macro/std",
6461
"scale-info/std",
6562
"scale/std",
6663
"serde/std",
@@ -70,14 +67,6 @@ std = [
7067
"sp-io/std",
7168
"sp-runtime-interface/std",
7269
"sp-weights/std",
73-
"ink_e2e_macro/std",
7470
"ink_revive_types/std",
75-
"ink_sandbox?/std",
7671
"frame-support/std",
7772
]
78-
79-
sandbox = [
80-
"dep:ink_sandbox",
81-
"dep:subxt-metadata",
82-
"ink_e2e_macro/sandbox",
83-
]

crates/e2e/macro/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ tracing = { workspace = true }
3131

3232
[dev-dependencies]
3333
ink = { path = "../../ink" }
34-
ink_e2e = { path = "../", features = ["sandbox"] }
34+
ink_e2e = { path = "../" }
3535
temp-env = "0.3.6"
3636

3737
[features]
38-
std = ["derive_more/std"]
39-
sandbox = []
38+
std = ["derive_more/std"]

crates/e2e/macro/src/codegen.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ impl InkE2ETest {
7878
Backend::Node(node_config) => {
7979
build_full_client(&environment, exec_build_contracts, node_config)
8080
}
81-
#[cfg(any(test, feature = "sandbox"))]
8281
Backend::RuntimeOnly(runtime) => {
8382
build_runtime_client(exec_build_contracts, runtime.into())
8483
}
@@ -170,7 +169,6 @@ fn build_full_client(
170169
}
171170
}
172171

173-
#[cfg(any(test, feature = "sandbox"))]
174172
fn build_runtime_client(contracts: TokenStream2, runtime: syn::Path) -> TokenStream2 {
175173
quote! {
176174
let contracts = #contracts;

crates/e2e/macro/src/config.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub enum Backend {
2424
///
2525
/// This runs a runtime emulator within `TestExternalities`
2626
/// the same process as the test.
27-
#[cfg(any(test, feature = "sandbox"))]
2827
RuntimeOnly(RuntimeOnly),
2928
}
3029

@@ -64,7 +63,6 @@ impl Node {
6463
}
6564

6665
/// The runtime emulator that should be used within `TestExternalities`
67-
#[cfg(any(test, feature = "sandbox"))]
6866
#[derive(Clone, Eq, PartialEq, Debug, darling::FromMeta)]
6967
pub enum RuntimeOnly {
7068
#[darling(word)]
@@ -73,7 +71,6 @@ pub enum RuntimeOnly {
7371
Sandbox(syn::Path),
7472
}
7573

76-
#[cfg(any(test, feature = "sandbox"))]
7774
impl From<RuntimeOnly> for syn::Path {
7875
fn from(value: RuntimeOnly) -> Self {
7976
match value {

crates/e2e/src/error.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,3 @@ where
7070
<Self as fmt::Debug>::fmt(self, f)
7171
}
7272
}
73-
74-
/// Dummy error type for sandbox_client
75-
#[derive(Debug, thiserror::Error)]
76-
pub struct SandboxErr {
77-
msg: String,
78-
}
79-
80-
impl SandboxErr {
81-
/// Create a new `SandboxErr` with the given message.
82-
#[allow(dead_code)]
83-
pub fn new(msg: String) -> Self {
84-
Self { msg }
85-
}
86-
}
87-
88-
impl From<String> for SandboxErr {
89-
fn from(msg: String) -> Self {
90-
Self { msg }
91-
}
92-
}
93-
94-
impl fmt::Display for SandboxErr {
95-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
96-
write!(f, "SandboxErr: {}", self.msg)
97-
}
98-
}

crates/e2e/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ mod contract_results;
2828
mod error;
2929
pub mod events;
3030
mod node_proc;
31-
#[cfg(feature = "sandbox")]
32-
mod sandbox_client;
3331
mod subxt_client;
3432
mod xts;
3533

@@ -44,25 +42,30 @@ pub use backend_calls::{
4442
CallBuilder,
4543
InstantiateBuilder,
4644
};
47-
pub use client_utils::ContractsRegistry;
45+
pub use builders::{
46+
CreateBuilderPartial,
47+
constructor_exec_input,
48+
};
49+
pub use client_utils::{
50+
ContractsRegistry,
51+
code_hash,
52+
salt,
53+
};
4854
pub use contract_results::{
55+
BareInstantiationResult,
4956
CallDryRunResult,
5057
CallResult,
58+
ContractExecResultFor,
59+
ContractResult,
5160
InstantiateDryRunResult,
5261
InstantiationResult,
5362
UploadResult,
5463
};
55-
pub use ink_e2e_macro::test;
5664
pub use ink_revive_types::evm::CallTrace;
5765
pub use node_proc::{
5866
TestNodeProcess,
5967
TestNodeProcessBuilder,
6068
};
61-
#[cfg(feature = "sandbox")]
62-
pub use sandbox_client::{
63-
Client as SandboxClient,
64-
preset,
65-
};
6669
pub use sp_keyring::Sr25519Keyring;
6770
pub use subxt::{
6871
self,
@@ -85,9 +88,6 @@ pub use tokio;
8588
pub use tracing;
8689
pub use tracing_subscriber;
8790

88-
#[cfg(feature = "sandbox")]
89-
pub use ink_sandbox::DefaultSandbox;
90-
9191
use ink::codegen::ContractCallBuilder;
9292
use ink_env::{
9393
ContractEnv,

crates/sandbox/Cargo.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,17 @@ sp-runtime = { workspace = true }
2424
sp-io = { workspace = true }
2525
ink_primitives = { workspace = true }
2626
ink_revive_types = { workspace = true }
27+
ink_env = { workspace = true, default-features = true }
28+
ink_e2e = { path = "../e2e" }
29+
ink_e2e_macro = { workspace = true, default-features = true }
2730

31+
jsonrpsee = { workspace = true, features = ["ws-client"] }
32+
thiserror = { workspace = true }
2833
paste = { workspace = true }
2934
scale-info = { workspace = true }
35+
subxt = { workspace = true }
36+
subxt-metadata = { workspace = true }
37+
subxt-signer = { workspace = true, features = ["subxt", "sr25519", "unstable-eth"] }
3038

3139
[features]
3240
default = [
@@ -46,5 +54,6 @@ std = [
4654
"scale-info/std",
4755
"sp-core/std",
4856
"sp-externalities/std",
49-
"sp-io/std"
57+
"sp-io/std",
58+
"ink_e2e_macro/std",
5059
]

0 commit comments

Comments
 (0)