-
Notifications
You must be signed in to change notification settings - Fork 664
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
Feature: allow specifying initial stx balances with clarity-cli #1662
Conversation
Thank you @kantai this is going to be so helpful. Plus looking at the code changes was so helpful, as did not think the change was going so easy, but not so familiar with the Rust code yet... Also, finding out you can pass on a pre-populated db could open quite a few possibilities. For example I ran a test a couple days ago that was calling a contract 10,000 times to check how the contract would behave when going past a limit, but I'm not even sure how long it took as I went to bed before it finished after running for over an hour. The VM handled the test beautifully, and the contract returned a failure when it was supposed to 😂 |
fs::write(&clar_name, r#" | ||
(unwrap-panic (if (is-eq (stx-get-balance 'S1G2081040G2081040G2081040G208105NK8PE5) u1000) (ok 1) (err 2))) | ||
(unwrap-panic (if (is-eq (stx-get-balance 'S1G2081040G2081040G2081040G208105NK8PE5.names) u2000) (ok 1) (err 2))) | ||
"#).unwrap(); |
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.
@kantai How would a test for an account overflow look like?
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.
I think using this interface, it'd be a little hard to actually test a STX overflow, since that would require loading an account with u128::max_value, though JSON parsing really only works up to u64.
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.
LGTM!
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.
Looks good to me, thank you @kantai !
To support this issue in clarity-js-sdk: stacks-archive/clarity-js-sdk#77