Skip to content

feat: governor spoke is able to execute multiple transactions atomically#3703

Merged
mrice32 merged 7 commits intoUMAprotocol:masterfrom
mrice32:governance
Dec 17, 2021
Merged

feat: governor spoke is able to execute multiple transactions atomically#3703
mrice32 merged 7 commits intoUMAprotocol:masterfrom
mrice32:governance

Conversation

@mrice32
Copy link
Copy Markdown
Member

@mrice32 mrice32 commented Dec 15, 2021

Motivation

The GovernorSpoke contract should be able to execute multiple transactions atomically keep the Governance system from losing control of the sequencing of important actions.

Summary

This adds a more complex structure for cross-chain messages so that they can contain multiple transactions rather than one.

Testing

Check a box to describe how you tested these changes and list the steps for reviewers to test.

  • Ran end-to-end test, running the code as in production
  • New unit tests created
  • Existing tests adequate, no new tests required
  • All existing tests pass
  • Untested

Issue(s)

N/A

Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
@mrice32 mrice32 requested a review from chrismaree December 15, 2021 06:48
Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
@mrice32 mrice32 marked this pull request as ready for review December 15, 2021 08:00
@mrice32 mrice32 requested a review from nicholaspai as a code owner December 15, 2021 08:00
emit ExecutedGovernanceTransaction(to, inputData);
for (uint256 i = 0; i < calls.length; i++) {
(address to, bytes memory inputData) = (calls[i].to, calls[i].data);
require(_executeCall(to, inputData), "execute call failed");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this forces that everything in the batch either success or fails, thereby making this atomic. nice.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

Comment thread packages/core/contracts/cross-chain-oracle/GovernorHub.sol Outdated
let targetAddress = addressWhitelist.options.address;
let inputDataBytes = addressWhitelist.methods.addToWhitelist(messenger).encodeABI();
let messageBytes = web3.eth.abi.encodeParameters(["address", "bytes"], [targetAddress, inputDataBytes]);
const calls = [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is really not too bad! having to do the web3.eth.abi.encodeParameters on this array of objects (struct) is a bit painful but nothing we cant abstract away in a script :)

Copy link
Copy Markdown
Member

@chrismaree chrismaree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awesome!

mrice32 and others added 3 commits December 16, 2021 11:08
Co-authored-by: Chris Maree <christopher.maree@gmail.com>
Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
@mrice32 mrice32 merged commit 0d3cf20 into UMAprotocol:master Dec 17, 2021
@mrice32 mrice32 deleted the governance branch December 17, 2021 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants