feat(cannon-3): draft var system changes for 3.0#1863
Open
saturn-dbeal wants to merge 15 commits intomainfrom
Open
feat(cannon-3): draft var system changes for 3.0#1863saturn-dbeal wants to merge 15 commits intomainfrom
saturn-dbeal wants to merge 15 commits intomainfrom
Conversation
Co-authored-by: saturn <saturn@dbeal.dev>
…1848) Co-authored-by: saturn <saturn@dbeal.dev>
Co-authored-by: dbeal <git@dbeal.dev>
Co-authored-by: Saturn <saturn@dbeal.dev>
This is a draft RFC for Cannon 3.0 breaking changes to the var system. ## Changes ### New var format Variables can now be defined with type information, descriptions, and namespacing: ```toml [var.main] foobar.value = "my super variable" foobar.type = "string" foobar.description = "Super important variable documentation" baz.type = "address" ``` Access via: `<%= var.main.foobar %>` ### Key features - **Type validation**: Required `type` field with validation for string, address, number, boolean, bytes - **Optional value**: If `value` is not defined, must be provided externally at build time - **Descriptions**: Optional `description` field for documentation - **Namespacing**: Vars are organized in namespaces (e.g., `var.main`, `var.deploy`) ### Breaking changes - `type` is now required for all vars - Vars output to `var.namespace.varname` in addition to `settings.varname` (backwards compat) - Missing values without override will error instead of silently failing ### Internal changes - Added `vars` to ChainBuilderContext type - Updated varSchema to support nested VarDefinition structure - Added type validation functions for address, number, boolean, bytes - Updated context initialization in builder.ts, cli/helpers.ts, website hooks - Added comprehensive tests for new format
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a draft RFC for Cannon 3.0 breaking changes to the var system.
Summary
Variables can now be defined with type information, descriptions, and namespacing:
Access via:
<%= var.main.foobar %>Key Features
typefield with validation for string, address, number, boolean, bytesvalueis not defined, must be provided externally at build timedescriptionfield for documentationvar.main,var.deploy)Breaking Changes
typeis now required for all varsvar.namespace.varnamein addition tosettings.varname(backwards compat maintained)RFC
This is a draft for discussion. The exact format and behavior may change based on feedback.
🤖 Generated with Cannon