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

Allow dynamic types in configurables #6760

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
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
59 changes: 26 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ sway-ir-macros = { path = "sway-ir/sway-ir-macros", version = "0.66.6" }
#

# Dependencies from the `fuel-abi-types` repository:
fuel-abi-types = "0.7"
fuel-abi-types = "0.8"

# Dependencies from the `fuel-core` repository:
#
Expand Down Expand Up @@ -234,3 +234,10 @@ vec1 = "1.8"
vte = "0.13"
walkdir = "2.3"
whoami = "1.5"

[patch.crates-io]
fuel-abi-types = { git = "https://github.com/FuelLabs/fuel-abi-types", branch = "xunilrj/indirect-configurables" }
fuels = { git = "https://github.com/FuelLabs/fuels-rs", branch = "hal3e/dynamic-configurables" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the plan to wait for the fuels branches to be merged this PR goes out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

fuels-core = { git = "https://github.com/FuelLabs/fuels-rs", branch = "hal3e/dynamic-configurables" }
fuels-accounts = { git = "https://github.com/FuelLabs/fuels-rs", branch = "hal3e/dynamic-configurables" }
fuels-code-gen = { git = "https://github.com/FuelLabs/fuels-rs", branch = "hal3e/dynamic-configurables" }
2 changes: 2 additions & 0 deletions forc-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,8 @@ fn report_assembly_information(
sway_core::asm_generation::Datum::Collection(items) => {
items.iter().map(calculate_entry_size).sum()
}

sway_core::asm_generation::Datum::OffsetOf(_) => std::mem::size_of::<u64>() as u64,
}
}

Expand Down
2 changes: 1 addition & 1 deletion forc-plugins/forc-client/src/op/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ pub async fn deploy_executables(
println_action_green("Uploading", "blob containing executable bytecode.");
loader.upload_blob(account.clone()).await?;
println_action_green("Generating", "loader bytecode for the uploaded executable.");
let loader_bytecode = loader.code();
let loader_bytecode = loader.code()?;
let pkg_name = &pkg.descriptor.name;
let out_dir = pkg.descriptor.manifest_file.dir().join("out");
let bin_path = out_dir.join(format!("{pkg_name}-loader.bin"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,62 +251,74 @@
{
"name": "BOOL",
"concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903",
"offset": 240
"offset": 240,
"indirect": false
},
{
"name": "U8",
"concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b",
"offset": 352
"offset": 352,
"indirect": false
},
{
"name": "U16",
"concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef",
"offset": 296
"offset": 296,
"indirect": false
},
{
"name": "U32",
"concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc",
"offset": 336
"offset": 336,
"indirect": false
},
{
"name": "U64",
"concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0",
"offset": 344
"offset": 344,
"indirect": false
},
{
"name": "U256",
"concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e",
"offset": 304
"offset": 304,
"indirect": false
},
{
"name": "B256",
"concreteTypeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b",
"offset": 208
"offset": 208,
"indirect": false
},
{
"name": "STR_4",
"concreteTypeId": "94f0fa95c830be5e4f711963e83259fe7e8bc723278ab6ec34449e791a99b53a",
"offset": 280
"offset": 280,
"indirect": false
},
{
"name": "TUPLE",
"concreteTypeId": "e0128f7be9902d1fe16326cafe703b52038064a7997b03ebfc1c9dd607e1536c",
"offset": 288
"offset": 288,
"indirect": false
},
{
"name": "ARRAY",
"concreteTypeId": "d9fac01ab38fe10950758ae9604da330d6406a71fda3ef1ea818121261132d56",
"offset": 192
"offset": 192,
"indirect": false
},
{
"name": "STRUCT",
"concreteTypeId": "563310524b4f4447a10d0e50556310253dfb3b5eb4b29c3773222b737c8b7075",
"offset": 264
"offset": 264,
"indirect": false
},
{
"name": "ENUM",
"concreteTypeId": "37cd1cba311039a851ac8bfa614cc41359b4ad95c8656fcef2e8f504fe7a1272",
"offset": 248
"offset": 248,
"indirect": false
}
]
}
6 changes: 3 additions & 3 deletions forc-plugins/forc-client/tests/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,13 +1198,13 @@ async fn call_with_forc_generated_overrides(node_url: &str, contract_id: Contrac
// we are ensuring forc-deploy indeed generated the files we are basing our
// tests below.
let generated_loader_abi_path = tmp_dir.path().join("out/deployed_script-loader-abi.json");
let generated_loader_abi = fs::read_to_string(generated_loader_abi_path).unwrap();
let generated_loader_abi = fs::read_to_string(&generated_loader_abi_path).unwrap();

// this path is basically, `forc-plugins/forc-client/test/data/deployed_script/deployed_script-loader-abi.json`.
let used_loader_abi_path = project_dir.join("deployed_script-loader-abi.json");
let used_loader_abi = fs::read_to_string(used_loader_abi_path).unwrap();
let used_loader_abi = fs::read_to_string(&used_loader_abi_path).unwrap();

assert_eq!(generated_loader_abi, used_loader_abi);
pretty_assertions::assert_eq!(generated_loader_abi, used_loader_abi);

let generated_loader_bin = tmp_dir.path().join("out/deployed_script-loader.bin");
abigen!(Script(
Expand Down
2 changes: 1 addition & 1 deletion forc-plugins/forc-migrate/src/migrations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub(crate) struct MutProgramInfo<'a> {
pub engines: &'a Engines,
}

impl<'a> ProgramInfo<'a> {
impl ProgramInfo<'_> {
pub(crate) fn as_mut(&mut self) -> MutProgramInfo {
MutProgramInfo {
lexed_program: &mut self.lexed_program,
Expand Down
2 changes: 1 addition & 1 deletion forc-plugins/forc-migrate/src/modifying/storage_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl ToInKey for Expr {
}
}

impl<'a> Modifier<'a, StorageField> {
impl Modifier<'_, StorageField> {
pub(crate) fn with_in_key<K: ToInKey>(&mut self, key: K) -> &mut Self {
// If the `in` token already exists, just replace the key and leave the `in`
// token as is. Place the key after the `in` token.
Expand Down
1 change: 1 addition & 0 deletions sway-core/src/abi_generation/fuel_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ fn generate_configurables(
decl.type_ascription.type_id,
)?,
offset: 0,
indirect: decl.is_indirect(engines),
})
})
.collect::<Result<Vec<_>, _>>()
Expand Down
Loading
Loading