FuelLabs / FuelLabs/fuelup

feat: add forc-crypto as standalone package in channel TOML files

Open
#810 0 comments 0 reactions 1 assignee Claimed by @JoshuaBatty View on GitHub
Dominant language
Rust
Stars
282
Forks
150
Avg merge
2d 17h
Merged PRs (30d)
2

Description

## Summary

Now that `forc-crypto` has been migrated from the sway repository to the forc monorepo (v0.71.0+), it's no longer bundled inside the `forc-binaries` tarball. The channel TOML files need to include `forc-crypto` as a separate package entry, similar to how `forc-wallet` is specified.

## Background

Previously, `forc-crypto` was distributed as part of the `forc-binaries` tarball from the sway repo. Starting with v0.71.0, it's now a standalone release from `FuelLabs/forc` with its own tarball:

```
forc-crypto-0.71.0-linux_amd64.tar.gz
forc-crypto-0.71.0-linux_arm64.tar.gz
forc-crypto-0.71.0-darwin_amd64.tar.gz
forc-crypto-0.71.0-darwin_arm64.tar.gz
```

### Related PRs/Issues
- FuelLabs/fuelup#808 (forc-crypto migration in fuelup)
- FuelLabs/forc#119 (forc-crypto migration to forc monorepo)
- FuelLabs/sway-rfcs#49 (RFC for forc monorepo migration)

## Files to Update

The build-channel tool and then regenerate:
```
channel-fuel-mainnet.toml
channel-fuel-testnet.toml
channel-fuel-devnet.toml
channel-fuel-nightly.toml
```

## Implementation

### Step 1: Update build-channel tool

Modify `/ci/build-channel/src/main.rs` to:

1. Accept `forc-crypto` as a version-specifiable component (like `forc` and `fuel-core`)
2. Generate the appropriate package entry for `forc-crypto`

Currently the tool accepts versions like:
```bash
build-channel my-channel.toml 2023-02-13 forc=0.70.1 fuel-core=0.46.0
```

After this change, it should also accept:
```bash
build-channel my-channel.toml 2023-02-13 forc=0.70.1 fuel-core=0.46.0 forc-crypto=0.71.0
```

### Step 2: Expected Output Format

The generated TOML should include a new `[pkg.forc-crypto]` section:

```toml
[pkg.forc-crypto]
version = "0.71.0"

[pkg.forc-crypto.target.linux_amd64]
url = "https://github.com/FuelLabs/forc/releases/download/forc-crypto-0.71.0/forc-crypto-0.71.0-linux_amd64.tar.gz"
hash = ""

[pkg.forc-crypto.target.linux_arm64]
url = "https://github.com/FuelLabs/forc/releases/download/forc-crypto-0.71.0/forc-crypto-0.71.0-linux_arm64.tar.gz"
hash = ""

[pkg.forc-crypto.target.darwin_amd64]
url = "https://github.com/FuelLabs/forc/releases/download/forc-crypto-0.71.0/forc-crypto-0.71.0-darwin_amd64.tar.gz"
hash = ""

[pkg.forc-crypto.target.darwin_arm64]
url = "https://github.com/FuelLabs/forc/releases/download/forc-crypto-0.71.0/forc-crypto-0.71.0-darwin_arm64.tar.gz"
hash = ""
```

### Key Implementation Details

1. **Repository**: `FuelLabs/forc`
2. **Tag format**: `forc-crypto-{version}` (not `v{version}`)
3. **Tarball naming**: `forc-crypto-{version}-{target}.tar.gz`
4. **Targets**: `linux_amd64`, `linux_arm64`, `darwin_amd64`, `darwin_arm64`

The `write_document` function in `main.rs` already handles similar logic for other components. The key difference for `forc-crypto` is:
- Uses the forc monorepo (`FuelLabs/forc`)
- Uses component-prefixed tags (`forc-crypto-0.71.0` instead of `v0.71.0`)
- Has its own tarball prefix (`forc-crypto` instead of `forc-binaries`)

These patterns are already handled by `Component::repository_for_version()`, `Component::tag_for_version()`, and `Component::tarball_prefix_for_version()` from FuelLabs/fuelup#808.

### Step 3: Regenerate Channel Files

After updating the build-channel tool, regenerate the channel files with the appropriate forc-crypto version:

```bash
cd ci/build-channel
cargo build --release

# Example for mainnet (adjust versions as needed)
./target/release/build-channel channel-fuel-mainnet.toml 2025-01-15 forc=0.70.1 fuel-core=0.46.0 forc-crypto=0.71.0
```

## Acceptance Criteria

- [ ] `build-channel` tool accepts `forc-crypto=X.Y.Z` version specification
- [ ] Generated TOML includes proper `[pkg.forc-crypto]` section with all 4 targets
- [ ] URLs use correct tag format (`forc-crypto-{version}`)
- [ ] URLs use correct tarball naming (`forc-crypto-{version}-{target}.tar.gz`)
- [ ] Hashes are correctly computed
- [ ] Channel files regenerated and pushed to gh-pages
- [ ] `fuelup component add forc-crypto` works with updated channels

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.