Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use named return #189

Merged
merged 8 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/gas-estimation/InterchainGasEstimation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ abstract contract InterchainGasEstimation is IInterchainGasEstimation {

uint256 txSize = _l1TxSize(payload) + overhead + (4 * 16);

return (l1GasInfo.relativeGasPrice * txSize * gasInfo.l1FeeScalar) / precision;
l1DataFee = (l1GasInfo.relativeGasPrice * txSize * gasInfo.l1FeeScalar) / precision;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/gateway/AxelarAmplifierGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ contract AxelarAmplifierGateway is BaseAmplifierGateway, BaseWeightedMultisig, U
* @return isLatestSigners True if provided signers are the current ones
*/
function validateProof(bytes32 dataHash, Proof calldata proof) external view returns (bool isLatestSigners) {
return _validateProof(dataHash, proof);
isLatestSigners = _validateProof(dataHash, proof);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions contracts/gateway/BaseAmplifierGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ abstract contract BaseAmplifierGateway is IBaseAmplifierGateway {

/**
* @dev For backwards compatibility with `validateContractCall`, `commandId` is used here instead of `messageId`.
* @return valid True if message is valid
*/
function _validateMessage(
bytes32 commandId,
Expand Down Expand Up @@ -224,6 +225,7 @@ abstract contract BaseAmplifierGateway is IBaseAmplifierGateway {

/**
* @dev For backwards compatibility with `validateContractCall`, `commandId` is used here instead of `messageId`.
* @return bytes32 the message hash
*/
function _messageHash(
bytes32 commandId,
Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/BaseMultisig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract BaseMultisig is IBaseMultisig {

/**
* @notice Returns the current signer threshold
* @return uint The signer threshold
* @return uint256 The signer threshold
*/
function signerThreshold() external view override returns (uint256) {
return signers.threshold;
Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/InterchainMultisig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ contract InterchainMultisig is Caller, BaseWeightedMultisig, IInterchainMultisig
* @return isLatestSigners True if provided signers are the current ones
*/
function validateProof(bytes32 dataHash, Proof calldata proof) external view returns (bool isLatestSigners) {
return _validateProof(dataHash, proof);
isLatestSigners = _validateProof(dataHash, proof);
}

/**
Expand Down
10 changes: 3 additions & 7 deletions contracts/utils/RolesBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,11 @@ contract RolesBase is IRolesBase {
* @param roles The roles to convert
* @return accountRoles The roles in uint256 format
*/
function _toAccountRoles(uint8[] memory roles) internal pure returns (uint256) {
function _toAccountRoles(uint8[] memory roles) internal pure returns (uint256 accountRoles) {
uint256 length = roles.length;
uint256 accountRoles;

for (uint256 i = 0; i < length; ++i) {
accountRoles |= (1 << roles[i]);
}

return accountRoles;
}

/**
Expand All @@ -74,7 +70,7 @@ contract RolesBase is IRolesBase {
* @return key The key of the roles mapping
*/
function _rolesKey(address account) internal view virtual returns (bytes32 key) {
return keccak256(abi.encodePacked(ROLES_PREFIX, account));
key = keccak256(abi.encodePacked(ROLES_PREFIX, account));
}

/**
Expand Down Expand Up @@ -108,7 +104,7 @@ contract RolesBase is IRolesBase {
* @return key The key of the proposed roles mapping
*/
function _proposalKey(address fromAccount, address toAccount) internal view virtual returns (bytes32 key) {
return keccak256(abi.encodePacked(PROPOSE_ROLES_PREFIX, fromAccount, toAccount));
key = keccak256(abi.encodePacked(PROPOSE_ROLES_PREFIX, fromAccount, toAccount));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/TimeLock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract TimeLock is ITimeLock {
/**
* @notice Returns the timestamp after which the TimeLock may be executed.
* @param hash The hash of the timelock
* @return uint The timestamp after which the timelock with the given hash can be executed
* @return uint256 The timestamp after which the timelock with the given hash can be executed
*/
function getTimeLock(bytes32 hash) external view override returns (uint256) {
return _getTimeLockEta(hash);
Expand Down
2 changes: 1 addition & 1 deletion test/governance/AxelarServiceGovernance.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ describe('AxelarServiceGovernance', () => {
const bytecodeHash = keccak256(bytecode);

const expected = {
london: '0x87891d8e17e62bddae5afa47c6231b236207b7c9cfff0810bc62b226a3765600',
london: '0x46faca3ff5c329445a41ba4b7a206d10ff59880aaf59fa144997a4979910a36f',
}[getEVMVersion()];

expect(bytecodeHash).to.be.equal(expected);
Expand Down
2 changes: 1 addition & 1 deletion test/governance/InterchainGovernance.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ describe('InterchainGovernance', () => {
const bytecodeHash = keccak256(bytecode);

const expected = {
london: '0x034b9b57bed553b7c9cfa5e4a14304776b65d8a3caefc87df9339203b04df56e',
london: '0xb909177113ad762effa23767ebfa25c9f9a4521abb452794ac96a97340d09333',
}[getEVMVersion()];

expect(bytecodeHash).to.be.equal(expected);
Expand Down
Loading