forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: deprecate
ConfigTimeConstant
s (FuelLabs#4298)
## Description Closes FuelLabs#3681 I meant to tackle FuelLabs#3077 first, but tackling FuelLabs#3681 first cleans up a lot of the code needed to make FuelLabs#3077 easier. This PR is mostly cleanup: - Completely removes usage of `ConfigTimeConstant` everywhere (in forc-pkg, sway-core, sway-type) - **(BREAKING)** Completely removes support for `[constants]` table in the manifest, which was using the `ConfigTimeConstant` struct. This change is breaking for app devs ([open issue](FuelLabs/sway-applications#375)) and from a [quick search](https://github.com/FuelLabs/sway-applications/search?l=TOML&q=%5Bconstants%5D) on our sway-applications repo, there's a number of manifests still using the old version of configuration time constants. Consequentially, the above change also allowed us to cut down on other constructs like `ConstInjectMap` within forc-pkg, since the only thing we need to inject now are const CONTRACT_IDs - this cuts down quite a bit of now-redundant code. - As a result of the removal of `ConfigTimeConstant`, a few tests using that feature were also deleted. - Also updated the `configurable` example to be known as `configurable_constants` instead of `config_time_constant`. **This PR does not:** - Fix the manual creation of `CONTRACT_ID` const. To create the const, we still undergo manual parsing and type-checking and finally inserting into a `SymbolMap` manually. This will be handled in a separate PR to tackle FuelLabs#3077 Other than removal of a lot of code to do with CTC, the main change here that allows contract dependencies to still work here is instead of relying on the `ConstInjectMap` which we used to inject both constants and contract dependencies, there is now only a single contract ID value that we require (this is abstracted as `ContractIdConst`) to inject into the contract for tests. ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
- Loading branch information
1 parent
f4cffba
commit 032cd3b
Showing
29 changed files
with
131 additions
and
318 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
|
@@ -3,6 +3,6 @@ authors = ["Fuel Labs <[email protected]>"] | |
entry = "main.sw" | ||
implicit-std = false | ||
license = "Apache-2.0" | ||
name = "config_time_constants" | ||
name = "configurable_constants" | ||
|
||
[dependencies] |
File renamed without changes.
This file contains 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 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 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 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 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.