Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ahramy committed Sep 6, 2024
1 parent a035528 commit 3b4312f
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 63 deletions.
10 changes: 5 additions & 5 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Multisig operations demand multi-signatory authorization for proposal execution.

## Axelar Service Governance

Building upon the Interchain Governance Contract, the Service Governance Contract is specifically designed to manage operations that require coordination. By incorporating `MultisigBase`, it introduces the functionality to approve, execute, and cancel multisig proposals, in addition to schedule and cancel TimeLock proposals. This is intended to be used as the owner for services such as the Interchain token service contract, allowing Axelar governance to manage it.
Building upon the Interchain Governance Contract, the Service Governance Contract is specifically designed to manage operations that require coordination. Axelar Service Governance introduces the functionality to approve, execute, and cancel operator proposals, in addition to schedule and cancel TimeLock proposals. This is intended to be used as the owner for services such as the Interchain token service contract, allowing Axelar governance to manage it.

### Service Governance Operations

Expand All @@ -66,10 +66,10 @@ The contract orchestrates four governance operations:

- **Cancel TimeLock Proposal**: Again, similar to Interchain Governance, it cancels an existing governance proposal.

- **Approve Multisig Proposal**: This function enables multisig proposal approval by setting the proposal's approval status to true. It resets any previous voting and signals successful approval via a MultisigApproved event.
- **Approve Operator Proposal**: This function enables operator proposal approval by setting the proposal's approval status to true. It resets any previous voting and signals successful approval via a OperatorApproved event.

- **Cancel Multisig Approval**: Cancels an approved multisig proposal, setting the approval status of the proposal to false and indicating successful cancellation through a `MultisigCancelled` event.
- **Cancel Operator Approval**: Cancels an approved operator proposal, setting the approval status of the proposal to false and indicating successful cancellation through a `OperatorCancelled` event.

### Secure Execution of Multisig Proposals
### Secure Execution of Operator Proposals

Each time a new multisig proposal receives approval from governance, the multisig voting count is reset to 0. This ensures that any previous votes on similar proposals will not affect the new proposal. When a multisig proposal gathers the required number of signatory approvals, it becomes ready for execution. Before execution, the contract verifies the proposal's approval status. If the status is set to false, the transaction is reverted. Once executed successfully, the approval status of the proposal is reset, and a MultisigExecuted event gets emitted.
Each time a new operator proposal receives approval from governance, the operator voting count is reset to 0. This ensures that any previous votes on similar proposals will not affect the new proposal. When a operator proposal gathers the required number of signatory approvals, it becomes ready for execution. Before execution, the contract verifies the proposal's approval status. If the status is set to false, the transaction is reverted. Once executed successfully, the approval status of the proposal is reset, and a OperatorExecuted event gets emitted.
20 changes: 10 additions & 10 deletions contracts/governance/AxelarServiceGovernance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { InterchainGovernance } from './InterchainGovernance.sol';
/**
* @title AxelarServiceGovernance Contract
* @dev This contract is part of the Axelar Governance system, it inherits the Interchain Governance contract
* with added functionality to approve and execute multisig proposals.
* with added functionality to approve and execute operator proposals.
*/
contract AxelarServiceGovernance is InterchainGovernance, IAxelarServiceGovernance {
enum ServiceGovernanceCommand {
ScheduleTimeLockProposal,
CancelTimeLockProposal,
ApproveMultisigProposal,
ApproveOperatorProposal,
CancelOperatorApproval
}

Expand Down Expand Up @@ -52,13 +52,13 @@ contract AxelarServiceGovernance is InterchainGovernance, IAxelarServiceGovernan
}

/**
* @notice Returns whether a multisig proposal has been approved
* @notice Returns whether an operator proposal has been approved
* @param target The address of the contract targeted by the proposal
* @param callData The call data to be sent to the target contract
* @param nativeValue The amount of native tokens to be sent to the target contract
* @return bool True if the proposal has been approved, False otherwise
*/
function isMultisigProposalApproved(
function isOperatorProposalApproved(
address target,
bytes calldata callData,
uint256 nativeValue
Expand All @@ -67,12 +67,12 @@ contract AxelarServiceGovernance is InterchainGovernance, IAxelarServiceGovernan
}

/**
* @notice Executes a multisig proposal.
* @notice Executes an operator proposal.
* @param target The target address the proposal will call
* @param callData The data that encodes the function and arguments to call on the target contract
* @param nativeValue The value of native token to be sent to the target contract
*/
function executeMultisigProposal(
function executeOperatorProposal(
address target,
bytes calldata callData,
uint256 nativeValue
Expand All @@ -83,7 +83,7 @@ contract AxelarServiceGovernance is InterchainGovernance, IAxelarServiceGovernan

operatorApprovals[proposalHash] = false;

emit MultisigExecuted(proposalHash, target, callData, nativeValue);
emit OperatorExecuted(proposalHash, target, callData, nativeValue);

_call(target, callData, nativeValue);
}
Expand Down Expand Up @@ -128,15 +128,15 @@ contract AxelarServiceGovernance is InterchainGovernance, IAxelarServiceGovernan

emit ProposalCancelled(proposalHash, target, callData, nativeValue, eta);
return;
} else if (commandType == uint256(ServiceGovernanceCommand.ApproveMultisigProposal)) {
} else if (commandType == uint256(ServiceGovernanceCommand.ApproveOperatorProposal)) {
operatorApprovals[proposalHash] = true;

emit MultisigApproved(proposalHash, target, callData, nativeValue);
emit OperatorApproved(proposalHash, target, callData, nativeValue);
return;
} else if (commandType == uint256(ServiceGovernanceCommand.CancelOperatorApproval)) {
operatorApprovals[proposalHash] = false;

emit MultisigCancelled(proposalHash, target, callData, nativeValue);
emit OperatorCancelled(proposalHash, target, callData, nativeValue);
return;
} else {
revert InvalidCommand();
Expand Down
18 changes: 9 additions & 9 deletions contracts/interfaces/IAxelarServiceGovernance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ import { IInterchainGovernance } from './IInterchainGovernance.sol';

/**
* @title IAxelarServiceGovernance Interface
* @dev This interface extends IInterchainGovernance and IMultisigBase for multisig proposal actions
* @dev This interface extends IInterchainGovernance for operator proposal actions
*/
interface IAxelarServiceGovernance is IInterchainGovernance {
error InvalidOperator();
error NotApproved();
error NotAuthorized();

event MultisigApproved(
event OperatorApproved(
bytes32 indexed proposalHash,
address indexed targetContract,
bytes callData,
uint256 nativeValue
);

event MultisigCancelled(
event OperatorCancelled(
bytes32 indexed proposalHash,
address indexed targetContract,
bytes callData,
uint256 nativeValue
);

event MultisigExecuted(
event OperatorExecuted(
bytes32 indexed proposalHash,
address indexed targetContract,
bytes callData,
Expand All @@ -37,31 +37,31 @@ interface IAxelarServiceGovernance is IInterchainGovernance {
event OperatorshipTransferred(address indexed oldOperator, address indexed newOperator);

/**
* @notice Returns whether a multisig proposal has been approved
* @notice Returns whether an operator proposal has been approved
* @param proposalHash The hash of the proposal
* @return bool True if the proposal has been approved, False otherwise
*/
function operatorApprovals(bytes32 proposalHash) external view returns (bool);

/**
* @notice Returns whether a multisig proposal has been approved
* @notice Returns whether an operator proposal has been approved
* @param target The address of the contract targeted by the proposal
* @param callData The call data to be sent to the target contract
* @param nativeValue The amount of native tokens to be sent to the target contract
* @return bool True if the proposal has been approved, False otherwise
*/
function isMultisigProposalApproved(
function isOperatorProposalApproved(
address target,
bytes calldata callData,
uint256 nativeValue
) external view returns (bool);

/**
* @notice Executes a multisig proposal
* @notice Executes an operator proposal
* @param targetContract The target address the proposal will call
* @param callData The data that encodes the function and arguments to call on the target contract
*/
function executeMultisigProposal(
function executeOperatorProposal(
address targetContract,
bytes calldata callData,
uint256 value
Expand Down
Loading

0 comments on commit 3b4312f

Please sign in to comment.