-
Notifications
You must be signed in to change notification settings - Fork 316
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
feat: support versioned-smart-contract
tx types
#1341
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
537d04e
to
2e4813c
Compare
test('Versioned smart contract payload serialization and deserialization', () => { | ||
const contractName = 'contract_name'; | ||
const codeBody = | ||
'(define-map store ((key (buff 32))) ((value (buff 32))))' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell this is the came contract as fs.readFileSync('./tests/contracts/kv-store.clar')
, we could reuse that file for this test as well...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean, and fast 🏎
Maybe we could add "test vector" style tests with hardcoded serialized txs (which match the rust impl). Thoughts? 💭 This PR will be deployed to npm via github actions, is that enough for testing and development? (I'm thinking about if it makes sense to hold off releasing these additions to be closer to 2.1 launch; maybe bundle them together) 🤷♂ |
@janniks I'm already using this code for local API testing and development. Deployment isn't a blocker for me. But yeah I think if we do deploy this, it would make more sense if it was tagged as alpha on npm. I don't think the Stacks 2.1 changes around all of this are finalized (the serialization format could change, but unlikely). |
📦 Released under |
@janniks I just created a new branch |
709d523
to
e86b982
Compare
Codecov Report
@@ Coverage Diff @@
## stacks-2.1 #1341 +/- ##
==============================================
+ Coverage 65.06% 65.10% +0.04%
==============================================
Files 126 126
Lines 8833 8856 +23
Branches 1910 1919 +9
==============================================
+ Hits 5747 5766 +19
- Misses 2833 2837 +4
Partials 253 253
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Closes #1339
I need this change for some API testing & development for Stacks 2.1.
This adds an optional arg
clarityVersion
to the smart contract builder functions. If specified, aversioned-smart-contract
type will be created. If not specified, it will default to the regularsmart-contract
.Example:
I have no strong feelings on how these function signatures look. An alternative approach could be using entirely new builder functions for this tx type, rather than an optional arg to the existing functions.
I verified that the serialized payload generated in this PR is valid with the Rust deserialization code at https://github.com/hirosystems/stacks-encoding-native-js/pull/5/files
@janniks feel free to take over this PR and make any changes