Closed austinkline closed 8 months ago
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:
RandomBeaconHistory
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
Randomness Beacon should work
PR to reproduce: https://github.com/Flowtyio/flow-raffle/pull/17
pull its branch down and run
./run-tests.sh
- Cadence version: v1.9.2 - Network: Cadence Testing Framework
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
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:
Expected Behavior
Randomness Beacon should work
Steps To Reproduce
PR to reproduce: https://github.com/Flowtyio/flow-raffle/pull/17
pull its branch down and run
Environment