-
Notifications
You must be signed in to change notification settings - Fork 102
SIP-039: Clarity 5 and Epoch 3.4 #256
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
Open
brice-stacks
wants to merge
27
commits into
stacksgov:main
Choose a base branch
from
brice-stacks:clarity-5
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+234
−0
Open
Changes from 11 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
31bb550
feat: add Clarity 5 SIP (epoch 3.4)
brice-stacks 0bcd7a0
fix: make `from-consensus-buff?` change Clarity-gated
brice-stacks 05a058c
feat: add `from-consensus-buff?` PR
brice-stacks ae7c06b
fix: stack depth change must be epoch-gated
brice-stacks 5deeaaa
Merge branch 'main' into clarity-5
brice-stacks b399e6e
chore: add link to SIP-035 and clarify errors
brice-stacks fc8aec0
chore: improve wording
brice-stacks 6f90472
add forum link
brice-stacks 4284fa9
set SIP number
brice-stacks e9b47af
adjust file structure for new SIP number
brice-stacks d4ab493
add explanation of `burn-block-height` bug
brice-stacks 4b158fe
add ame-contract rait use to SIP
brice-stacks ff022aa
add hard fork label
brice-stacks 0b1c173
remove extraneous comma
brice-stacks 9f9c619
remove issue from titles
brice-stacks e5af10d
chore: minor changes from review
brice-stacks ffbbbbd
feat: add contract call with constant
brice-stacks c48933e
fix: add `stx-account` and `stx-get-balance` to `at-block` bug
brice-stacks 9ba2867
chore: updated activation section for vote
brice-stacks 85ccf1b
Set status to accepted
wileyj 8fb11a0
feat: add `sip-address` script
brice-stacks 9de700b
Revert "feat: add `sip-address` script"
brice-stacks e68faee
add voting information
brice-stacks abadf17
Move to Activation-In-Progress
wileyj 1fbcbc5
chore: adjust activation height to 943,333
brice-stacks 1cda9de
fix: leave original activation and add note
brice-stacks 263eac1
add activation status from @clairetopalian
brice-stacks 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,139 @@ | ||
| # Preamble | ||
|
|
||
| SIP Number: 039 | ||
|
|
||
| Title: Clarity 5: Fixing known issues in Clarity | ||
|
|
||
| Author(s): | ||
|
|
||
| - Brice Dobry <brice@stackslabs.com> | ||
|
|
||
| Status: Draft | ||
|
|
||
| Consideration: Governance, Technical | ||
|
|
||
| Type: Consensus | ||
|
jcnelson marked this conversation as resolved.
|
||
|
|
||
| Layer: Consensus | ||
|
brice-stacks marked this conversation as resolved.
Outdated
|
||
|
|
||
| Created: 2025-01-16 | ||
|
|
||
| License: BSD-2-Clause | ||
|
|
||
| Sign-off: | ||
|
|
||
| Discussions-To: | ||
|
|
||
| - https://forum.stacks.org/t/clarity-5-and-epoch-3-4/18659 | ||
|
|
||
| # Abstract | ||
|
wileyj marked this conversation as resolved.
|
||
|
|
||
| The goal of this version of Clarity is not to add any new features, but to | ||
|
wileyj marked this conversation as resolved.
Outdated
|
||
| resolve known issues with existing functionality, specifically those that | ||
| require a hard-fork to change. The implementation for this SIP should only | ||
| resolve problems in the current Clarity implementation or make beneficial | ||
| changes to under-specified aspects of the Clarity language and virtual machine | ||
| (VM). | ||
|
|
||
| # Copyright | ||
|
|
||
| This SIP is made available under the terms of the BSD-2-Clause license, | ||
| available at https://opensource.org/licenses/BSD-2-Clause. This SIP’s copyright | ||
| is held by the Stacks Open Internet Foundation. | ||
|
|
||
| # Introduction | ||
|
|
||
| This SIP intends to solve the known issues in the implementation of the Clarity | ||
| VM, without making any changes to its intended behavior. | ||
|
wileyj marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Specification | ||
|
|
||
| ## Resolve the discrepancy in `secp256r1-verify` described in SIP-035 | ||
|
|
||
| In Clarity 5 and above, `secp256r1-verify` will no longer double-hash its input. | ||
| See [SIP-035](/sips/sip-035/sip-secp256r1-verify.md) for details. | ||
|
wileyj marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Runtime error when passing an empty buffer to `from-consensus-buff?` (see issue [#6683](https://github.com/stacks-network/stacks-core/issues/6683)) | ||
|
|
||
| Beginning in Clarity 5, computing the cost of passing an empty buffer to | ||
| `from-consensus-buff?` will no longer trigger a runtime error. Instead, the cost | ||
| will be charged appropriately, and the expression will return `none`, as | ||
| originally intended. | ||
|
|
||
| ## Bug with `burn-block-height` inside an `at-block` expression (see issue [#6123](https://github.com/stacks-network/stacks-core/issues/6123)) | ||
|
|
||
| From issue [#6123](https://github.com/stacks-network/stacks-core/issues/6123): | ||
|
wileyj marked this conversation as resolved.
|
||
|
|
||
| > Epoch 3 introduced a bug which causes `burn-block-height` to always return the | ||
| > current burn block height, even if inside of an `at-block` expression. This | ||
| > should be fixed to behave as expected in the next hard-fork. | ||
|
|
||
| In Clarity 5 and above, `burn-block-height` will return the correct value when | ||
| used inside of an `at-block` expression. | ||
|
wileyj marked this conversation as resolved.
|
||
|
|
||
| ## Increased stack depth | ||
|
|
||
| Currently, the Clarity VM limits the call stack of a transaction execution to a | ||
| depth of 64 and several user applications have been hitting this limit recently. | ||
| This value was not specified in any previous SIPs, but was chosen to constrain | ||
| memory usage by the VM. Upon further testing, it has been determined that this | ||
| value can safely be increased to 128 without imposing unreasonable requirements | ||
| on Stacks node runners. Effective in epoch 3.4, the stack depth will be set | ||
| to 128. | ||
|
|
||
| ## Rejectable transactions | ||
|
|
||
| Several kinds of errors have been avoided in the Clarity VM via a soft-fork | ||
| mechanism, causing transactions that trigger these problematic situations to be | ||
| rejected, not allowed to be included in a block. This strategy is useful for | ||
| quickly patching issues without requiring a hard-fork. However, once the | ||
| soft-fork is in place, the next time a hard-fork is executed, these errors can | ||
| all be transitioned to errors that can be included in a block. This is much | ||
| better for the network, since not including a transaction in a block has several | ||
| downsides: | ||
|
|
||
| - Miners cannot charge a fee for processing the transaction | ||
| - Users may be confused as to why their transaction is not being included, | ||
| causing that transaction and all later transactions (with higher nonces) to | ||
| stall | ||
| - These unmineable transactions remain in the mempool, unprocessed, until they | ||
|
wileyj marked this conversation as resolved.
|
||
| age out | ||
|
|
||
| With the upgrade to epoch 3.4, all known reachable "rejectable" errors, will | ||
|
brice-stacks marked this conversation as resolved.
Outdated
|
||
| become includable errors. | ||
|
|
||
| # Related Work | ||
|
|
||
| This SIP is focused on fixing consensus issues discovered in previous | ||
| implementations of Clarity, or improving behavior which is unspecified in prior | ||
| SIPs. The existing SIPs defining Clarity are: | ||
|
|
||
| - [SIP-002 (Clarity)](../sip-002/sip-002-smart-contract-language.md) | ||
|
wileyj marked this conversation as resolved.
|
||
| - [SIP-015 (Clarity 2)](../sip-015/sip-015-network-upgrade.md) | ||
| - [SIP-021 (Clarity 3)](../sip-021/sip-021-nakamoto.md) | ||
| - [SIP-033 (Clarity 4)](../sip-033/sip-033-clarity4.md) | ||
|
|
||
| # Backwards Compatibility | ||
|
|
||
| Clarity 5 will be implemented with these changes while maintaining backwards | ||
| compatibility for previous versions of Clarity. Existing contracts will continue | ||
| to execute with the existing behavior, but new contracts will default to | ||
| Clarity 5. | ||
|
|
||
| # Activation | ||
|
brice-stacks marked this conversation as resolved.
|
||
|
|
||
| Since this SIP only proposes fixes to the existing Clarity designs, it will not | ||
| require a community vote. In order to activate epoch 3.4 and Clarity 5, this SIP | ||
| must be approved by the Technical CAB and the Steering Committee. Once approved, | ||
| an activation height must be selected, allowing ample time for the changes to be | ||
| implemented, a release published, and community members to update. This block | ||
| height may be decided jointly by the Steering Committee, Technical CAB, and | ||
| Stacks core engineers implementing the changes. | ||
|
wileyj marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Reference Implementation | ||
|
|
||
| At the time of this writing, the following public implementations are available | ||
| so far: | ||
|
|
||
| - [`secp256r1-verify?` change](https://github.com/stacks-network/stacks-core/pull/6763) | ||
| - [`from-consensus-buff?` change](https://github.com/stacks-network/stacks-core/pull/6820) | ||
|
brice-stacks marked this conversation as resolved.
|
||
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.