Skip to content
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

Implement stacks-block-height and tenure-height #322

Open
obycode opened this issue Feb 1, 2024 · 0 comments
Open

Implement stacks-block-height and tenure-height #322

obycode opened this issue Feb 1, 2024 · 0 comments
Labels
blocked good first issue Good for newcomers missing Some missing functionality that is required for v1.0 wasm
Milestone

Comments

@obycode
Copy link
Collaborator

obycode commented Feb 1, 2024

SIP-021 specifies the following updates to Clarity:

The protocol described in this document would have Stacks blocks occur at a much greater frequency than in the past. Many contracts rely on the block-height primitive to approximate a time assuming that a block takes, on average, 10 minutes. To release faster blocks while preserving the functionality of existing contracts that make this block frequency assumption, this proposal calls for a new version of Clarity, version 3, which includes the following changes.

A new Clarity global variable stacks-block-height will be introduced, which evaluates to the Stacks block height.
A new Clarity global variable tenure-height will be introduced, which evaluates to the number of tenures that have passed. When the Nakamoto block-processing starts, this will be equal to the chain length.
The Clarity global variable block-height will continue to be supported in existing Clarity 1 and Clarity 2 contracts by returning the same value as tenure-height. Usage of block-height in a Clarity 3+ contract will trigger an analysis error.

These changes will be implemented in the interpreter in stacks-network/stacks-core#3943 and also need to be implemented in the clarity-wasm runtime.

@obycode obycode added the missing Some missing functionality that is required for v1.0 label Feb 1, 2024
@saralab saralab added the wasm label Feb 2, 2024
@smcclellan smcclellan added this to the WASM Phase 1 milestone Mar 12, 2024
@smcclellan smcclellan added the good first issue Good for newcomers label Mar 18, 2024
@smcclellan smcclellan changed the title stacks-block-height and tenure-height Implement stacks-block-height and tenure-height Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked good first issue Good for newcomers missing Some missing functionality that is required for v1.0 wasm
Projects
Status: Status: 📋 Backlog
Development

No branches or pull requests

4 participants