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

[DRAFT] Update clarinet-sdk and clarinet-sdk-wasm to support repl.remote_data #115

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

BowTiedRadone
Copy link
Collaborator

This PR updates clarinet-sdk and clarinet-sdk-wasm to the latest stable version. Before merging the PR, Rendezvous compatibility with the remote data feature introduced in @hirosystems/clarinet-sdk v2.13.0 has to be checked. For this reason, this PR is still a draft.

@BowTiedRadone
Copy link
Collaborator Author

Closing this, as per #116.

This commit refactors a trait reference processing test that proved to be
erratic after upgrading to the latest version of clarinet-sdk. Failed CI job
that caused this commit:
https://github.com/stacks-network/rendezvous/actions/runs/13400901964/job/37431400758?pr=115.
@BowTiedRadone
Copy link
Collaborator Author

PR reopened. Thanks to @hugocaillard for quickly releasing a new Clarinet version with a fix for Node < 22. At this point, the previous Rendezvous functionality should be preserved. Remote simnet data is left to be tested before taking this PR out of draft.

citizen.ts Outdated
await simnet.initEmptySession();
await simnet.initEmptySession({
enabled: false,
initial_height: 5,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What 5 means?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a random hardcoded value. It can easily be 1.

citizen.ts Outdated
enabled: false,
initial_height: 5,
api_url: "",
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An idea would be to read the session params from rv-config.json (it can be a section there with three key/values) and then:

  • If any of them is malformed or missing we throw an error and exit.
  • If all of them are valid, we pass them to the empty session.
  • If none of them is specified we pass dummy/empty values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we could rename path to conf or just keep path for now and re-purpose it for rv-config.json. Then since it's a JSON, we can deserialize it to a type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great plan! This way, we don't have to increase the already fairly sized number of command-line args, and we'll kick off the user configurations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can keep it as path for now. And if it works we can right after rename to conf.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

@BowTiedRadone BowTiedRadone Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update and the resources, @hugocaillard. So, to initialize an empty simnet session, can we stick to what's inside the user's Clarinet.toml? And override a hardcoded remote data object if there's nothing? Also, what will happen in the scenario used in Rendezvous (empty session initialization, redeployment of all contracts by epoch, overwriting the target contract source with the concatenation)?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can pass null if there's nothing in the clarinet.toml (of if it's not enabled).

Also, what will happen in the scenario used in Rendezvous (empty session initialization, redeployment of all contracts by epoch, overwriting the target contract source with the concatenation)?

It should just work as usual. But I do encourage you to give it a try

Copy link
Collaborator Author

@BowTiedRadone BowTiedRadone Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some updates after trying initEmptySession with different remote_data_settings:

  1. For null, the Rendezvous example project won't be successfully initialized. The error is the following (probably because there is an issue resolving the dependency tree for traits):
UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Contract deployment runtime error: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.rendezvous-token -> use of undeclared trait <sip-010-trait>".
  1. For previously working { enabled: false, api_url: "", initial_height: 5 }, same error as for null.
  2. For remote data (see Clarinet.toml), it seems to be working properly. The CI fails because of the API rate limit.

Copy link
Member

@moodmosaic moodmosaic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Member

@moodmosaic moodmosaic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit adds support for public network contracts fuzzing. If
the user correctly sets up the remote data in Clarinet.toml, an
empty session configured with those settings will be set up in the
`issueFirstClassCitizenship` method.
@BowTiedRadone BowTiedRadone force-pushed the deps/clarinet-sdk-update branch from 64ded9f to 054f022 Compare February 21, 2025 15:03
@moodmosaic moodmosaic changed the title [DRAFT] Update clarinet-sdk and clarinet-sdk-wasm to the latest version [DRAFT] Update clarinet-sdk and clarinet-sdk-wasm to support repl.remote_data Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants