From c7ba90ac2848348a47e75f886c17de627385b686 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com> Date: Mon, 16 Oct 2023 20:48:04 +0200 Subject: [PATCH] RandomBeaconHistory contract (#375) * Minimal source of randomness contract * Add call to entropy * Source of randomness history suggestions (#377) * change sor heartbeat signature * RandomBeaconHistory impl + transactions & scripts * simplify RandomBeaconHistory interface * rm RandomBeaconHistory.HeartbeatPublicPath * cleanup RandomBeaconHistory formatting & naming * update go assets * update RandomBeaconHistory events & err messages * update go assets * Update contracts/RandomBeaconHistory.cdc Co-authored-by: Tarak Ben Youssef <50252200+tarakby@users.noreply.github.com> * update go assets * rename RandomBeaconHistory.initHeight -> .lowestHeight * add RandomBeaconHistory.getRandomSourceHistoryPage() * add RandomBeaconHistory scripts * update go assets * fix RandomBeaconHistory typo * update go assets * update RandomBeacon naming * remove unused transaction and rename * fix get_source_of_randomness script * Adress review comments * change signature of sourceOfRandomness * fix tidy --------- Co-authored-by: Tarak Ben Youssef <50252200+tarakby@users.noreply.github.com> Co-authored-by: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com> --- contracts/RandomBeaconHistory.cdc | 168 ++++++++++++++++++ flow.json | 16 +- lib/go/contracts/contracts.go | 33 ++-- lib/go/contracts/internal/assets/assets.go | 23 +++ lib/go/templates/internal/assets/assets.go | 73 ++++++++ lib/go/templates/templates.go | 60 ++++--- .../get_latest_source_of_randomness.cdc | 7 + .../scripts/get_source_of_randomness.cdc | 7 + .../scripts/get_source_of_randomness_page.cdc | 7 + 9 files changed, 344 insertions(+), 50 deletions(-) create mode 100644 contracts/RandomBeaconHistory.cdc create mode 100644 transactions/randomBeaconHistory/scripts/get_latest_source_of_randomness.cdc create mode 100644 transactions/randomBeaconHistory/scripts/get_source_of_randomness.cdc create mode 100644 transactions/randomBeaconHistory/scripts/get_source_of_randomness_page.cdc diff --git a/contracts/RandomBeaconHistory.cdc b/contracts/RandomBeaconHistory.cdc new file mode 100644 index 000000000..865d06e68 --- /dev/null +++ b/contracts/RandomBeaconHistory.cdc @@ -0,0 +1,168 @@ +/// RandomBeaconHistory (FLIP 123) +/// +/// This contract stores the history of random sources generated by the Flow network. The defined Heartbeat resource is +/// updated by the Flow Service Account at the end of every block with that block's source of randomness. +/// +/// While the source values are safely generated by the Random Beacon (non-predictable, unbiasable, verifiable) and transmitted into the execution +/// environment via the committing transaction, using the raw values from this contract does not guarantee non-revertible +/// randomness. The Hearbeat is intended to be used in conjunction with a +/// commit-reveal mechanism to provide an onchain source of non-revertible randomness. +// It is also recommended to use the source values with a pseudo-random number +// generator (PRNG) to generate an arbitrary-long sequence of random values. +// +// For usage of randomness where result abortion is not an issue, it is recommended +// to use the Cadence built-in function `revertibleRandom`, which is also based on +// the safe Random Beacon. +/// +/// Read the full FLIP here: https://github.com/onflow/flips/pull/123 +/// +access(all) contract RandomBeaconHistory { + + /// The height at which the first source of randomness was recorded + access(contract) var lowestHeight: UInt64? + /// Sequence of random sources recorded by the Heartbeat, stored as an array over a mapping to reduce storage + access(contract) let randomSourceHistory: [[UInt8]] + + /// The path of the Heartbeat resource in the deployment account + access(all) let HeartbeatStoragePath: StoragePath + + /* --- Hearbeat --- */ + // + /// The Heartbeat resource containing each block's source of randomness in sequence + /// + access(all) resource Heartbeat { + + /// Callable by owner of the Heartbeat resource, Flow Service Account, records the provided random source + /// + /// @param randomSourceHistory The random source to record + /// + access(all) fun heartbeat(randomSourceHistory: [UInt8]) { + + let currentBlockHeight = getCurrentBlock().height + if RandomBeaconHistory.lowestHeight == nil { + RandomBeaconHistory.lowestHeight = currentBlockHeight + } + + RandomBeaconHistory.randomSourceHistory.append(randomSourceHistory) + } + } + + /* --- RandomSourceHistory --- */ + // + /// Represents a random source value for a given block height + /// + access(all) struct RandomSource { + access(all) let blockHeight: UInt64 + access(all) let value: [UInt8] + + init(blockHeight: UInt64, value: [UInt8]) { + self.blockHeight = blockHeight + self.value = value + } + } + + /* --- RandomSourceHistoryPage --- */ + // + /// Contains RandomSource values ordered chronologically according to associated block height + /// + access(all) struct RandomSourceHistoryPage { + access(all) let page: UInt64 + access(all) let perPage: UInt64 + access(all) let totalLength: UInt64 + access(all) let values: [RandomSource] + + init(page: UInt64, perPage: UInt64, totalLength: UInt64, values: [RandomSource]) { + self.page = page + self.perPage = perPage + self.totalLength = totalLength + self.values = values + } + } + + /* --- Contract Methods --- */ + // + /// Getter for the source of randomness at a given block height. Panics if the requested block height either + /// precedes or exceeds the recorded history. Note that a source of randomness for block n will not be accessible + /// until block n+1. + /// + /// @param atBlockHeight The block height at which to retrieve the source of randomness + /// + /// @return The source of randomness at the given block height as RandomSource struct + /// + access(all) fun sourceOfRandomness(atBlockHeight blockHeight: UInt64): RandomSource { + pre { + self.lowestHeight != nil: "History has not yet been initialized" + blockHeight >= self.lowestHeight!: "Requested block height precedes recorded history" + blockHeight < getCurrentBlock().height: "Source of randomness not yet recorded" + } + let index = blockHeight - self.lowestHeight! + assert( + index >= 0 && index < UInt64(self.randomSourceHistory.length), + message: "Problem finding random source history index" + ) + return RandomSource(blockHeight: blockHeight, value: self.randomSourceHistory[index]) + } + + /// Retrieves a page from the history of random sources, ordered chronologically + /// + /// @param page: The page number to retrieve, 0-indexed + /// @param perPage: The number of random sources to include per page + /// + /// @return A RandomSourceHistoryPage containing RandomSource values in choronological order according to + /// associated block height + /// + access(all) view fun getRandomSourceHistoryPage(_ page: UInt64, perPage: UInt64): RandomSourceHistoryPage { + pre { + self.lowestHeight != nil: "History has not yet been initialized" + } + let values: [RandomSource] = [] + let totalLength = UInt64(self.randomSourceHistory.length) + + var startIndex = page * perPage + if startIndex > totalLength { + startIndex = totalLength + } + var endIndex = startIndex + perPage + if endIndex > totalLength { + endIndex = totalLength + } + // Return empty page if request exceeds last page + if startIndex == endIndex { + return RandomSourceHistoryPage(page: page, perPage: perPage, totalLength: totalLength, values: values) + } + + // Iterate over history and construct page RandomSource values + let lowestHeight = self.lowestHeight! + for i, block in self.randomSourceHistory.slice(from: Int(startIndex), upTo: Int(endIndex)) { + values.append( + RandomSource( + blockHeight: lowestHeight + startIndex + UInt64(i), + value: self.randomSourceHistory[startIndex + UInt64(i)] + ) + ) + } + + return RandomSourceHistoryPage( + page: page, + perPage: perPage, + totalLength: totalLength, + values: values + ) + } + + /// Getter for the block height at which the first source of randomness was recorded + /// + /// @return The block height at which the first source of randomness was recorded + /// + access(all) view fun getLowestHeight(): UInt64 { + return self.lowestHeight ?? panic("History has not yet been initialized") + } + + init() { + self.lowestHeight = nil + self.randomSourceHistory = [] + self.HeartbeatStoragePath = /storage/FlowRandomBeaconHistoryHeartbeat + + self.account.save(<-create Heartbeat(), to: self.HeartbeatStoragePath) + } +} diff --git a/flow.json b/flow.json index 127ae472b..1b967a987 100644 --- a/flow.json +++ b/flow.json @@ -1,16 +1,9 @@ { - "emulators": { - "default": { - "port": 3569, - "serviceAccount": "emulator-account" - } - }, "contracts": { "FlowClusterQC": "./contracts/epochs/FlowClusterQC.cdc", - "FlowEpoch": "./contracts/epochs/FlowEpoch.cdc", - "FlowDKG": "./contracts/epochs/FlowEpoch.cdc", - "NodeVersionBeacon": "./contracts/NodeVersionBeacon.cdc", "FlowContractAudits": "./contracts/FlowContractAudits.cdc", + "FlowDKG": "./contracts/epochs/FlowEpoch.cdc", + "FlowEpoch": "./contracts/epochs/FlowEpoch.cdc", "FlowFees": "./contracts/FlowFees.cdc", "FlowIDTableStaking": "./contracts/FlowIDTableStaking.cdc", "FlowIDTableStaking_old": "./contracts/FlowIDTableStaking_old.cdc", @@ -19,6 +12,8 @@ "FlowStorageFees": "./contracts/FlowStorageFees.cdc", "FlowToken": "./contracts/FlowToken.cdc", "LockedTokens": "./contracts/LockedTokens.cdc", + "NodeVersionBeacon": "./contracts/NodeVersionBeacon.cdc", + "RandomBeaconHistory": "./contracts/RandomBeaconHistory.cdc", "StakingProxy": "./contracts/StakingProxy.cdc" }, "networks": { @@ -31,6 +26,5 @@ "address": "f8d6e0586b0a20c7", "key": "7677f7c9410f8773b482737c778b5d7c6acfdbbae718d61e4727a07667f66004" } - }, - "deployments": {} + } } \ No newline at end of file diff --git a/lib/go/contracts/contracts.go b/lib/go/contracts/contracts.go index 254e6eab0..e417adc9f 100644 --- a/lib/go/contracts/contracts.go +++ b/lib/go/contracts/contracts.go @@ -26,19 +26,20 @@ import ( /// const ( - flowFeesFilename = "FlowFees.cdc" - storageFeesFilename = "FlowStorageFees.cdc" - flowServiceAccountFilename = "FlowServiceAccount.cdc" - flowTokenFilename = "FlowToken.cdc" - flowIdentityTableFilename = "FlowIDTableStaking.cdc" - flowQCFilename = "epochs/FlowClusterQC.cdc" - flowDKGFilename = "epochs/FlowDKG.cdc" - flowEpochFilename = "epochs/FlowEpoch.cdc" - flowLockedTokensFilename = "LockedTokens.cdc" - flowStakingProxyFilename = "StakingProxy.cdc" - flowStakingCollectionFilename = "FlowStakingCollection.cdc" - flowContractAuditsFilename = "FlowContractAudits.cdc" - flowNodeVersionBeaconFilename = "NodeVersionBeacon.cdc" + flowFeesFilename = "FlowFees.cdc" + storageFeesFilename = "FlowStorageFees.cdc" + flowServiceAccountFilename = "FlowServiceAccount.cdc" + flowTokenFilename = "FlowToken.cdc" + flowIdentityTableFilename = "FlowIDTableStaking.cdc" + flowQCFilename = "epochs/FlowClusterQC.cdc" + flowDKGFilename = "epochs/FlowDKG.cdc" + flowEpochFilename = "epochs/FlowEpoch.cdc" + flowLockedTokensFilename = "LockedTokens.cdc" + flowStakingProxyFilename = "StakingProxy.cdc" + flowStakingCollectionFilename = "FlowStakingCollection.cdc" + flowContractAuditsFilename = "FlowContractAudits.cdc" + flowNodeVersionBeaconFilename = "NodeVersionBeacon.cdc" + flowRandomBeaconHistoryFilename = "RandomBeaconHistory.cdc" // Test contracts // only used for testing @@ -342,6 +343,12 @@ func NodeVersionBeacon() []byte { return []byte(code) } +func RandomBeaconHistory() []byte { + code := assets.MustAssetString(flowRandomBeaconHistoryFilename) + + return []byte(code) +} + // FlowContractAudits returns the deprecated FlowContractAudits contract. // This contract is no longer used on any network func FlowContractAudits() []byte { diff --git a/lib/go/contracts/internal/assets/assets.go b/lib/go/contracts/internal/assets/assets.go index 924467011..9f3b3d596 100644 --- a/lib/go/contracts/internal/assets/assets.go +++ b/lib/go/contracts/internal/assets/assets.go @@ -9,6 +9,7 @@ // FlowToken.cdc (11.433kB) // LockedTokens.cdc (29.136kB) // NodeVersionBeacon.cdc (22.585kB) +// RandomBeaconHistory.cdc (6.953kB) // StakingProxy.cdc (5.483kB) // epochs/FlowClusterQC.cdc (17.938kB) // epochs/FlowDKG.cdc (18.223kB) @@ -263,6 +264,26 @@ func nodeversionbeaconCdc() (*asset, error) { return a, nil } +var _randombeaconhistoryCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\x6d\x8f\xdb\xb8\xf1\x7f\xbf\x9f\x62\x6e\x5f\xdc\xdf\x4e\xfc\x70\xb9\xfb\xa3\x28\x8c\x38\xe9\x5d\x80\x5c\x16\x48\xaf\x8b\xdd\x14\x7d\xb1\x58\xf4\x28\x69\x64\xb1\x47\x93\x2a\x49\xd9\x71\x0f\xf9\xee\xc5\x90\x94\x4c\xca\xd4\x26\x29\xda\x05\x9c\x58\x16\x39\x8f\xbf\xf9\xcd\x90\xeb\xf5\x1a\xee\x98\xac\xd4\xfe\x27\x64\xa5\x92\xef\xb8\xb1\x4a\x9f\x60\xf6\xf6\xfd\xcd\x2d\xbc\xf8\xfe\x87\xf9\xd5\x7a\xbd\xa6\x0f\x7c\x68\xb8\x81\x52\x49\xab\x59\x69\x81\x96\xa1\x01\xdb\x20\x34\x61\x8f\xaa\x41\x3b\x51\x60\x54\xa7\x4b\x34\xb0\x43\x89\x9a\x59\xac\xa0\x38\xb9\xa5\x6f\x85\x3a\x82\x44\x7b\x54\xfa\xb7\x15\x7c\x68\x10\x2a\xac\xb9\xc4\x0a\xde\x21\xd3\xb6\x40\x66\x41\xa3\xdf\x0e\xdc\x38\xbd\x5d\x5b\x5d\x88\xb8\x47\x7d\xe0\x25\xc2\x8f\x65\xa9\x3a\x69\x81\x59\xf7\x0e\x65\x45\x56\xe0\x01\xf5\x09\x0a\xa1\xca\xdf\xe0\xc8\x6d\x03\xb6\x61\xd6\x3f\xff\x9f\x09\xc6\x9d\xad\x95\x68\xcc\x6a\xf0\xf2\x6f\x0d\x17\xe8\x84\x85\x75\x07\x26\x3a\x34\xc0\x34\x82\x61\x35\x8a\xd3\xa5\x57\x3e\x80\xe0\x23\x08\x33\xa9\xe4\xb2\xd5\x58\xf1\xd2\xb2\x42\xe0\x02\x3a\x59\x70\x66\xfc\xf7\x03\x6a\x5e\x73\xfa\x3e\x07\x26\x2b\xb0\x9a\x49\xb3\xe7\x96\xc4\x71\x69\x95\xf7\xe3\x23\x96\x9d\xe5\x4a\x82\xb3\x09\xe5\x81\x6b\x25\xf7\x28\x2d\x1c\x38\x73\x4b\x4a\xb5\xa7\x5d\x5c\xee\xbc\x08\x56\xd2\xfa\x05\x74\xc6\xfd\xd4\x20\x68\x76\xec\x8d\xaf\xb5\xda\x83\x4d\xf2\x57\x29\x34\x20\x95\x85\x5d\xc7\x34\x93\x16\x11\xc8\x6e\x4d\xb1\xb3\xbc\x10\xe8\x34\x47\x11\x72\xd9\xa2\x2c\xb9\x24\x71\x43\xd6\xa2\xac\xb0\x02\xab\xa0\x40\xe8\x8c\xf3\x80\x34\xfc\xa3\x93\xce\x1a\x1f\x7c\xe6\x24\x79\x7b\x9d\x7c\x26\x60\x8f\x65\xc3\x24\x37\x7b\xda\xdc\x6a\x75\xe0\x15\x02\x93\xa0\x64\xd9\x30\x2e\xa3\x1c\xa5\x46\x8d\x52\x06\x37\xce\x12\x26\x8c\x02\x8d\xa4\x62\xb0\xa8\x33\xb9\x2c\x7a\x83\xa0\x35\xd8\x55\x6a\x19\xd0\x2a\xbb\x7d\x81\x9a\x42\xdd\xa7\x56\x69\x98\xdd\xde\xfd\xf2\xf3\x9c\x24\xf5\xe9\x26\xfb\x98\x2e\xb8\xd5\x4c\x9f\x96\x42\xc9\x1d\x18\xfc\x67\x87\x32\x06\x53\x50\xb4\x72\xd2\xe8\xf3\x56\x69\xe8\x0c\xdb\x8d\x00\x07\xc7\x06\x35\x12\xd6\x3b\x61\x81\x15\x4a\xbb\x80\x71\x9f\x13\x46\xdf\x4c\x87\x0b\xe0\xce\xc1\xc8\x37\x92\x19\xb9\xf7\x86\x55\xce\x80\xa2\xe3\xc2\x2e\xb9\x84\xba\x8f\xfd\xaf\xe7\xa8\x79\x7c\xfe\xba\x80\x63\xc3\xcb\x66\x88\x58\xc1\x28\x65\x1e\x64\x3e\x56\xac\x1e\x81\xd9\xf9\xe1\x0b\xe3\x0e\x59\xe5\x56\xd5\x9d\x10\xe0\xe8\x81\x5c\xd8\x40\x63\x6d\x6b\x36\xeb\xf5\x8e\xdb\xa6\x2b\x56\xa5\xda\xaf\x95\xac\x85\x3a\xae\x6b\xc1\x5b\xb3\x6e\x3b\x21\xd6\x2f\xbe\xff\xc1\x49\x62\x65\x89\xc6\xcc\x98\x10\xf3\x33\x16\x73\x04\xf4\xfb\xd5\x15\x00\x80\x27\x1e\x84\x06\xf9\xae\x71\x75\xee\x7d\x70\x86\x70\x6d\x6c\xb6\x9c\xe1\xc8\x7c\xd0\x34\x45\x8c\xe4\x04\xbd\xbd\xca\x39\x1c\x98\x06\xa1\x8e\x68\xec\x3b\x27\x7a\x03\x7f\xbd\x91\xf6\x0f\xff\xff\x7a\x50\x7b\x7f\x99\xdc\x9e\xd7\x7a\xd1\x3d\x01\x0c\xe4\xb5\xf0\xbc\x58\x01\x33\x1e\x2e\x9a\x9d\x40\x1d\x50\x03\x83\x3d\x6b\x5b\x57\x9b\x84\xd5\xaa\x2b\xd1\xad\x65\x3b\xcc\x1b\x28\xd0\x06\xb5\xf7\x4e\x6b\x08\xcc\x06\x1e\x1e\xc8\xd2\x3f\x3e\x3e\xa6\x11\x6a\x99\x6d\xc8\xd4\xc4\x9e\x88\x4c\xa5\x7b\x53\x61\x2b\xd4\xc9\x31\x09\xf3\xdc\x19\x6b\x77\x69\x21\xc5\x83\x80\x7b\x6f\xe2\x2d\xb3\xcd\x06\xa2\x87\xa0\xfb\x19\x2c\x97\xcb\x33\x2b\xd0\xc3\xb3\x75\x30\x2b\xb1\x2e\x63\x11\xb9\xca\xb8\xa4\x90\x20\x2b\x9b\x27\xf9\x99\xcc\xef\x8b\xad\x97\x7b\x61\xf8\x20\xf9\xac\x2c\xa0\xa8\xb7\xe4\x0d\x13\x82\xa8\x97\xf2\xa6\x8e\x12\xf5\x74\xc0\x16\xd9\x46\xb3\x08\xa9\xf7\x8d\x2f\x10\x57\x95\xc2\x23\xd6\x98\x68\xff\x53\xcb\x34\xdb\xe7\x92\xea\x42\x94\x08\xf1\x28\x21\x55\x59\x71\xb1\xdb\x75\x27\xa1\xe9\xed\x9f\xe5\x21\xe3\x11\x33\x8f\xe3\x41\x7f\x94\xea\xb2\xd3\x1a\xa5\xfd\x89\xa2\xef\x4b\x01\xb6\xb0\x43\xfb\x26\xfa\x7d\x36\x5f\xf9\x02\x4c\x76\xf3\x3a\x57\xb9\xab\xb8\xaa\x60\xbb\x05\xc9\x05\xfc\x9e\x6c\xa4\xbf\xcf\xef\xcc\x58\x96\x48\xf9\x94\xfa\x92\x13\x98\x09\xc6\x8a\xb5\x2d\xca\x2a\x17\xa7\xf9\xd5\x59\x74\xa4\x20\x80\xfc\x2e\x93\xb6\x3c\xde\xef\xb0\xd5\x68\x50\x5a\x03\x6c\x94\x55\xd7\x1d\xa0\x56\xc4\x07\x3b\x7e\x40\x19\xa6\x94\x28\xba\x39\x64\x1b\xab\xbb\x81\x27\xbd\x09\x51\x48\xc7\xc5\x5b\x9c\x03\xd6\xb3\xda\xe4\x5a\x67\xd0\x00\x10\xb7\x6c\x58\xcb\x25\xb7\xb3\x8c\xb0\xc5\x68\xd7\x7c\x94\x5e\x83\xa2\x5e\x15\x09\x9e\x8a\x89\x1c\xba\xa5\x3e\x28\x5b\x2f\xf5\x6b\x73\x70\x4b\xad\x35\x9f\x87\x37\x9e\x60\x4c\x1a\xb7\x30\x09\x10\x7f\x13\x51\x97\x8d\x56\x52\x09\xb5\xe3\x25\x13\xe2\xe4\x58\x51\x57\x81\xa7\x99\x31\xaa\xe4\x7e\xd4\xfb\x0f\xf3\x14\x9b\x39\x9d\xb2\x96\xed\xf0\xb3\xb9\x6a\x51\xdf\x7e\xc9\x3a\xab\x2c\x13\xef\x51\xee\x88\xb3\xbf\x24\xff\x66\x03\x0f\xb1\xcd\x39\x1c\xc4\x16\x2e\xc6\xa6\x2c\x72\x3a\x17\x13\xc2\xb3\x70\x21\xf1\xb0\x75\x71\xc8\xbc\xf4\xda\xe8\xbd\xff\x76\xb9\x24\xd2\x0f\xdb\xd8\x9a\x09\xb8\x99\x1e\x6f\xe6\x49\xc0\xbd\xe9\x47\x94\x3f\xa3\x6d\x54\x65\x26\x90\xf6\x33\x5a\x8b\xda\xd5\x75\x34\x73\xa6\x1d\x8c\xd9\x6c\xcd\xaf\xe0\x96\x49\x5e\x1a\x62\x53\x37\xb5\x53\x97\x33\x63\xc4\x01\x72\xdb\xa0\x1e\x14\xb6\x1a\x4b\xac\x1c\x8c\x01\x3f\x96\x88\xa1\x23\x0d\x83\x49\x38\x93\xad\xe0\x17\x65\xd1\x9f\x7f\x58\xde\x2e\x32\xda\xab\xa2\x79\x5d\x08\x37\x80\x16\x18\x90\xe2\x4e\x02\xbd\xd6\x4e\x5a\x2e\xfa\xc5\xcf\x5f\xac\x92\x3a\x88\x3a\x1c\x4b\xba\x09\xf5\xb6\xc4\x97\xf3\x10\x47\x3d\xce\x6a\x8e\x07\x9c\x8c\xdb\xa5\x0e\x8d\xb6\xd3\xd2\x89\x9d\x0a\x34\x09\xbb\x0c\x35\x0d\x65\x09\x15\xf8\x72\x9d\xac\x66\x6a\xac\x5e\xc3\x5f\xea\xbb\x41\xfe\x2c\xf5\x2e\xc3\x8f\xf3\xcd\x14\x53\xb7\x1a\x73\xe0\x4f\xfa\xde\x37\xae\x63\x6e\xe0\xba\x6f\x32\x0d\xf3\x87\x82\x13\x51\x3b\xa2\x74\xf5\xc8\x99\xe0\xff\xc2\xea\x3a\x11\x16\x73\xee\xab\xed\xa5\xec\x6f\x36\x70\x7d\x97\xc7\xd7\x00\xa8\x31\x82\xa6\x35\xbc\x9c\x9c\x12\x36\x70\x7d\x9f\xcb\x4c\xef\x45\xaf\xe3\x7a\x54\x7b\x10\x46\x12\x2e\x2b\xfc\x98\x76\x0d\x58\x66\xdc\x39\xb3\x9a\x31\xa8\xed\x2c\x9d\x4e\x9c\x90\x57\x5b\xf8\x0e\xbe\xfd\x36\x3c\xbd\x0c\x19\x9a\x39\x59\xb9\xe9\x40\x38\xd2\x98\x2f\x12\x51\x7b\x34\xc6\xb1\xdd\xf5\xad\x56\x85\xc0\x3d\xd4\x5c\xba\x1e\x91\x76\xf7\xfe\x22\xc4\x29\x3b\x3b\x77\x9e\x2b\x02\x74\x63\x74\xa4\x0d\x36\x7a\x18\xba\xec\x94\xad\x0f\x4e\xcd\xe3\x3c\xa1\x2d\x37\x7e\xf8\x92\xa2\xe9\xc3\xd1\x6a\x38\xfd\x3f\x71\x51\xb3\x98\x6a\x87\x53\x15\xee\xbb\x81\x3f\x76\xec\xb0\x3f\x41\x47\xf5\xbc\x80\xef\x96\xce\xbe\x70\xfe\x8a\xf7\xf6\xbd\x83\xb6\x87\x9d\x97\x47\x2c\xab\x80\xcb\x52\x74\x15\xd2\x86\x73\x63\xc8\x51\xc1\x8f\x93\x1d\x37\x3a\x63\xe4\x86\x00\x2e\xa1\x6c\x54\xe4\xb1\x8f\x43\x32\x04\x0c\xda\xbe\x76\x18\x38\x70\x3c\x3a\x0e\xd9\xa1\x9d\xb0\x6f\xf6\x77\x78\xb2\xaf\x8e\x98\x24\x3f\x4b\xfc\x0f\x49\x25\x2d\xcb\x7c\x3b\x87\x2d\x3c\x3c\x26\xeb\xd2\x5e\xfc\x85\x15\x77\x1e\xe6\xe9\x64\x6e\x2c\xd3\xf6\x26\xd0\x80\x83\xd8\xb3\x8b\xde\xcf\xeb\x78\xd9\xab\x44\xed\x28\x1e\xb1\xb4\xdc\x6c\xf0\x29\x51\x8e\xb2\xea\x17\x47\x3b\x9f\xe7\x0c\x18\x96\x3e\xa5\x3e\x92\xf7\xb4\x72\x5f\xbc\x84\x68\xdc\xb7\xf6\xe4\x1d\xe7\x75\x3f\x13\x0c\x9d\x5e\x30\x63\xd3\x51\x29\x8d\xc5\x76\x7b\xd6\x99\x9a\x92\x21\xa0\x18\x8e\x1e\x8c\xf4\x6f\x04\xc5\xf0\x65\x34\xe3\x45\x0f\xe7\x41\xcf\xff\x1f\x9f\xa3\x62\xdf\x6e\xac\xbf\x47\x73\xf7\x21\x3d\x17\x31\x59\x51\x95\x86\xc9\xd9\x79\x9c\xa9\xd4\x04\x5f\xa3\x63\xe2\x13\x7d\x81\x66\x1b\xbe\x08\xe5\xea\xae\x10\x26\x40\x68\x04\x2f\x71\x46\x44\xb9\x81\x1b\x69\x67\xe7\x60\xce\x17\xd0\xb5\x1f\x94\xff\xb9\x8f\xea\x7c\x3c\xc3\x86\x5b\xbf\x70\xb6\x9c\x38\xec\x06\xc2\xbf\x78\x0b\x69\x63\xdd\xa4\x0e\x3e\x4f\x41\x18\xca\x89\x8f\x5a\x54\x62\xc8\x13\x3d\x23\x2f\xeb\xf1\x42\xd6\xfc\x2a\xff\x14\x65\xf4\x33\x58\x4a\x04\x44\xc0\x4a\x7f\x1f\x83\x2c\x79\x3b\x09\xb8\x4c\xec\x37\x63\xa4\x5c\xf4\xc5\xd1\x90\x3e\x31\x92\x7e\xe5\xbd\xe2\xd4\x64\xfa\xdf\x95\x3e\xd5\x56\xde\x47\x40\x99\xcd\xfb\xae\x11\x61\x33\x58\x74\xd9\x10\x5e\xbf\x86\x96\xce\x1d\xb3\x2f\xeb\x08\x49\x30\xdd\x79\x30\xae\x80\x4b\xf1\xae\xdd\xa4\xef\x73\xd7\x5e\x49\xeb\x70\xab\x72\x17\x8f\xb0\x85\x75\xb8\x2a\x5d\xbf\x15\xea\x98\xb9\xe9\x19\xb6\x5d\xa5\xe2\xc2\x1d\xe7\xca\xb0\x03\xce\x5e\x2e\x4b\x8d\x44\x40\xc3\xea\xd9\x9c\x58\x6d\x33\xad\xba\xf7\xfb\xd3\xd5\xbf\x03\x00\x00\xff\xff\x71\x04\x28\x86\x29\x1b\x00\x00" + +func randombeaconhistoryCdcBytes() ([]byte, error) { + return bindataRead( + _randombeaconhistoryCdc, + "RandomBeaconHistory.cdc", + ) +} + +func randombeaconhistoryCdc() (*asset, error) { + bytes, err := randombeaconhistoryCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "RandomBeaconHistory.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6b, 0x4, 0x9a, 0xe, 0x8a, 0xc0, 0x13, 0xd1, 0xa1, 0x68, 0x78, 0x86, 0x47, 0x78, 0x49, 0xf5, 0xb5, 0x14, 0x2b, 0x9d, 0x22, 0x59, 0xf, 0xb5, 0x84, 0x91, 0x5b, 0x73, 0xee, 0x7, 0x8c, 0xf1}} + return a, nil +} + var _stakingproxyCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\xdb\x6e\x1b\x37\x13\xbe\xd7\x53\x4c\x7c\x91\x48\x80\x63\xfd\xf8\x1b\x04\x85\x50\xb5\x4d\x63\x14\x35\x82\xa6\x46\xec\x5c\x15\x01\x42\x91\xb3\x5a\xc2\x5c\x72\x4b\x72\x23\xab\x86\xde\xbd\xe0\x69\xcf\x2b\xcb\x09\xa2\x1b\xed\x2e\x39\xa7\x6f\xc8\x99\x8f\x5c\x2e\xe1\x36\xe7\x06\xa8\x92\x56\x13\x6a\x81\x61\xc6\x25\x1a\x20\x12\xb8\xb4\xa8\x33\x42\x11\x32\xa5\x41\x2a\x86\x60\x2c\xb9\x43\x6d\x66\xcb\x25\x58\x05\x95\x41\xf7\xb7\x41\x20\x1b\xe1\x1f\x4b\xd4\x99\xd2\x05\x50\x55\x14\x4a\xfa\xe9\x5c\x6e\x81\x50\xcb\x95\x34\x33\x27\x77\x65\x81\x08\xa3\x1a\x43\xa0\xd1\xa8\x4a\x53\x04\x9b\x13\x0b\x24\x58\x52\x25\x6a\x62\x95\x06\x4a\xa4\x13\x8b\xb6\x8c\x55\x1a\x6b\xbd\xa5\x56\xf7\x1c\x8d\xf7\x8f\x08\x01\x2a\x03\x9b\x23\xd7\x6d\x15\x5c\x79\x79\x8d\xc2\x3f\x9b\x9c\x97\x66\x36\x2b\xab\x4d\x13\xf3\x4d\x50\x77\xad\xd5\xfd\x1e\x1e\x66\x33\x00\x80\xe5\x72\x09\x25\xb1\x79\x63\xd4\xe6\xd8\x73\x2d\x39\x5e\x0b\x70\x39\x9c\x65\x80\x50\xaa\x2a\x69\xbd\x97\xc9\xf3\x1c\x45\x89\xda\x0b\x3a\x57\x04\x5a\x78\xaf\x18\xfe\x15\x85\xde\x92\x92\x6c\xb8\xe0\x76\x7f\x63\x95\x26\x5b\xbc\x26\x36\x5f\x41\xeb\x65\x76\x82\xec\x75\xb5\x11\x9c\x06\xd1\xe6\xb9\x89\xef\xad\x92\x96\x70\x69\x1a\xa7\xb9\xcc\x14\x10\x63\x14\xe5\xc4\x22\x83\x1d\xb7\x79\x3f\x23\xb5\x61\x63\x75\x45\x83\xed\x2b\x27\x17\x91\x6b\xfb\xc5\x99\x73\x5a\x73\xb9\x1d\x0c\x69\x25\x70\x05\x1f\xaf\xa4\xfd\x71\x30\x26\xd1\xee\x94\x76\x40\xbd\x61\x4c\xa3\x31\x93\x5a\x9a\x99\xef\x70\x3f\x39\x2b\xa2\xde\x9e\x52\xcf\xe1\x92\xdb\xb9\x0b\xf0\xea\x32\x0d\x9e\xb7\x9d\x3b\x9f\xf6\xe6\x7c\xdc\xfc\xf9\x88\xbd\x05\x3c\xd4\x16\xbd\x67\x1a\x7b\x5f\xdc\x2f\xb8\x71\x21\x50\x6e\x6d\x0e\xeb\x35\xbc\x7e\xb5\x82\x33\x07\x30\x5c\x5d\x42\xfc\x5c\x54\xc6\xba\x3d\xf7\xc3\xff\x61\xb3\xb7\x68\x60\xfe\xfa\x15\xe4\x78\x0f\x34\x27\x6e\x39\xa3\x36\x8b\xb3\xa1\xea\x7e\x10\xc9\xca\xcf\xf0\x3f\x78\xfe\xbc\x1b\x49\x6f\xac\x09\xa7\x35\xb0\x1a\x98\x48\xbf\xb3\x68\x01\x88\x64\xf0\x0e\xf7\x90\x93\x2f\xa9\x50\xb8\x95\x46\x95\xd6\x48\x6d\x8c\xa7\xeb\xea\xa1\xf3\x66\x50\x64\x17\x9c\xc1\x3a\x22\x33\x1c\x74\x89\x82\xb5\xcf\xd7\x70\x70\x10\xb3\x53\xd4\xff\x76\x4c\xcc\x39\xbf\xee\x42\x33\x9c\xde\xa0\x03\xeb\x16\x54\xb3\x6e\x48\x87\x66\xdb\xdd\xe6\xd8\xaa\xad\xbe\xe8\x09\x5e\x70\x6b\x60\x37\x51\x00\x5d\x09\x49\xae\x3a\x0d\x99\x56\x85\x87\x32\xd4\x63\xd8\xe5\xca\xbd\xee\xa3\x90\x2f\xd8\xfd\x6d\xda\x58\x74\xeb\xe9\xc6\x0b\x76\x2a\x5e\x9a\x9f\x55\xa1\x70\xe3\x7b\xdc\xdd\xaa\x3b\x94\x66\x4e\x0a\x57\xc0\x56\xf0\xf1\x77\x7e\xff\xfa\xd5\x62\x62\xfe\x47\xe9\xff\xd8\xa9\x42\x1a\xff\xa9\xd0\xd8\x20\xc6\xe5\xf6\x71\x89\x2a\x58\x78\x23\xc4\x7c\x64\xd4\x15\x2b\xa6\xc9\xee\xa9\x7e\x24\xb9\x0f\xb8\x23\x9a\x1d\x97\x3b\x92\x46\x04\x86\x86\x6a\xbe\xc1\x3a\x91\x0c\x05\x6e\xeb\x24\x32\x75\x3c\x27\x97\x69\xf6\x64\x5a\xa2\xbe\xa7\x64\x26\x89\x3c\x15\x94\x24\x77\x0a\x28\xdf\x96\xd4\xef\x9c\xb6\xc7\x37\x5f\x7f\xc3\x95\xae\x55\x9a\x1c\x4d\x24\x13\xbd\xfd\xf2\x87\x12\x2c\xb6\x6e\xa7\x90\x18\xd7\xf6\x95\x66\xa8\x5d\x8d\x23\x42\xa8\x1d\x28\x9b\xfb\xd7\x3b\x94\x90\xfb\xf9\xc6\x0d\xba\x5e\xc3\x89\xe0\xff\x36\x94\xa1\x4b\x08\xba\x34\x25\xb4\x5f\x9b\x63\x51\x2f\x9c\x9a\x2b\x4d\x6e\xe7\xe0\x5e\x68\xf7\x63\x6b\x88\x30\xd6\xe6\x3b\x83\xd6\xe7\x38\xd5\x7e\x05\x6f\xe4\xfe\xc6\x2f\xd2\x87\x9e\xfe\xc3\x48\x2a\xb6\x68\x13\x0b\xe8\xe9\x5b\xac\x6a\x7e\xf0\xcb\x58\x2a\xba\xdc\xaf\x47\x9c\x02\xef\x0a\xa4\x8a\xeb\xc4\xa3\x9a\x32\x68\x15\x14\x44\x92\x2d\x8e\xc2\xd6\x01\xdf\x55\xc8\x92\xec\x3d\x98\xa0\xb2\xec\x25\xcd\x09\x97\x2d\xe2\x66\x2c\x12\xe6\x08\x64\x23\x6c\x86\xa8\x8f\x62\xbd\x3a\x35\x05\xce\xd2\x9f\xa4\x34\x21\xce\xab\x4b\xbf\x26\x88\xdc\xa7\x72\xe0\x31\xe0\x45\x29\xb0\x40\x69\x03\x2d\xeb\x17\xeb\x3a\xef\x1d\xad\x7e\xd5\x99\x3e\x7e\x56\x81\x6b\x5c\x21\xa4\xca\x78\x1c\xdc\xa3\x50\xf4\x0e\x59\x3b\xc8\x5a\x8f\x8c\x9c\x2f\x56\xda\xc1\xa4\xd0\x88\xe6\xae\xf1\x2d\xe0\x0b\xa9\x09\xed\x75\x60\xe2\x2b\x78\x08\x79\x3f\xb6\x80\x0e\x8f\x20\x92\x16\xcc\xb4\x51\x19\x67\xb4\xcc\x25\xa1\x43\x8f\xd9\xf5\x89\x57\xbb\x65\x47\xa7\x61\x0d\x0f\x23\xbc\x23\x19\xe9\x0e\xf7\x9c\x7f\xdf\x6b\xd5\x42\xb8\xb4\xf1\x90\x59\xc6\x22\xa1\xde\xa8\xaa\x2e\x33\xae\x4f\x77\x54\xec\x88\xb4\x7e\x3a\xa5\x58\xda\x08\x78\xdd\xc1\x7b\x5b\xb7\xbb\xcd\x3c\x04\xe9\xd3\x69\x14\xb3\x13\xda\xdf\xe9\xe1\x82\xb3\x4f\x8e\x6f\x4a\x2e\x1e\xa3\x63\x13\xb2\x75\x4e\xa6\x90\xfa\x80\x85\xfa\xd2\x3e\x66\xf0\x0c\xb8\x05\x6e\xe4\x0b\xd7\x08\xfd\x01\xcf\xed\x85\x42\x69\x1c\xe9\x2a\x4e\xf8\xf1\x1a\xd3\x0b\x58\xa3\xad\xb4\xec\xfa\x7d\x11\x74\xcd\xef\x1c\x39\x0f\x8a\x16\xcf\xa6\x9c\xbe\x8e\xad\x80\x39\x2f\xfc\x21\xd6\x65\x6a\x8b\xd6\x1f\x37\x6d\x1e\x43\xf1\xe7\x4f\x30\x25\x52\x9e\x71\x9a\x16\xf3\x57\x96\xc9\x13\x62\x08\xd8\x5f\x7e\x7a\x82\xdb\xc1\xc5\x76\x51\xf4\x35\x31\x27\x06\x0c\xdf\x4a\x64\x50\x95\x1d\x1d\x83\x83\xec\x0b\xd3\xc0\x6c\x55\x4d\x35\xc3\xb2\xee\x88\xde\x3a\x2a\x5a\x1f\x9a\xb9\x86\xcf\xbd\x12\xf0\x19\x72\xd4\xd8\xb4\xcb\x64\xab\xa3\xa5\xde\x55\xad\x7b\x05\xa3\x0a\xec\xdf\x2a\xf8\xeb\x84\xef\xd0\xe6\x4e\xdf\x4e\xdd\x72\x92\x92\x73\xe2\x7e\x9a\x12\x0e\x1e\x4e\x65\xf8\x76\x70\x19\xe1\x18\x26\x4d\xab\x32\xac\xf1\xce\xbd\x46\x5a\x09\xdd\x24\xab\x38\xd5\x2d\xdf\xd6\xa5\xca\xbe\xde\x9d\x20\x15\x08\x25\xb7\xa8\x41\x22\x32\x64\x13\x7b\xf3\x08\xd8\x8b\x63\x30\x7f\x33\xca\xcf\xc6\x50\x9e\xdc\x41\x5d\x25\x4f\xaa\x05\xbf\x29\xad\xd5\x0e\x08\x9c\x69\xcc\x50\xa3\xa4\x78\xe6\x00\x4c\xe7\xb0\x06\x3b\xa3\xea\x0f\xf5\x1d\x54\xb7\xcf\xba\x64\x6d\x30\x2d\xeb\x74\xd1\xc2\xed\x00\xdc\x8d\x37\xfa\xb5\xe0\x1e\xab\x25\xe3\x70\x4e\x9f\x5a\xdf\x6a\x8c\xdb\x1d\x77\x31\xce\x58\x47\x42\x69\x19\xbf\x23\x72\x31\x50\x2f\xd9\x62\x46\xf3\xc5\x0a\x7e\x1d\xe5\x4c\x2d\x7f\xa3\xaf\x3f\xbd\x8c\xf2\xe3\x24\x6b\xde\x21\xf8\x83\x8e\xef\x23\x7d\xf4\x62\x0d\xd6\xb0\x34\xe1\x75\x29\x5b\x93\x4f\x51\xd3\xdc\xab\x39\x2d\xfe\xe8\x40\x87\x4a\x0e\xb3\xc3\xec\xbf\x00\x00\x00\xff\xff\xeb\x91\x32\x1d\x6b\x15\x00\x00" func stakingproxyCdcBytes() ([]byte, error) { @@ -463,6 +484,7 @@ var _bindata = map[string]func() (*asset, error){ "FlowToken.cdc": flowtokenCdc, "LockedTokens.cdc": lockedtokensCdc, "NodeVersionBeacon.cdc": nodeversionbeaconCdc, + "RandomBeaconHistory.cdc": randombeaconhistoryCdc, "StakingProxy.cdc": stakingproxyCdc, "epochs/FlowClusterQC.cdc": epochsFlowclusterqcCdc, "epochs/FlowDKG.cdc": epochsFlowdkgCdc, @@ -523,6 +545,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "FlowToken.cdc": {flowtokenCdc, map[string]*bintree{}}, "LockedTokens.cdc": {lockedtokensCdc, map[string]*bintree{}}, "NodeVersionBeacon.cdc": {nodeversionbeaconCdc, map[string]*bintree{}}, + "RandomBeaconHistory.cdc": {randombeaconhistoryCdc, map[string]*bintree{}}, "StakingProxy.cdc": {stakingproxyCdc, map[string]*bintree{}}, "epochs": {nil, map[string]*bintree{ "FlowClusterQC.cdc": {epochsFlowclusterqcCdc, map[string]*bintree{}}, diff --git a/lib/go/templates/internal/assets/assets.go b/lib/go/templates/internal/assets/assets.go index 220fd7e8b..bff7ac0d3 100644 --- a/lib/go/templates/internal/assets/assets.go +++ b/lib/go/templates/internal/assets/assets.go @@ -235,6 +235,9 @@ // quorumCertificate/scripts/get_voter_is_registered.cdc (198B) // quorumCertificate/scripts/get_voting_completed.cdc (187B) // quorumCertificate/submit_vote.cdc (584B) +// randomBeaconHistory/scripts/get_latest_source_of_randomness.cdc (200B) +// randomBeaconHistory/scripts/get_source_of_randomness.cdc (305B) +// randomBeaconHistory/scripts/get_source_of_randomness_page.cdc (332B) // stakingCollection/close_stake.cdc (758B) // stakingCollection/create_machine_account.cdc (1.152kB) // stakingCollection/create_new_tokenholder_acct.cdc (2.95kB) @@ -5055,6 +5058,66 @@ func quorumcertificateSubmit_voteCdc() (*asset, error) { return a, nil } +var _randombeaconhistoryScriptsGet_latest_source_of_randomnessCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x8d\xb1\xae\x83\x30\x0c\x45\xf7\x7c\xc5\x15\x13\x19\x1e\xd2\x5b\x19\xe9\xc2\x56\xa9\xfd\x82\x28\x35\x10\x15\xec\xca\x71\x86\xaa\xea\xbf\x57\x84\x15\x8f\xf7\x9c\x23\xa7\xed\x25\x6a\x68\x6e\x81\x1f\xb2\x0d\x14\xa2\xf0\x98\xb2\x89\xbe\x1b\xe7\x42\x8c\x94\x73\x1b\xd6\xd5\x63\x2a\x8c\x2d\x24\x6e\x7d\x8f\x13\xbb\x3b\xb6\xbb\x14\x8d\x84\x8f\x03\x00\x25\x2b\xca\xa7\x76\xae\xde\x75\x3a\x18\xef\x5f\x6a\xb2\x5f\xb0\x61\x95\xf8\x1c\x29\xcd\x8b\xf5\x98\xc9\x2e\x45\x95\xf8\x98\x5b\xdf\x2d\x95\xe0\x0f\xff\xb5\xf1\xee\xeb\x7e\x01\x00\x00\xff\xff\xf0\x98\xc8\x29\xc8\x00\x00\x00" + +func randombeaconhistoryScriptsGet_latest_source_of_randomnessCdcBytes() ([]byte, error) { + return bindataRead( + _randombeaconhistoryScriptsGet_latest_source_of_randomnessCdc, + "randomBeaconHistory/scripts/get_latest_source_of_randomness.cdc", + ) +} + +func randombeaconhistoryScriptsGet_latest_source_of_randomnessCdc() (*asset, error) { + bytes, err := randombeaconhistoryScriptsGet_latest_source_of_randomnessCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "randomBeaconHistory/scripts/get_latest_source_of_randomness.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xea, 0xa4, 0x75, 0x4f, 0xef, 0x7f, 0xaa, 0x32, 0x42, 0x97, 0x99, 0x27, 0x7f, 0xe5, 0x88, 0xed, 0x26, 0x42, 0xef, 0xc0, 0xfc, 0x6, 0xb9, 0xfe, 0x81, 0xc, 0x3, 0x7e, 0x1a, 0xdd, 0xca, 0x78}} + return a, nil +} + +var _randombeaconhistoryScriptsGet_source_of_randomnessCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x8f\xb1\x4e\x03\x31\x0c\x86\xf7\x3c\xc5\xaf\x4e\xbd\xa5\xb7\x20\x86\x8e\x9d\xca\x84\x74\x88\x07\x08\xa9\xc3\x45\x5c\x6c\xb0\x1d\x24\x84\x78\x77\xd4\x9c\x84\x44\x75\x63\xf2\xdb\xdf\xe7\xbf\xd4\x77\x51\xc7\x6e\x8a\x7c\x91\x7a\xa2\x98\x84\xcf\xc5\x5c\xf4\x6b\x17\xc2\x38\x8e\x98\xc8\xb5\xd0\x27\x19\x7c\x26\x98\x34\x4d\x04\xc9\xd0\xbe\xc1\x64\x86\x2c\xda\x43\xa5\x8f\x46\xe6\x74\xc1\xcb\x22\xe9\x0d\x33\x95\xd7\xd9\x91\x55\x6a\xcf\x37\x24\x48\xc2\xae\x31\xf9\xe1\x2a\x0b\x31\x25\x32\xdb\xc7\x65\x19\x90\x1b\xa3\xc6\xc2\xfb\xe8\xa7\x2b\xee\xdc\x69\x47\x3c\x3f\xb0\xdf\xdf\x0d\xc7\x2d\xdc\x61\xfd\x7b\x5a\xaf\xfc\x0e\x00\xa0\xe4\x4d\x79\x73\x7a\x6d\xf3\x98\xa7\xbf\x2e\xb7\xb2\x7f\xcf\x21\xfc\x84\xdf\x00\x00\x00\xff\xff\x5d\x21\x51\x1c\x31\x01\x00\x00" + +func randombeaconhistoryScriptsGet_source_of_randomnessCdcBytes() ([]byte, error) { + return bindataRead( + _randombeaconhistoryScriptsGet_source_of_randomnessCdc, + "randomBeaconHistory/scripts/get_source_of_randomness.cdc", + ) +} + +func randombeaconhistoryScriptsGet_source_of_randomnessCdc() (*asset, error) { + bytes, err := randombeaconhistoryScriptsGet_source_of_randomnessCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "randomBeaconHistory/scripts/get_source_of_randomness.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x28, 0xa6, 0x99, 0x82, 0xb8, 0xdc, 0x36, 0x48, 0xb8, 0x9f, 0xd3, 0xec, 0xc3, 0x76, 0x62, 0xbd, 0xbc, 0x45, 0xc2, 0x80, 0x8d, 0xaf, 0x6f, 0x37, 0xc6, 0x4a, 0xf1, 0x85, 0x7e, 0x56, 0xab, 0x12}} + return a, nil +} + +var _randombeaconhistoryScriptsGet_source_of_randomness_pageCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x8e\xb1\x4e\xc3\x40\x10\x44\xfb\xfb\x8a\x51\xaa\x58\x42\x71\x83\x28\x52\x52\x41\x87\x82\xf8\x80\xe3\x32\xb6\x4f\xd8\xb7\x66\x77\x8d\x84\x10\xff\x8e\x6c\x5c\xb8\x70\x9a\xd3\x69\x46\x6f\xe7\xe5\x61\x14\x75\x1c\x2e\xb1\x5c\x65\x78\x64\x4c\x52\x9e\xb2\xb9\xe8\xf7\x21\x84\xba\xae\x71\xa1\x6b\xe6\x17\x0d\xde\x11\x26\x93\x26\x42\x1a\xe8\x42\x14\x9a\xa1\x11\x5d\x4a\xe5\xe7\x44\x73\x5e\xf1\xde\x4b\xfa\x40\xc7\xdc\x76\x8e\x46\x65\x58\xfa\x9d\x11\x24\x29\xae\x31\xf9\x69\x1e\x0b\x31\x25\x9a\x1d\x63\xdf\x57\x68\xa6\x82\x21\xe6\x72\x1c\x63\xcb\x33\xde\x9e\x8b\x3f\xdc\xdf\x61\xa4\xbe\x6c\x82\xea\xbc\x77\xf6\xf4\x9f\xbd\x2e\xb6\x6b\x36\x53\xf8\x09\x00\xa0\xf4\x49\xcb\x2e\xd8\xd2\x6f\xb0\xab\xc7\xfc\x6e\x2c\xd6\x4f\x15\x7e\xc3\x5f\x00\x00\x00\xff\xff\xf5\xa8\xc5\xcc\x4c\x01\x00\x00" + +func randombeaconhistoryScriptsGet_source_of_randomness_pageCdcBytes() ([]byte, error) { + return bindataRead( + _randombeaconhistoryScriptsGet_source_of_randomness_pageCdc, + "randomBeaconHistory/scripts/get_source_of_randomness_page.cdc", + ) +} + +func randombeaconhistoryScriptsGet_source_of_randomness_pageCdc() (*asset, error) { + bytes, err := randombeaconhistoryScriptsGet_source_of_randomness_pageCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "randomBeaconHistory/scripts/get_source_of_randomness_page.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x62, 0xf0, 0xf6, 0x8b, 0xf8, 0xca, 0xc, 0x62, 0x19, 0x13, 0x50, 0x69, 0x4d, 0xb, 0xba, 0x48, 0xfc, 0x65, 0x7a, 0x23, 0xd5, 0x42, 0xa1, 0x25, 0x91, 0x4d, 0xe8, 0x7d, 0xf1, 0xaf, 0xfe, 0xaa}} + return a, nil +} + var _stakingcollectionClose_stakeCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x52\xc1\x6e\xd4\x40\x0c\xbd\xe7\x2b\xac\x1e\xd0\x56\xaa\xb6\x08\x6e\x11\xb0\x8a\xb2\x05\x45\x54\x2d\x6a\x96\x0f\x70\x26\x4e\x32\x30\x19\x47\x33\x4e\x5b\x84\xfa\xef\x68\x66\x48\x40\xdd\x3d\xac\x0f\x89\xfc\x64\xbf\xf7\x6c\x8f\x1e\x27\x76\x02\x9f\x0d\x3f\xd5\x82\x3f\xb5\xed\x4b\x36\x86\x94\x68\xb6\xd0\x39\x1e\xe1\xed\x73\x7d\x28\xbe\x56\x77\x5f\xca\xfb\xdb\xdb\x9b\xf2\x50\xdd\xdf\x15\xfb\xfd\xc3\x4d\x5d\x67\xd9\xf5\x35\x94\x86\x3d\x79\xe0\x59\x00\xc1\x27\x0a\xe0\xe6\x07\x29\x01\x6d\x41\x06\x5a\x51\xb5\x32\x87\xc6\xc3\xa0\x3d\xb4\x4c\x1e\x2c\x0b\x38\x1a\xf9\x91\x62\xb9\x23\xc5\xae\x4d\xe2\x21\xd7\x2d\x59\xd1\xf2\x0b\x04\x1b\x43\x57\xa1\xb7\x99\x05\xb4\xa4\xee\x91\x30\xc8\xa0\xc4\x62\x54\x8a\x67\x2b\x09\x50\xc9\x9b\x16\x50\x68\x83\x0a\x3d\x92\x0b\x25\xe4\x23\x8a\x3d\x6a\x9b\x65\xe2\xd0\x7a\x8c\xc6\x36\x96\x5b\xaa\xf6\x39\xd4\xe2\xb4\xed\xaf\xa0\x25\x43\x3d\x0a\xbb\x00\x7e\xaf\xac\xbc\x7f\xb7\xbb\x84\xdf\x19\x00\x40\xfc\x18\x92\x65\xc0\x7f\x9b\x7b\xa0\x2e\x87\x37\x27\x97\xba\x3d\x42\xb2\xc8\x33\x39\x9a\xd0\xd1\xe6\xef\x00\x39\x14\xb3\x0c\x45\x4a\x16\xc1\x10\x9e\x4c\xb7\x3d\x25\x08\x1f\x97\xe1\xb7\x0d\x3b\xc7\x4f\x1f\xce\x35\xf0\x69\x13\x76\x9d\x9f\x7e\x04\xc7\xe5\xb5\xb0\xc3\x9e\xbe\xa1\x0c\x97\xab\xad\x10\xbb\x1d\x4c\x68\xb5\xda\x5c\x94\x3c\x9b\x36\xde\x35\x59\x01\x47\x1d\x08\xc3\x11\xd7\x45\x62\x78\x49\x3b\xa0\x67\x52\xb3\xd0\x39\xd3\x6e\xe3\x6d\x03\x1f\xad\x37\x4b\xff\x57\x37\xfb\x2f\x59\xb4\x5e\xb2\x3f\x01\x00\x00\xff\xff\x6e\x12\x74\xdf\xf6\x02\x00\x00" func stakingcollectionClose_stakeCdcBytes() ([]byte, error) { @@ -6401,6 +6464,9 @@ var _bindata = map[string]func() (*asset, error){ "quorumCertificate/scripts/get_voter_is_registered.cdc": quorumcertificateScriptsGet_voter_is_registeredCdc, "quorumCertificate/scripts/get_voting_completed.cdc": quorumcertificateScriptsGet_voting_completedCdc, "quorumCertificate/submit_vote.cdc": quorumcertificateSubmit_voteCdc, + "randomBeaconHistory/scripts/get_latest_source_of_randomness.cdc": randombeaconhistoryScriptsGet_latest_source_of_randomnessCdc, + "randomBeaconHistory/scripts/get_source_of_randomness.cdc": randombeaconhistoryScriptsGet_source_of_randomnessCdc, + "randomBeaconHistory/scripts/get_source_of_randomness_page.cdc": randombeaconhistoryScriptsGet_source_of_randomness_pageCdc, "stakingCollection/close_stake.cdc": stakingcollectionClose_stakeCdc, "stakingCollection/create_machine_account.cdc": stakingcollectionCreate_machine_accountCdc, "stakingCollection/create_new_tokenholder_acct.cdc": stakingcollectionCreate_new_tokenholder_acctCdc, @@ -6787,6 +6853,13 @@ var _bintree = &bintree{nil, map[string]*bintree{ }}, "submit_vote.cdc": {quorumcertificateSubmit_voteCdc, map[string]*bintree{}}, }}, + "randomBeaconHistory": {nil, map[string]*bintree{ + "scripts": {nil, map[string]*bintree{ + "get_latest_source_of_randomness.cdc": {randombeaconhistoryScriptsGet_latest_source_of_randomnessCdc, map[string]*bintree{}}, + "get_source_of_randomness.cdc": {randombeaconhistoryScriptsGet_source_of_randomnessCdc, map[string]*bintree{}}, + "get_source_of_randomness_page.cdc": {randombeaconhistoryScriptsGet_source_of_randomness_pageCdc, map[string]*bintree{}}, + }}, + }}, "stakingCollection": {nil, map[string]*bintree{ "close_stake.cdc": {stakingcollectionClose_stakeCdc, map[string]*bintree{}}, "create_machine_account.cdc": {stakingcollectionCreate_machine_accountCdc, map[string]*bintree{}}, diff --git a/lib/go/templates/templates.go b/lib/go/templates/templates.go index 2406f2430..8e94b0809 100644 --- a/lib/go/templates/templates.go +++ b/lib/go/templates/templates.go @@ -14,35 +14,37 @@ import ( ) const ( - placeholderFungibleTokenAddress = "0xFUNGIBLETOKENADDRESS" - placeholderFlowTokenAddress = "0xFLOWTOKENADDRESS" - placeholderIDTableAddress = "0xIDENTITYTABLEADDRESS" - placeholderLockedTokensAddress = "0xLOCKEDTOKENADDRESS" - placeholderStakingProxyAddress = "0xSTAKINGPROXYADDRESS" - placeholderQuorumCertificateAddress = "0xQCADDRESS" - placeholderFlowFeesAddress = "0xFLOWFEESADDRESS" - placeholderStorageFeesAddress = "0xFLOWSTORAGEFEESADDRESS" - placeholderServiceAccountAddress = "0xFLOWSERVICEADDRESS" - placeholderDKGAddress = "0xDKGADDRESS" - placeholderEpochAddress = "0xEPOCHADDRESS" - placeholderStakingCollectionAddress = "0xSTAKINGCOLLECTIONADDRESS" - placeholderNodeVersionBeaconAddress = "0xNODEVERSIONBEACONADDRESS" + placeholderFungibleTokenAddress = "0xFUNGIBLETOKENADDRESS" + placeholderFlowTokenAddress = "0xFLOWTOKENADDRESS" + placeholderIDTableAddress = "0xIDENTITYTABLEADDRESS" + placeholderLockedTokensAddress = "0xLOCKEDTOKENADDRESS" + placeholderStakingProxyAddress = "0xSTAKINGPROXYADDRESS" + placeholderQuorumCertificateAddress = "0xQCADDRESS" + placeholderFlowFeesAddress = "0xFLOWFEESADDRESS" + placeholderStorageFeesAddress = "0xFLOWSTORAGEFEESADDRESS" + placeholderServiceAccountAddress = "0xFLOWSERVICEADDRESS" + placeholderDKGAddress = "0xDKGADDRESS" + placeholderEpochAddress = "0xEPOCHADDRESS" + placeholderStakingCollectionAddress = "0xSTAKINGCOLLECTIONADDRESS" + placeholderNodeVersionBeaconAddress = "0xNODEVERSIONBEACONADDRESS" + placeholderRandomBeaconHistoryAddress = "0xRANDOMBEACONHISTORYADDRESS" ) type Environment struct { - Network string - FungibleTokenAddress string - FlowTokenAddress string - IDTableAddress string - LockedTokensAddress string - StakingProxyAddress string - QuorumCertificateAddress string - DkgAddress string - EpochAddress string - StorageFeesAddress string - FlowFeesAddress string - ServiceAccountAddress string - NodeVersionBeaconAddress string + Network string + FungibleTokenAddress string + FlowTokenAddress string + IDTableAddress string + LockedTokensAddress string + StakingProxyAddress string + QuorumCertificateAddress string + DkgAddress string + EpochAddress string + StorageFeesAddress string + FlowFeesAddress string + ServiceAccountAddress string + NodeVersionBeaconAddress string + RandomBeaconHistoryAddress string } func withHexPrefix(address string) string { @@ -137,5 +139,11 @@ func ReplaceAddresses(code string, env Environment) string { withHexPrefix(env.NodeVersionBeaconAddress), ) + code = strings.ReplaceAll( + code, + placeholderRandomBeaconHistoryAddress, + withHexPrefix(env.RandomBeaconHistoryAddress), + ) + return code } diff --git a/transactions/randomBeaconHistory/scripts/get_latest_source_of_randomness.cdc b/transactions/randomBeaconHistory/scripts/get_latest_source_of_randomness.cdc new file mode 100644 index 000000000..3673435d6 --- /dev/null +++ b/transactions/randomBeaconHistory/scripts/get_latest_source_of_randomness.cdc @@ -0,0 +1,7 @@ +import "RandomBeaconHistory" + +access(all) fun main(): RandomBeaconHistory.RandomSource { + return RandomBeaconHistory.sourceOfRandomness( + atBlockHeight: getCurrentBlock().height - 1 + ) +} diff --git a/transactions/randomBeaconHistory/scripts/get_source_of_randomness.cdc b/transactions/randomBeaconHistory/scripts/get_source_of_randomness.cdc new file mode 100644 index 000000000..2cb748358 --- /dev/null +++ b/transactions/randomBeaconHistory/scripts/get_source_of_randomness.cdc @@ -0,0 +1,7 @@ +import "RandomBeaconHistory" + +/// Retrieves the source of randomness for the requested block height from the RandomBeaconHistory contract. +/// +access(all) fun main(atBlockHeight: UInt64): RandomBeaconHistory.RandomSource { + return RandomBeaconHistory.sourceOfRandomness(atBlockHeight: atBlockHeight) +} diff --git a/transactions/randomBeaconHistory/scripts/get_source_of_randomness_page.cdc b/transactions/randomBeaconHistory/scripts/get_source_of_randomness_page.cdc new file mode 100644 index 000000000..9e05eaa60 --- /dev/null +++ b/transactions/randomBeaconHistory/scripts/get_source_of_randomness_page.cdc @@ -0,0 +1,7 @@ +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) +}