diff --git a/contracts/DependencyAudit.cdc b/contracts/DependencyAudit.cdc index ed5132b..367a4f9 100644 --- a/contracts/DependencyAudit.cdc +++ b/contracts/DependencyAudit.cdc @@ -41,27 +41,99 @@ access(all) contract DependencyAudit { } if unstagedDependencies.length > 0 { - if DependencyAudit.panicOnUnstaged { - // If `panicOnUnstaged` is set to true, the transaction will panic if there are any unstaged dependencies - // the panic message will include the unstaged dependencies - var unstagedDependenciesString = "" - var numUnstagedDependencies = unstagedDependencies.length - var j = 0 - while j < numUnstagedDependencies { - if j > 0 { - unstagedDependenciesString = unstagedDependenciesString.concat(", ") - } - unstagedDependenciesString = unstagedDependenciesString.concat(unstagedDependencies[j].toString()) - - j = j + 1 - } - - // the transactions will fail with a message that looks like this: `error: panic: Found unstaged dependencies: A.2ceae959ed1a7e7a.MigrationContractStaging, A.2ceae959ed1a7e7a.DependencyAudit` - panic("This transaction is using dependencies not staged for Crescendo upgrade coming soon! Learn more: https://bit.ly/FLOWCRESCENDO. Dependencies not staged: ".concat(unstagedDependenciesString)) - } else { - emit UnstagedDependencies(dependencies: unstagedDependencies) + self.maybePanicOnUnstagedDependencies(unstagedDependencies) + + emit UnstagedDependencies(dependencies: unstagedDependencies) + } + } + + access(self) fun maybePanicOnUnstagedDependencies(_ unstagedDependencies: [Dependency]) { + // If `panicOnUnstaged` is set to false, the function will return without panicking + if !DependencyAudit.panicOnUnstaged { + return + } + + // check if we should panic randomly + if !self.shouldPanicRandomly() { + return + } + + var unstagedDependenciesString = "" + var numUnstagedDependencies = unstagedDependencies.length + var j = 0 + while j < numUnstagedDependencies { + if j > 0 { + unstagedDependenciesString = unstagedDependenciesString.concat(", ") } + unstagedDependenciesString = unstagedDependenciesString.concat(unstagedDependencies[j].toString()) + + j = j + 1 + } + + // the transactions will fail with a message that looks like this: `error: panic: Found unstaged dependencies: A.2ceae959ed1a7e7a.MigrationContractStaging, A.2ceae959ed1a7e7a.DependencyAudit` + panic("This transaction is using dependencies not staged for Crescendo upgrade coming soon! Learn more: https://bit.ly/FLOWCRESCENDO. Dependencies not staged: ".concat(unstagedDependenciesString)) + } + + // shouldPanicRandomly is used to randomly panic on unstaged dependencies + // The probability of panicking is based on the current block height and the start and end block heights + // If the start block height is greater than or equal to the end block height, the function will return true + // The function will always return true if the current block is more than the end block height + // The function will always return false if the current block is less than the start block height + // The function will return true if a random number between the start and end block heights is less than the current block height + // This means the probability of panicking increases linearly as the current block height approaches the end block height + access(self) fun shouldPanicRandomly(): Bool { + // get start block height or true + // get end block height or true + // get current block height + // get random number between start and end + // if random number is less than current block return true + // else return false + + let maybeBoundaries = self.getBoundaries() + if maybeBoundaries == nil { + // if settings are invalid use default behaviour: panic true + return true + } + let boundaries = maybeBoundaries! + + let startBlock: UInt64 = boundaries.start + let endBlock: UInt64 = boundaries.end + let currentBlock: UInt64 = getCurrentBlock().height + + if startBlock >= endBlock { + // if settings are invalid use default behaviour: panic true + return true } + + let dif = endBlock - startBlock + var rnd = revertibleRandom() % dif + rnd = rnd + startBlock + + // fail if the random number is less than the current block + return rnd < currentBlock + } + + access(all) struct Boundaries { + access(all) let start: UInt64 + access(all) let end: UInt64 + + init(start: UInt64, end: UInt64) { + self.start = start + self.end = end + } + } + + access(self) fun getBoundaries(): Boundaries? { + return self.account.copy(from: /storage/flowDependencyAuditBoundaries) + } + + access(self) fun setBoundaries(boundaries: Boundaries) { + self.account.load(from: /storage/flowDependencyAuditBoundaries) + self.account.save(boundaries, to: /storage/flowDependencyAuditBoundaries) + } + + access(self) fun unsetBoundaries() { + self.account.load(from: /storage/flowDependencyAuditBoundaries) } // The Administrator resorce can be used to add or remove addresses from the excludedAddresses dictionary @@ -87,6 +159,17 @@ access(all) contract DependencyAudit { emit PanicOnUnstagedDependenciesChanged(shouldPanic: shouldPanic) } + // setStartEndBlock sets the start and end block heights for the `shouldPanicRandomly` function + access(all) fun setStartEndBlock(start: UInt64, end: UInt64) { + let boundaries = Boundaries(start: start, end: end) + DependencyAudit.setBoundaries(boundaries: boundaries) + } + + // unsetStartEndBlock unsets the start and end block heights for the `shouldPanicRandomly` function + access(all) fun unsetStartEndBlock() { + DependencyAudit.unsetBoundaries() + } + // testCheckDependencies is used for testing purposes // It will call the `checkDependencies` function with the provided dependencies // `checkDependencies` is otherwise not callable from the outside diff --git a/lib/go/contracts/internal/assets/assets.go b/lib/go/contracts/internal/assets/assets.go index 2f2abc0..4e8db2b 100644 --- a/lib/go/contracts/internal/assets/assets.go +++ b/lib/go/contracts/internal/assets/assets.go @@ -1,6 +1,6 @@ // Code generated by go-bindata. DO NOT EDIT. // sources: -// DependencyAudit.cdc (6.09kB) +// DependencyAudit.cdc (8.469kB) // MigrationContractStaging.cdc (19.438kB) package assets @@ -70,7 +70,7 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var _dependencyauditCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x58\x6d\x6f\xdb\xb6\x13\x7f\xef\x4f\x71\xf5\x2b\x0b\x7f\x57\x6e\x0b\xfc\x51\x54\xa8\x57\x64\x69\x0a\x0c\xe8\x13\x96\x6e\x7b\x61\x04\x33\x23\x9d\x6d\x26\x32\x69\x90\x94\x53\x2f\xc8\x77\x1f\x8e\x94\x25\x52\xa2\x9c\x0c\x05\x2a\x04\x81\x64\x1e\xef\x8e\xbf\x7b\xe0\x8f\xe4\xdb\x9d\x54\x06\xc6\x9f\xf8\x5a\x31\xc3\xa5\x38\x97\xc2\x28\x96\x9b\x4b\xc3\xd6\x5c\xac\xc7\xa3\xd1\x6c\x06\xdf\x36\x5c\x43\x5e\x8f\x00\xd7\xf4\x57\x69\x2c\xe0\xfa\x00\x66\x83\xf0\xe1\xcf\x4f\x90\xb3\xb2\xe4\x62\x6d\xbf\x97\xf9\x06\xf3\xdb\xf7\xb8\x43\x51\xa0\xc8\x39\xea\x25\xac\x2a\x91\x93\x01\x58\x29\xb9\x05\xd6\x7e\xcb\x95\x9d\xa3\xd9\x16\x41\xd0\x3f\x26\x0a\xd0\x5c\xac\x05\x33\x95\x42\xe0\xc2\xd9\x28\xe5\xdd\x25\xaa\x3d\xcf\xf1\x2c\xcf\x65\x25\x4c\xe3\xd1\x94\x7c\x64\xc6\x8a\xa1\x28\x48\x23\xee\x51\x1d\xc0\x28\x26\x34\xb3\x66\x52\xb7\x0e\x84\x65\xe1\xb9\x75\x56\x14\x0a\xb5\x26\xff\xc8\x6a\x30\xf6\x99\x6d\xe9\xf7\x3b\x5e\x96\x70\x8d\xc0\xca\xd2\x1a\xf0\x45\x40\x20\x16\x05\x16\x60\x24\xa8\x8a\xfc\x24\x2f\x42\xa3\x8d\xdd\x53\x98\x58\x23\x56\x00\xf8\x0a\x98\x38\x1c\x51\x09\xac\x31\x85\x20\xa4\x01\x6d\xd8\x1a\x8b\x23\x30\x43\xa1\x6b\xe0\xb1\x4b\xff\xed\xa9\x6a\xa7\x56\x20\xf4\x0c\xb7\xdc\x00\x13\x84\xaa\x30\x70\xc7\xcd\xc6\x0a\x55\xa2\xf6\xc4\x57\x37\x05\xa9\x60\xc7\x04\xcf\x69\x29\x4b\xfb\xf6\x45\xfc\x51\x8b\x2e\x29\x75\x34\x1a\x42\xcc\xa8\x0a\xd3\x11\xcb\x73\xd4\x7a\xc2\xca\x32\x69\x53\xac\x81\xe9\x70\x56\x15\xdc\xc0\xfd\x68\x04\x00\xe0\xcb\x96\x68\xe0\xac\xd8\x72\xc1\xb5\x51\xcc\x48\x75\x69\xa4\x62\x6b\xfc\xca\xcc\x26\x03\xef\xc3\x4d\xad\xa3\xa0\x0f\xda\xe0\x16\xd8\x31\xee\xb0\x61\x7b\x6c\xec\x6a\x17\x41\xbb\x66\x42\xe4\x1a\x1d\x28\x1a\xf6\x9c\xd9\x25\x6f\x8f\x60\xb7\xbe\x6a\x09\x77\x08\xf8\x3d\x2f\xab\x02\x49\x68\xeb\x52\x3c\xc0\xf9\x40\xd1\xbd\xcd\xb5\xbf\x0c\x8d\xe5\x2a\x81\x3d\x53\xc7\xc9\x45\x93\x8e\x19\xdc\xd7\xef\x19\xfc\x2a\x65\xf9\xd0\x5f\x3f\xcd\xeb\x80\xeb\x64\xfb\xa2\x2e\x6c\x47\x29\x3f\x05\x27\x7e\xe4\x32\x58\xb4\xb8\x5f\x25\x43\x7a\xbe\x86\x46\x7d\x75\xe7\x1b\x26\xd6\x58\x4c\xf4\x46\x56\x65\x61\x05\x9d\x4f\x49\x13\x84\x5e\x15\x50\x42\x50\xef\xc0\xa2\x85\xed\x44\xad\x07\x4e\xb9\xb1\x84\xb2\xb5\xaf\x78\xf2\x37\x44\x4b\x3d\x83\x45\xfd\x7e\x35\x85\x50\xc6\x96\x7c\x06\x8b\x4b\xa3\xb8\x58\xdb\x61\x56\x99\x8d\x54\xfc\x1f\x54\xfe\xc4\x04\xee\xad\x23\xf4\x50\x20\xaa\x08\x18\x21\x9c\x30\x87\xc5\xd5\x28\x98\x24\xaa\x6d\x00\xc4\x3c\xee\x6f\x5a\xa2\x58\x9b\x4d\x30\x95\xc3\x1c\x5e\x34\xbf\xdc\x6d\x78\x89\xc0\xe1\x6d\x4f\x65\xeb\x25\x3d\x54\x32\x5c\x5f\xd4\xc9\x06\xf3\x6e\x99\xa5\xbd\x3c\x5c\x44\x3d\x5a\xf0\xab\x2b\x78\xf7\x0e\x56\xac\xd4\x18\x58\xe0\x2b\xdf\x40\x68\xdd\x8e\xc3\x1c\x38\xfc\x0f\x5e\xf6\x46\x28\xbe\x5c\x54\xa1\xba\x87\x51\xcf\xff\xba\xe3\xcc\x07\xdb\x5e\xca\xf5\xa5\x95\x99\xb0\x63\x05\x0d\x2d\x62\x6a\xf7\x9b\xac\x9f\x02\x0b\x7e\x95\x74\xd7\xf5\xac\xb6\xdc\x5f\x54\x2c\xf8\x29\xdb\xd1\xc7\xa4\x45\xf8\x07\xdd\x49\x4e\x01\xd3\x87\xd5\x13\xe0\xab\xb8\x87\x2e\xad\xe0\x17\x78\xd1\x59\x13\x5f\xf5\x12\xa3\xd3\x68\x22\x20\xb8\x2d\xe6\xb1\x76\xef\x36\x17\x6f\x87\x74\xbd\xb6\xd9\x2e\xcc\x06\x15\xda\x0d\x89\x36\xab\xe8\xfe\x12\xb3\x4c\x4a\x9d\x8e\x2d\x6a\xcd\xd6\xe8\xd4\x72\xd1\xf4\xe4\x27\xea\x1a\xaa\x65\xd7\x10\x60\x0e\xe3\x71\x74\x8e\xa8\xb6\xb1\x7e\x08\xf3\x53\xd0\x47\x35\xdd\x04\x95\x7d\x7c\x5c\x85\xdf\xb8\x0a\x8f\x5a\xea\x47\xa4\x0e\xe5\x4d\x24\xc2\xfe\x73\x72\xb9\xc3\x83\x69\x2e\x45\xce\xcc\x64\x3c\x85\x71\x12\x55\xfe\x10\xfd\xf5\x07\xcd\xc5\x24\x16\x37\x57\xa9\x91\x4e\x6e\x92\x24\xa3\xa8\x5d\xc2\xf5\x26\xda\x79\x1e\xfa\x13\xea\x94\xf2\xf2\x54\xbb\x8c\x5a\x31\x5e\x3a\xfe\xc3\x9a\x54\xb3\x94\xa1\x94\xf2\x56\x43\xc9\x6f\xe9\x9b\xeb\x0c\x96\xa8\x94\x54\x99\x4b\xcb\x0c\x3e\xc8\x4a\x14\xf1\x24\xcc\xe0\x2c\x7d\x95\x23\xc3\x37\xff\x7f\x83\xc5\x4b\xf6\x1a\x5f\xb3\x74\xa8\xbb\x4d\x63\xc2\x9d\x6a\x5d\xf6\xd6\x63\x9d\x98\x8c\x2d\x8d\xf7\x8b\xcf\xd2\x78\x82\x3e\x24\xb5\x2d\xc5\x5c\x49\x05\xe7\x0a\x75\x8e\xa2\x90\x50\xed\xd6\x8a\x15\x44\x97\xb6\x34\x49\x4b\x29\x9e\xc1\x47\x64\x4a\xc0\x56\x2a\xcc\x60\x63\xcc\x4e\x67\xb3\xd9\x35\x37\x69\x79\x98\x7d\xf8\xf8\xe5\xaf\xf3\xdf\x2f\x2e\xcf\x2f\x3e\xbf\xff\x92\xc2\xfb\xb8\x91\x0c\xc6\xa7\xa2\xeb\xe2\xda\xed\x7f\x80\xa5\xc6\x48\x56\x5b\xa6\xfa\x04\xa6\x13\xb3\xd4\x6d\xb1\xe1\xdb\x43\xc0\x23\x03\xe6\x09\x0a\xb5\x54\x39\x42\xce\x04\x71\x46\x7b\x34\x32\x92\x58\x26\xd8\xd1\xad\xdc\xa3\xc7\x39\x1b\x9e\xd3\xdb\x6f\xa1\xe0\x36\x32\x4c\x1d\x6a\x6b\x3d\x12\x46\xb6\x2a\x32\x16\xba\xd0\x42\x41\x67\xa1\xa2\xb8\xe8\xa9\x26\x6f\xc8\x68\xeb\x07\x35\xe5\xa7\x78\xd1\x75\x81\xe8\x56\xcc\xc4\x84\x45\x38\x56\xd2\x89\x12\xa5\x54\x2d\x47\x27\x98\xd6\x9b\x7e\x30\x1f\xa7\x27\xf5\x6c\x62\x57\xb4\xbd\x0c\x06\xd0\x07\xc7\x85\xa3\x8f\x4f\x1d\xa6\x10\xa2\xa7\x87\x2a\x06\xd2\x80\xa9\x9f\x8e\x53\xea\x1c\x99\xdc\xe2\x21\x3b\x6a\x1a\xce\x76\x1f\x2c\x8d\xe6\x04\xdf\xa7\x61\xed\x4e\xfc\xbd\x8d\x7f\xcf\x14\x67\xd7\x25\x1e\xb3\x6c\xcf\xca\x0a\xe9\xfc\xb9\xf4\x4e\x07\xcb\x41\xe8\x4e\x1b\x8e\x9c\x30\x3a\xb8\x3c\xc6\x60\xe6\xe0\xa9\x08\x66\xda\x16\xf2\x5f\x0f\x39\xde\x47\x32\x00\xa5\x41\x6d\xce\x63\xa7\x1f\xdb\x2e\x28\xdc\x24\x41\x8d\x75\x57\xa9\x9d\xd4\x1e\x3d\x21\x72\x55\x1f\x4b\xf3\xe3\x3d\xc4\x23\xf7\x09\xf5\x11\x7d\xa7\xe4\x9e\x17\x43\xb4\x67\x36\x8b\xaa\xe1\x1a\x24\x31\xb1\x3b\xae\xdd\xcd\x00\x19\xb5\xb1\x6c\xca\x41\x56\x46\xf3\x02\x07\xc3\x17\x5d\xec\xcf\x3a\x91\xd1\xa3\xd0\x54\x4a\xf4\xd2\xa0\x7f\x4a\x8c\x7a\x34\xed\x3b\x31\xf5\x0d\x27\xf1\xcd\xc1\x47\x41\x1b\x55\x05\x37\x19\x9e\x83\xdd\x7b\x8c\xe6\x68\x50\x3b\x30\x28\xe8\x0e\x08\x0e\x0c\x8f\xe1\x0b\x6e\x26\x5d\x1d\xd3\x40\xb8\x0b\x8f\xc6\x72\x95\x1e\xdb\xcb\xfc\xe8\x40\x5f\xc4\x5e\xc8\xcd\xad\xaa\x58\x5a\xf7\xc2\xde\xd0\xb0\xa3\xe1\x8e\x5d\xa2\xb8\xb5\xb1\x86\xf5\xf9\xbe\x78\x44\x2e\x98\xd7\xf4\x6d\x78\xf1\x1d\x76\x0a\x57\xfc\x7b\x30\xde\xd5\x19\x7c\xa7\xba\xe4\x39\x4e\x28\x79\x33\x78\x35\x85\x6a\xf7\x4d\x66\x1d\x11\x47\xc9\x93\x58\x0e\x8d\xcf\xd2\x86\xa1\x04\x93\x92\x86\x04\xa7\xe3\xe6\xbd\x81\x6d\x20\x47\x6a\x02\xc1\x68\xf7\x6e\x37\x73\x3a\x26\xb1\xbd\xa3\x0d\xf6\x36\xd4\xdd\x5f\x81\x96\xf5\xa5\x62\x33\xa5\xe6\x18\x0e\xf9\xf6\x0a\x56\xbb\xeb\x12\xa8\xef\x44\x7c\x53\xcb\xde\x7e\xd0\xde\x6a\x86\xbb\x5d\xd3\x36\xea\x6b\xb2\xe6\x5e\x2c\x1d\x35\x79\x16\xb9\xab\x8a\x16\xa1\xc5\xa1\xbf\x6b\xce\xe1\xfe\x21\x94\xe9\x77\x66\x77\xaf\x10\x4a\x0d\x5d\xf5\xc1\x1c\x66\x35\x58\xb3\x55\x29\xef\x3a\x05\x6f\xa7\xb5\xaa\x3a\x9b\x6a\xdf\xbd\x48\x95\x3c\x9d\x75\x78\x85\xe1\xaa\x9a\xe2\xf5\xf6\x39\xe4\x0a\x99\xe9\x10\x36\x2f\xbf\x5d\xfe\xbb\xb8\xa5\x94\x05\x93\xb7\xcf\xed\xdc\x29\x18\x99\x9d\x5e\x7e\x52\xa7\xd6\xc3\xe8\xdf\x00\x00\x00\xff\xff\xd9\xff\x40\x24\xca\x17\x00\x00" +var _dependencyauditCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x59\x6d\x6f\x1b\x37\x12\xfe\xae\x5f\x31\x11\x70\x80\x84\xaa\xab\xb4\xb8\xbb\xa2\x42\x94\xc0\x71\x12\x20\x40\xdb\x14\x75\x7b\xf7\xc1\x30\x2a\x6a\x39\x92\x68\xaf\x48\x1d\xc9\x95\xa3\x33\xfc\xdf\x0f\x7c\xd9\x5d\x92\xcb\x95\x5d\xb4\x17\xa3\x68\x24\x71\x38\x6f\x9c\x19\x3e\x33\x64\xfb\x83\x90\x1a\xc6\x3f\xb2\xad\x24\x9a\x09\x7e\x29\xb8\x96\xa4\xd4\x57\x9a\x6c\x19\xdf\x8e\x47\xa3\xf9\x1c\x7e\xdd\x31\x05\xa5\x5f\x01\xa6\xcc\x7f\xb5\x42\x0a\xeb\x13\xe8\x1d\xc2\x87\x7f\xfd\x08\x25\xa9\x2a\xc6\xb7\xf6\xfb\xaa\xdc\x61\x79\xf7\x0e\x0f\xc8\x29\xf2\x92\xa1\x5a\xc1\xa6\xe6\xa5\x11\x00\x1b\x29\xf6\x40\xba\xef\x62\x63\xf7\x28\xb2\x47\xe0\xe6\x7f\x84\x53\x50\x8c\x6f\x39\xd1\xb5\x44\x60\xdc\xc9\xa8\xc4\xfd\x15\xca\x23\x2b\xf1\xa2\x2c\x45\xcd\x75\xab\xd1\xcc\xe8\x48\xb4\x25\x43\x4e\x0d\x47\x3c\xa2\x3c\x81\x96\x84\x2b\x62\xc5\x14\xce\x0e\x84\x15\x0d\xd4\xba\xa0\x54\xa2\x52\x46\x3f\x23\x35\x5a\xfb\x89\xec\xcd\xef\xf7\xac\xaa\x60\x8d\x40\xaa\xca\x0a\x08\x49\x80\x23\x52\x8a\x14\xb4\x00\x59\x1b\x3d\x8d\x16\xb1\xd0\x56\xee\x39\x9f\x58\x21\x96\x00\xd8\x06\x08\x3f\x35\x5e\x89\xa4\x11\x89\xc0\x85\x06\xa5\xc9\x16\x69\xe3\x98\xa1\xa3\x6b\xdd\x63\x4d\xff\xf8\x5c\xb6\x33\x4b\x10\x6b\x86\x7b\xa6\x81\x70\xe3\x55\xae\xe1\x9e\xe9\x9d\x25\xaa\xb9\xd7\x24\x64\x37\x03\x21\xe1\x40\x38\x2b\x8d\x29\x2b\xfb\xe9\x13\xff\xcd\x93\xae\x4c\xe8\x28\xd4\xc6\x63\x5a\xd6\x58\x8c\x48\x59\xa2\x52\x13\x52\x55\xd3\x2e\xc4\x5a\x37\x9d\x2e\x6a\xca\x34\x3c\x8c\x46\x00\x00\x21\x6d\x85\x1a\x2e\xe8\x9e\x71\xa6\xb4\x24\x5a\xc8\x2b\x2d\x24\xd9\xe2\xcf\x44\xef\x16\x10\x7c\x71\x5b\xfd\x29\xa8\x93\xd2\xb8\x07\xd2\x9c\x3b\xec\xc8\x11\x5b\xb9\xca\x9d\xa0\xb5\xd9\x78\x64\x8d\xce\x29\x0a\x8e\x8c\x58\x93\xf7\x8d\xb3\x3b\x5d\x95\x80\x7b\x04\xfc\x5c\x56\x35\x45\x43\xb4\x77\x21\x1e\xf9\xf9\x64\x4e\xf7\xae\x54\xa1\x19\x0a\xab\xcd\x14\x8e\x44\x36\x9b\x69\x1b\x8e\x0b\x78\xf0\x9f\x17\xf0\x56\x88\xea\xb1\x6f\xbf\xd9\x97\x38\xd7\xd1\xf6\x49\xdd\xb1\x35\x54\x61\x08\x4e\xc2\x93\x5b\xc0\x75\xe7\xf7\x9b\xe9\x10\x9f\x9f\x63\xa1\x21\xbb\xcb\x1d\xe1\x5b\xa4\x13\xb5\x13\x75\x45\x2d\xa1\xd3\x69\xda\x1e\x42\x2f\x0b\x4c\x40\x98\xda\x81\xb4\x73\xdb\x99\x5c\x8f\x94\x72\x6b\x53\x13\xad\x7d\xc6\x93\xdf\x21\x9b\xea\x0b\xb8\xf6\x9f\x6f\x66\x10\xd3\xd8\x94\x5f\xc0\xf5\x95\x96\x8c\x6f\xed\x32\xa9\xf5\x4e\x48\xf6\x5f\x94\xe1\xc6\x29\x3c\x58\x45\xcc\x9f\x39\x88\x3a\xe3\x8c\xd8\x9d\xb0\x84\xeb\x9b\x51\xb4\x89\xd7\xfb\xc8\x11\xcb\xbc\xbe\x45\x85\x7c\xab\x77\xd1\x56\x06\x4b\x78\xd9\xfe\x72\xbf\x63\x15\x02\x83\x57\x3d\x96\x9d\x96\xe6\xcf\xa4\x0c\x53\xef\x7d\xb0\xc1\x32\x4d\xb3\xa2\x17\x87\xd7\x59\x8d\xae\xd9\xcd\x0d\xbc\x79\x03\x1b\x52\x29\x8c\x24\xb0\x4d\x28\x20\x96\x6e\xd7\x61\x09\x0c\xbe\x82\x6f\x7a\x2b\xe6\x7c\x19\xaf\x63\x76\x8f\xa3\x9e\xfe\xbe\xe2\x2c\x07\xcb\x5e\xc1\xd4\x95\xa5\x99\x90\x26\x83\x86\x8c\x98\xd9\xfb\x66\xd1\x0f\x81\x6b\x76\x33\x4d\xed\x7a\xe1\x25\xf7\x8d\xca\x1d\x7e\x41\x0e\xe6\xcb\xa4\xf3\xf0\x9f\x54\x67\x7a\xce\x31\x7d\xb7\x06\x04\x6c\x93\xd7\xd0\x85\x15\xbc\x86\x97\x89\x4d\xa6\x2e\x15\x7b\x72\x5a\xe3\x99\x54\x9f\xe4\x78\x4e\x63\xb5\xec\xb5\xf1\x8c\xb2\x93\x67\xd5\x99\x12\x18\x14\x95\x4e\x93\xf6\x4f\xea\xf9\xfb\x33\x92\x33\x4c\x67\x73\xd4\x69\x5e\x24\x75\x36\xf1\x97\x44\x5d\x4b\x3e\xe0\xfa\x17\xd6\x9b\x41\x41\xfc\x85\x70\x2a\xf6\xd5\x69\x32\x7d\x36\x9b\xa1\x0a\xe3\xca\x14\x2c\x61\x3c\x4e\x0b\x4b\xce\x15\xb0\x3c\x17\x08\x11\x87\xdb\x4c\x7d\xb9\x75\xf5\x25\xcb\xf9\x21\xcd\x96\xdb\x4c\x5c\xc1\x40\xae\xb4\x66\x0c\x2f\x16\xa5\xe0\x25\xd1\x93\xf1\x0c\xc6\x69\x26\xfc\x85\xec\x73\x14\xd7\xb7\x37\x85\x16\x8e\x6e\x32\x4d\x22\xdc\xf8\xe9\x76\x28\xf1\xe6\x73\x7b\x99\x05\x78\x50\x39\x68\xb1\x21\xac\x72\x28\x8a\xc0\x1e\x95\x22\x5b\x74\xc0\xa3\x12\xe2\x4e\x41\xc5\xee\xcc\x77\xa6\x16\xb0\x42\x29\x85\x5c\xb8\x8b\x7e\x01\x1f\x44\xcd\x69\x1e\x76\x2d\xe0\xa2\xf8\xb6\x44\x82\xdf\xff\xe3\x7b\xa4\xdf\x90\xef\xf0\x3b\x52\x0c\xd5\xc8\x59\x8e\x38\x09\xfa\x55\x6b\x87\x15\x3e\x19\xdb\x26\x20\x30\xc6\x35\x01\xc6\xb5\x31\x24\xee\x00\xea\x46\x48\xb8\x94\xa8\x4a\xe4\x54\x40\x7d\xd8\x4a\x42\x0d\xd8\xda\x9b\x4d\x4a\x08\xfe\x02\x7e\x40\x22\x39\xec\x85\xc4\x05\xec\xb4\x3e\xa8\xc5\x7c\xbe\x66\xba\xa8\x4e\xf3\x0f\x3f\x7c\xfa\xf7\xe5\x2f\xef\xaf\x2e\xdf\xff\xf4\xee\x53\x01\xef\xf2\x42\x16\x30\x3e\x77\x7a\xee\xdc\x7c\xf5\x7c\x6c\x51\x48\x26\x1f\xdb\x9e\xc6\x60\xf9\xe6\x37\x87\x63\x05\xcf\xfb\x3c\x04\x96\x07\x29\xd6\x64\xcd\x2a\xa6\x2d\xc8\xb6\x1b\xef\x8c\x9d\x4c\xc1\x9a\x18\xbe\xc2\xc1\xf5\xb2\x96\xd2\xc0\xa8\x75\x25\xca\x3b\xd8\x21\xdb\xee\xb4\x6d\x3e\x6c\x13\xa4\x89\x74\xdf\x4c\x1f\x13\x92\xb4\xc2\x3e\x6e\x02\xca\x88\x09\x53\xb0\x95\x48\x34\x4a\x13\x4d\xdc\xe0\x70\xfc\x4f\x4d\x2a\x8b\xb5\x7d\x6b\x14\x6e\xc8\x21\x7d\x57\x84\x2c\x34\xcf\xd7\xdb\x6c\x25\x73\x20\x2f\x48\xf7\xf9\x1c\xb6\xee\xb2\x4e\x95\x14\xb2\x63\x1e\x50\xa6\xba\x0d\xd1\xe5\xbc\x97\xd2\xb8\xd3\x33\xb5\x6a\x8d\x12\xd6\xa8\xef\x11\x79\xec\xda\x70\x0b\xdb\x24\x3b\x98\x82\x0a\x95\x72\x4e\x8c\x05\xa6\xee\xf1\x2c\xb0\x52\xd8\xac\x39\x50\xd4\xae\x1a\xcc\x62\xef\xa8\xb7\x26\x77\x89\x74\x75\xd8\x5e\x0a\x5b\xd4\xdd\x8f\x93\x69\x78\x6b\xf4\x76\x2c\x81\xb3\x2a\xa9\xa7\x4e\x77\x85\x5a\x33\xbe\x75\x6d\x1c\xe3\x47\x52\x31\x6a\x02\x19\x28\x6e\x48\x5d\x99\x26\x66\x47\x8e\x4c\xd4\x4d\x19\x89\xb5\x87\xf6\xe6\x89\x7f\x7f\x8c\x2c\x58\x87\xca\x27\xca\xbd\x88\x8d\xb5\x7e\x7e\x6b\xbc\xb5\x80\xdf\x3e\x72\xfd\xcf\xbf\xc3\x32\xd8\x5f\xd8\xf5\x68\x07\x72\x7a\x86\x3e\x3c\xad\xaa\x8b\x80\x74\xc7\x16\xf5\x65\xb0\x32\x99\x16\x3e\x38\x42\xb7\x76\xba\xc1\xeb\x65\x2b\xf7\xcb\xba\x35\x32\x86\xb2\x0d\x04\x8a\x7c\x1d\x68\x18\xdd\xc7\x92\x1b\xc8\x2b\xf1\x88\x52\xb3\x75\x85\x2e\xf5\x26\x53\xf8\x9b\x61\xd1\x92\x7a\x32\x4e\xe1\xab\x90\x53\x18\xaa\xf6\xee\x61\xae\x86\x9c\x09\xfb\x5e\xa5\x1a\x25\x56\x19\x21\xaf\xa2\xc3\xc8\xc0\x34\xdb\x35\x2a\x2d\xeb\x52\x43\x10\xcd\x9d\xbf\xd3\x86\xde\x2a\xdd\x9c\xea\x20\x15\x72\xda\xd2\x74\xc7\xcb\x99\x9e\x44\xfb\x67\x21\x61\x8a\xb6\x1c\x2c\xb3\x35\x61\x09\x71\x4c\xb6\xcb\x68\xdd\x19\x06\xe0\x79\x2c\x9a\x24\xf4\x22\xb0\xf9\x4d\x20\xde\x7b\xd0\x8a\xf0\x2d\x6c\x51\x8a\xc3\xe9\x55\x47\xfe\x7a\x62\x7a\xe1\x05\xcc\x95\x9b\x63\xcc\x37\x95\xb8\x4f\x2e\xe8\x8e\x7a\x7a\x56\x2b\x15\x69\xd5\x65\x56\xa8\x5e\xe8\x9d\x48\xaf\x4a\x10\xfa\x27\xf5\xea\xf1\x54\xe4\x88\x81\x1e\x33\xd0\xe2\xaf\xb1\xb4\xe6\xb1\xad\xff\x4f\xab\x1e\xa3\xb1\x52\x34\x88\x02\x89\x4a\xc8\x12\xa1\x24\x1c\xd6\xd8\xa2\x0a\x42\x29\xd8\xd5\xbd\x38\x62\x30\x82\x6a\xc7\x1e\xbd\xf6\x1b\x28\xb3\x77\x33\x91\x27\x2f\xad\x97\x5d\x46\x56\x6d\x84\xc5\x2a\x44\x57\x31\xa1\xf4\x7d\x8f\xb5\xd1\xc6\x08\xed\xf4\x68\x60\xc2\x53\x5a\xa4\x2a\x18\xd7\xe7\x44\x4c\x48\x66\xe4\x92\xe6\xa1\xc1\x88\x9e\x0e\x18\x0f\xb4\xe9\xf7\x0e\x4f\x4f\x2b\xfc\xee\x1b\x58\xf6\xab\xf1\xe3\x00\x44\x77\xc7\xd1\xf7\x8f\x3f\xa6\xd8\x45\xcf\x3f\xaa\x9c\x93\x06\x44\x7d\x71\x3f\x15\x4e\x91\xc9\x1d\x9e\x16\x0d\xa7\xa1\xae\x2a\x76\x96\x42\x7d\xa6\xd7\x36\xcb\xca\x3d\x00\xf4\xc6\xbe\x47\x22\x19\x59\x57\xd8\x44\xd9\x91\x54\x35\x1a\xa4\xbc\x0a\x10\xe5\x6a\xd0\x75\xe7\x05\x67\x06\x8e\x89\x5f\x9e\xea\xe8\x97\x21\xb0\xed\x0f\x31\xfe\xe8\xcc\x33\xf8\x32\xcd\xb9\x32\x63\xde\x95\xb9\x83\xde\x7b\x24\xf0\x07\x2e\xb2\x1e\x3c\x0b\x0a\xa0\xe7\x62\xff\xf1\x4c\x90\xd3\xe9\x59\xcf\x0c\x5f\x17\xeb\x4c\x61\x3f\x63\x93\xad\xc6\xb1\x55\x4f\x9d\x4a\xaf\x80\x0f\xb5\xd5\xa8\xf4\x65\x6e\x90\x6c\x4b\xad\x49\x15\x43\x61\xba\xaf\x43\x2d\x0f\x42\xf9\x56\xcd\xef\xfe\xe8\x27\xfc\x65\xf3\xa4\xf3\xc4\xd3\x8c\x7f\xed\x38\x48\x71\x64\x34\xd7\x02\x7a\xbe\x39\x36\x4c\x81\xd0\x3b\x94\xf7\x4c\xb9\x47\x16\x23\xd4\xe6\x41\x5b\x4a\x44\xad\x15\xa3\x38\xe8\xc7\xac\xb1\x5f\x6a\xb8\x0d\x1d\x5e\x49\x0f\xab\x3f\x70\xcf\x6a\x34\xeb\x2b\x31\x0b\x05\x9f\x1f\xf4\x85\x08\xb2\x53\xe0\x0c\x82\x6c\xa7\xac\x5e\x81\x41\x42\x37\x6b\x75\xce\x48\x50\x64\xca\x63\x16\x11\x67\x91\x64\x53\x9a\x97\x8d\x02\x7d\x12\xfb\xb6\xb9\xb4\xac\x9e\x93\x3e\xdd\xcc\xa9\x11\x9c\xc8\x35\x7d\x81\x17\xd6\x8e\xb8\x42\x5d\x82\xa9\x55\xda\xdf\xf8\xbb\xed\xe5\x67\x38\x48\xdc\xb0\xcf\xd1\x7a\xca\x33\xfa\x5e\xa8\x8a\x95\xe8\xf1\xd2\xb7\x33\xa8\x0f\xbf\x8a\x45\x42\xe2\xe6\x89\xd3\x5c\x0c\x8d\x2f\x8a\x76\x5c\x13\x6d\x9a\xb6\x13\xbe\x62\xdc\x7e\x6e\xdd\x36\x10\x23\x1e\x7c\x11\x83\x7c\x3a\x20\xc4\x14\x18\x84\x49\x9b\x9b\xc6\x83\x3a\x50\xc2\xbf\xcf\xb6\x5b\x3c\x3e\x73\x9e\xef\x5e\xb3\x95\x7b\x79\x02\x8f\x16\x43\x51\xab\xde\x5d\xda\x3d\x10\xc7\x48\xa1\x2d\x1b\xfe\xc5\xb1\x7d\x62\x2c\x46\x6d\x9c\x65\x9e\xfd\xb2\x49\xe8\x9a\x91\x1e\xe2\x58\xc2\xc3\x63\x4c\xd3\xbf\xd5\x92\x69\x84\xa5\x1a\x7a\x35\x85\xe5\x59\x04\x6c\xb7\x75\xac\x12\x40\xd2\x57\x2f\x93\x25\xcf\x47\x6c\x49\x9f\xec\xce\xeb\xd5\xd7\x50\xda\x01\x57\x0c\x76\x27\xe7\xfa\x8c\x57\x5f\xdb\xbd\xae\xc9\x38\x6b\x7e\x83\xeb\x1f\x47\xff\x0b\x00\x00\xff\xff\x8e\xd3\x79\x2b\x15\x21\x00\x00" func dependencyauditCdcBytes() ([]byte, error) { return bindataRead( @@ -86,7 +86,7 @@ func dependencyauditCdc() (*asset, error) { } info := bindataFileInfo{name: "DependencyAudit.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9e, 0xcf, 0xd7, 0x43, 0x2a, 0xa5, 0x5d, 0x83, 0x82, 0x97, 0xa4, 0xbe, 0x2e, 0x25, 0xfc, 0x48, 0x92, 0x88, 0xc0, 0x47, 0x21, 0x52, 0x14, 0xc1, 0x62, 0xc4, 0xb7, 0x26, 0xb7, 0x8c, 0xa9, 0x6c}} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0xa0, 0x47, 0x2e, 0x93, 0xd0, 0x81, 0x2b, 0xa8, 0x76, 0xca, 0xfe, 0xf0, 0x9, 0xbb, 0x77, 0x54, 0xb7, 0xca, 0x6c, 0xa0, 0x26, 0xad, 0xab, 0x2b, 0x3e, 0x77, 0x35, 0x2c, 0x90, 0x86, 0x69}} return a, nil } diff --git a/lib/go/templates/internal/assets/assets.go b/lib/go/templates/internal/assets/assets.go index 43c9034..a7e29c1 100644 --- a/lib/go/templates/internal/assets/assets.go +++ b/lib/go/templates/internal/assets/assets.go @@ -25,6 +25,7 @@ // transactions/delegatee/execute_all_delegated_updates.cdc (687B) // transactions/delegatee/remove_delegated_updaters.cdc (567B) // transactions/dependency-audit/admin/add_excluded_addresses.cdc (341B) +// transactions/dependency-audit/admin/set_start_end_block.cdc (345B) // transactions/dependency-audit/admin/set_unstaged_cause_panic.cdc (352B) // transactions/dependency-audit/admin/test_check_dependencies.cdc (440B) // transactions/host/publish_host_capability.cdc (2.303kB) @@ -611,6 +612,26 @@ func transactionsDependencyAuditAdminAdd_excluded_addressesCdc() (*asset, error) return a, nil } +var _transactionsDependencyAuditAdminSet_start_end_blockCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\xcf\xcf\x4a\xc4\x30\x10\x06\xf0\x7b\x9e\x62\xec\x41\x5b\x90\x9e\xc4\x43\x11\x4b\xfd\x73\xf0\x26\x2c\x3e\xc0\x98\x8c\xbb\xc1\xed\x4c\x98\x4c\x10\x91\x7d\x77\xa9\xd9\x7a\xd8\xc3\xe6\x12\x42\x3e\xe6\xfb\x4d\x9c\x93\xa8\x41\xf3\x44\x89\x38\x10\xfb\xef\xa9\x84\x68\x8d\x73\xa6\xc8\x19\xbd\x45\xe1\x36\x1b\xaa\x0d\xf0\xf6\xc2\x76\x7b\x73\x0d\xc4\x61\x7d\x74\xf0\xe3\x00\x00\x92\x52\x42\xa5\x36\xc7\x2d\x93\x0e\x30\x15\xdb\x4d\xde\x4b\x61\x5b\x23\xcb\xa9\xdf\xfd\xbb\xa8\xca\xd7\xdd\xe5\x49\x6b\x3f\x85\x39\x72\xcc\xa6\x68\xa2\xf7\xed\x87\xca\x3c\xc0\xd9\xd0\xc6\x44\x71\x4b\xaf\x68\xbb\x6e\xec\x33\xd9\x66\xa1\x3e\x73\x78\xd8\x8b\xff\x5c\xe1\x7f\xd7\xd1\x4d\x1c\xba\x7f\xcf\x38\x42\x42\x8e\xbe\x6d\x1e\xa5\xec\x03\xb0\x18\x54\xdc\xf9\x5a\x58\x68\xc7\x6d\xae\x32\xe4\xaa\xb8\x68\xea\xe4\x83\x3b\xb8\xdf\x00\x00\x00\xff\xff\x28\xf0\x8b\x80\x59\x01\x00\x00" + +func transactionsDependencyAuditAdminSet_start_end_blockCdcBytes() ([]byte, error) { + return bindataRead( + _transactionsDependencyAuditAdminSet_start_end_blockCdc, + "transactions/dependency-audit/admin/set_start_end_block.cdc", + ) +} + +func transactionsDependencyAuditAdminSet_start_end_blockCdc() (*asset, error) { + bytes, err := transactionsDependencyAuditAdminSet_start_end_blockCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "transactions/dependency-audit/admin/set_start_end_block.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x35, 0xa0, 0x10, 0x93, 0xe9, 0x18, 0x86, 0xf1, 0x3e, 0xdf, 0x9c, 0xb1, 0x5, 0xbb, 0xa2, 0x9c, 0xe2, 0x4c, 0x4c, 0x80, 0x75, 0xe, 0x9d, 0x9b, 0xb4, 0xf1, 0x64, 0x46, 0x34, 0xa9, 0xff, 0x43}} + return a, nil +} + var _transactionsDependencyAuditAdminSet_unstaged_cause_panicCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\xcf\x41\x4e\xc4\x30\x0c\x05\xd0\x7d\x4e\x61\xba\x80\x76\xd3\x03\x54\x88\xaa\xc0\x9e\x91\x10\x07\x08\x89\x69\x2d\x4d\xed\xc8\x76\x85\x10\x9a\xbb\xa3\x52\x18\xc1\x2c\x9a\x5d\xf2\x7f\x92\x67\x9a\x8b\xa8\x43\xf5\x88\x05\x39\x23\xa7\x8f\x61\xc9\xe4\x55\x08\xae\x91\x2d\x26\x27\xe1\xda\x26\x59\x8e\xf9\x10\x99\x52\x07\xf7\x22\xc7\x06\x3e\x03\x00\x40\x51\x2c\x51\xb1\x36\x1a\x19\xb5\x83\x61\xf1\x69\x48\x49\x16\xf6\xdf\xca\xba\xb6\xb8\x7d\x15\x55\x79\xbf\xbd\xbe\xf8\xac\x1d\xf2\x4c\x4c\xe6\x1a\x5d\xf4\xae\x7e\x53\x99\x3b\xd8\x2d\x3d\xbb\x68\x1c\xf1\x10\x7d\x6a\xfa\xd6\xd0\xbf\x6d\x4f\xfc\xc2\xe6\x71\xc4\x7c\xbe\x4c\x68\xff\xf5\x7f\x36\xcd\xd9\xd7\xf7\x50\xd6\x93\xba\x7a\x58\x53\x60\x71\xd8\xb0\xfb\x0c\x58\xa9\x3f\xd3\xdd\x18\xd8\xa6\xba\xaa\xb6\x97\x4f\xe1\x14\xbe\x02\x00\x00\xff\xff\x63\x20\x68\x33\x60\x01\x00\x00" func transactionsDependencyAuditAdminSet_unstaged_cause_panicCdcBytes() ([]byte, error) { @@ -1067,6 +1088,7 @@ var _bindata = map[string]func() (*asset, error){ "transactions/delegatee/execute_all_delegated_updates.cdc": transactionsDelegateeExecute_all_delegated_updatesCdc, "transactions/delegatee/remove_delegated_updaters.cdc": transactionsDelegateeRemove_delegated_updatersCdc, "transactions/dependency-audit/admin/add_excluded_addresses.cdc": transactionsDependencyAuditAdminAdd_excluded_addressesCdc, + "transactions/dependency-audit/admin/set_start_end_block.cdc": transactionsDependencyAuditAdminSet_start_end_blockCdc, "transactions/dependency-audit/admin/set_unstaged_cause_panic.cdc": transactionsDependencyAuditAdminSet_unstaged_cause_panicCdc, "transactions/dependency-audit/admin/test_check_dependencies.cdc": transactionsDependencyAuditAdminTest_check_dependenciesCdc, "transactions/host/publish_host_capability.cdc": transactionsHostPublish_host_capabilityCdc, @@ -1174,6 +1196,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "dependency-audit": {nil, map[string]*bintree{ "admin": {nil, map[string]*bintree{ "add_excluded_addresses.cdc": {transactionsDependencyAuditAdminAdd_excluded_addressesCdc, map[string]*bintree{}}, + "set_start_end_block.cdc": {transactionsDependencyAuditAdminSet_start_end_blockCdc, map[string]*bintree{}}, "set_unstaged_cause_panic.cdc": {transactionsDependencyAuditAdminSet_unstaged_cause_panicCdc, map[string]*bintree{}}, "test_check_dependencies.cdc": {transactionsDependencyAuditAdminTest_check_dependenciesCdc, map[string]*bintree{}}, }}, diff --git a/tests/dependency_audit_tests.cdc b/tests/dependency_audit_tests.cdc index 43c3555..5d26358 100644 --- a/tests/dependency_audit_tests.cdc +++ b/tests/dependency_audit_tests.cdc @@ -246,3 +246,66 @@ access(all) fun testChekDependenciesWithUnstagedEntriesPanics() { // not sure how to test this: // Test.expect(commitResult.error!.message, Test.contain("panic: This transaction is using dependencies not staged for Crescendo upgrade coming soon! Learn more: https://bit.ly/FLOWCRESCENDO. Dependencies not staged: A.0000000000000008.Foo") ) } + +access(all) fun testBoundaries() { + var commitResult = executeTransaction( + "../transactions/dependency-audit/admin/set_start_end_block.cdc", + [100 as UInt64, 200 as UInt64], + adminAccount + ) + Test.expect(commitResult, Test.beSucceeded()) + + var addresses: [Address] = [fooAccount.address] + var names: [String] = ["Foo"] + var authorizers: [Address] = [] + commitResult = executeTransaction( + "../transactions/dependency-audit/admin/test_check_dependencies.cdc", + [addresses, names, authorizers], + adminAccount + ) + Test.expect(commitResult, Test.beSucceeded()) + + commitResult = executeTransaction( + "../transactions/dependency-audit/admin/set_start_end_block.cdc", + [1 as UInt64, 2 as UInt64], + adminAccount + ) + Test.expect(commitResult, Test.beSucceeded()) + + addresses = [fooAccount.address] + names = ["Foo"] + authorizers = [] + commitResult = executeTransaction( + "../transactions/dependency-audit/admin/test_check_dependencies.cdc", + [addresses, names, authorizers], + adminAccount + ) + Test.expect(commitResult, Test.beFailed()) + + // The block height is 42 at this point + + commitResult = executeTransaction( + "../transactions/dependency-audit/admin/set_start_end_block.cdc", + [0 as UInt64, 100 as UInt64], + adminAccount + ) + Test.expect(commitResult, Test.beSucceeded()) + + var i = 0 + var failCount = 0 + while i < 10 { + commitResult = executeTransaction( + "../transactions/dependency-audit/admin/test_check_dependencies.cdc", + [addresses, names, authorizers], + adminAccount + ) + if commitResult.error != nil { + failCount = failCount + 1 + } + i = i + 1 + } + + // expect 2-8 failures in 10 attempts + Test.expect(failCount, Test.beGreaterThan(1)) + Test.expect(failCount, Test.beLessThan(9)) +} diff --git a/transactions/dependency-audit/admin/set_start_end_block.cdc b/transactions/dependency-audit/admin/set_start_end_block.cdc new file mode 100644 index 0000000..262a243 --- /dev/null +++ b/transactions/dependency-audit/admin/set_start_end_block.cdc @@ -0,0 +1,8 @@ +import "DependencyAudit" + +transaction(start: UInt64, end: UInt64) { + prepare(signer: AuthAccount) { + signer.borrow<&DependencyAudit.Administrator>(from: DependencyAudit.AdministratorStoragePath)?.setStartEndBlock(start: start, end: end) + ?? panic("Could not borrow DependencyAudit.Administrator from signer's storage!") + } +}