Skip to content

Document Clarinet mainnet execution simulation #985

Closed
@hugocaillard

Description

@hugocaillard

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions