Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling run_external #5918

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sway-lib-std/src/lib.sw
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub mod alias;
pub mod hash;
pub mod asset_id;
pub mod contract_id;
pub mod execution;
// pub mod execution;
pub mod constants;
pub mod call_frames;
pub mod context;
Expand Down
10 changes: 0 additions & 10 deletions test/src/sdk-harness/Forc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,6 @@ name = "result_option_expect"
source = "member"
dependencies = ["std"]

[[package]]
name = "run_external_proxy"
source = "member"
dependencies = ["std"]

[[package]]
name = "run_external_target"
source = "member"
dependencies = ["std"]

[[package]]
name = "script_bytecode"
source = "member"
Expand Down
5 changes: 3 additions & 2 deletions test/src/sdk-harness/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ members = [
"test_projects/registers",
"test_projects/result_in_abi",
"test_projects/result_option_expect",
"test_projects/run_external_proxy",
"test_projects/run_external_target",
# Disabled until LDC is stabilized
# "test_projects/run_external_proxy",
# "test_projects/run_external_target",
"test_projects/script_bytecode",
"test_projects/script_data",
"test_projects/storage",
Expand Down
141 changes: 71 additions & 70 deletions test/src/sdk-harness/test_projects/run_external_proxy/mod.rs
Original file line number Diff line number Diff line change
@@ -1,78 +1,79 @@
use fuels::prelude::*;
// use fuels::prelude::*;

abigen!(Contract(
name = "RunExternalProxyContract",
abi = "test_projects/run_external_proxy/out/release/run_external_proxy-abi.json",
));
// abigen!(Contract(
// name = "RunExternalProxyContract",
// abi = "test_projects/run_external_proxy/out/release/run_external_proxy-abi.json",
// ));

#[tokio::test]
#[ignore]
async fn run_external_can_proxy_call() {
let wallet = launch_provider_and_get_wallet().await.unwrap();
// #[tokio::test]
// #[ignore]
// async fn run_external_can_proxy_call() {
// let wallet = launch_provider_and_get_wallet().await.unwrap();

let target_id = Contract::load_from(
"test_projects/run_external_target/out/release/run_external_target.bin",
LoadConfiguration::default()
.with_storage_configuration(StorageConfiguration::default().with_autoload(false)),
)
.unwrap()
.deploy(&wallet, TxPolicies::default())
.await
.unwrap();
// let target_id = Contract::load_from(
// "test_projects/run_external_target/out/release/run_external_target.bin",
// LoadConfiguration::default()
// .with_storage_configuration(StorageConfiguration::default().with_autoload(false)),
// )
// .unwrap()
// .deploy(&wallet, TxPolicies::default())
// .await
// .unwrap();

let configurables = RunExternalProxyContractConfigurables::default()
.with_TARGET(target_id.clone().into())
.unwrap();
let id = Contract::load_from(
"test_projects/run_external_proxy/out/release/run_external_proxy.bin",
LoadConfiguration::default().with_configurables(configurables),
)
.unwrap()
.deploy(&wallet, TxPolicies::default())
.await
.unwrap();
// let configurables = RunExternalProxyContractConfigurables::default()
// .with_TARGET(target_id.clone().into())
// .unwrap();
// let id = Contract::load_from(
// "test_projects/run_external_proxy/out/release/run_external_proxy.bin",
// LoadConfiguration::default().with_configurables(configurables),
// )
// .unwrap()
// .deploy(&wallet, TxPolicies::default())
// .await
// .unwrap();

let instance = RunExternalProxyContract::new(id.clone(), wallet);
// let instance = RunExternalProxyContract::new(id.clone(), wallet);

// Call "double_value"
// Will call run_external_proxy::double_value
// that will call run_external_target::double_value
// and return the value doubled.
let result = instance
.methods()
.double_value(42)
.with_contract_ids(&[target_id.clone().into()])
.call()
.await
.unwrap();
for r in result.receipts.iter() {
match r {
Receipt::LogData { data, .. } => {
if let Some(data) = data {
if data.len() > 8 {
if let Ok(s) = std::str::from_utf8(&data[8..]) {
print!("{:?} ", s);
}
}
// // Call "double_value"
// // Will call run_external_proxy::double_value
// // that will call run_external_target::double_value
// // and return the value doubled.
// let result = instance
// .methods()
// .double_value(42)
// .with_contract_ids(&[target_id.clone().into()])
// .call()
// .await
// .unwrap();
// // TODO: this can be removed after the string slice bug is fixed.
// for r in result.receipts.iter() {
// match r {
// Receipt::LogData { data, .. } => {
// if let Some(data) = data {
// if data.len() > 8 {
// if let Ok(s) = std::str::from_utf8(&data[8..]) {
// print!("{:?} ", s);
// }
// }

println!("{:?}", data);
}
}
_ => {}
}
}
assert_eq!(result.value, 84);
// println!("{:?}", data);
// }
// }
// _ => {}
// }
// }
// assert_eq!(result.value, 84);

// Call "does_not_exist_in_the_target"
// Will call run_external_proxy::does_not_exist_in_the_target
// it will proxy the call to run_external_target,
// and endup in the fallback, fn that will triple the input value
let result = instance
.methods()
.does_not_exist_in_the_target(42)
.with_contract_ids(&[target_id.into()])
.call()
.await
.unwrap();
assert_eq!(result.value, 126);
}
// // Call "does_not_exist_in_the_target"
// // Will call run_external_proxy::does_not_exist_in_the_target
// // it will proxy the call to run_external_target,
// // and endup in the fallback, fn that will triple the input value
// let result = instance
// .methods()
// .does_not_exist_in_the_target(42)
// .with_contract_ids(&[target_id.into()])
// .call()
// .await
// .unwrap();
// assert_eq!(result.value, 126);
// }
Loading