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

Lots of warnings on forc init -> forc test, considering cleanup #4709

Closed
SilentCicero opened this issue Jun 27, 2023 · 5 comments · Fixed by #4854
Closed

Lots of warnings on forc init -> forc test, considering cleanup #4709

SilentCicero opened this issue Jun 27, 2023 · 5 comments · Fixed by #4854
Assignees
Labels
code quality forc-pkg Everything related to the `forc-pkg` crate. good first issue Good for newcomers lib: std Standard library P: high Should be looked at if there are no critical issues left

Comments

@SilentCicero
Copy link
Member

I'm getting a huge set of warnings when I run forc init, then forc test out of the box.

The default example and test should not have all these warnings and repeated warning statements. Default examples should be always up to date and not produce warnings.

  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: constants
  WARNING! unused manifest key: constants
  Creating a new `Forc.lock` file. (Cause: lock file did not exist)
    Adding core
    Adding std git+https://github.com/fuellabs/sway?tag=v0.39.0#7a095280e7e1c0bfbbfc201867896e720aab7209
   Created new lock file at /fuel-oracle/src/contracts/Forc.lock
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: project.target
  WARNING! unused manifest key: constants
  WARNING! unused manifest key: constants
 Compiling library core (.forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core)
warning
   --> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:485:21
    |
483 | 
484 |     fn lsh(self, other: u64) -> Self {
485 |         __lsh(self, other)
    |                     ----- This cast, from integer type of width sixty four to integer type of width thirty two, will lose precision.
486 |     }
487 |     fn rsh(self, other: u64) -> Self {
    |
____

warning
   --> /.forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:488:21
    |
486 | 
487 |     fn rsh(self, other: u64) -> Self {
488 |         __rsh(self, other)
    |                     ----- This cast, from integer type of width sixty four to integer type of width thirty two, will lose precision.
489 |     }
490 | }
    |
____

warning
   --> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:494:21
    |
492 | 
493 |     fn lsh(self, other: u64) -> Self {
494 |         __lsh(self, other)
    |                     ----- This cast, from integer type of width sixty four to integer type of width sixteen, will lose precision.
495 |     }
496 |     fn rsh(self, other: u64) -> Self {
    |
____

warning
   --> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:497:21
    |
495 | 
496 |     fn rsh(self, other: u64) -> Self {
497 |         __rsh(self, other)
    |                     ----- This cast, from integer type of width sixty four to integer type of width sixteen, will lose precision.
498 |     }
499 | }
    |
____

warning
   --> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:503:21
    |
501 | 
502 |     fn lsh(self, other: u64) -> Self {
503 |         __lsh(self, other)
    |                     ----- This cast, from integer type of width sixty four to integer type of width eight, will lose precision.
504 |     }
505 |     fn rsh(self, other: u64) -> Self {
    |
____

warning
   --> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:506:21
    |
504 | 
505 |     fn rsh(self, other: u64) -> Self {
506 |         __rsh(self, other)
    |                     ----- This cast, from integer type of width sixty four to integer type of width eight, will lose precision.
507 |     }
508 | }
    |
____

warning
 --> forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/lib.sw:0:1
  |
0 | library;
  | - Module privacy rules will soon change to make modules private by default.
                                            You can enable the new behavior with the --experimental-private-modules flag, which will become the default behavior in a later release.
                                            More details are available in the related RFC: https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0008-private-modules.md
1 | 
2 | pub mod primitives;
  |
____

  Compiled library "core" with 7 warnings.
 Compiling library std (git+https://github.com/fuellabs/sway?tag=v0.39.0#7a095280e7e1c0bfbbfc201867896e720aab7209)
warning
 --> forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-std/src/lib.sw:0:1
  |
0 | library;
  | - Module privacy rules will soon change to make modules private by default.
                                            You can enable the new behavior with the --experimental-private-modules flag, which will become the default behavior in a later release.
                                            More details are available in the related RFC: https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0008-private-modules.md
1 | 
2 | pub mod error_signals;
  |
____

  Compiled library "std" with 1 warning.
 Compiling contract contracts (/fuel-oracle/src/contracts)
warning
 -->/fuel-oracle/src/contracts/src/main.sw:0:1
  |
0 | contract;
  | - Module privacy rules will soon change to make modules private by default.
                                            You can enable the new behavior with the --experimental-private-modules flag, which will become the default behavior in a later release.
                                            More details are available in the related RFC: https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0008-private-modules.md
1 | 
2 | abi MyContract {
  |
____

  Compiled contract "contracts" with 1 warning.
warning
 --> /fuel-oracle/src/contracts/src/main.sw:0:1
  |
0 | contract;
  | - Module privacy rules will soon change to make modules private by default.
                                            You can enable the new behavior with the --experimental-private-modules flag, which will become the default behavior in a later release.
                                            More details are available in the related RFC: https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0008-private-modules.md
1 | 
2 | abi MyContract {
  |
____

  Compiled contract "contracts" with 1 warning.
  Finished debug in 948.981125ms
  contract contracts
      Bytecode size: 60 bytes
   Running 0 tests
   Result: OK. 0 passed. 0 failed. Finished in 0ns.
@SilentCicero SilentCicero added forc-test Everything related to the `forc-test` lib and `forc test` command. good first issue Good for newcomers code quality labels Jun 27, 2023
@kayagokalp kayagokalp added lib: std Standard library forc-pkg Everything related to the `forc-pkg` crate. and removed forc-test Everything related to the `forc-test` lib and `forc test` command. labels Jun 28, 2023
@kayagokalp
Copy link
Member

Manifest key warnings seems related to forc-pkg manifest parser. Other warnings are emitted from compiling the std lib, added appropriate tags for them. Also not sure if you are aware of it but, this output seems to be emitted from an outdated version of the forc and compiler private-modules feature is stabilized in the latest release (v0.40.1) (so there shouldn't be a warning for it)

@tritao
Copy link
Contributor

tritao commented Jun 30, 2023

Some of those have already been fixed in #4648.

@JoshuaBatty JoshuaBatty added the P: high Should be looked at if there are no critical issues left label Jul 11, 2023
@eureka-cpu
Copy link
Contributor

@gr00vytvniks the warnings produced here are just duplicates of the same warning, you would just need to dedup them if you want to claim this issue

@kayagokalp
Copy link
Member

I think this issue is due to different warnings coming from different projects so I guess there is nothing to de-duplicate. Basically forc searches for std library after checking out sway repo. And there are couple of projects it checks before finding std library. So the warnings are actually coming from different places. For example simple_predicate which is living under docs folder here is using a deprecated feature . So they should be cleared in order to remove this warnings. This will also be solved once we mirror std and core to a different repo for faster checking as there won't be another projects to create warnings there.

@kayagokalp
Copy link
Member

Steps to close this issue:

  1. let mut manifest: Self = serde_ignored::deserialize(toml_de, |path| {
    add a prompt to print the manifest_str so that you can see which manifests are creating this issue, One of them is simple_predicate there are couple more of them.
  2. You will have manifest files and warnings printed, the manifest file before the warning is the one creating that warning. So look at the name of the project
  3. Find that project in sway repo, and remove the unused key from its manifest file.

Basically [constants] table and target field should be removed from the manifest file.

kayagokalp added a commit that referenced this issue Jul 18, 2023
## Description

We will be fixing #4709, but the one thing more important than fixing it
might be ensuring that it does not happen again. Until we have the
bandwidth to introduce nice CLI testing suite I am adding myself as code
owner to forc-pkg. Since forc-pkg lives between the compiler and forc,
it is seeing lots of traffic and I will try to make sure nothing changes
in terms of user experience during those changes. Feel free to close
this, if you feel like we might have a better way of ensuring this
before we got the CLI testing suite ready.
@kayagokalp kayagokalp assigned kayagokalp and unassigned kayagokalp Jul 24, 2023
kayagokalp pushed a commit that referenced this issue Jul 26, 2023
)

## Description

This PR removes unused keys in sway reference so that warnings do not
appear while searching for std after creating a new project with `forc
init`.

Closes #4709 
Co-authored-by: Kaya Gökalp <kaya.gokalp@fuel.sh>
@kayagokalp kayagokalp self-assigned this Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality forc-pkg Everything related to the `forc-pkg` crate. good first issue Good for newcomers lib: std Standard library P: high Should be looked at if there are no critical issues left
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants