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

Feature: allow specifying initial stx balances with clarity-cli #1662

Merged
merged 1 commit into from
Jun 29, 2020

Conversation

kantai
Copy link
Member

@kantai kantai commented Jun 5, 2020

To support this issue in clarity-js-sdk: stacks-archive/clarity-js-sdk#77

@psq
Copy link
Contributor

psq commented Jun 5, 2020

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();
Copy link
Collaborator

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?

Copy link
Member Author

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.

@diwakergupta diwakergupta added this to the 2020 W23-W25 milestone Jun 8, 2020
@kantai kantai requested review from jcnelson and lgalabru June 22, 2020 15:13
Copy link
Member

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@lgalabru lgalabru left a 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 !

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.

None yet

6 participants