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

Create a testing contract for easier "full stack" testing #1403

Merged
merged 12 commits into from
Aug 29, 2022

Conversation

uint
Copy link
Contributor

@uint uint commented Aug 29, 2022

Closes #1401

@uint uint requested a review from webmaster128 August 29, 2022 16:04
Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

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

Good stuff.

I think we need a better name. Having a tests contract in a test as part of the tests is not super helpful. I don't have great ideas. We can go for any fantasy name or just "stateless" or "pure".

contracts/tests/examples/schema.rs Outdated Show resolved Hide resolved
contracts/tests/src/errors.rs Outdated Show resolved Hide resolved
contracts/tests/src/contract.rs Outdated Show resolved Hide resolved
}
}

fn do_argon2(mem_cost: u32, time_cost: u32) -> Result<Response, HackError> {
Copy link
Member

Choose a reason for hiding this comment

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

Renaming this to fn execute_argon2 would be more consistent with the fn query_* style we usually use for queries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, when working on Isotonic we got into the habit of creating submodules like

mod query {
    fn balance(...) -> ... {}
    // ...
}

mod execute {
    fn mint(...) -> ... {}
    // ...
}

I'd kind of want to do that, but I also understand it wouldn't be consistent with the style of other contracts in the repo.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds great. Let's do that for all new contracts.

Copy link
Member

Choose a reason for hiding this comment

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

is fn execute and mod execute in the same module not a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It isn't. I think those are separate namespaces

contracts/tests/src/errors.rs Outdated Show resolved Hide resolved
contracts/tests/src/msg.rs Outdated Show resolved Hide resolved
@uint
Copy link
Contributor Author

uint commented Aug 29, 2022

I think we need a better name. Having a tests contract in a test as part of the tests is not super helpful. I don't have great ideas. We can go for any fantasy name or just "stateless" or "pure".

...would cyberpunk be alright here? I like cyberpunk.

@webmaster128
Copy link
Member

...would cyberpunk be alright here? I like cyberpunk.

Absolutely

@uint uint requested a review from webmaster128 August 29, 2022 18:39
@webmaster128 webmaster128 merged commit 152721c into main Aug 29, 2022
@webmaster128 webmaster128 deleted the testing-contract branch August 29, 2022 19:50
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.

Create stateless testing contract
2 participants