-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert back to custom upgrade script
- Loading branch information
1 parent
fd270d7
commit 46e5bb9
Showing
3 changed files
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
integration/utils/templates/set-protocol-state-version.cdc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import NodeVersionBeacon from "NodeVersionBeacon" | ||
|
||
/// Transaction that allows NodeVersionAdmin to specify a new protocol state version. | ||
/// The new version will become active at view `activeView` if the service event | ||
/// is processed and applied to the protocol state within a block `B` such that | ||
/// `B.view + ∆ < activeView`, for a protocol-defined safety threshold ∆. | ||
/// Service events not meeting this threshold are discarded. | ||
/// | ||
/// This is a special version of the admin transaction for use in integration tests. | ||
/// We allow the sender to pass in a value to add to the current view, to reduce | ||
/// the liklihood that a test spuriously fails due to timing. | ||
transaction(newProtocolVersion: UInt64, activeViewDiff: UInt64) { | ||
|
||
let adminRef: &NodeVersionBeacon.Admin | ||
|
||
prepare(acct: auth(BorrowValue) &Account) { | ||
// Borrow a reference to the NodeVersionAdmin implementing resource | ||
self.adminRef = acct.storage.borrow<&NodeVersionBeacon.Admin>(from: NodeVersionBeacon.AdminStoragePath) | ||
?? panic("Couldn't borrow NodeVersionBeacon.Admin Resource") | ||
} | ||
|
||
execute { | ||
let block = getCurrentBlock() | ||
self.adminRef.emitProtocolStateVersionUpgrade( | ||
newProtocolVersion: newProtocolVersion, | ||
activeView: block.view + activeViewDiff | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters