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

[Test] Unable to use RandomBeaconHistory contract #261

Closed
austinkline opened this issue Dec 21, 2023 · 0 comments · Fixed by #262
Closed

[Test] Unable to use RandomBeaconHistory contract #261

austinkline opened this issue Dec 21, 2023 · 0 comments · Fixed by #262
Labels
Bug The issue represents a bug, malfunction, regression Feedback

Comments

@austinkline
Copy link

austinkline commented Dec 21, 2023

Current Behavior

The use of the RandomBeaconHistory in the Cadence testing framework is broken, I get the following error when running a test on a repo of ours:

Full stack trace- FAIL: testDrawFromRaffle Execution failed: error: assertion failed: given value is: I.Test.Test.TransactionResult(status: I.Test.Test.ResultStatus(rawValue: 1), error: I.Test.Test.Error(message: "[Error Code: 1101] error caused by: 1 error occurred:\n\t* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:\n --> 1add2b24ceb669bec953141646beef36854a11de994050782405416e5f1cdd90:10:8\n |\n10 | manager.revealDrawing(manager: ref, raffleID: id, receiptID: receiptID)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n --> 0000000000000007.FlowtyRaffles:319:12\n |\n319 | manager._revealDrawing(raffleID: raffleID, receiptID: receiptID, drawer: ref)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n --> 0000000000000007.FlowtyRaffles:327:32\n |\n327 | let drawingResult = raffle.revealDrawing(id: receiptID)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n --> 0000000000000007.FlowtyRaffles:183:51\n |\n183 | let res: FlowtyRaffles.DrawingResult = receipt.reveal(ref)\n | ^^^^^^^^^^^^^^^^^^^\n\n --> 0000000000000007.FlowtyRaffles:107:23\n |\n107 | let rand = FlowtyRaffles.randUInt64(atBlockHeight: self.commitBlock, salt: self.uuid)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n --> 0000000000000007.FlowtyRaffles:347:33\n |\n347 | let sourceOfRandomness = RandomBeaconHistory.sourceOfRandomnessAtBlockHeight(blockHeight: atBlockHeight)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nerror: pre-condition failed: Source of randomness not yet recorded\n --> 0000000000000001.RandomBeaconHistory:96:12\n |\n96 | blockHeight < getCurrentBlock().height: \"Source of randomness not yet recorded\"\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n\n")) --> test_helpers.cdc:60:4

The important Part:

0000000000000007.FlowtyRaffles:347:33
    |
347 |         let sourceOfRandomness = RandomBeaconHistory.sourceOfRandomnessAtBlockHeight(blockHeight: atBlockHeight)
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: pre-condition failed: Source of randomness not yet recorded
  --> 0000000000000001.RandomBeaconHistory:96:12
   |
96 |             blockHeight < getCurrentBlock().height: \"Source of randomness not yet recorded\"
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


"))
			  --> test_helpers.cdc:60:4

Expected Behavior

Randomness Beacon should work

Steps To Reproduce

PR to reproduce:
Flowtyio/flow-raffle#17

pull its branch down and run

./run-tests.sh

Environment

- Cadence version: v1.9.2
- Network: Cadence Testing Framework
@austinkline austinkline added Bug The issue represents a bug, malfunction, regression Feedback labels Dec 21, 2023
@turbolent turbolent changed the title [Cadence Testing Framework] Unable to use RandomnessBeacon contract in the cadence testing framework [Test] Unable to use RandomnessBeacon contract in the cadence testing framework Dec 29, 2023
@turbolent turbolent changed the title [Test] Unable to use RandomnessBeacon contract in the cadence testing framework [Test] Unable to use RandomBeaconHistory contract Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The issue represents a bug, malfunction, regression Feedback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant