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

fuelup - forc binary distribution and toolchain manager #1

Closed
4 tasks
adlerjohn opened this issue Jun 14, 2021 · 16 comments
Closed
4 tasks

fuelup - forc binary distribution and toolchain manager #1

adlerjohn opened this issue Jun 14, 2021 · 16 comments
Assignees
Labels
enhancement enhancement to a current feature

Comments

@adlerjohn
Copy link
Contributor

adlerjohn commented Jun 14, 2021

We need a version manager similar to rustup that allows downloading, installing, and managing different versions of the compiler and forc. I suggest calling this forcup.

For now, the version manager should be able to:

@adlerjohn adlerjohn added the forc label Jun 14, 2021
@adlerjohn adlerjohn changed the title Verion manager Version manager Jun 14, 2021
@adlerjohn adlerjohn assigned digorithm and unassigned leviathanbeak Jan 9, 2022
mitchmindtree referenced this issue in mitchmindtree/sway Mar 28, 2022
* build:bump SDK and dep versions

* test;update tests to use new SDK version syntax

* style:cargo fmt

* build:add fule-vm as a dep

* test:add an is_within_range() function to avoid hardcoded vals

* style:cargo fmt
mitchmindtree referenced this issue in FuelLabs/sway Mar 29, 2022
* Initial commit

* Initial commit

* initial commit

* intial commit

* update manifest to use git core dependency

* add README

* Add README

* Fix link to forc (#1)

* Fix link to forc (#1)

* Add basic build CI workflow (#2)

* Add basic build CI workflow.

* Remove installation and use of fuel-core.

* Implement Modulo (#3)

Added "modulo" function so the % operator works

Very simple implementation to all the other functions just wrapping the mod opcode

* .gitattributes to highlight .sw syntax as rust (#3)

* .gitattributes to highlight .sw syntax as rust (#5)

* Add Result type (#6)

* Add Result type.

* Fix syntax.

* Add basic build CI workflow. (#8)

* Add in rsh and lsh operations (#6)

* Update ops.sw

* Weird spacing thing

* ec-recover (#5)

* Add ecr lib

* Add todo comment

* Add recover_pubkey and refactor ecr

* Fixup

* Update comments

* Add comments to ec-recover asm block

* Modify asm

* Clean up asm

* Fix B512 field assignment

* Fix ordering of lib deps

* Remove ec_recover, to be added in separate PR

* Clean up comments

* Adding the missing `ec_recover`functionality (#18)

* Add todo comment

* Add working ec_recover implementation

* Format manifest file. (#10)

* Adding the `mint` and `burn` token operations. (#26)

* Add token lib

* Add todo comment

* Rename token_id to asset_id

* Rename token_id to asset_id

* Rename token_id to asset_id

* Fix register names in asm block

* Fixup

* Refactor ugly  while loop

* Fixup

* Remove ecr from branch

* Fix review issues

* Modify type definition to silence warning re losing precision via type-cast

* Fix asm block registers

* Add only the mint function

* Ad burn to token lib

* "fix toml file"

* Split `eq` out of `Ord` and put it in `Eq` (#9)

* Moved eq into its own trait (Eq)

Moved eq into it's own trait (Eq) and then added all the implementations for u64, u32, u16, u8, and b256

* Forgot to delete u16's old Eq implementation

* Move le to a test implementation

* Fixed ge, le, and neq to not use eq and instead use inline assembly

* Update ops.sw

* Formatting changes

* Adding the force_transfer function to the token lib. (#27)

* Add force_transfer function to token lib

* Add import of ContractID type

* Implement the Eq trait for Address (#25)

* Impl Ord for Address

* Fix todo comment

* Fix toml formatting

* Add comment to use meq

* Impl Eq for Address

* Fix formatting

* Remove todo

* Add more methods to Result. (#16)

* Add more methods to Result.

* Don't use catch all.

* Use catch up, but fix typo.

* Fix return type.

* Compile workarounds.

* fmt

* Remove todo comments.

* fmt

* Make Result public.

* Add Option type & is_some/is_none methods (#31)

* Feat:Add Option type & is_some/is_none methods

* Doc:Improve module-level docs

* Fix:Add generic type T to match

* Simplify the B512 (and therefore ECR) code. (#33)

* Simplify the B512 (and therefore ECR) code.

Instead of 2 b256 fields in a struct we can use a 2 element array
instead.

I found that both the assumptions about memory layout and all the
copying was producing brittle code, and simplifying the ASM blocks as
much as possible is a good thing.

* Do a `forc fmt`.

* Adding the transfer_to_output function to token library (#32)

* Add force_transfer function to token lib

* Add import of ContractID type

* Add transfer_to_output function to token lib

* Add imports and temp remove constants

* Add else clause to if branch

* Add better comment

* Add final else clause to if branch

* Add semicolons to if-else

* style: add a comment and remove trailing semicolon from if statement in return position

* fix: make some comments internal

* fix: re-enable constants

* fix: change OUTPUT_LENGTH_LOCATION from 48 to 56

* fix: clean up assembly and incorporate PR review feedback

* docs: fix comments to reflect change to OUTPUT_LENGTH_LOCATION

* fix: remove redundent local variable assignment

* refactor: split asm blocks to avoid a second usage of the xos opcode

* style: forc fmt

* fix:change offset to 40 for getting amount

* Implementing an initial version of a msg_sender function (#30)

* Add module level docstring description

* Rearrange lib.sw order

* Use result type and add Sender type

* Improve function documentation

* refactor: improve clarity by removing the ! operator

* refactor: pass in constants to asm blocks

* fix: remove redundent `dep address;` from lib.sw

* fix: switch consts to enum

* refactor: revert to using constants for now but added TODO

* Minimal viable test harness for the stdlib (#37)

* config:update gitignore to ignore all tagket dirs

* feat:add working demo of test harness

* fix:add modules

* Add new demo_script_test project

* build:update dep versions in manifest files

* fix:update code in mod and main

* fix:change author email

* fixup

* fix:use local path to ttest current stdlib

* test:remove dummy test

* cleanup:remove dummy tests in prep for merge

* style:cargo fmt

* Porting token ops tests to the new stdlib test harness (#42)

* test:add token-ops tests

* test:update structure

* test:add more test

* test:adds more comments to failing tests

* test:remove failing tests from PR

* style:cargo fmt

* stle:forc fmt

* style:fix formatting I missed

* test:cleanup and remove logs

* bugfix: remove second register from gm opcode (#46)

* fix:remove second register from gm opcode

* docs:add link to gm opcode spec

* Add out directory to gitignore. (#50)

* Implement Square Root into the Standard Library (#49)

* Implement Square Root Function for uint types

* Update math.sw

* Update lib.sw

* Update math.sw

* Update math.sw

* Update math.sw

* Add Square Trait to uint

* Fix fmt

* Update math.sw

* Update math.sw

* Bump test dependencies. (#52)

* Bump test dependencies.

* Remove patch version.

* Use `t` instead of `T` for `Result` matches. (#53)

* Use t instead of T for Result matches.

* Update option.sw

* change author to authors in Forc.toml (#11)

* change author to authors in Forc.toml files (#56)

* switch from matches to if lets for enum destructuring (#62)

* switch from matches to if lets

* fmt

* Temporarily remove the Option and Result implementations (#63)

* fix:temp removal of result & option implementations

* fix:remove option & result from lib.sw

* fix:remove import of Result & change return type of msg_sender temporarily

* Fix return types of context::contract_id & context::msg_asset_id (#59)

* style:fix weird forc fmt issue

* fix:correct the return type for context module funcs

* test:add contract and json abi file

* test:add module to harness

* build:add manifest file

* test:add tests for context module

* style:forc fmt

* style:cargo fmt

* style:formatting

* fix:remove context test_project, coming in follow-up PR

* style:forc fmt

* Update token ops tests (#64)

* cleanup:remove duplicate abi

* build:update deps for sdk

* build:bump fuels-rs versions

* fix:remove salt field

* test:update to use newest syntax

* style:cargo fmt

* Adding a registers.sw module (#61)

* feat:add bare module registers

* feat:add registers.sw to expose16 reserved registers

* test:add new test project "registers"

* build:update forc manifest file

* test:add contract and abi.json

* test:add test file and empty tests

* test:temp disable ret & retl, add simple tests

* test:enable ret & retl again

* build:update manifest authors field

* build:remove redundant abi file

* fix:remove unneeded zero and one functions

* fix:remove zero and one funcs from abi and contract

* test:remove tests for zero and one & updates paths to abi file

* test:fix expected values and function calls

* style:forc fmt

* fix: add dep registers to context.sw

* style: forc fmt

* build:bump sdk version and add fuels-signers as a dep

* update tests to use new syntax

* style:cargo fmt & forc fmt

* Avoid implicit cast warning (#65)

* avoid implicit cast warning

* minor variable naming change

Co-authored-by: Mohammad <mohammad@Mohammads-MacBook-Pro.local>

* Fix test formatting. (#51)

* Ignore Forc lockfile (#69)

* Use new contract call syntax. (#70)

* Use new contract call syntax.

* Missed one

* Make core branch explicit (#71)

* Make core branch explicit

* Update Forc.toml

* fix:correct inline docs for registers.sw (#72)

* Fix some `path`s in the test project dependencies (#73)

The `path`s of dependencies should be point to the directory containing
the dependency's `Forc.toml` (not the `src`). This commit fixes the
`Forc.toml`s of the test projects to account for this.

There was also a spuriuos Forc.toml at `tests/Forc.toml` which has been
removed.

* Rename param in the ContractId::into() implementation (#76)

* fix:rename param

* docs:update comment and link tracking issue

* fixup

* Prefer `https` over `http` for forc git dependency URLs (#77)

This helps to resolve some dependency double-ups pending a proper
solution fix in `forc`.

See #931 and FuelLabs/fuels-rs#150 (comment)

* Add `out` and `Forc.lock` to gitignore (#13)

* Bump SDK version (#78)

* build:bump SDK and dep versions

* test;update tests to use new SDK version syntax

* style:cargo fmt

* build:add fule-vm as a dep

* test:add an is_within_range() function to avoid hardcoded vals

* style:cargo fmt

* Rename ETH_ID to NATIVE_ASSET_ID (#79)

* b256 -> contractId params for context functions which get balance from a contract (this or other) (#81)

* hotfix:complete param type changes (#82)

* Implement the `EQ` trait for `ContractId` (#83)

* feat:impl eq for ContractId

* test:add test project for contractId eq implementation

* test:wip on sscript test

* test:add script call draft

* test: finish script test

* test:finish test for contractId eq impl

* fix: remove comment

* style: cargo fmt

* build:remove core as unneeded dep

* Change `[project]` name from `lib-std` to `std` (#80)

See #977 for motivation.

* bump sdk to 0.7. Use test-helpers to cut down on boilerplate (#84)

* Cleanup stdlib tests (#85)

* cleanup: remove compiler warnings

* style: cargo fmt

* Adding a call_frames module (#66)

* test:add new test project call_frames

* test:add bare call_frames module

* feat:add initial call_frames.sw module

* feat:add new call frame access constants

* feat:add call_frames.sw and refactor context mod

* fix:reorder lib.sw

* style:cleanup comments'

* style:forc fmt

* refactor:reorganize functions by module and expose under context namespace

* cleanup:remove unneeded files from test project

* test:add initial draft test

* test:add first test

* temp:remove use of constants

* test:setup test project and artifact for call_frames

* test:outline primary tests

* test:fix test assertions

* cleanup:remove helper functions from call_frames until they can be tested

* style:cargo fmt & forc fmt

* test:cleanup forc tomls

* test:use new contract call syntax

* fix:update return types for call_frames functions

* test:update to SDK v 0.6

* test:update tests

* style: cargo fmt

* fix:rename var to satisfy compiler

* style: forc fmt

* cleanup: remove unused CONSTs until needed

* build: remove core as a dep

* Disable default features from fuel-core (#86)

* Implement Eq for bool (#14)

* Re-add Option and Result. (#68)

* Re-add Option and Result.

* Re-add to auth.

* fmt

* Fix option and result, and add tests.

* Remove redundant gitignores.

* Fix tests.

* Fix to actually compile.

* Fix function naming.

* Fix test.

* Add missing semicolon.

* move option dep up

* Add `Result.unwrap()` (#90)

* Refactor panic into separate library.

* Update tests to use new panic.

* Implement unwrap.

* Add test.

* Add Option.unwrap() (#91)

* Bump fuels-rs to v0.8 (#92)

* Refactor the context module & port tests to SDK (#89)

* test:add new context test project

* test:add context module to harness

* test:add context testing contract and abi

* test:add context_testing_abi

* test:add the first tests

* test:fix contract path

* refactor:context.sw balance functions now use a common balance func

* test:add context_caller_contract to test_artifacts

* temp:ignore failing tests

* reorg:remove tests which belong elsewhere

* build:fix manifest fields

* test:add get_global_gas to context contract

* test:update context_testing_abi

* test:update context_caller abi & contract

* test:add and fix tests for context

* fix:fix types in context module

* build:cleanup/fix forc toml files

* test:cleanup types & contract calls

* build:update deps in cargo toml

* fix:update types in token_ops

* test:update to new sdk version

* test:update import paths to use .bin files

* test:update more tests to use new build path and comparison values

* test:cleanup

* fix:update contract call in caller contract

* test:fix test call to use correct contract

* build: bump SDK to 7

* style: forc fmt

* style: forc fmt

* test: refactor & bump to SDK 7

* style: cargo fmt

* test: update SDK usage to use latest features

* test:work on fixing tests

* improvement: rename contract_id to target

* fix: rename balance() and refactor imports

* style: use multi import syntax

* test: refactor test helper funcs

* test: fix function call names

* refactor: rename functions for clarity

* test: remove use of helper funcs bc/ContractNotFound

* style: cargo fmt

* fix: add gas param to all inter-contract calls

* test: refactor helper to share provider

* fix: update abis and contracts

* test: fix balance test

* fix: remove minting from contract functions

* test: add minting step to tests

* test: cleanup tests

* test: get all tests passing

* test:remove failing duplicate test

* style: cargo fmt && forc fmt

* build: remove core as a dep

* refactor: balance reg & balance_of funcs

* fix: update function names in contracts

* style: forc fmt

* test: fix tests by removing call_params

* style: cargo fmt

* cleanup: remove all compiler warnings

* Walk git dependency repo to discover nested forc dependencies

Closes #952.

This should be complete for the most part, though depends on implementing #977 first.

* Remove implied pkg from names of pkg discovery fns

* Update `Cargo.lock` for the addition of `walkdir`

`walkdir` is used to traverse the git repository when searching for
dependency packages.

* Change `std`'s `core` dep to use the local path

Yet to test whether `forc` can handle `path` dependencies within
dependencies. In theory I these should work provided that the `path` is
relative and points to a location within the same git repository. If
this *does* work, the behaviour should be discussed, documented and
enforced by `forc`.

* Update examples `std` dependency declarations to use local `path`

* Update all tests to depend on `std` via local `path`

This should assist in ensuring that all tests must always pass for any
change to `sway`, `lib-core`, `lib-std` or `forc`.

* Build sway-lib-core and sway-lib-std under unique CI jobs

* Add successful `sway-lib-core` and `sway-lib-std` reqs for publish

* Add tx module. (#93)

* Add tx module.

* Add functions.

* Clean up.

* Add skeleton test artifact project.

* Use hard-coded constants since compiler can't handle consts.

* Fill in skeleton.

* Make untested get typed script data non-pub.

* Add output functions.

* Comment out unreachable.

* Improve name.

* Add remaining functions.

* Fix name.

* Register tests to harness.

* Add tests.

* Fix script start offset test.

* Fix script start offset get.

* Fix test with todo.

* Add non-working test for input coin owner.

* Return wallet.

* Fix test.

* Update transfer to output (#94)

* fixing transfer_to_output

* Update transfer_to_output

* Improving a comment

* fmt

* Auth method 3 (#54)

* Add changes from prior work

* Remove import of ops

* Cleanup and format

* Rename functions to match opcode naming

* Re-order lib.sw

* Fix types to use ContractId

* Refactor and cleanup

* Reorder lib.sw

* Clean up comments and types

* FIx lib deps ordering

* cleanup

* congig:update gitignore

* Commit stashed changes with get_coin_owner WIP

* Fix:cleanup merge conflict resolution mistake

* Clean up a bit and use Result.

* General cleanup.

* Improve comment.

* Fix a bunch of type errors.

* Add missed assert.

* Fix order to make compile.

* Refactor.

* fix

* Fix build errors.

* Update offsets for 255 max inputs.

* Remove warnings.

* Improve error name.

* Fix some asm.

* Fix more asm

* space

* Fix comment

* Fix offsets.

* Refactor to use new tx module.

* test: add auth test project

* test: register auth tests

* test: add tests to mod.rs

* test: add auth testing abi & contract

* test: add auth caller contract & script

* test: fix enum variant name

* test: fix import of result

* test: refactor types to workaround MissingData error from SDK

* test: fix number of args passed

* test: ignore script test

* style: forc fmt

* style: cargo fmt

* test: work on script test

* Remove redundant assert.

* Clean up tests, not working yet.

* Fix test for some reason.

* Fix test.

Co-authored-by: Nick Furfaro <nfurfaro33@gmail.com>

* Update path to assert (#97)

* test: update path to assert

* Delete build.sh

Added by accident.

* test: remove redundant test (#99)

* Update examples and tests for chain::assert -> assert::assert

* Update newly merged test for chain::assert -> assert::assert

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
Co-authored-by: Alex Hansen <alex@alex-hansen.com>
Co-authored-by: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com>
Co-authored-by: wolflo <33909953+wolflo@users.noreply.github.com>
Co-authored-by: Nick Furfaro <nfurfaro33@gmail.com>
Co-authored-by: Toby Hutton <toby@grusly.com>
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: Mohammad <mohammad@Mohammads-MacBook-Pro.local>
Co-authored-by: Simon Roberts <46566889+simonr0204@users.noreply.github.com>
Co-authored-by: Brandon Kite <brandonkite92@gmail.com>
@tedbyron
Copy link

are there public builds? I'd be interested in making this

@mitchmindtree
Copy link
Contributor

I don't think there are just yet - FuelLabs/sway#1191 is related to this.

@otrho
Copy link

otrho commented Apr 27, 2022

fuelup? I know Fuel is waaay more than just Forc and Sway, but still...

@adlerjohn adlerjohn added the enhancement enhancement to a current feature label Apr 27, 2022
@adlerjohn
Copy link
Contributor Author

Updated the issue description since it was outdated. As @mitchmindtree said, this does depends on binaries being built in CI first.

@mitchmindtree mitchmindtree changed the title Version manager fuelup - forc binary distribution and version manager May 19, 2022
@mitchmindtree mitchmindtree changed the title fuelup - forc binary distribution and version manager fuelup - forc binary distribution and toolchain manager May 19, 2022
@mitchmindtree
Copy link
Contributor

mitchmindtree commented May 19, 2022

OK, now that FuelLabs/sway#1191 is done and fuel-core also has some automated publishing, this is no longer blocked!

@binggh is just about finished up with his awesome work on forc-documenter, we just had a chat and he's interested in diving into this next 🚀 @binggh once you're ready, feel free to assign yourself to the issue here.

rustup will be our primary source of inspiration. The key goal is to make downloading and managing forc toolchains as pleasant and easy as possible.

Another thing to keep in mind while working on this is cross-platform support, and in particular Windows (and implications w.r.t. poor bash support, etc). While we don't have windows binaries yet pending FuelLabs/sway#1526, we probably do eventually want to support it, so we should keep this in mind. Hopefully rustup makes for a nice guide on how to handle this anyway.

@eightfilms eightfilms self-assigned this May 19, 2022
@adlerjohn
Copy link
Contributor Author

Do we want to create a new repo for fuelup?

@eightfilms
Copy link
Contributor

perhaps we don't need to create a new repo for now until it grows substantially in size in future, but I'll defer this decision to @mitchmindtree

@adlerjohn
Copy link
Contributor Author

It's mostly that we don't necessarily want releases of fuelup to be tied to releases of forc; after all, fuelup will have to download other packages such as fuel-core and potentially other independent plugins such as forc-wallet.

@adlerjohn
Copy link
Contributor Author

https://github.com/FuelLabs/fuelup

@adlerjohn adlerjohn transferred this issue from FuelLabs/sway May 19, 2022
@eightfilms
Copy link
Contributor

eightfilms commented May 25, 2022

The toolchain includes a docs directory.

What does including a docs directory entail? Does it mean the docs relevant for that version of forc for example?

@adlerjohn
Copy link
Contributor Author

Yes, the compiled mdbook files. This can be deferred to a future PR.

@eightfilms
Copy link
Contributor

(Going to use this as somewhat of a tracking issue, so I'm posting my discussion here 😅 )

Toolchain version management & what a stable toolchain means

Had a short chat with @mitchmindtree regarding how the toolchain should look like. Would love to get more ideas on this topic of toolchain versioning and management. The main question for us in my mind is: what would constitute as stable toolchain? #6

@mitchmindtree brought up a good point that forc and fuel-core are meant to be independent projects i.e. in future Sway can also target other VMs, but they are also meant to work together right now. In which case the onus might be on us to define what a stable toolchain is i.e. do we want to package specific versions of forc, forc-fmt, fuel-core etc. together ourselves and label it as stable, or do we want to allow devs to freely control versioning of each of the above crates? At first I thought the second approach seemed nicer since it gave granular control but later on Mitch convinced me that the first approach is better as fuelup is meant to be as simple as possible for devs to use - in that case we should probably minimise the number of active decisions they make when using the toolchain.

@mitchmindtree gave a few suggestions:

  1. depending on whether we use stable or nightly, we first pick the appropriate forc, then we pick whichever latest stable or nightly release of fuel-core
  2. select the version of fuel-core from the forc CI (serves as a good base to work from since we would know its well tested)
  3. maintain a simple file fuel-core-version in the Sway repo containing the semver version of fuel-core which we test against, then both forc CI and fuelup know which version to use from there.

For reference, the Rust toolchain operates on a train schedule which means the stable, beta and nightly toolchains are on a fixed schedule, and depend on not having breaking bugs to be labelled as stable. I'm not sure how the rust toolchain used to be like before 1.0 and how they synced - Mitch said they might not have been synced before and it's something I'll look into

@eightfilms
Copy link
Contributor

eightfilms commented May 26, 2022

After some thought I think it's way too early to decide what should be stable and what is not, since we're pretty much iterating on new versions on a very quick schedule, and devs would also want to use the latest versions anyway, for the latest features. Starting by implementing nightly toolchain management makes sense - but would depend on both sway and fuel-core having nightly releases as well.

In which case we can kick off #6 by starting with implementing management for switching between nightlies (fuelup default nightly-2022-01-01-x86_64-apple-darwin or fuelup default nightly -> for the latest nightly)

@adlerjohn
Copy link
Contributor Author

Rust nightly isn't the same as build-each-night. cc @mitchmindtree for more explanation.

I think we should avoid actual nightly builds against master, as they're not guaranteed to have any stability. Release builds are often enough that nightly builds simply aren't needed, and have at least a bit of guarantees around stability.

@mitchmindtree
Copy link
Contributor

mitchmindtree commented May 27, 2022

Rust nightly isn't the same as build-each-night. cc @mitchmindtree for more explanation.

Ah, this was exactly my understanding of what nightlies were 😂 At least in the early days my understanding is that it was roughly a cron job that would build everything, run a bunch of tests, and if anything failed it would just not release that night, so the latest nightly was always whatever the most recently successful build was. Sometimes there would be a week or two between successful "nightly" releases.

That was years ago though, I'm not aware of how Rust's nightlies operate today. @binggh would certainly be worth investigating!

@adlerjohn
Copy link
Contributor Author

it is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement enhancement to a current feature
Projects
Archived in project
Development

No branches or pull requests

7 participants