From 0c80c47c18129d7a679968472a89b96a25e3574e Mon Sep 17 00:00:00 2001 From: A5 Pickle Date: Thu, 21 Dec 2023 15:32:58 -0600 Subject: [PATCH] evm: remove comments --- .../CircleIntegration/Governance.sol | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/evm/src/contracts/CircleIntegration/Governance.sol b/evm/src/contracts/CircleIntegration/Governance.sol index 959c87d..e183623 100644 --- a/evm/src/contracts/CircleIntegration/Governance.sol +++ b/evm/src/contracts/CircleIntegration/Governance.sol @@ -42,32 +42,23 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade { // unless the target chain is 0 (which means all chains). uint16 targetChain; (targetChain, offset) = vaa.payload.asUint16Unchecked(offset); - - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(targetChain == 0 || targetChain == _chainId, "invalid target chain"); uint16 foreignChain; (foreignChain, offset) = vaa.payload.asUint16Unchecked(offset); - - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(foreignChain != 0 && foreignChain != _chainId, "invalid chain"); mapping(uint16 => bytes32) storage registeredEmitters = getRegisteredEmitters(); // For now, ensure that we cannot register the same foreign chain again. - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(registeredEmitters[foreignChain] == 0, "chain already registered"); bytes32 foreignAddress; (foreignAddress, offset) = vaa.payload.asBytes32Unchecked(offset); - - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(foreignAddress != 0, "emitter cannot be zero address"); uint32 cctpDomain; (cctpDomain, offset) = vaa.payload.asUint32Unchecked(offset); - - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(cctpDomain != _localCctpDomain, "domain == localDomain()"); _checkLength(vaa.payload, offset); @@ -102,14 +93,10 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade { // contract upgrades should only be relevant for this contract's chain ID uint16 targetChain; (targetChain, offset) = vaa.payload.asUint16Unchecked(offset); - - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(targetChain == _chainId, "invalid target chain"); bytes32 encodedImplementation; (encodedImplementation, offset) = vaa.payload.asBytes32Unchecked(offset); - - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(bytes12(encodedImplementation) == 0, "invalid address"); _checkLength(vaa.payload, offset); @@ -125,7 +112,6 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade { abi.encodeWithSignature("circleIntegrationImplementation()") ); - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(queried.length == 32, "invalid implementation"); require( abi.decode(queried, (bytes32)) == keccak256("circleIntegrationImplementation()"), @@ -141,8 +127,6 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade { // call initialize function of the new implementation (bool success, bytes memory reason) = newImplementation.delegatecall(abi.encodeWithSignature("initialize()")); - - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(success, string(reason)); emit ContractUpgraded(currentImplementation, newImplementation); @@ -180,41 +164,33 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade { uint8 action ) private view returns (IWormhole.VM memory vaa, uint256 offset) { // Make sure the blockchain has not forked. - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(block.chainid == _evmChain, "invalid evm chain"); // verify the governance message bool valid; string memory reason; (vaa, valid, reason) = _wormhole.parseAndVerifyVM(encodedVaa); - - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(valid, reason); // Confirm that the governance message was sent from the governance contract. - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(vaa.emitterChainId == GOVERNANCE_CHAIN, "invalid governance chain"); require(vaa.emitterAddress == GOVERNANCE_EMITTER, "invalid governance contract"); // Confirm that this governance action has not been consumed already. - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(!consumedVaas[vaa.hash], "governance action already consumed"); bytes32 govModule; (govModule, offset) = vaa.payload.asBytes32Unchecked(offset); - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(govModule == GOVERNANCE_MODULE, "invalid governance module"); uint8 govAction; (govAction, offset) = vaa.payload.asUint8Unchecked(offset); - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(govAction == action, "invalid governance action"); } function _checkLength(bytes memory encoded, uint256 expected) private pure { - // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it. require(encoded.length == expected, "invalid governance payload length"); }