-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate to the BuildScript rolling-candidate deploy model #18
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8ed437c
Migrate to the BuildScript rolling-candidate deploy model
thedavidmeister 0a1fd75
Merge origin/main into issue-14-buildscript branch
thedavidmeister 39d1cfd
Finish migration onto rain-deploy abstracts; drop historical snapshots
thedavidmeister 1508bbb
Filter rain-deploy abstracts and the suites declaration from slither
thedavidmeister File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name: Git is clean | ||
| on: [push] | ||
| jobs: | ||
| copy-artifacts: | ||
| uses: rainlanguage/rainix/.github/workflows/rainix-copy-artifacts.yaml@main | ||
| secrets: inherit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| // SPDX-License-Identifier: LicenseRef-DCL-1.0 | ||
| // SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd | ||
| pragma solidity =0.8.25; | ||
|
|
||
| import {BuildScript} from "rain-deploy-0.1.7/src/abstract/BuildScript.sol"; | ||
| import {DeployCandidate} from "../src/abstract/RainDeploySuitesBase.sol"; | ||
| import {CloneFactoryDeploySuites} from "../src/abstract/CloneFactoryDeploySuites.sol"; | ||
| import {LibRainDeploySnapshot} from "rain-deploy-0.1.7/src/lib/LibRainDeploySnapshot.sol"; | ||
|
|
||
| /// One contract's generated files: the rolling snapshot, the alias lib that | ||
| /// re-exports its pins and the released-suites lib emitted from its record. | ||
| struct GeneratedContract { | ||
| /// Places the snapshot inside `src/generated/<dir>/` and names both | ||
| /// generated libs. | ||
| string contractName; | ||
| /// Prefix for the constants the alias lib exports, e.g. `CLONE_FACTORY`. | ||
| string constantPrefix; | ||
| /// Snapshots are written from its `sourceCreationCode` and | ||
| /// `snapshot.dependencies`; the released lib takes its suite key and | ||
| /// artifact path from its `snapshot`. | ||
| DeployCandidate candidate; | ||
| } | ||
|
|
||
| /// @title Build | ||
| /// @notice Generates the deploy pins for every contract this repo deploys. | ||
| /// `generatedContracts()` is the only list, read by every hook below. | ||
| /// | ||
| /// `run()` (what CI regenerates against) rewrites the rolling | ||
| /// `src/generated/candidate/` snapshot, the alias lib and the released-suites | ||
| /// libs. `cutRelease()` freezes the candidate into `src/generated/<tag>/` | ||
| /// first. The frozen `0_1_3`/`0_1_4`/`0_1_5` snapshots are append-only | ||
| /// historical records, never regenerated here. | ||
| contract Build is BuildScript, CloneFactoryDeploySuites { | ||
| /// Every contract this repo generates deploy pins for. | ||
| /// @return The generated contracts. | ||
| function generatedContracts() internal pure returns (GeneratedContract[] memory) { | ||
| GeneratedContract[] memory contracts = new GeneratedContract[](1); | ||
| contracts[0] = GeneratedContract({ | ||
| contractName: "CloneFactory", constantPrefix: "CLONE_FACTORY", candidate: cloneFactoryCandidate() | ||
| }); | ||
| return contracts; | ||
| } | ||
|
|
||
| /// @inheritdoc BuildScript | ||
| /// @dev In declaration order — the order the aggregate emits its entries | ||
| /// in. | ||
| function snapshotContractNames() internal pure override returns (string[] memory) { | ||
| GeneratedContract[] memory contracts = generatedContracts(); | ||
| string[] memory names = new string[](contracts.length); | ||
| for (uint256 i = 0; i < contracts.length; i++) { | ||
| names[i] = contracts[i].contractName; | ||
| } | ||
| return names; | ||
| } | ||
|
|
||
| /// @inheritdoc BuildScript | ||
| /// @dev Every alias lib, every released-suites lib and the aggregate over | ||
| /// them. | ||
| function regenerateLibs() internal override { | ||
| GeneratedContract[] memory contracts = generatedContracts(); | ||
| for (uint256 i = 0; i < contracts.length; i++) { | ||
| LibRainDeploySnapshot.writeAliasLib( | ||
| vm, | ||
| LibRainDeploySnapshot.LIB_DIR, | ||
| contracts[i].contractName, | ||
| contracts[i].constantPrefix, | ||
| LibRainDeploySnapshot.CANDIDATE | ||
| ); | ||
| LibRainDeploySnapshot.writeReleasedSuitesLib( | ||
| vm, | ||
| LibRainDeploySnapshot.LIB_DIR, | ||
| recordRoot(), | ||
| contracts[i].contractName, | ||
| contracts[i].candidate.snapshot | ||
| ); | ||
| } | ||
| LibRainDeploySnapshot.writeReleasedSuitesAggregate(vm, LibRainDeploySnapshot.LIB_DIR, snapshotContractNames()); | ||
| } | ||
|
|
||
| /// @inheritdoc BuildScript | ||
| function regenerateSnapshots() internal override { | ||
| GeneratedContract[] memory contracts = generatedContracts(); | ||
| for (uint256 i = 0; i < contracts.length; i++) { | ||
| LibRainDeploySnapshot.writeSnapshot( | ||
| vm, | ||
| LibRainDeploySnapshot.CANDIDATE, | ||
| contracts[i].contractName, | ||
| contracts[i].candidate.sourceCreationCode, | ||
| contracts[i].candidate.snapshot.dependencies | ||
| ); | ||
| } | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "detectors_to_exclude": "assembly-usage,solc-version,pragma,unindexed-event-address", | ||
| "filter_paths": "dependencies/forge-std-1.16.1,dependencies/@openzeppelin-contracts-5.6.1" | ||
| "filter_paths": "dependencies,src/abstract/(CloneFactoryDeploySuites|RainDeploySuitesBase)\\.sol" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.