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

Add tests for RandomBeaconHistory contract #389

Merged
merged 6 commits into from
Nov 7, 2023

Conversation

m-Peter
Copy link
Contributor

@m-Peter m-Peter commented Oct 19, 2023

Work towards onflow/developer-grants#216

Description

Uses the Cadence testing framework to test the functionality of RandomBeaconHistory contract.

@@ -3,5 +3,5 @@ import "RandomBeaconHistory"
/// Retrieves the source of randomness for the requested block height from the RandomBeaconHistory contract.
///
access(all) fun main(page: UInt64, perPage: UInt64): RandomBeaconHistory.RandomSourceHistoryPage {
return RandomBeaconHistory.getRandomSourceHistoryPage(page: page, perPage: perPage)
return RandomBeaconHistory.getRandomSourceHistoryPage(page, perPage: perPage)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cc @janezpodhostnik There was an error while testing this script, not how much important it is though.

Copy link
Collaborator

@janezpodhostnik janezpodhostnik Oct 30, 2023

Choose a reason for hiding this comment

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

Its not that important, as it is mostly as an example, but we should fix this. I'll open up a PR.

Thank you for finding this.

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 is fixed in this PR, so not sure there's a need to open up another PR.

"StakingProxy": {
"source": "./contracts/StakingProxy.cdc",
"aliases": {
"testing": "0x0000000000000007"
Copy link
Member

Choose a reason for hiding this comment

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

Why do they all have the same testing alias?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The testing alias is basically the account where the current contract will be deployed for usage in the Cadence testing framework. For the sake of completion & consistency, I had added it to all contracts in the flow.json config file. It does not need to be the same though. There are 10 predefined accounts that can be used as the testing alias.

@m-Peter m-Peter marked this pull request as ready for review October 31, 2023 10:41
@m-Peter
Copy link
Contributor Author

m-Peter commented Oct 31, 2023

The CI does not automatically run for pull requests coming from forks.

@joshuahannan joshuahannan merged commit 58fd61d into onflow:master Nov 7, 2023
1 check passed
@m-Peter m-Peter deleted the bootstrap-cadence-testing branch November 7, 2023 16:21
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