Skip to content

Document Clarinet mainnet execution simulation #985

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

Closed
hugocaillard opened this issue Apr 18, 2025 · 2 comments
Closed

Document Clarinet mainnet execution simulation #985

hugocaillard opened this issue Apr 18, 2025 · 2 comments
Assignees

Comments

@hugocaillard
Copy link
Collaborator

hugocaillard commented Apr 18, 2025

I would like to request some help from the documentation team to document the new MXS feature in clarinet.
The output would be a guide in the Clarinet SDK Guides sections, similar to the "Unit testing" one.

Here are some of the keys points to highlight (not necessarily in this order, I let the assignee define the exact structure of this doc)

  • What is Mainnet execution simulation and why it's useful:
    • test smart contracts with real world data
    • (re)simulate any transaction to see its output or evualute its costs
  • How to use it in unit tests (main use case)
    • enable it up in the Clarinet.toml
    • explain that the initial_height is optional (defaults to latest stacks block height if omitted) but is recommended to get consistent results
    • this project can be showned as an example https://github.com/hirosystems/clarinet-pyth-example

If you think it's relevant, we cna also specify that it is available in the playground to be quickly tested. Go to https://play.hiro.so/?remote_data=true and in the command input, call a mainnet contract, such as pox-4 (contract-call? 'SP000000000000000000002Q6VF78.pox-4 get-total-ustx-stacked u117)

At the end, specificy that there are some limitations. Currently, the following features are not implemented in MXS:

(get-burn-block-info? pox-addrs <burn-block-height>)

(get-tenure-info? block-reward <stacks-block-height>)
(get-tenure-info? miner-spend-total <stacks-block-height>)
(get-tenure-info? miner-spend-winner <stacks-block-height>

In the future, we'll likely add a section on how to use it programmatically using the js sdk directly (not in the context of unit tests) - but the exact api will soon change, so no need to cover this for now.

@github-project-automation github-project-automation bot moved this to 🆕 New in Devrel Apr 18, 2025
@ryanwaits ryanwaits moved this from 🆕 New to 📋 Backlog in Devrel Apr 28, 2025
@ryanwaits ryanwaits self-assigned this May 5, 2025
@friedger
Copy link
Contributor

friedger commented May 11, 2025

Here is a guide now that uses the wrong Clarinet.toml settings:

https://github.com/hirosystems/docs/blob/main/content/docs/stacks/clarinet-js-sdk/guides/mainnet-execution-simulation.mdx#enable-mxs-in-your-project

@hugocaillard The testing section should be still repl.remote_data and enabled for clarinet 3.0.1

@hugocaillard
Copy link
Collaborator Author

Thanks @friedger, pr here: #992

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Devrel May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants