paritytech / zombienet-sdk

ZombieNet SDK
https://paritytech.github.io/zombienet-sdk/zombienet_sdk/
GNU General Public License v3.0
28 stars 8 forks source link

Error when parsing empty args array #202

Closed AlexD10S closed 3 months ago

AlexD10S commented 3 months ago

I am not sure if this is an issue with the SDK or is something that shouldn't be in the Config file.

When I try to parse a Config file that contains an empty array for args: args = [""], it throws an error (The config file is the one in the frontier-parachain-template):

TOML parse error at line 30, column 11
   |
30 |   args = [""]
   |           ^^
the provided argument is invalid and doesn't match Arg::Option or Arg::Flag

After some researching I can see the error is when parsing the Config file in the function load_from_toml (line):

let mut network_config: NetworkConfig = toml::from_str(
            re.replace_all(&file_str, "$field_name = \"$u128_value\"")
                .as_ref(),
        )?;

Should be ignored if the array is empty?

Thanks for this amazing SDK!! We are using it in our tool pop-cli.

pepoviola commented 3 months ago

Hi @AlexD10S, thanks for your feedback! I will update the toml in that repo since an empty string can not be deserialized to a valid argument (and I'm not sure if we want to deserialize to an empty arg). That make sense to you?

Thanks again for your feedback :)

https://github.com/paritytech/frontier-parachain-template/pull/38

AlexD10S commented 3 months ago

It makes sense, thanks @pepoviola