Issue with Script Building on Devnet
Hello friends,
In our Spark system, we use not only contracts but also scripts. When migrating to devnet, these scripts stopped building. For example, here is one of them that helps match orders efficiently, but when I try to build it using the devnet compiler version (e.g., 0.58), the build fails with the following error (it worked on beta-5):
error: Private struct field is inaccessible
--> /Users/alexey/Desktop/orderbook-contract/match-in-pairs-script/src/main.sw:17:23
|
...
17 | while (i < orders.len) {
| ^^^ Private field "len" of the struct "Vec" is inaccessible in this module.
| --- help: Private fields can only be accessed within the module in which their struct is declared.
|
::: /Users/alexey/.forc/git/checkouts/std-9be0d6062747ea7/3c86abb4008017cfb93132c759758cd7a02fc8d9/sway-lib-std/src/vec.sw:144:5
|
...
144 | len: u64,
| --- info: Field "len" is declared here as private.
|
____
Aborting due to 1 error.
Error: Failed to compile match-in-pairs-script
How to reproduce
fuelup default nightly
git clone git@github.com:compolabs/orderbook-contract.git
cd orderbook-contract
git checkout devnet-master-merge
forc build
My toolchain
Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup
installed toolchains
--------------------
beta-5-aarch64-apple-darwin
latest-aarch64-apple-darwin
nightly-aarch64-apple-darwin (default)
nightly-2024-01-24-aarch64-apple-darwin
nightly-2024-03-30-aarch64-apple-darwin
active toolchain
----------------
nightly-aarch64-apple-darwin (default)
forc : 0.58.0+nightly.20240515.3c86abb400
- forc-client
- forc-deploy : 0.58.0+nightly.20240515.3c86abb400
- forc-run : 0.58.0+nightly.20240515.3c86abb400
- forc-crypto : 0.58.0+nightly.20240515.3c86abb400
- forc-debug : 0.58.0+nightly.20240515.3c86abb400
- forc-doc : 0.58.0+nightly.20240515.3c86abb400
- forc-explore : 0.28.1+nightly.20240515.4bb7392eed
- forc-fmt : 0.58.0+nightly.20240515.3c86abb400
- forc-lsp : 0.58.0+nightly.20240515.3c86abb400
- forc-tx : 0.58.0+nightly.20240515.3c86abb400
- forc-wallet : 0.7.0+nightly.20240515.3576ae79c4
fuel-core : 0.26.0+nightly.20240515.5b427ebdb1
fuel-core-keygen : not found
Has anyone faced a similar issue or can provide insights on what might be going wrong? Any help would be appreciated!
Thank you!