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

typeArguments = null resulting in type Option<Vec> #6257

Open
segfault-magnet opened this issue Jul 10, 2024 · 0 comments
Open

typeArguments = null resulting in type Option<Vec> #6257

segfault-magnet opened this issue Jul 10, 2024 · 0 comments
Labels
bug Something isn't working triage This issue was opened with a template and needs to be triaged by code owners.

Comments

@segfault-magnet
Copy link
Contributor

Related Component

compiler

Problem

When I compile a sway project, the resulting ABI is missing the typeArguments for the configurables arg of the function seen in the snippet below:

    pub type ContractConfigurables = Vec<(u64, Vec<u8>)>;
    #[storage(read, write)]
    fn register_contract(
        child_contract: ContractId,
        configurables: Option<ContractConfigurables>,
    ) -> Result<BytecodeRoot, str> {

The resulting ABI:

   {
      "inputs": [
        {
          "name": "child_contract",
          "type": 10,
          "typeArguments": null
        },
        {
          "name": "configurables",
          "type": 4,
          "typeArguments": [
            {
              "name": "",
              "type": 13,
              "typeArguments": null
            }
          ]
        }
      ],
      "name": "register_contract",

type 4 is an Option, type 13 is a Vec. The Vec has no generic arguments causing issues later on in the SDK when trying to generate bindings.

Steps

  1. clone https://github.com/segfault-magnet/src12_repro
  2. build with forc 0.61.2
  3. inspect json ABI for the issue mentioned

Possible Solution(s)

No response

Notes

No response

Installed components

fuelup show
Default host: x86_64-unknown-linux-gnu
fuelup home: /home/segfault_magnet/.fuelup

Installed toolchains
--------------------
latest-x86_64-unknown-linux-gnu
custom (default)
nightly-2024-05-27-x86_64-unknown-linux-gnu
nightly-2024-07-09-x86_64-unknown-linux-gnu

active toolchain
----------------
custom (default)
  forc : 0.61.2
    - forc-client
      - forc-deploy : 0.61.2
      - forc-run : 0.61.2
    - forc-crypto : 0.61.2
    - forc-debug : 0.61.2
    - forc-doc : 0.61.2
    - forc-fmt : 0.61.2
    - forc-lsp : 0.61.2
    - forc-tx : 0.61.2
    - forc-wallet : not found
  fuel-core : 0.31.0
  fuel-core-keygen : 0.31.0

fuels versions
--------------
forc : 0.64.0
@segfault-magnet segfault-magnet added bug Something isn't working triage This issue was opened with a template and needs to be triaged by code owners. labels Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue was opened with a template and needs to be triaged by code owners.
Projects
None yet
Development

No branches or pull requests

1 participant