From e9485b5577bcc26d79975d404106164255fcbc96 Mon Sep 17 00:00:00 2001 From: Joshua Batty Date: Tue, 13 Jan 2026 15:14:09 +1100 Subject: [PATCH] feat: migrate `forc-node` from sway to forc monorepo Update fuelup to source forc-node from FuelLabs/forc starting with version 0.71.0, with version-based routing to maintain backward compatibility for older versions from the sway repository. --- ci/build-channel/src/main.rs | 25 ++++++++++++ component/src/lib.rs | 73 +++++++++++++++++++++++++++++++++++- components.toml | 8 +++- 3 files changed, 103 insertions(+), 3 deletions(-) diff --git a/ci/build-channel/src/main.rs b/ci/build-channel/src/main.rs index 197fccb33..82e8f59f2 100644 --- a/ci/build-channel/src/main.rs +++ b/ci/build-channel/src/main.rs @@ -451,4 +451,29 @@ mod tests { ("forc", "forc-crypto-0.71.0", "forc-crypto") ); } + + #[test] + fn test_forc_node_url_generation() { + let forc_node = Component::from_name("forc-node").unwrap(); + + // Legacy version (< 0.71.0) should use sway repo with forc-binaries tarball + let legacy = Version::new(0, 70, 1); + let repo = forc_node.repository_for_version(&legacy); + let tag = forc_node.tag_for_version(&legacy); + let prefix = forc_node.tarball_prefix_for_version(&legacy); + assert_eq!( + (repo, tag.as_str(), prefix), + ("sway", "v0.70.1", "forc-binaries") + ); + + // Migrated version (>= 0.71.0) should use forc repo with forc-node tarball + let migrated = Version::new(0, 71, 0); + let repo = forc_node.repository_for_version(&migrated); + let tag = forc_node.tag_for_version(&migrated); + let prefix = forc_node.tarball_prefix_for_version(&migrated); + assert_eq!( + (repo, tag.as_str(), prefix), + ("forc", "forc-node-0.71.0", "forc-node") + ); + } } diff --git a/component/src/lib.rs b/component/src/lib.rs index 1172c86bb..04fa50d4c 100644 --- a/component/src/lib.rs +++ b/component/src/lib.rs @@ -118,7 +118,7 @@ impl Component { pub fn tag_for_version(&self, version: &Version) -> String { let repo = self.repository_for_version(version); match (self.name.as_str(), repo) { - ("forc-wallet", "forc") | ("forc-crypto", "forc") => { + ("forc-wallet", "forc") | ("forc-crypto", "forc") | ("forc-node", "forc") => { format!("{}-{}", self.name, version) } _ => format!("v{}", version), @@ -563,6 +563,77 @@ mod tests { ); } + #[test] + fn test_repository_for_version_forc_node_migration() { + let components = Components::collect().unwrap(); + let forc_node = components + .component + .get("forc-node") + .expect("forc-node component must exist"); + + let legacy = Version::new(0, 70, 1); + let migrated = Version::new(0, 71, 0); + + assert_eq!( + forc_node.repository_for_version(&legacy), + "sway", + "pre-0.71.0 forc-node versions should use the sway repository" + ); + assert_eq!( + forc_node.repository_for_version(&migrated), + "forc", + "0.71.0+ forc-node versions should use the forc monorepo" + ); + } + + #[test] + fn test_tarball_prefix_for_version_forc_node_migration() { + let components = Components::collect().unwrap(); + let forc_node = components + .component + .get("forc-node") + .expect("forc-node component must exist"); + + let legacy = Version::new(0, 70, 1); + let migrated = Version::new(0, 71, 0); + + assert_eq!( + forc_node.tarball_prefix_for_version(&legacy), + "forc-binaries", + "pre-0.71.0 forc-node was bundled in forc-binaries" + ); + assert_eq!( + forc_node.tarball_prefix_for_version(&migrated), + "forc-node", + "0.71.0+ forc-node has its own tarball" + ); + } + + #[test] + fn test_tag_for_version_forc_node_migration() { + let components = Components::collect().unwrap(); + let forc_node = components + .component + .get("forc-node") + .expect("forc-node component must exist"); + + // Legacy versions (< 0.71.0) should use standard v-prefixed tags + let legacy = Version::new(0, 70, 1); + assert_eq!( + forc_node.tag_for_version(&legacy), + "v0.70.1", + "Legacy forc-node versions should use v-prefixed tags" + ); + + // New versions (>= 0.71.0) in forc repo should use forc-node-prefixed tags + let migrated = Version::new(0, 71, 0); + assert_eq!( + forc_node.tag_for_version(&migrated), + "forc-node-0.71.0", + "Migrated forc-node versions should use forc-node-prefixed tags" + ); + } + #[test] fn test_tag_for_version_standard_components() { let components = Components::collect().unwrap(); diff --git a/components.toml b/components.toml index 798eba8c7..e7903509a 100644 --- a/components.toml +++ b/components.toml @@ -77,11 +77,15 @@ targets = ["linux_amd64", "linux_arm64", "darwin_amd64", "darwin_arm64"] [component.forc-node] name = "forc-node" -tarball_prefix = "forc-binaries" +tarball_prefix = "forc-node" is_plugin = true executables = ["forc-node"] -repository_name = "sway" +repository_name = "forc" +legacy_repository_name = "sway" +legacy_before = "0.71.0" +legacy_tarball_prefix = "forc-binaries" targets = ["linux_amd64", "linux_arm64", "darwin_amd64", "darwin_arm64"] +publish = true [component.forc-publish] name = "forc-publish"