-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add transaction scripts for oracle delegation (#735)
* add transaction scripts for oracle delegation * cleanup * change hard coded path * docs * on genesis: enable oracle delegation * patch integration test
- Loading branch information
1 parent
8b4457a
commit 4240824
Showing
35 changed files
with
570 additions
and
105 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
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
21 changes: 21 additions & 0 deletions
21
language/diem-framework/modules/0L_transaction_scripts/ol_oracle.move
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 |
---|---|---|
@@ -1,8 +1,29 @@ | ||
address 0x1 { | ||
module OracleScripts { | ||
use 0x1::Oracle; | ||
|
||
public(script) fun ol_oracle_tx(sender: signer, id: u64, data: vector<u8>) { | ||
Oracle::handler(&sender, id, data); | ||
} | ||
|
||
/// A validator (Alice) can delegate the authority for the operation of an upgrade to another validator (Bob). When Oracle delegation happens, effectively the consensus voting power of Alice, is added to Bob only for the effect of calculating the preference on electing a stdlib binary. Whatever binary Bob proposes, Alice will also propose without needing to be submitting transactions. | ||
public(script) fun ol_delegate_vote(sender: signer, dest: address) { | ||
// if for some reason not delegated | ||
Oracle::enable_delegation(&sender); | ||
|
||
Oracle::delegate_vote(&sender, dest); | ||
} | ||
|
||
/// First Bob must have delegation enabled, which can be done with: | ||
public(script) fun ol_enable_delegation(sender: signer) { | ||
Oracle::enable_delegation(&sender); | ||
} | ||
/// Alice can remove Bob as the delegate with this function. | ||
public(script) fun ol_remove_delegation(sender: signer) { | ||
Oracle::remove_delegate_vote(&sender); | ||
} | ||
|
||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.