Graduate to yarn 4 🧶 (#2899)

Co-authored-by: J M Rossy <jm.rossy@gmail.com>
Fixes https://github.com/hyperlane-xyz/issues/issues/687
Fixes #2228 
Fixes https://github.com/hyperlane-xyz/issues/issues/704
nambrot/kurtosis-cli
Yorke Rhodes 1 year ago committed by GitHub
parent 87796e2ac0
commit b14f997810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .github/workflows/node.yml
  2. 6
      .prettierrc
  3. 785
      .yarn/releases/yarn-3.2.0.cjs
  4. 893
      .yarn/releases/yarn-4.0.1.cjs
  5. 12
      .yarnrc.yml
  6. 5
      Dockerfile
  7. 24
      package.json
  8. 17
      solidity/contracts/Mailbox.sol
  9. 25
      solidity/contracts/client/GasRouter.sol
  10. 8
      solidity/contracts/client/MailboxClient.sol
  11. 59
      solidity/contracts/client/Router.sol
  12. 20
      solidity/contracts/hooks/OPStackHook.sol
  13. 19
      solidity/contracts/hooks/PausableHook.sol
  14. 18
      solidity/contracts/hooks/StaticProtocolFee.sol
  15. 10
      solidity/contracts/hooks/aggregation/ERC5164Hook.sol
  16. 18
      solidity/contracts/hooks/aggregation/StaticAggregationHook.sol
  17. 57
      solidity/contracts/hooks/igp/InterchainGasPaymaster.sol
  18. 18
      solidity/contracts/hooks/igp/StorageGasOracle.sol
  19. 15
      solidity/contracts/hooks/libs/AbstractMessageIdAuthHook.sol
  20. 45
      solidity/contracts/hooks/libs/AbstractPostDispatchHook.sol
  21. 52
      solidity/contracts/hooks/libs/StandardHookMetadata.sol
  22. 15
      solidity/contracts/hooks/routing/DestinationRecipientRoutingHook.sol
  23. 39
      solidity/contracts/hooks/routing/DomainRoutingHook.sol
  24. 9
      solidity/contracts/hooks/routing/FallbackDomainRoutingHook.sol
  25. 7
      solidity/contracts/interfaces/IGasOracle.sol
  26. 8
      solidity/contracts/interfaces/IInterchainGasPaymaster.sol
  27. 7
      solidity/contracts/interfaces/IInterchainSecurityModule.sol
  28. 16
      solidity/contracts/interfaces/IMailbox.sol
  29. 7
      solidity/contracts/interfaces/IValidatorAnnounce.sol
  30. 22
      solidity/contracts/interfaces/hooks/IPostDispatchHook.sol
  31. 7
      solidity/contracts/interfaces/isms/IAggregationIsm.sol
  32. 7
      solidity/contracts/interfaces/isms/IMultisigIsm.sol
  33. 7
      solidity/contracts/interfaces/isms/IRoutingIsm.sol
  34. 10
      solidity/contracts/isms/NoopIsm.sol
  35. 10
      solidity/contracts/isms/PausableIsm.sol
  36. 16
      solidity/contracts/isms/aggregation/AbstractAggregationIsm.sol
  37. 10
      solidity/contracts/isms/aggregation/StaticAggregationIsm.sol
  38. 2
      solidity/contracts/isms/hook/AbstractMessageIdAuthorizedIsm.sol
  39. 27
      solidity/contracts/isms/libs/AggregationIsmMetadata.sol
  40. 49
      solidity/contracts/isms/libs/MerkleRootMultisigIsmMetadata.sol
  41. 17
      solidity/contracts/isms/libs/MessageIdMultisigIsmMetadata.sol
  42. 21
      solidity/contracts/isms/multisig/AbstractMerkleRootMultisigIsm.sol
  43. 21
      solidity/contracts/isms/multisig/AbstractMessageIdMultisigIsm.sol
  44. 35
      solidity/contracts/isms/multisig/AbstractMultisigIsm.sol
  45. 17
      solidity/contracts/isms/multisig/StaticMultisigIsm.sol
  46. 16
      solidity/contracts/isms/multisig/ValidatorAnnounce.sol
  47. 16
      solidity/contracts/isms/routing/AbstractRoutingIsm.sol
  48. 9
      solidity/contracts/isms/routing/DefaultFallbackRoutingIsm.sol
  49. 34
      solidity/contracts/isms/routing/DomainRoutingIsm.sol
  50. 10
      solidity/contracts/isms/routing/InterchainAccountIsm.sol
  51. 9
      solidity/contracts/libs/CheckpointLib.sol
  52. 68
      solidity/contracts/libs/EnumerableMapExtended.sol
  53. 27
      solidity/contracts/libs/LibBit.sol
  54. 11
      solidity/contracts/libs/Merkle.sol
  55. 40
      solidity/contracts/libs/Message.sol
  56. 9
      solidity/contracts/libs/MetaProxy.sol
  57. 8
      solidity/contracts/libs/MinimalProxy.sol
  58. 43
      solidity/contracts/libs/StaticAddressSetFactory.sol
  59. 39
      solidity/contracts/middleware/InterchainAccountRouter.sol
  60. 49
      solidity/contracts/middleware/libs/Call.sol
  61. 12
      solidity/contracts/middleware/libs/InterchainAccountMessage.sol
  62. 33
      solidity/contracts/middleware/libs/InterchainQueryMessage.sol
  63. 16
      solidity/contracts/middleware/liquidity-layer/LiquidityLayerRouter.sol
  64. 33
      solidity/contracts/middleware/liquidity-layer/adapters/CircleBridgeAdapter.sol
  65. 17
      solidity/contracts/middleware/liquidity-layer/adapters/PortalAdapter.sol
  66. 7
      solidity/contracts/middleware/liquidity-layer/interfaces/circle/ICircleMessageTransmitter.sol
  67. 21
      solidity/contracts/middleware/liquidity-layer/interfaces/portal/IPortalTokenBridge.sol
  68. 18
      solidity/contracts/mock/MockCircleMessageTransmitter.sol
  69. 15
      solidity/contracts/mock/MockPortalBridge.sol
  70. 6
      solidity/contracts/test/TestGasRouter.sol
  71. 10
      solidity/contracts/test/TestInterchainGasPaymaster.sol
  72. 64
      solidity/contracts/test/TestMessage.sol
  73. 9
      solidity/contracts/test/TestPostDispatchHook.sol
  74. 33
      solidity/contracts/test/TestRouter.sol
  75. 6
      solidity/contracts/test/TestSendReceiver.sol
  76. 12
      solidity/contracts/token/HypERC20.sol
  77. 17
      solidity/contracts/token/HypERC20Collateral.sol
  78. 13
      solidity/contracts/token/HypERC721.sol
  79. 18
      solidity/contracts/token/HypERC721Collateral.sol
  80. 18
      solidity/contracts/token/HypNative.sol
  81. 1
      solidity/contracts/token/README.md
  82. 33
      solidity/contracts/token/extensions/FastHypERC20.sol
  83. 23
      solidity/contracts/token/extensions/FastHypERC20Collateral.sol
  84. 15
      solidity/contracts/token/extensions/HypERC721URICollateral.sol
  85. 32
      solidity/contracts/token/extensions/HypERC721URIStorage.sol
  86. 14
      solidity/contracts/token/libs/FastTokenRouter.sol
  87. 8
      solidity/contracts/token/libs/TokenMessage.sol
  88. 7
      solidity/contracts/token/libs/TokenRouter.sol
  89. 29
      solidity/package.json
  90. 17
      solidity/test/InterchainAccountRouter.t.sol
  91. 6
      solidity/test/Mailbox.t.sol
  92. 7
      solidity/test/Router.t.sol
  93. 7
      solidity/test/ValidatorAnnounce.t.sol
  94. 8
      solidity/test/hooks/AggregationHook.t.sol
  95. 19
      solidity/test/igps/InterchainGasPaymaster.t.sol
  96. 27
      solidity/test/isms/AggregationIsm.t.sol
  97. 14
      solidity/test/isms/DomainRoutingIsm.t.sol
  98. 9
      solidity/test/isms/ERC5164ISM.t.sol
  99. 9
      solidity/test/isms/IsmTestUtils.sol
  100. 26
      solidity/test/isms/MultisigIsm.t.sol
  101. Some files were not shown because too many files have changed in this diff Show More

@ -49,9 +49,6 @@ jobs:
with:
node-version: 18
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
- name: yarn-cache
uses: actions/cache@v3
with:

@ -10,12 +10,12 @@
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false,
"explicitTypes": "always"
"bracketSpacing": false
}
}
],
"importOrder": ["^@hyperlane-xyz/(.*)$", "^../(.*)$", "^./(.*)$"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
"importOrderSortSpecifiers": true,
"plugins": ["prettier-plugin-solidity", "@trivago/prettier-plugin-sort-imports"]
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,11 +1,13 @@
compressionLevel: mixed
enableGlobalCache: false
enableScripts: false
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: "https://mskelton.dev/yarn-outdated/v3"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-3.2.0.cjs
yarnPath: .yarn/releases/yarn-4.0.1.cjs

@ -1,11 +1,10 @@
FROM node:16-alpine
FROM node:18-alpine
WORKDIR /hyperlane-monorepo
RUN apk add --update --no-cache git g++ make py3-pip
RUN yarn set version 3.2.0
RUN yarn plugin import workspace-tools
RUN yarn set version 4.0.1
# Copy package.json and friends
COPY package.json yarn.lock .yarnrc.yml ./

@ -3,28 +3,28 @@
"description": "A yarn workspace of core Hyperlane packages",
"version": "0.0.0",
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.1",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.16.0",
"eslint-config-prettier": "^8.5.0",
"husky": "^8.0.0",
"lint-staged": "^12.4.3",
"prettier": "^2.4.1"
"prettier": "^2.8.8"
},
"packageManager": "yarn@3.2.0",
"packageManager": "yarn@4.0.1",
"private": true,
"scripts": {
"build": "yarn workspaces foreach --verbose --parallel --topological run build",
"clean": "yarn workspaces foreach --verbose --parallel run clean",
"build": "yarn workspaces foreach --all --parallel --topological run build",
"clean": "yarn workspaces foreach --all --parallel run clean",
"prettier": "yarn workspaces foreach --all --parallel run prettier",
"lint": "yarn workspaces foreach --all --parallel run lint",
"test": "yarn workspaces foreach --all --parallel run test",
"coverage": "yarn workspaces foreach --all --parallel run coverage",
"version:prepare": "yarn workspaces foreach --all --no-private --topological version --immediate",
"publish:all": "yarn workspaces foreach --all --no-private --topological npm publish --access public",
"postinstall": "husky install",
"prettier": "yarn workspaces foreach --verbose --parallel run prettier",
"lint": "yarn workspaces foreach --verbose --parallel run lint",
"test": "yarn workspaces foreach --verbose --parallel run test",
"coverage": "yarn workspaces foreach --verbose --parallel run coverage",
"version:check": "yarn version check --interactive",
"version:prepare": "yarn workspaces foreach --no-private --verbose --topological version --immediate",
"publish:all": "yarn workspaces foreach --no-private --verbose --topological npm publish --access public"
"version:check": "yarn version check --interactive"
},
"workspaces": [
"solidity",

@ -191,11 +191,10 @@ contract Mailbox is IMailbox, Indexed, Versioned, OwnableUpgradeable {
* @param _metadata Metadata used by the ISM to verify `_message`.
* @param _message Formatted Hyperlane message (refer to Message.sol).
*/
function process(bytes calldata _metadata, bytes calldata _message)
external
payable
override
{
function process(
bytes calldata _metadata,
bytes calldata _message
) external payable override {
/// CHECKS ///
// Check that the message was intended for this mailbox.
@ -391,11 +390,9 @@ contract Mailbox is IMailbox, Indexed, Versioned, OwnableUpgradeable {
* @param _recipient The message recipient whose ISM should be returned.
* @return The ISM to use for `_recipient`.
*/
function recipientIsm(address _recipient)
public
view
returns (IInterchainSecurityModule)
{
function recipientIsm(
address _recipient
) public view returns (IInterchainSecurityModule) {
// use low-level staticcall in case of revert or empty return data
(bool success, bytes memory returnData) = _recipient.staticcall(
abi.encodeCall(

@ -19,10 +19,9 @@ abstract contract GasRouter is Router {
* @notice Sets the gas amount dispatched for each configured domain.
* @param gasConfigs The array of GasRouterConfig structs
*/
function setDestinationGas(GasRouterConfig[] calldata gasConfigs)
external
onlyOwner
{
function setDestinationGas(
GasRouterConfig[] calldata gasConfigs
) external onlyOwner {
for (uint256 i = 0; i < gasConfigs.length; i += 1) {
_setDestinationGas(gasConfigs[i].domain, gasConfigs[i].gas);
}
@ -42,11 +41,9 @@ abstract contract GasRouter is Router {
* @param _destinationDomain The domain of the router.
* @return _gasPayment Payment computed by the registered InterchainGasPaymaster.
*/
function quoteGasPayment(uint32 _destinationDomain)
external
view
returns (uint256 _gasPayment)
{
function quoteGasPayment(
uint32 _destinationDomain
) external view returns (uint256 _gasPayment) {
return _quoteDispatch(_destinationDomain, "");
}
@ -54,13 +51,9 @@ abstract contract GasRouter is Router {
return msg.sender;
}
function _metadata(uint32 _destination)
internal
view
virtual
override
returns (bytes memory)
{
function _metadata(
uint32 _destination
) internal view virtual override returns (bytes memory) {
return
StandardHookMetadata.formatMetadata(
destinationGas[_destination],

@ -68,11 +68,9 @@ abstract contract MailboxClient is OwnableUpgradeable {
* @notice Sets the address of the application's custom interchain security module.
* @param _module The address of the interchain security module contract.
*/
function setInterchainSecurityModule(address _module)
public
onlyContractOrNull(_module)
onlyOwner
{
function setInterchainSecurityModule(
address _module
) public onlyContractOrNull(_module) onlyOwner {
interchainSecurityModule = IInterchainSecurityModule(_module);
}

@ -52,11 +52,10 @@ abstract contract Router is MailboxClient, IMessageRecipient {
* @param _domain The domain of the remote Application Router
* @param _router The address of the remote Application Router
*/
function enrollRemoteRouter(uint32 _domain, bytes32 _router)
external
virtual
onlyOwner
{
function enrollRemoteRouter(
uint32 _domain,
bytes32 _router
) external virtual onlyOwner {
_enrollRemoteRouter(_domain, _router);
}
@ -80,11 +79,9 @@ abstract contract Router is MailboxClient, IMessageRecipient {
* @notice Batch version of `unenrollRemoteRouter`
* @param _domains The domains of the remote Application Routers
*/
function unenrollRemoteRouters(uint32[] calldata _domains)
external
virtual
onlyOwner
{
function unenrollRemoteRouters(
uint32[] calldata _domains
) external virtual onlyOwner {
uint256 length = _domains.length;
for (uint256 i = 0; i < length; i += 1) {
_unenrollRemoteRouter(_domains[i]);
@ -121,10 +118,10 @@ abstract contract Router is MailboxClient, IMessageRecipient {
* @param _domain The domain
* @param _address The new router
*/
function _enrollRemoteRouter(uint32 _domain, bytes32 _address)
internal
virtual
{
function _enrollRemoteRouter(
uint32 _domain,
bytes32 _address
) internal virtual {
_routers.set(_domain, _address);
}
@ -141,11 +138,10 @@ abstract contract Router is MailboxClient, IMessageRecipient {
* @param _domain The domain of the potential remote Application Router
* @param _address The address of the potential remote Application Router
*/
function _isRemoteRouter(uint32 _domain, bytes32 _address)
internal
view
returns (bool)
{
function _isRemoteRouter(
uint32 _domain,
bytes32 _address
) internal view returns (bool) {
return routers(_domain) == _address;
}
@ -154,21 +150,17 @@ abstract contract Router is MailboxClient, IMessageRecipient {
* @param _domain The domain of the chain for which to get the Application Router
* @return _router The address of the remote Application Router on _domain
*/
function _mustHaveRemoteRouter(uint32 _domain)
internal
view
returns (bytes32)
{
function _mustHaveRemoteRouter(
uint32 _domain
) internal view returns (bytes32) {
(bool contained, bytes32 _router) = _routers.tryGet(_domain);
require(contained, _domainNotFoundError(_domain));
return _router;
}
function _domainNotFoundError(uint32 _domain)
internal
pure
returns (string memory)
{
function _domainNotFoundError(
uint32 _domain
) internal pure returns (string memory) {
return
string.concat(
"No router enrolled for domain: ",
@ -176,11 +168,10 @@ abstract contract Router is MailboxClient, IMessageRecipient {
);
}
function _dispatch(uint32 _destinationDomain, bytes memory _messageBody)
internal
virtual
returns (bytes32)
{
function _dispatch(
uint32 _destinationDomain,
bytes memory _messageBody
) internal virtual returns (bytes32) {
return _dispatch(_destinationDomain, msg.value, _messageBody);
}

@ -59,22 +59,20 @@ contract OPStackHook is AbstractMessageIdAuthHook {
}
// ============ Internal functions ============
function _quoteDispatch(bytes calldata, bytes calldata)
internal
pure
override
returns (uint256)
{
function _quoteDispatch(
bytes calldata,
bytes calldata
) internal pure override returns (uint256) {
return 0; // gas subsidized by the L2
}
/// @inheritdoc AbstractMessageIdAuthHook
function _sendMessageId(bytes calldata metadata, bytes memory payload)
internal
override
{
function _sendMessageId(
bytes calldata metadata,
bytes memory payload
) internal override {
require(
metadata.msgValue(0) < 2**255,
metadata.msgValue(0) < 2 ** 255,
"OPStackHook: msgValue must be less than 2 ** 255"
);
l1Messenger.sendMessage{value: metadata.msgValue(0)}(

@ -43,19 +43,16 @@ contract PausableHook is AbstractPostDispatchHook, Ownable, Pausable {
// ============ Internal functions ============
/// @inheritdoc AbstractPostDispatchHook
function _postDispatch(bytes calldata metadata, bytes calldata message)
internal
override
whenNotPaused
{}
function _postDispatch(
bytes calldata metadata,
bytes calldata message
) internal override whenNotPaused {}
/// @inheritdoc AbstractPostDispatchHook
function _quoteDispatch(bytes calldata, bytes calldata)
internal
pure
override
returns (uint256)
{
function _quoteDispatch(
bytes calldata,
bytes calldata
) internal pure override returns (uint256) {
return 0;
}
}

@ -91,10 +91,10 @@ contract StaticProtocolFee is AbstractPostDispatchHook, Ownable {
// ============ Internal Functions ============
/// @inheritdoc AbstractPostDispatchHook
function _postDispatch(bytes calldata metadata, bytes calldata message)
internal
override
{
function _postDispatch(
bytes calldata metadata,
bytes calldata message
) internal override {
require(
msg.value >= protocolFee,
"StaticProtocolFee: insufficient protocol fee"
@ -109,12 +109,10 @@ contract StaticProtocolFee is AbstractPostDispatchHook, Ownable {
}
/// @inheritdoc AbstractPostDispatchHook
function _quoteDispatch(bytes calldata, bytes calldata)
internal
view
override
returns (uint256)
{
function _quoteDispatch(
bytes calldata,
bytes calldata
) internal view override returns (uint256) {
return protocolFee;
}

@ -45,12 +45,10 @@ contract ERC5164Hook is AbstractMessageIdAuthHook {
// ============ Internal Functions ============
function _quoteDispatch(bytes calldata, bytes calldata)
internal
pure
override
returns (uint256)
{
function _quoteDispatch(
bytes calldata,
bytes calldata
) internal pure override returns (uint256) {
return 0; // EIP-5164 doesn't enforce a gas abstraction
}

@ -29,10 +29,10 @@ contract StaticAggregationHook is AbstractPostDispatchHook {
}
/// @inheritdoc AbstractPostDispatchHook
function _postDispatch(bytes calldata metadata, bytes calldata message)
internal
override
{
function _postDispatch(
bytes calldata metadata,
bytes calldata message
) internal override {
address[] memory _hooks = hooks(message);
uint256 count = _hooks.length;
for (uint256 i = 0; i < count; i++) {
@ -49,12 +49,10 @@ contract StaticAggregationHook is AbstractPostDispatchHook {
}
/// @inheritdoc AbstractPostDispatchHook
function _quoteDispatch(bytes calldata metadata, bytes calldata message)
internal
view
override
returns (uint256)
{
function _quoteDispatch(
bytes calldata metadata,
bytes calldata message
) internal view override returns (uint256) {
address[] memory _hooks = hooks(message);
uint256 count = _hooks.length;
uint256 total = 0;

@ -101,10 +101,10 @@ contract InterchainGasPaymaster is
* @param _owner The owner of the contract.
* @param _beneficiary The beneficiary.
*/
function initialize(address _owner, address _beneficiary)
public
initializer
{
function initialize(
address _owner,
address _beneficiary
) public initializer {
__Ownable_init();
_transferOwnership(_owner);
_setBeneficiary(_beneficiary);
@ -124,10 +124,9 @@ contract InterchainGasPaymaster is
* @notice Sets the gas oracles for remote domains specified in the config array.
* @param _configs An array of configs including the remote domain and gas oracles to set.
*/
function setDestinationGasConfigs(GasParam[] calldata _configs)
external
onlyOwner
{
function setDestinationGasConfigs(
GasParam[] calldata _configs
) external onlyOwner {
uint256 _len = _configs.length;
for (uint256 i = 0; i < _len; i++) {
_setDestinationGasConfig(
@ -192,13 +191,10 @@ contract InterchainGasPaymaster is
* @param _gasLimit The amount of destination gas to pay for.
* @return The amount of native tokens required to pay for interchain gas.
*/
function quoteGasPayment(uint32 _destinationDomain, uint256 _gasLimit)
public
view
virtual
override
returns (uint256)
{
function quoteGasPayment(
uint32 _destinationDomain,
uint256 _gasLimit
) public view virtual override returns (uint256) {
// Get the gas data for the destination domain.
(
uint128 _tokenExchangeRate,
@ -221,7 +217,9 @@ contract InterchainGasPaymaster is
* @return tokenExchangeRate The exchange rate of the remote native token quoted in the local native token.
* @return gasPrice The gas price on the remote chain.
*/
function getExchangeRateAndGasPrice(uint32 _destinationDomain)
function getExchangeRateAndGasPrice(
uint32 _destinationDomain
)
public
view
override
@ -250,11 +248,10 @@ contract InterchainGasPaymaster is
* @param _gasLimit The amount of destination gas to pay for. This is only for application gas usage as
* the gas usage for the mailbox and the ISM is already accounted in the DomainGasConfig.gasOverhead
*/
function destinationGasLimit(uint32 _destinationDomain, uint256 _gasLimit)
public
view
returns (uint256)
{
function destinationGasLimit(
uint32 _destinationDomain,
uint256 _gasLimit
) public view returns (uint256) {
return
uint256(destinationGasConfigs[_destinationDomain].gasOverhead) +
_gasLimit;
@ -263,10 +260,10 @@ contract InterchainGasPaymaster is
// ============ Internal Functions ============
/// @inheritdoc AbstractPostDispatchHook
function _postDispatch(bytes calldata metadata, bytes calldata message)
internal
override
{
function _postDispatch(
bytes calldata metadata,
bytes calldata message
) internal override {
payForGas(
message.id(),
message.destination(),
@ -279,12 +276,10 @@ contract InterchainGasPaymaster is
}
/// @inheritdoc AbstractPostDispatchHook
function _quoteDispatch(bytes calldata metadata, bytes calldata message)
internal
view
override
returns (uint256)
{
function _quoteDispatch(
bytes calldata metadata,
bytes calldata message
) internal view override returns (uint256) {
return
quoteGasPayment(
message.destination(),

@ -46,7 +46,9 @@ contract StorageGasOracle is IGasOracle, Ownable {
* @return tokenExchangeRate The exchange rate of the remote native token quoted in the local native token.
* @return gasPrice The gas price on the remote chain.
*/
function getExchangeRateAndGasPrice(uint32 _destinationDomain)
function getExchangeRateAndGasPrice(
uint32 _destinationDomain
)
external
view
override
@ -63,10 +65,9 @@ contract StorageGasOracle is IGasOracle, Ownable {
* @notice Sets the remote gas data for many remotes at a time.
* @param _configs The configs to use when setting the remote gas data.
*/
function setRemoteGasDataConfigs(RemoteGasDataConfig[] calldata _configs)
external
onlyOwner
{
function setRemoteGasDataConfigs(
RemoteGasDataConfig[] calldata _configs
) external onlyOwner {
uint256 _len = _configs.length;
for (uint256 i = 0; i < _len; i++) {
_setRemoteGasData(_configs[i]);
@ -77,10 +78,9 @@ contract StorageGasOracle is IGasOracle, Ownable {
* @notice Sets the remote gas data using the values in `_config`.
* @param _config The config to use when setting the remote gas data.
*/
function setRemoteGasData(RemoteGasDataConfig calldata _config)
external
onlyOwner
{
function setRemoteGasData(
RemoteGasDataConfig calldata _config
) external onlyOwner {
_setRemoteGasData(_config);
}

@ -65,10 +65,10 @@ abstract contract AbstractMessageIdAuthHook is
// ============ Internal functions ============
/// @inheritdoc AbstractPostDispatchHook
function _postDispatch(bytes calldata metadata, bytes calldata message)
internal
override
{
function _postDispatch(
bytes calldata metadata,
bytes calldata message
) internal override {
bytes32 id = message.id();
require(
_isLatestDispatched(id),
@ -90,7 +90,8 @@ abstract contract AbstractMessageIdAuthHook is
* @param metadata The metadata for the hook caller
* @param payload The payload for call to the ISM
*/
function _sendMessageId(bytes calldata metadata, bytes memory payload)
internal
virtual;
function _sendMessageId(
bytes calldata metadata,
bytes memory payload
) internal virtual;
}

@ -27,24 +27,19 @@ abstract contract AbstractPostDispatchHook is IPostDispatchHook {
// ============ External functions ============
/// @inheritdoc IPostDispatchHook
function supportsMetadata(bytes calldata metadata)
public
pure
virtual
override
returns (bool)
{
function supportsMetadata(
bytes calldata metadata
) public pure virtual override returns (bool) {
return
metadata.length == 0 ||
metadata.variant() == StandardHookMetadata.VARIANT;
}
/// @inheritdoc IPostDispatchHook
function postDispatch(bytes calldata metadata, bytes calldata message)
external
payable
override
{
function postDispatch(
bytes calldata metadata,
bytes calldata message
) external payable override {
require(
supportsMetadata(metadata),
"AbstractPostDispatchHook: invalid metadata variant"
@ -53,12 +48,10 @@ abstract contract AbstractPostDispatchHook is IPostDispatchHook {
}
/// @inheritdoc IPostDispatchHook
function quoteDispatch(bytes calldata metadata, bytes calldata message)
public
view
override
returns (uint256)
{
function quoteDispatch(
bytes calldata metadata,
bytes calldata message
) public view override returns (uint256) {
require(
supportsMetadata(metadata),
"AbstractPostDispatchHook: invalid metadata variant"
@ -73,9 +66,10 @@ abstract contract AbstractPostDispatchHook is IPostDispatchHook {
* @param metadata The metadata of the message being dispatched.
* @param message The message being dispatched.
*/
function _postDispatch(bytes calldata metadata, bytes calldata message)
internal
virtual;
function _postDispatch(
bytes calldata metadata,
bytes calldata message
) internal virtual;
/**
* @notice Quote dispatch hook implementation.
@ -83,9 +77,8 @@ abstract contract AbstractPostDispatchHook is IPostDispatchHook {
* @param message The message being dispatched.
* @return The quote for the dispatch.
*/
function _quoteDispatch(bytes calldata metadata, bytes calldata message)
internal
view
virtual
returns (uint256);
function _quoteDispatch(
bytes calldata metadata,
bytes calldata message
) internal view virtual returns (uint256);
}

@ -47,11 +47,10 @@ library StandardHookMetadata {
* @param _default Default fallback value.
* @return Value for the message as uint256.
*/
function msgValue(bytes calldata _metadata, uint256 _default)
internal
pure
returns (uint256)
{
function msgValue(
bytes calldata _metadata,
uint256 _default
) internal pure returns (uint256) {
if (_metadata.length < MSG_VALUE_OFFSET + 32) return _default;
return
uint256(bytes32(_metadata[MSG_VALUE_OFFSET:MSG_VALUE_OFFSET + 32]));
@ -63,11 +62,10 @@ library StandardHookMetadata {
* @param _default Default fallback gas limit.
* @return Gas limit for the message as uint256.
*/
function gasLimit(bytes calldata _metadata, uint256 _default)
internal
pure
returns (uint256)
{
function gasLimit(
bytes calldata _metadata,
uint256 _default
) internal pure returns (uint256) {
if (_metadata.length < GAS_LIMIT_OFFSET + 32) return _default;
return
uint256(bytes32(_metadata[GAS_LIMIT_OFFSET:GAS_LIMIT_OFFSET + 32]));
@ -79,11 +77,10 @@ library StandardHookMetadata {
* @param _default Default fallback refund address.
* @return Refund address for the message as address.
*/
function refundAddress(bytes calldata _metadata, address _default)
internal
pure
returns (address)
{
function refundAddress(
bytes calldata _metadata,
address _default
) internal pure returns (address) {
if (_metadata.length < REFUND_ADDRESS_OFFSET + 20) return _default;
return
address(
@ -98,11 +95,9 @@ library StandardHookMetadata {
* @param _metadata ABI encoded global hook metadata.
* @return Refund address for the message as address.
*/
function getCustomMetadata(bytes calldata _metadata)
internal
pure
returns (bytes calldata)
{
function getCustomMetadata(
bytes calldata _metadata
) internal pure returns (bytes calldata) {
if (_metadata.length < MIN_METADATA_LENGTH) return _metadata[0:0];
return _metadata[MIN_METADATA_LENGTH:];
}
@ -136,11 +131,9 @@ library StandardHookMetadata {
* @param _msgValue msg.value for the message.
* @return ABI encoded global hook metadata.
*/
function formatMetadata(uint256 _msgValue)
internal
view
returns (bytes memory)
{
function formatMetadata(
uint256 _msgValue
) internal view returns (bytes memory) {
return formatMetadata(_msgValue, uint256(0), msg.sender, "");
}
@ -150,11 +143,10 @@ library StandardHookMetadata {
* @param _refundAddress Refund address for the message.
* @return ABI encoded global hook metadata.
*/
function formatMetadata(uint256 _gasLimit, address _refundAddress)
internal
pure
returns (bytes memory)
{
function formatMetadata(
uint256 _gasLimit,
address _refundAddress
) internal pure returns (bytes memory) {
return formatMetadata(uint256(0), _gasLimit, _refundAddress, "");
}
}

@ -23,14 +23,15 @@ contract DestinationRecipientRoutingHook is DomainRoutingHook {
/// @notice destination => recipient =>custom hook
mapping(uint32 => mapping(bytes32 => address)) public customHooks;
constructor(address mailbox, address owner)
DomainRoutingHook(mailbox, owner)
{}
constructor(
address mailbox,
address owner
) DomainRoutingHook(mailbox, owner) {}
function _postDispatch(bytes calldata metadata, bytes calldata message)
internal
override
{
function _postDispatch(
bytes calldata metadata,
bytes calldata message
) internal override {
address customHookPreset = customHooks[message.destination()][
message.recipient()
];

@ -59,13 +59,9 @@ contract DomainRoutingHook is AbstractPostDispatchHook, MailboxClient {
}
}
function supportsMetadata(bytes calldata)
public
pure
virtual
override
returns (bool)
{
function supportsMetadata(
bytes calldata
) public pure virtual override returns (bool) {
// routing hook does not care about metadata shape
return true;
}
@ -73,11 +69,10 @@ contract DomainRoutingHook is AbstractPostDispatchHook, MailboxClient {
// ============ Internal Functions ============
/// @inheritdoc AbstractPostDispatchHook
function _postDispatch(bytes calldata metadata, bytes calldata message)
internal
virtual
override
{
function _postDispatch(
bytes calldata metadata,
bytes calldata message
) internal virtual override {
_getConfiguredHook(message).postDispatch{value: msg.value}(
metadata,
message
@ -85,22 +80,16 @@ contract DomainRoutingHook is AbstractPostDispatchHook, MailboxClient {
}
/// @inheritdoc AbstractPostDispatchHook
function _quoteDispatch(bytes calldata metadata, bytes calldata message)
internal
view
virtual
override
returns (uint256)
{
function _quoteDispatch(
bytes calldata metadata,
bytes calldata message
) internal view virtual override returns (uint256) {
return _getConfiguredHook(message).quoteDispatch(metadata, message);
}
function _getConfiguredHook(bytes calldata message)
internal
view
virtual
returns (IPostDispatchHook hook)
{
function _getConfiguredHook(
bytes calldata message
) internal view virtual returns (IPostDispatchHook hook) {
hook = hooks[message.destination()];
require(
address(hook) != address(0),

@ -45,12 +45,9 @@ contract FallbackDomainRoutingHook is DomainRoutingHook {
// ============ Internal Functions ============
function _getConfiguredHook(bytes calldata message)
internal
view
override
returns (IPostDispatchHook)
{
function _getConfiguredHook(
bytes calldata message
) internal view override returns (IPostDispatchHook) {
IPostDispatchHook _hook = hooks[message.destination()];
if (address(_hook) == address(0)) {
_hook = fallbackHook;

@ -9,8 +9,7 @@ interface IGasOracle {
uint128 gasPrice;
}
function getExchangeRateAndGasPrice(uint32 _destinationDomain)
external
view
returns (uint128 tokenExchangeRate, uint128 gasPrice);
function getExchangeRateAndGasPrice(
uint32 _destinationDomain
) external view returns (uint128 tokenExchangeRate, uint128 gasPrice);
}

@ -28,8 +28,8 @@ interface IInterchainGasPaymaster {
address _refundAddress
) external payable;
function quoteGasPayment(uint32 _destinationDomain, uint256 _gasAmount)
external
view
returns (uint256);
function quoteGasPayment(
uint32 _destinationDomain,
uint256 _gasAmount
) external view returns (uint256);
}

@ -28,9 +28,10 @@ interface IInterchainSecurityModule {
* @param _message Hyperlane encoded interchain message
* @return True if the message was verified
*/
function verify(bytes calldata _metadata, bytes calldata _message)
external
returns (bool);
function verify(
bytes calldata _metadata,
bytes calldata _message
) external returns (bool);
}
interface ISpecifiesInterchainSecurityModule {

@ -96,12 +96,12 @@ interface IMailbox {
IPostDispatchHook customHook
) external view returns (uint256 fee);
function process(bytes calldata metadata, bytes calldata message)
external
payable;
function recipientIsm(address recipient)
external
view
returns (IInterchainSecurityModule module);
function process(
bytes calldata metadata,
bytes calldata message
) external payable;
function recipientIsm(
address recipient
) external view returns (IInterchainSecurityModule module);
}

@ -10,10 +10,9 @@ interface IValidatorAnnounce {
* @param _validators The list of validators to get storage locations for
* @return A list of announced storage locations
*/
function getAnnouncedStorageLocations(address[] calldata _validators)
external
view
returns (string[][] memory);
function getAnnouncedStorageLocations(
address[] calldata _validators
) external view returns (string[][] memory);
/**
* @notice Announces a validator signature storage location

@ -36,19 +36,19 @@ interface IPostDispatchHook {
* @param metadata metadata
* @return Whether the hook supports metadata
*/
function supportsMetadata(bytes calldata metadata)
external
view
returns (bool);
function supportsMetadata(
bytes calldata metadata
) external view returns (bool);
/**
* @notice Post action after a message is dispatched via the Mailbox
* @param metadata The metadata required for the hook
* @param message The message passed from the Mailbox.dispatch() call
*/
function postDispatch(bytes calldata metadata, bytes calldata message)
external
payable;
function postDispatch(
bytes calldata metadata,
bytes calldata message
) external payable;
/**
* @notice Compute the payment required by the postDispatch call
@ -56,8 +56,8 @@ interface IPostDispatchHook {
* @param message The message passed from the Mailbox.dispatch() call
* @return Quoted payment for the postDispatch call
*/
function quoteDispatch(bytes calldata metadata, bytes calldata message)
external
view
returns (uint256);
function quoteDispatch(
bytes calldata metadata,
bytes calldata message
) external view returns (uint256);
}

@ -12,8 +12,7 @@ interface IAggregationIsm is IInterchainSecurityModule {
* @return modules The array of ISM addresses
* @return threshold The number of modules needed to verify
*/
function modulesAndThreshold(bytes calldata _message)
external
view
returns (address[] memory modules, uint8 threshold);
function modulesAndThreshold(
bytes calldata _message
) external view returns (address[] memory modules, uint8 threshold);
}

@ -12,8 +12,7 @@ interface IMultisigIsm is IInterchainSecurityModule {
* @return validators The array of validator addresses
* @return threshold The number of validator signatures needed
*/
function validatorsAndThreshold(bytes calldata _message)
external
view
returns (address[] memory validators, uint8 threshold);
function validatorsAndThreshold(
bytes calldata _message
) external view returns (address[] memory validators, uint8 threshold);
}

@ -10,8 +10,7 @@ interface IRoutingIsm is IInterchainSecurityModule {
* @param _message Formatted Hyperlane message (see Message.sol).
* @return module The ISM to use to verify _message
*/
function route(bytes calldata _message)
external
view
returns (IInterchainSecurityModule);
function route(
bytes calldata _message
) external view returns (IInterchainSecurityModule);
}

@ -6,12 +6,10 @@ import {IInterchainSecurityModule} from "../interfaces/IInterchainSecurityModule
contract NoopIsm is IInterchainSecurityModule {
uint8 public constant override moduleType = uint8(Types.NULL);
function verify(bytes calldata, bytes calldata)
public
pure
override
returns (bool)
{
function verify(
bytes calldata,
bytes calldata
) public pure override returns (bool) {
return true;
}
}

@ -15,12 +15,10 @@ contract PausableIsm is IInterchainSecurityModule, Ownable, Pausable {
* @inheritdoc IInterchainSecurityModule
* @dev Reverts when paused, otherwise returns `true`.
*/
function verify(bytes calldata, bytes calldata)
external
view
whenNotPaused
returns (bool)
{
function verify(
bytes calldata,
bytes calldata
) external view whenNotPaused returns (bool) {
return true;
}

@ -32,11 +32,9 @@ abstract contract AbstractAggregationIsm is IAggregationIsm {
* @return modules The array of ISM addresses
* @return threshold The number of ISMs needed to verify
*/
function modulesAndThreshold(bytes calldata _message)
public
view
virtual
returns (address[] memory, uint8);
function modulesAndThreshold(
bytes calldata _message
) public view virtual returns (address[] memory, uint8);
// ============ Public Functions ============
@ -45,10 +43,10 @@ abstract contract AbstractAggregationIsm is IAggregationIsm {
* @param _metadata ABI encoded module metadata (see AggregationIsmMetadata.sol)
* @param _message Formatted Hyperlane message (see Message.sol).
*/
function verify(bytes calldata _metadata, bytes calldata _message)
public
returns (bool)
{
function verify(
bytes calldata _metadata,
bytes calldata _message
) public returns (bool) {
(address[] memory _isms, uint8 _threshold) = modulesAndThreshold(
_message
);

@ -21,13 +21,9 @@ contract StaticAggregationIsm is AbstractAggregationIsm {
* @return modules The array of ISM addresses
* @return threshold The number of ISMs needed to verify
*/
function modulesAndThreshold(bytes calldata)
public
view
virtual
override
returns (address[] memory, uint8)
{
function modulesAndThreshold(
bytes calldata
) public view virtual override returns (address[] memory, uint8) {
return abi.decode(MetaProxy.metadata(), (address[], uint8));
}
}

@ -105,7 +105,7 @@ abstract contract AbstractMessageIdAuthorizedIsm is
"AbstractMessageIdAuthorizedIsm: sender is not the hook"
);
require(
msg.value < 2**VERIFIED_MASK_INDEX,
msg.value < 2 ** VERIFIED_MASK_INDEX,
"AbstractMessageIdAuthorizedIsm: msg.value must be less than 2^255"
);

@ -19,11 +19,10 @@ library AggregationIsmMetadata {
* @param _index The index of the ISM to check for metadata for
* @return Whether or not metadata was provided for the ISM at `_index`
*/
function hasMetadata(bytes calldata _metadata, uint8 _index)
internal
pure
returns (bool)
{
function hasMetadata(
bytes calldata _metadata,
uint8 _index
) internal pure returns (bool) {
(uint32 _start, ) = _metadataRange(_metadata, _index);
return _start > 0;
}
@ -37,11 +36,10 @@ library AggregationIsmMetadata {
* @param _index The index of the ISM to return metadata for
* @return The metadata provided for the ISM at `_index`
*/
function metadataAt(bytes calldata _metadata, uint8 _index)
internal
pure
returns (bytes calldata)
{
function metadataAt(
bytes calldata _metadata,
uint8 _index
) internal pure returns (bytes calldata) {
(uint32 _start, uint32 _end) = _metadataRange(_metadata, _index);
return _metadata[_start:_end];
}
@ -56,11 +54,10 @@ library AggregationIsmMetadata {
* @return The range of the metadata provided for the ISM at `_index`, or
* zeroes if not provided
*/
function _metadataRange(bytes calldata _metadata, uint8 _index)
private
pure
returns (uint32, uint32)
{
function _metadataRange(
bytes calldata _metadata,
uint8 _index
) private pure returns (uint32, uint32) {
uint256 _start = (uint32(_index) * RANGE_SIZE * 2);
uint256 _mid = _start + RANGE_SIZE;
uint256 _end = _mid + RANGE_SIZE;

@ -25,11 +25,9 @@ library MerkleRootMultisigIsmMetadata {
* @param _metadata ABI encoded Multisig ISM metadata.
* @return Origin merkle tree hook of the signed checkpoint as bytes32
*/
function originMerkleTreeHook(bytes calldata _metadata)
internal
pure
returns (bytes32)
{
function originMerkleTreeHook(
bytes calldata _metadata
) internal pure returns (bytes32) {
return
bytes32(
_metadata[ORIGIN_MERKLE_TREE_OFFSET:ORIGIN_MERKLE_TREE_OFFSET +
@ -42,11 +40,9 @@ library MerkleRootMultisigIsmMetadata {
* @param _metadata ABI encoded Multisig ISM metadata.
* @return Index of the target message in the merkle tree.
*/
function messageIndex(bytes calldata _metadata)
internal
pure
returns (uint32)
{
function messageIndex(
bytes calldata _metadata
) internal pure returns (uint32) {
return
uint32(
bytes4(_metadata[MESSAGE_INDEX_OFFSET:MESSAGE_INDEX_OFFSET + 4])
@ -58,11 +54,9 @@ library MerkleRootMultisigIsmMetadata {
* @param _metadata ABI encoded Multisig ISM metadata.
* @return Index of the signed checkpoint
*/
function signedIndex(bytes calldata _metadata)
internal
pure
returns (uint32)
{
function signedIndex(
bytes calldata _metadata
) internal pure returns (uint32) {
return
uint32(
bytes4(_metadata[SIGNED_INDEX_OFFSET:SIGNED_INDEX_OFFSET + 4])
@ -74,11 +68,9 @@ library MerkleRootMultisigIsmMetadata {
* @param _metadata ABI encoded Multisig ISM metadata.
* @return Message ID of the signed checkpoint
*/
function signedMessageId(bytes calldata _metadata)
internal
pure
returns (bytes32)
{
function signedMessageId(
bytes calldata _metadata
) internal pure returns (bytes32) {
return bytes32(_metadata[MESSAGE_ID_OFFSET:MESSAGE_ID_OFFSET + 32]);
}
@ -89,11 +81,9 @@ library MerkleRootMultisigIsmMetadata {
* @param _metadata ABI encoded Multisig ISM metadata.
* @return Merkle proof branch of the message.
*/
function proof(bytes calldata _metadata)
internal
pure
returns (bytes32[32] memory)
{
function proof(
bytes calldata _metadata
) internal pure returns (bytes32[32] memory) {
return
abi.decode(
_metadata[MERKLE_PROOF_OFFSET:MERKLE_PROOF_OFFSET +
@ -111,11 +101,10 @@ library MerkleRootMultisigIsmMetadata {
* @param _index The index of the signature to return.
* @return The validator ECDSA signature at `_index`.
*/
function signatureAt(bytes calldata _metadata, uint256 _index)
internal
pure
returns (bytes calldata)
{
function signatureAt(
bytes calldata _metadata,
uint256 _index
) internal pure returns (bytes calldata) {
uint256 _start = SIGNATURES_OFFSET + (_index * SIGNATURE_LENGTH);
uint256 _end = _start + SIGNATURE_LENGTH;
return _metadata[_start:_end];

@ -20,11 +20,9 @@ library MessageIdMultisigIsmMetadata {
* @param _metadata ABI encoded Multisig ISM metadata.
* @return Origin merkle tree hook of the signed checkpoint as bytes32
*/
function originMerkleTreeHook(bytes calldata _metadata)
internal
pure
returns (bytes32)
{
function originMerkleTreeHook(
bytes calldata _metadata
) internal pure returns (bytes32) {
return
bytes32(
_metadata[ORIGIN_MERKLE_TREE_OFFSET:ORIGIN_MERKLE_TREE_OFFSET +
@ -62,11 +60,10 @@ library MessageIdMultisigIsmMetadata {
* @param _index The index of the signature to return.
* @return The validator ECDSA signature at `_index`.
*/
function signatureAt(bytes calldata _metadata, uint256 _index)
internal
pure
returns (bytes calldata)
{
function signatureAt(
bytes calldata _metadata,
uint256 _index
) internal pure returns (bytes calldata) {
uint256 _start = SIGNATURES_OFFSET + (_index * SIGNATURE_LENGTH);
uint256 _end = _start + SIGNATURE_LENGTH;
return _metadata[_start:_end];

@ -35,12 +35,10 @@ abstract contract AbstractMerkleRootMultisigIsm is AbstractMultisigIsm {
/**
* @inheritdoc AbstractMultisigIsm
*/
function digest(bytes calldata _metadata, bytes calldata _message)
internal
pure
override
returns (bytes32)
{
function digest(
bytes calldata _metadata,
bytes calldata _message
) internal pure override returns (bytes32) {
require(
_metadata.messageIndex() <= _metadata.signedIndex(),
"Invalid merkle index metadata"
@ -65,13 +63,10 @@ abstract contract AbstractMerkleRootMultisigIsm is AbstractMultisigIsm {
/**
* @inheritdoc AbstractMultisigIsm
*/
function signatureAt(bytes calldata _metadata, uint256 _index)
internal
pure
virtual
override
returns (bytes calldata)
{
function signatureAt(
bytes calldata _metadata,
uint256 _index
) internal pure virtual override returns (bytes calldata) {
return _metadata.signatureAt(_index);
}
}

@ -31,12 +31,10 @@ abstract contract AbstractMessageIdMultisigIsm is AbstractMultisigIsm {
/**
* @inheritdoc AbstractMultisigIsm
*/
function digest(bytes calldata _metadata, bytes calldata _message)
internal
pure
override
returns (bytes32)
{
function digest(
bytes calldata _metadata,
bytes calldata _message
) internal pure override returns (bytes32) {
return
CheckpointLib.digest(
_message.origin(),
@ -50,13 +48,10 @@ abstract contract AbstractMessageIdMultisigIsm is AbstractMultisigIsm {
/**
* @inheritdoc AbstractMultisigIsm
*/
function signatureAt(bytes calldata _metadata, uint256 _index)
internal
pure
virtual
override
returns (bytes calldata)
{
function signatureAt(
bytes calldata _metadata,
uint256 _index
) internal pure virtual override returns (bytes calldata) {
return _metadata.signatureAt(_index);
}
}

@ -30,11 +30,9 @@ abstract contract AbstractMultisigIsm is IMultisigIsm {
* @return validators The array of validator addresses
* @return threshold The number of validator signatures needed
*/
function validatorsAndThreshold(bytes calldata _message)
public
view
virtual
returns (address[] memory, uint8);
function validatorsAndThreshold(
bytes calldata _message
) public view virtual returns (address[] memory, uint8);
/**
* @notice Returns the digest to be used for signature verification.
@ -42,11 +40,10 @@ abstract contract AbstractMultisigIsm is IMultisigIsm {
* @param _message Formatted Hyperlane message (see Message.sol).
* @return digest The digest to be signed by validators
*/
function digest(bytes calldata _metadata, bytes calldata _message)
internal
view
virtual
returns (bytes32);
function digest(
bytes calldata _metadata,
bytes calldata _message
) internal view virtual returns (bytes32);
/**
* @notice Returns the signature at a given index from the metadata.
@ -54,11 +51,10 @@ abstract contract AbstractMultisigIsm is IMultisigIsm {
* @param _index The index of the signature to return
* @return signature Packed encoding of signature (65 bytes)
*/
function signatureAt(bytes calldata _metadata, uint256 _index)
internal
pure
virtual
returns (bytes calldata);
function signatureAt(
bytes calldata _metadata,
uint256 _index
) internal pure virtual returns (bytes calldata);
// ============ Public Functions ============
@ -68,11 +64,10 @@ abstract contract AbstractMultisigIsm is IMultisigIsm {
* @param _metadata ABI encoded module metadata
* @param _message Formatted Hyperlane message (see Message.sol).
*/
function verify(bytes calldata _metadata, bytes calldata _message)
public
view
returns (bool)
{
function verify(
bytes calldata _metadata,
bytes calldata _message
) public view returns (bool) {
bytes32 _digest = digest(_metadata, _message);
(
address[] memory _validators,

@ -16,12 +16,9 @@ abstract contract AbstractMetaProxyMultisigIsm is AbstractMultisigIsm {
/**
* @inheritdoc AbstractMultisigIsm
*/
function validatorsAndThreshold(bytes calldata)
public
pure
override
returns (address[] memory, uint8)
{
function validatorsAndThreshold(
bytes calldata
) public pure override returns (address[] memory, uint8) {
return abi.decode(MetaProxy.metadata(), (address[], uint8));
}
}
@ -37,9 +34,7 @@ abstract contract AbstractMetaProxyMultisigIsm is AbstractMultisigIsm {
contract StaticMerkleRootMultisigIsm is
AbstractMerkleRootMultisigIsm,
AbstractMetaProxyMultisigIsm
{
}
{}
/**
* @title StaticMessageIdMultisigIsm
@ -49,9 +44,7 @@ contract StaticMerkleRootMultisigIsm is
contract StaticMessageIdMultisigIsm is
AbstractMessageIdMultisigIsm,
AbstractMetaProxyMultisigIsm
{
}
{}
// solhint-enable no-empty-blocks

@ -88,11 +88,9 @@ contract ValidatorAnnounce is MailboxClient, IValidatorAnnounce {
* @param _validators The list of validators to get registrations for
* @return A list of registered storage metadata
*/
function getAnnouncedStorageLocations(address[] calldata _validators)
external
view
returns (string[][] memory)
{
function getAnnouncedStorageLocations(
address[] calldata _validators
) external view returns (string[][] memory) {
string[][] memory _metadata = new string[][](_validators.length);
for (uint256 i = 0; i < _validators.length; i++) {
_metadata[i] = storageLocations[_validators[i]];
@ -110,11 +108,9 @@ contract ValidatorAnnounce is MailboxClient, IValidatorAnnounce {
* @param _storageLocation Storage location string.
* @return The digest of the announcement.
*/
function getAnnouncementDigest(string memory _storageLocation)
public
view
returns (bytes32)
{
function getAnnouncementDigest(
string memory _storageLocation
) public view returns (bytes32) {
return
ECDSA.toEthSignedMessageHash(
keccak256(abi.encodePacked(_domainHash(), _storageLocation))

@ -24,11 +24,9 @@ abstract contract AbstractRoutingIsm is IRoutingIsm {
* @param _message Formatted Hyperlane message (see Message.sol).
* @return module The ISM to use to verify _message
*/
function route(bytes calldata _message)
public
view
virtual
returns (IInterchainSecurityModule);
function route(
bytes calldata _message
) public view virtual returns (IInterchainSecurityModule);
// ============ Public Functions ============
@ -37,10 +35,10 @@ abstract contract AbstractRoutingIsm is IRoutingIsm {
* @param _metadata ABI encoded module metadata
* @param _message Formatted Hyperlane message (see Message.sol).
*/
function verify(bytes calldata _metadata, bytes calldata _message)
public
returns (bool)
{
function verify(
bytes calldata _metadata,
bytes calldata _message
) public returns (bool) {
return route(_message).verify(_metadata, _message);
}
}

@ -18,12 +18,9 @@ contract DefaultFallbackRoutingIsm is DomainRoutingIsm, MailboxClient {
constructor(address _mailbox) MailboxClient(_mailbox) {}
function module(uint32 origin)
public
view
override
returns (IInterchainSecurityModule)
{
function module(
uint32 origin
) public view override returns (IInterchainSecurityModule) {
(bool contained, bytes32 _module) = _modules.tryGet(origin);
if (contained) {
return IInterchainSecurityModule(_module.bytes32ToAddress());

@ -62,10 +62,10 @@ contract DomainRoutingIsm is AbstractRoutingIsm, OwnableUpgradeable {
* @param _domain The origin domain
* @param _module The ISM to use to verify messages
*/
function set(uint32 _domain, IInterchainSecurityModule _module)
external
onlyOwner
{
function set(
uint32 _domain,
IInterchainSecurityModule _module
) external onlyOwner {
_set(_domain, address(_module));
}
@ -81,12 +81,9 @@ contract DomainRoutingIsm is AbstractRoutingIsm, OwnableUpgradeable {
return _modules.keys();
}
function module(uint32 origin)
public
view
virtual
returns (IInterchainSecurityModule)
{
function module(
uint32 origin
) public view virtual returns (IInterchainSecurityModule) {
(bool contained, bytes32 _module) = _modules.tryGet(origin);
require(contained, _originNotFoundError(origin));
return IInterchainSecurityModule(_module.bytes32ToAddress());
@ -99,12 +96,9 @@ contract DomainRoutingIsm is AbstractRoutingIsm, OwnableUpgradeable {
* @param _message Formatted Hyperlane message (see Message.sol).
* @return module The ISM to use to verify _message
*/
function route(bytes calldata _message)
public
view
override
returns (IInterchainSecurityModule)
{
function route(
bytes calldata _message
) public view override returns (IInterchainSecurityModule) {
return module(_message.origin());
}
@ -118,11 +112,9 @@ contract DomainRoutingIsm is AbstractRoutingIsm, OwnableUpgradeable {
require(_modules.remove(_domain), _originNotFoundError(_domain));
}
function _originNotFoundError(uint32 _origin)
internal
pure
returns (string memory)
{
function _originNotFoundError(
uint32 _origin
) internal pure returns (string memory) {
return string.concat("No ISM found for origin: ", _origin.toString());
}

@ -25,13 +25,9 @@ contract InterchainAccountIsm is AbstractRoutingIsm {
* @param _message Formatted Hyperlane message (see Message.sol).
* @return module The ISM to use to verify _message
*/
function route(bytes calldata _message)
public
view
virtual
override
returns (IInterchainSecurityModule)
{
function route(
bytes calldata _message
) public view virtual override returns (IInterchainSecurityModule) {
address _ism = InterchainAccountMessage.ism(Message.body(_message));
if (_ism == address(0)) {
return mailbox.defaultIsm();

@ -43,11 +43,10 @@ library CheckpointLib {
* @param _originmerkleTreeHook The address of the origin merkle tree as bytes32.
* @return The domain hash.
*/
function domainHash(uint32 _origin, bytes32 _originmerkleTreeHook)
internal
pure
returns (bytes32)
{
function domainHash(
uint32 _origin,
bytes32 _originmerkleTreeHook
) internal pure returns (bytes32) {
// Including the origin merkle tree address in the signature allows the slashing
// protocol to enroll multiple trees. Otherwise, a valid signature for
// tree A would be indistinguishable from a fraudulent signature for tree B.

@ -16,11 +16,9 @@ library EnumerableMapExtended {
}
// ============ Library Functions ============
function keys(UintToBytes32Map storage map)
internal
view
returns (uint256[] memory _keys)
{
function keys(
UintToBytes32Map storage map
) internal view returns (uint256[] memory _keys) {
uint256 _length = map._inner.length();
_keys = new uint256[](_length);
for (uint256 i = 0; i < _length; i++) {
@ -28,11 +26,9 @@ library EnumerableMapExtended {
}
}
function uint32Keys(UintToBytes32Map storage map)
internal
view
returns (uint32[] memory _keys)
{
function uint32Keys(
UintToBytes32Map storage map
) internal view returns (uint32[] memory _keys) {
uint256[] memory uint256keys = keys(map);
_keys = new uint32[](uint256keys.length);
for (uint256 i = 0; i < uint256keys.length; i++) {
@ -48,50 +44,44 @@ library EnumerableMapExtended {
map._inner.set(bytes32(key), value);
}
function get(UintToBytes32Map storage map, uint256 key)
internal
view
returns (bytes32)
{
function get(
UintToBytes32Map storage map,
uint256 key
) internal view returns (bytes32) {
return map._inner.get(bytes32(key));
}
function tryGet(UintToBytes32Map storage map, uint256 key)
internal
view
returns (bool, bytes32)
{
function tryGet(
UintToBytes32Map storage map,
uint256 key
) internal view returns (bool, bytes32) {
return map._inner.tryGet(bytes32(key));
}
function remove(UintToBytes32Map storage map, uint256 key)
internal
returns (bool)
{
function remove(
UintToBytes32Map storage map,
uint256 key
) internal returns (bool) {
return map._inner.remove(bytes32(key));
}
function contains(UintToBytes32Map storage map, uint256 key)
internal
view
returns (bool)
{
function contains(
UintToBytes32Map storage map,
uint256 key
) internal view returns (bool) {
return map._inner.contains(bytes32(key));
}
function length(UintToBytes32Map storage map)
internal
view
returns (uint256)
{
function length(
UintToBytes32Map storage map
) internal view returns (uint256) {
return map._inner.length();
}
function at(UintToBytes32Map storage map, uint256 index)
internal
view
returns (uint256, bytes32)
{
function at(
UintToBytes32Map storage map,
uint256 index
) internal view returns (uint256, bytes32) {
(bytes32 key, bytes32 value) = map._inner.at(index);
return (uint256(key), value);
}

@ -3,27 +3,24 @@ pragma solidity >=0.8.0;
/// @notice Library for bit shifting and masking
library LibBit {
function setBit(uint256 _value, uint256 _index)
internal
pure
returns (uint256)
{
function setBit(
uint256 _value,
uint256 _index
) internal pure returns (uint256) {
return _value | (1 << _index);
}
function clearBit(uint256 _value, uint256 _index)
internal
pure
returns (uint256)
{
function clearBit(
uint256 _value,
uint256 _index
) internal pure returns (uint256) {
return _value & ~(1 << _index);
}
function isBitSet(uint256 _value, uint256 _index)
internal
pure
returns (bool)
{
function isBitSet(
uint256 _value,
uint256 _index
) internal pure returns (bool) {
return (_value >> _index) & 1 == 1;
}
}

@ -10,7 +10,7 @@ pragma solidity >=0.6.11;
**/
library MerkleLib {
uint256 internal constant TREE_DEPTH = 32;
uint256 internal constant MAX_LEAVES = 2**TREE_DEPTH - 1;
uint256 internal constant MAX_LEAVES = 2 ** TREE_DEPTH - 1;
/**
* @notice Struct representing incremental merkle tree. Contains current
@ -50,11 +50,10 @@ library MerkleLib {
* @param _zeroes Array of zero hashes
* @return _current Calculated root of `_tree`
**/
function rootWithCtx(Tree storage _tree, bytes32[TREE_DEPTH] memory _zeroes)
internal
view
returns (bytes32 _current)
{
function rootWithCtx(
Tree storage _tree,
bytes32[TREE_DEPTH] memory _zeroes
) internal view returns (bytes32 _current) {
uint256 _index = _tree.count;
for (uint256 i = 0; i < TREE_DEPTH; i++) {

@ -101,11 +101,9 @@ library Message {
* @param _message ABI encoded Hyperlane message.
* @return Sender of `_message` as address
*/
function senderAddress(bytes calldata _message)
internal
pure
returns (address)
{
function senderAddress(
bytes calldata _message
) internal pure returns (address) {
return sender(_message).bytes32ToAddress();
}
@ -114,11 +112,9 @@ library Message {
* @param _message ABI encoded Hyperlane message.
* @return Destination domain of `_message`
*/
function destination(bytes calldata _message)
internal
pure
returns (uint32)
{
function destination(
bytes calldata _message
) internal pure returns (uint32) {
return uint32(bytes4(_message[DESTINATION_OFFSET:RECIPIENT_OFFSET]));
}
@ -127,11 +123,9 @@ library Message {
* @param _message ABI encoded Hyperlane message.
* @return Recipient of `_message` as bytes32
*/
function recipient(bytes calldata _message)
internal
pure
returns (bytes32)
{
function recipient(
bytes calldata _message
) internal pure returns (bytes32) {
return bytes32(_message[RECIPIENT_OFFSET:BODY_OFFSET]);
}
@ -140,11 +134,9 @@ library Message {
* @param _message ABI encoded Hyperlane message.
* @return Recipient of `_message` as address
*/
function recipientAddress(bytes calldata _message)
internal
pure
returns (address)
{
function recipientAddress(
bytes calldata _message
) internal pure returns (address) {
return recipient(_message).bytes32ToAddress();
}
@ -153,11 +145,9 @@ library Message {
* @param _message ABI encoded Hyperlane message.
* @return Body of `_message`
*/
function body(bytes calldata _message)
internal
pure
returns (bytes calldata)
{
function body(
bytes calldata _message
) internal pure returns (bytes calldata) {
return bytes(_message[BODY_OFFSET:]);
}
}

@ -7,11 +7,10 @@ library MetaProxy {
hex"600b380380600b3d393df3363d3d373d3d3d3d60368038038091363936013d73";
bytes13 private constant SUFFIX = hex"5af43d3d93803e603457fd5bf3";
function bytecode(address _implementation, bytes memory _metadata)
internal
pure
returns (bytes memory)
{
function bytecode(
address _implementation,
bytes memory _metadata
) internal pure returns (bytes memory) {
return
abi.encodePacked(
PREFIX,

@ -14,11 +14,9 @@ library MinimalProxy {
}
}
function bytecode(address implementation)
internal
pure
returns (bytes memory)
{
function bytecode(
address implementation
) internal pure returns (bytes memory) {
return abi.encodePacked(PREFIX, bytes20(implementation), SUFFIX);
}
}

@ -27,10 +27,10 @@ abstract contract StaticThresholdAddressSetFactory {
* @param _threshold The threshold value to use
* @return set The contract address representing this StaticThresholdAddressSet
*/
function deploy(address[] calldata _values, uint8 _threshold)
public
returns (address)
{
function deploy(
address[] calldata _values,
uint8 _threshold
) public returns (address) {
(bytes32 _salt, bytes memory _bytecode) = _saltAndBytecode(
_values,
_threshold
@ -50,11 +50,10 @@ abstract contract StaticThresholdAddressSetFactory {
* @param _threshold The threshold value to use
* @return set The contract address representing this StaticThresholdAddressSet
*/
function getAddress(address[] calldata _values, uint8 _threshold)
external
view
returns (address)
{
function getAddress(
address[] calldata _values,
uint8 _threshold
) external view returns (address) {
(bytes32 _salt, bytes memory _bytecode) = _saltAndBytecode(
_values,
_threshold
@ -69,11 +68,10 @@ abstract contract StaticThresholdAddressSetFactory {
* @param _bytecode The metaproxy bytecode used in Create2
* @return set The contract address representing this StaticThresholdAddressSet
*/
function _getAddress(bytes32 _salt, bytes memory _bytecode)
internal
view
returns (address)
{
function _getAddress(
bytes32 _salt,
bytes memory _bytecode
) internal view returns (address) {
bytes32 _bytecodeHash = keccak256(_bytecode);
return Create2.computeAddress(_salt, _bytecodeHash);
}
@ -85,11 +83,10 @@ abstract contract StaticThresholdAddressSetFactory {
* @return _salt The salt used in Create2
* @return _bytecode The metaproxy bytecode used in Create2
*/
function _saltAndBytecode(address[] calldata _values, uint8 _threshold)
internal
view
returns (bytes32, bytes memory)
{
function _saltAndBytecode(
address[] calldata _values,
uint8 _threshold
) internal view returns (bytes32, bytes memory) {
bytes memory _metadata = abi.encode(_values, _threshold);
bytes memory _bytecode = MetaProxy.bytecode(implementation, _metadata);
bytes32 _salt = keccak256(_metadata);
@ -116,11 +113,9 @@ abstract contract StaticAddressSetFactory is StaticThresholdAddressSetFactory {
* @param _values An array of addresses
* @return set The contract address representing this StaticAddressSet
*/
function getAddress(address[] calldata _values)
external
view
returns (address)
{
function getAddress(
address[] calldata _values
) external view returns (address) {
(bytes32 _salt, bytes memory _bytecode) = _saltAndBytecode(
_values,
uint8(_values.length)

@ -180,10 +180,10 @@ contract InterchainAccountRouter is Router {
* @param _calls The sequence of calls to make
* @return The Hyperlane message ID
*/
function callRemote(uint32 _destination, CallLib.Call[] calldata _calls)
external
returns (bytes32)
{
function callRemote(
uint32 _destination,
CallLib.Call[] calldata _calls
) external returns (bytes32) {
bytes32 _router = routers(_destination);
bytes32 _ism = isms[_destination];
return callRemoteWithOverrides(_destination, _router, _ism, _calls);
@ -251,11 +251,10 @@ contract InterchainAccountRouter is Router {
* @param _owner The local owner of the interchain account
* @return The remote address of the interchain account
*/
function getRemoteInterchainAccount(uint32 _destination, address _owner)
external
view
returns (address)
{
function getRemoteInterchainAccount(
uint32 _destination,
address _owner
) external view returns (address) {
address _router = routers(_destination).bytes32ToAddress();
address _ism = isms[_destination].bytes32ToAddress();
return getRemoteInterchainAccount(_owner, _router, _ism);
@ -410,11 +409,7 @@ contract InterchainAccountRouter is Router {
/**
* @dev Required for use of Router, compiler will not include this function in the bytecode
*/
function _handle(
uint32,
bytes32,
bytes calldata
) internal pure override {
function _handle(uint32, bytes32, bytes calldata) internal pure override {
assert(false);
}
@ -424,10 +419,10 @@ contract InterchainAccountRouter is Router {
* @param _address The address of the remote InterchainAccountRouter
* @dev Sets the default ISM to the zero address
*/
function _enrollRemoteRouter(uint32 _destination, bytes32 _address)
internal
override
{
function _enrollRemoteRouter(
uint32 _destination,
bytes32 _address
) internal override {
_enrollRemoteRouterAndIsm(_destination, _address, bytes32(0));
}
@ -504,11 +499,9 @@ contract InterchainAccountRouter is Router {
* @param _salt The CREATE2 salt used for deploying the interchain account
* @return The address of the interchain account
*/
function _getLocalInterchainAccount(bytes32 _salt)
private
view
returns (address payable)
{
function _getLocalInterchainAccount(
bytes32 _salt
) private view returns (address payable) {
return payable(Create2.computeAddress(_salt, bytecodeHash));
}
}

@ -24,10 +24,9 @@ library CallLib {
bytes callback;
}
function call(Call memory _call)
internal
returns (bytes memory returnData)
{
function call(
Call memory _call
) internal returns (bytes memory returnData) {
return
Address.functionCallWithValue(
TypeCasts.bytes32ToAddress(_call.to),
@ -36,11 +35,9 @@ library CallLib {
);
}
function staticcall(StaticCall memory _call)
private
view
returns (bytes memory)
{
function staticcall(
StaticCall memory _call
) private view returns (bytes memory) {
return
Address.functionStaticCall(
TypeCasts.bytes32ToAddress(_call.to),
@ -48,11 +45,9 @@ library CallLib {
);
}
function staticcall(StaticCallWithCallback memory _call)
internal
view
returns (bytes memory callback)
{
function staticcall(
StaticCallWithCallback memory _call
) internal view returns (bytes memory callback) {
return bytes.concat(_call.callback, staticcall(_call._call));
}
@ -67,11 +62,9 @@ library CallLib {
}
}
function multistaticcall(StaticCallWithCallback[] memory _calls)
internal
view
returns (bytes[] memory)
{
function multistaticcall(
StaticCallWithCallback[] memory _calls
) internal view returns (bytes[] memory) {
uint256 i = 0;
uint256 len = _calls.length;
bytes[] memory callbacks = new bytes[](len);
@ -95,19 +88,17 @@ library CallLib {
}
}
function build(bytes32 to, bytes memory data)
internal
pure
returns (StaticCall memory)
{
function build(
bytes32 to,
bytes memory data
) internal pure returns (StaticCall memory) {
return StaticCall(to, data);
}
function build(address to, bytes memory data)
internal
pure
returns (StaticCall memory)
{
function build(
address to,
bytes memory data
) internal pure returns (StaticCall memory) {
return build(TypeCasts.addressToBytes32(to), data);
}

@ -72,15 +72,9 @@ library InterchainAccountMessage {
* @param _message The interchain account message
* @return The array of calls
*/
function decode(bytes calldata _message)
internal
pure
returns (
bytes32,
bytes32,
CallLib.Call[] memory
)
{
function decode(
bytes calldata _message
) internal pure returns (bytes32, bytes32, CallLib.Call[] memory) {
return abi.decode(_message, (bytes32, bytes32, CallLib.Call[]));
}

@ -33,11 +33,9 @@ library InterchainQueryMessage {
* @param _message The interchain query message
* @return The message type (query or response)
*/
function messageType(bytes calldata _message)
internal
pure
returns (MessageType)
{
function messageType(
bytes calldata _message
) internal pure returns (MessageType) {
// left padded with zeroes
return MessageType(uint8(bytes1(_message[CALLS_OFFSET - 1])));
}
@ -83,11 +81,9 @@ library InterchainQueryMessage {
* @return _calls The sequence of queries to make with the corresponding
* response callbacks
*/
function callsWithCallbacks(bytes calldata _message)
internal
pure
returns (CallLib.StaticCallWithCallback[] memory _calls)
{
function callsWithCallbacks(
bytes calldata _message
) internal pure returns (CallLib.StaticCallWithCallback[] memory _calls) {
assert(messageType(_message) == MessageType.QUERY);
(, , _calls) = abi.decode(
_message,
@ -101,11 +97,10 @@ library InterchainQueryMessage {
* @param _calls The sequence of callbacks to make
* @return Formatted message body
*/
function encode(bytes32 _sender, bytes[] memory _calls)
internal
pure
returns (bytes memory)
{
function encode(
bytes32 _sender,
bytes[] memory _calls
) internal pure returns (bytes memory) {
return abi.encode(_sender, MessageType.RESPONSE, _calls);
}
@ -114,11 +109,9 @@ library InterchainQueryMessage {
* @param _message The interchain query message, type == RESPONSE
* @return _calls The sequence of callbacks to make
*/
function rawCalls(bytes calldata _message)
internal
pure
returns (bytes[] memory _calls)
{
function rawCalls(
bytes calldata _message
) internal pure returns (bytes[] memory _calls) {
assert(messageType(_message) == MessageType.RESPONSE);
(, , _calls) = abi.decode(_message, (bytes32, MessageType, bytes[]));
}

@ -121,19 +121,17 @@ contract LiquidityLayerRouter is Router, ILiquidityLayerRouter {
}
}
function setLiquidityLayerAdapter(string calldata _bridge, address _adapter)
external
onlyOwner
{
function setLiquidityLayerAdapter(
string calldata _bridge,
address _adapter
) external onlyOwner {
liquidityLayerAdapters[_bridge] = _adapter;
emit LiquidityLayerAdapterSet(_bridge, _adapter);
}
function _getAdapter(string memory _bridge)
internal
view
returns (ILiquidityLayerAdapter _adapter)
{
function _getAdapter(
string memory _bridge
) internal view returns (ILiquidityLayerAdapter _adapter) {
_adapter = ILiquidityLayerAdapter(liquidityLayerAdapters[_bridge]);
// Require the adapter to have been set
require(address(_adapter) != address(0), "No adapter found for bridge");

@ -170,19 +170,19 @@ contract CircleBridgeAdapter is ILiquidityLayerAdapter, Router {
revert("No messages expected");
}
function addDomain(uint32 _hyperlaneDomain, uint32 _circleDomain)
external
onlyOwner
{
function addDomain(
uint32 _hyperlaneDomain,
uint32 _circleDomain
) external onlyOwner {
hyperlaneDomainToCircleDomain[_hyperlaneDomain] = _circleDomain;
emit DomainAdded(_hyperlaneDomain, _circleDomain);
}
function addToken(address _token, string calldata _tokenSymbol)
external
onlyOwner
{
function addToken(
address _token,
string calldata _tokenSymbol
) external onlyOwner {
require(
_token != address(0) && bytes(_tokenSymbol).length > 0,
"Cannot add default values"
@ -204,10 +204,10 @@ contract CircleBridgeAdapter is ILiquidityLayerAdapter, Router {
emit TokenAdded(_token, _tokenSymbol);
}
function removeToken(address _token, string calldata _tokenSymbol)
external
onlyOwner
{
function removeToken(
address _token,
string calldata _tokenSymbol
) external onlyOwner {
// Require the provided token and token symbols match what's in storage.
address _existingToken = address(tokenSymbolToAddress[_tokenSymbol]);
require(_existingToken == _token, "Token mismatch");
@ -232,11 +232,10 @@ contract CircleBridgeAdapter is ILiquidityLayerAdapter, Router {
destination
* @return hash of source and nonce
*/
function _circleNonceId(uint32 _originCircleDomain, uint64 _nonce)
internal
pure
returns (bytes32)
{
function _circleNonceId(
uint32 _originCircleDomain,
uint64 _nonce
) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_originCircleDomain, _nonce));
}
}

@ -189,10 +189,10 @@ contract PortalAdapter is ILiquidityLayerAdapter, Router {
revert("No messages expected");
}
function addDomain(uint32 _hyperlaneDomain, uint16 _wormholeDomain)
external
onlyOwner
{
function addDomain(
uint32 _hyperlaneDomain,
uint16 _wormholeDomain
) external onlyOwner {
hyperlaneDomainToWormholeDomain[_hyperlaneDomain] = _wormholeDomain;
emit DomainAdded(_hyperlaneDomain, _wormholeDomain);
@ -203,11 +203,10 @@ contract PortalAdapter is ILiquidityLayerAdapter, Router {
* @param _hyperlaneDomain The hyperlane of the origin
* @param _nonce The nonce of the adapter on the origin
*/
function transferId(uint32 _hyperlaneDomain, uint224 _nonce)
public
pure
returns (bytes32)
{
function transferId(
uint32 _hyperlaneDomain,
uint224 _nonce
) public pure returns (bytes32) {
return bytes32(abi.encodePacked(_hyperlaneDomain, _nonce));
}
}

@ -30,9 +30,10 @@ interface ICircleMessageTransmitter {
* of the attester address recovered from signatures.
* @return success bool, true if successful
*/
function receiveMessage(bytes memory _message, bytes calldata _attestation)
external
returns (bool success);
function receiveMessage(
bytes memory _message,
bytes calldata _attestation
) external returns (bool success);
function usedNonces(bytes32 _nonceId) external view returns (bool);
}

@ -69,19 +69,18 @@ interface IPortalTokenBridge {
bytes memory payload
) external payable returns (uint64 sequence);
function completeTransferWithPayload(bytes memory encodedVm)
external
returns (bytes memory);
function completeTransferWithPayload(
bytes memory encodedVm
) external returns (bytes memory);
function parseTransferWithPayload(bytes memory encoded)
external
pure
returns (TransferWithPayload memory transfer);
function parseTransferWithPayload(
bytes memory encoded
) external pure returns (TransferWithPayload memory transfer);
function wrappedAsset(uint16 tokenChainId, bytes32 tokenAddress)
external
view
returns (address);
function wrappedAsset(
uint16 tokenChainId,
bytes32 tokenAddress
) external view returns (address);
function isWrappedAsset(address token) external view returns (bool);
}

@ -12,19 +12,17 @@ contract MockCircleMessageTransmitter is ICircleMessageTransmitter {
token = _token;
}
function receiveMessage(bytes memory, bytes calldata)
external
pure
returns (bool success)
{
function receiveMessage(
bytes memory,
bytes calldata
) external pure returns (bool success) {
success = true;
}
function hashSourceAndNonce(uint32 _source, uint64 _nonce)
public
pure
returns (bytes32)
{
function hashSourceAndNonce(
uint32 _source,
uint64 _nonce
) public pure returns (bytes32) {
return keccak256(abi.encodePacked(_source, _nonce));
}

@ -35,10 +35,9 @@ contract MockPortalBridge is IPortalTokenBridge {
return true;
}
function completeTransferWithPayload(bytes memory encodedVm)
external
returns (bytes memory)
{
function completeTransferWithPayload(
bytes memory encodedVm
) external returns (bytes memory) {
(uint32 _originDomain, uint224 _nonce, uint256 _amount) = abi.decode(
encodedVm,
(uint32, uint224, uint256)
@ -53,11 +52,9 @@ contract MockPortalBridge is IPortalTokenBridge {
);
}
function parseTransferWithPayload(bytes memory encoded)
external
pure
returns (TransferWithPayload memory transfer)
{
function parseTransferWithPayload(
bytes memory encoded
) external pure returns (TransferWithPayload memory transfer) {
(bytes32 tokenAddress, bytes memory payload) = abi.decode(
encoded,
(bytes32, bytes)

@ -10,9 +10,5 @@ contract TestGasRouter is GasRouter {
_dispatch(_destination, _msg);
}
function _handle(
uint32,
bytes32,
bytes calldata
) internal pure override {}
function _handle(uint32, bytes32, bytes calldata) internal pure override {}
}

@ -11,12 +11,10 @@ contract TestInterchainGasPaymaster is InterchainGasPaymaster {
initialize(msg.sender, msg.sender);
}
function quoteGasPayment(uint32, uint256 gasAmount)
public
pure
override
returns (uint256)
{
function quoteGasPayment(
uint32,
uint256 gasAmount
) public pure override returns (uint256) {
return gasPrice * gasAmount;
}
}

@ -6,67 +6,51 @@ import {Message} from "../libs/Message.sol";
contract TestMessage {
using Message for bytes;
function version(bytes calldata _message)
external
pure
returns (uint32 _version)
{
function version(
bytes calldata _message
) external pure returns (uint32 _version) {
return _message.version();
}
function nonce(bytes calldata _message)
external
pure
returns (uint256 _nonce)
{
function nonce(
bytes calldata _message
) external pure returns (uint256 _nonce) {
return _message.nonce();
}
function body(bytes calldata _message)
external
pure
returns (bytes calldata _body)
{
function body(
bytes calldata _message
) external pure returns (bytes calldata _body) {
return _message.body();
}
function origin(bytes calldata _message)
external
pure
returns (uint32 _origin)
{
function origin(
bytes calldata _message
) external pure returns (uint32 _origin) {
return _message.origin();
}
function sender(bytes calldata _message)
external
pure
returns (bytes32 _sender)
{
function sender(
bytes calldata _message
) external pure returns (bytes32 _sender) {
return _message.sender();
}
function destination(bytes calldata _message)
external
pure
returns (uint32 _destination)
{
function destination(
bytes calldata _message
) external pure returns (uint32 _destination) {
return _message.destination();
}
function recipient(bytes calldata _message)
external
pure
returns (bytes32 _recipient)
{
function recipient(
bytes calldata _message
) external pure returns (bytes32 _recipient) {
return _message.recipient();
}
function recipientAddress(bytes calldata _message)
external
pure
returns (address _recipient)
{
function recipientAddress(
bytes calldata _message
) external pure returns (address _recipient) {
return _message.recipientAddress();
}

@ -17,12 +17,9 @@ contract TestPostDispatchHook is AbstractPostDispatchHook {
return uint8(IPostDispatchHook.Types.UNUSED);
}
function supportsMetadata(bytes calldata)
public
pure
override
returns (bool)
{
function supportsMetadata(
bytes calldata
) public pure override returns (bool) {
return true;
}

@ -8,32 +8,25 @@ contract TestRouter is Router {
constructor(address _mailbox) Router(_mailbox) {}
function initialize(address _hook, address _interchainSecurityModule)
public
initializer
{
function initialize(
address _hook,
address _interchainSecurityModule
) public initializer {
_MailboxClient_initialize(_hook, _interchainSecurityModule, msg.sender);
}
function _handle(
uint32,
bytes32,
bytes calldata
) internal pure override {}
function isRemoteRouter(uint32 _domain, bytes32 _potentialRemoteRouter)
external
view
returns (bool)
{
function _handle(uint32, bytes32, bytes calldata) internal pure override {}
function isRemoteRouter(
uint32 _domain,
bytes32 _potentialRemoteRouter
) external view returns (bool) {
return _isRemoteRouter(_domain, _potentialRemoteRouter);
}
function mustHaveRemoteRouter(uint32 _domain)
external
view
returns (bytes32)
{
function mustHaveRemoteRouter(
uint32 _domain
) external view returns (bytes32) {
return _mustHaveRemoteRouter(_domain);
}

@ -57,11 +57,7 @@ contract TestSendReceiver is IMessageRecipient {
);
}
function handle(
uint32,
bytes32,
bytes calldata
) external payable override {
function handle(uint32, bytes32, bytes calldata) external payable override {
bytes32 blockHash = previousBlockHash();
bool isBlockHashEndIn0 = uint256(blockHash) % 16 == 0;
require(!isBlockHashEndIn0, "block hash ends in 0");

@ -37,7 +37,9 @@ contract HypERC20 is ERC20Upgradeable, TokenRouter {
return _decimals;
}
function balanceOf(address _account)
function balanceOf(
address _account
)
public
view
virtual
@ -51,11 +53,9 @@ contract HypERC20 is ERC20Upgradeable, TokenRouter {
* @dev Burns `_amount` of token from `msg.sender` balance.
* @inheritdoc TokenRouter
*/
function _transferFromSender(uint256 _amount)
internal
override
returns (bytes memory)
{
function _transferFromSender(
uint256 _amount
) internal override returns (bytes memory) {
_burn(msg.sender, _amount);
return bytes(""); // no metadata
}

@ -25,12 +25,9 @@ contract HypERC20Collateral is TokenRouter {
wrappedToken = IERC20(erc20);
}
function balanceOf(address _account)
external
view
override
returns (uint256)
{
function balanceOf(
address _account
) external view override returns (uint256) {
return wrappedToken.balanceOf(_account);
}
@ -38,11 +35,9 @@ contract HypERC20Collateral is TokenRouter {
* @dev Transfers `_amount` of `wrappedToken` from `msg.sender` to this contract.
* @inheritdoc TokenRouter
*/
function _transferFromSender(uint256 _amount)
internal
override
returns (bytes memory)
{
function _transferFromSender(
uint256 _amount
) internal override returns (bytes memory) {
wrappedToken.safeTransferFrom(msg.sender, address(this), _amount);
return bytes(""); // no metadata
}

@ -34,7 +34,9 @@ contract HypERC721 is ERC721EnumerableUpgradeable, TokenRouter {
}
}
function balanceOf(address _account)
function balanceOf(
address _account
)
public
view
virtual
@ -48,12 +50,9 @@ contract HypERC721 is ERC721EnumerableUpgradeable, TokenRouter {
* @dev Asserts `msg.sender` is owner and burns `_tokenId`.
* @inheritdoc TokenRouter
*/
function _transferFromSender(uint256 _tokenId)
internal
virtual
override
returns (bytes memory)
{
function _transferFromSender(
uint256 _tokenId
) internal virtual override returns (bytes memory) {
require(ownerOf(_tokenId) == msg.sender, "!owner");
_burn(_tokenId);
return bytes(""); // no metadata

@ -29,12 +29,9 @@ contract HypERC721Collateral is TokenRouter {
* @dev Returns the balance of `_account` for `wrappedToken`.
* @inheritdoc TokenRouter
*/
function balanceOf(address _account)
external
view
override
returns (uint256)
{
function balanceOf(
address _account
) external view override returns (uint256) {
return IERC721(wrappedToken).balanceOf(_account);
}
@ -42,12 +39,9 @@ contract HypERC721Collateral is TokenRouter {
* @dev Transfers `_tokenId` of `wrappedToken` from `msg.sender` to this contract.
* @inheritdoc TokenRouter
*/
function _transferFromSender(uint256 _tokenId)
internal
virtual
override
returns (bytes memory)
{
function _transferFromSender(
uint256 _tokenId
) internal virtual override returns (bytes memory) {
// safeTransferFrom not used here because recipient is this contract
wrappedToken.transferFrom(msg.sender, address(this), _tokenId);
return bytes(""); // no metadata

@ -34,12 +34,9 @@ contract HypNative is TokenRouter {
return _transferRemote(_destination, _recipient, _amount, gasPayment);
}
function balanceOf(address _account)
external
view
override
returns (uint256)
{
function balanceOf(
address _account
) external view override returns (uint256) {
return _account.balance;
}
@ -48,12 +45,9 @@ contract HypNative is TokenRouter {
* @dev No-op because native amount is transferred in `msg.value`
* @dev Compiler will not include this in the bytecode.
*/
function _transferFromSender(uint256)
internal
pure
override
returns (bytes memory)
{
function _transferFromSender(
uint256
) internal pure override returns (bytes memory) {
return bytes(""); // no metadata
}

@ -65,7 +65,6 @@ interface TokenRouter {
uint256 amount
) public returns (bytes32 messageId);
}
```
**NOTE:** The [Relayer](https://docs.hyperlane.xyz/docs/protocol/agents/relayer) shown below must be compensated. Please refer to the relevant guide on [paying for interchain gas](https://docs.hyperlane.xyz/docs/build-with-hyperlane/guides/paying-for-interchain-gas) on the `messageID` returned from the `transferRemote` call.

@ -13,9 +13,10 @@ import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/
* @dev Supply on each chain is not constant but the aggregate supply across all chains is.
*/
contract FastHypERC20 is FastTokenRouter, HypERC20 {
constructor(uint8 __decimals, address _mailbox)
HypERC20(__decimals, _mailbox)
{}
constructor(
uint8 __decimals,
address _mailbox
) HypERC20(__decimals, _mailbox) {}
/**
* @dev delegates transfer logic to `_transferTo`.
@ -33,10 +34,10 @@ contract FastHypERC20 is FastTokenRouter, HypERC20 {
* @dev Mints `_amount` of tokens to `_recipient`.
* @inheritdoc FastTokenRouter
*/
function _fastTransferTo(address _recipient, uint256 _amount)
internal
override
{
function _fastTransferTo(
address _recipient,
uint256 _amount
) internal override {
_mint(_recipient, _amount);
}
@ -44,20 +45,16 @@ contract FastHypERC20 is FastTokenRouter, HypERC20 {
* @dev Burns `_amount` of tokens from `_recipient`.
* @inheritdoc FastTokenRouter
*/
function _fastRecieveFrom(address _sender, uint256 _amount)
internal
override
{
function _fastRecieveFrom(
address _sender,
uint256 _amount
) internal override {
_burn(_sender, _amount);
}
function balanceOf(address _account)
public
view
virtual
override(HypERC20, TokenRouter)
returns (uint256)
{
function balanceOf(
address _account
) public view virtual override(HypERC20, TokenRouter) returns (uint256) {
return ERC20Upgradeable.balanceOf(_account);
}
}

@ -19,9 +19,10 @@ contract FastHypERC20Collateral is FastTokenRouter, HypERC20Collateral {
* @notice Constructor
* @param erc20 Address of the token to keep as collateral
*/
constructor(address erc20, address _mailbox)
HypERC20Collateral(erc20, _mailbox)
{}
constructor(
address erc20,
address _mailbox
) HypERC20Collateral(erc20, _mailbox) {}
/**
* @dev delegates transfer logic to `_transferTo`.
@ -39,10 +40,10 @@ contract FastHypERC20Collateral is FastTokenRouter, HypERC20Collateral {
* @dev Transfers `_amount` of `wrappedToken` to `_recipient`.
* @inheritdoc FastTokenRouter
*/
function _fastTransferTo(address _recipient, uint256 _amount)
internal
override
{
function _fastTransferTo(
address _recipient,
uint256 _amount
) internal override {
wrappedToken.safeTransfer(_recipient, _amount);
}
@ -50,10 +51,10 @@ contract FastHypERC20Collateral is FastTokenRouter, HypERC20Collateral {
* @dev Transfers in `_amount` of `wrappedToken` from `_recipient`.
* @inheritdoc FastTokenRouter
*/
function _fastRecieveFrom(address _sender, uint256 _amount)
internal
override
{
function _fastRecieveFrom(
address _sender,
uint256 _amount
) internal override {
wrappedToken.safeTransferFrom(_sender, address(this), _amount);
}
}

@ -11,20 +11,19 @@ import {IERC721MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/to
*/
contract HypERC721URICollateral is HypERC721Collateral {
// solhint-disable-next-line no-empty-blocks
constructor(address erc721, address _mailbox)
HypERC721Collateral(erc721, _mailbox)
{}
constructor(
address erc721,
address _mailbox
) HypERC721Collateral(erc721, _mailbox) {}
/**
* @dev Transfers `_tokenId` of `wrappedToken` from `msg.sender` to this contract.
* @return The URI of `_tokenId` on `wrappedToken`.
* @inheritdoc HypERC721Collateral
*/
function _transferFromSender(uint256 _tokenId)
internal
override
returns (bytes memory)
{
function _transferFromSender(
uint256 _tokenId
) internal override returns (bytes memory) {
HypERC721Collateral._transferFromSender(_tokenId);
return
bytes(

@ -6,6 +6,7 @@ import {HypERC721} from "../HypERC721.sol";
import {ERC721URIStorageUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol";
import {ERC721EnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import {IERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
/**
* @title Hyperlane ERC721 Token that extends ERC721URIStorage with remote transfer and URI relay functionality.
@ -14,10 +15,12 @@ import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC72
contract HypERC721URIStorage is HypERC721, ERC721URIStorageUpgradeable {
constructor(address _mailbox) HypERC721(_mailbox) {}
function balanceOf(address account)
function balanceOf(
address account
)
public
view
override(HypERC721, ERC721Upgradeable)
override(HypERC721, ERC721Upgradeable, IERC721Upgradeable)
returns (uint256)
{
return HypERC721.balanceOf(account);
@ -27,11 +30,9 @@ contract HypERC721URIStorage is HypERC721, ERC721URIStorageUpgradeable {
* @return _tokenURI The URI of `_tokenId`.
* @inheritdoc HypERC721
*/
function _transferFromSender(uint256 _tokenId)
internal
override
returns (bytes memory _tokenURI)
{
function _transferFromSender(
uint256 _tokenId
) internal override returns (bytes memory _tokenURI) {
_tokenURI = bytes(tokenURI(_tokenId)); // requires minted
HypERC721._transferFromSender(_tokenId);
}
@ -49,7 +50,9 @@ contract HypERC721URIStorage is HypERC721, ERC721URIStorageUpgradeable {
_setTokenURI(_tokenId, string(_tokenURI)); // requires minted
}
function tokenURI(uint256 tokenId)
function tokenURI(
uint256 tokenId
)
public
view
override(ERC721Upgradeable, ERC721URIStorageUpgradeable)
@ -72,19 +75,20 @@ contract HypERC721URIStorage is HypERC721, ERC721URIStorageUpgradeable {
);
}
function supportsInterface(bytes4 interfaceId)
function supportsInterface(
bytes4 interfaceId
)
public
view
override(ERC721EnumerableUpgradeable, ERC721Upgradeable)
override(ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable)
returns (bool)
{
return ERC721EnumerableUpgradeable.supportsInterface(interfaceId);
}
function _burn(uint256 tokenId)
internal
override(ERC721URIStorageUpgradeable, ERC721Upgradeable)
{
function _burn(
uint256 tokenId
) internal override(ERC721URIStorageUpgradeable, ERC721Upgradeable) {
ERC721URIStorageUpgradeable._burn(tokenId);
}
}

@ -192,15 +192,17 @@ abstract contract FastTokenRouter is TokenRouter {
* @dev Should transfer `_amount` of tokens to `_recipient`.
* @dev The implementation is delegated.
*/
function _fastTransferTo(address _recipient, uint256 _amount)
internal
virtual;
function _fastTransferTo(
address _recipient,
uint256 _amount
) internal virtual;
/**
* @dev Should collect `amount` of tokens from `_sender`.
* @dev The implementation is delegated.
*/
function _fastRecieveFrom(address _sender, uint256 _amount)
internal
virtual;
function _fastRecieveFrom(
address _sender,
uint256 _amount
) internal virtual;
}

@ -23,11 +23,9 @@ library TokenMessage {
return amount(message);
}
function metadata(bytes calldata message)
internal
pure
returns (bytes calldata)
{
function metadata(
bytes calldata message
) internal pure returns (bytes calldata) {
return message[64:];
}
}

@ -89,10 +89,9 @@ abstract contract TokenRouter is GasRouter {
* @dev Called by `transferRemote` before message dispatch.
* @dev Optionally returns `metadata` associated with the transfer to be passed in message.
*/
function _transferFromSender(uint256 _amountOrId)
internal
virtual
returns (bytes memory metadata);
function _transferFromSender(
uint256 _amountOrId
) internal virtual returns (bytes memory metadata);
/**
* @notice Returns the balance of `account` on this token router.

@ -5,27 +5,27 @@
"dependencies": {
"@eth-optimism/contracts": "^0.6.0",
"@hyperlane-xyz/utils": "3.1.0-beta3",
"@openzeppelin/contracts": "^4.8.0",
"@openzeppelin/contracts-upgradeable": "^4.8.0"
"@openzeppelin/contracts": "^4.9.3",
"@openzeppelin/contracts-upgradeable": "^v4.9.3"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@typechain/ethers-v5": "10.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"@typechain/ethers-v5": "^10.0.0",
"@typechain/hardhat": "^6.0.0",
"chai": "^4.3.0",
"ethereum-waffle": "^3.4.4",
"ethereum-waffle": "^4.0.10",
"ethers": "^5.7.2",
"hardhat": "^2.16.1",
"hardhat": "^2.19.0",
"hardhat-gas-reporter": "^1.0.9",
"prettier": "^2.4.1",
"prettier-plugin-solidity": "^1.0.0-beta.5",
"solhint": "^3.3.2",
"prettier": "^2.8.8",
"prettier-plugin-solidity": "^1.1.3",
"solhint": "^4.0.0",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.8.3",
"ts-generator": "^0.1.1",
"typechain": "^8.1.1",
"typescript": "^5.1.6"
"typechain": "^8.3.2",
"typescript": "5.1.6"
},
"directories": {
"test": "test"
@ -58,5 +58,10 @@
"slither": "slither ."
},
"types": "dist/index.d.ts",
"stableVersion": "1.5.0"
"stableVersion": "1.5.0",
"peerDependencies": {
"@ethersproject/abi": "*",
"@ethersproject/providers": "*",
"@types/sinon-chai": "*"
}
}

@ -27,11 +27,10 @@ contract FailingIsm is IInterchainSecurityModule {
failureMessage = _failureMessage;
}
function verify(bytes calldata, bytes calldata)
external
view
returns (bool)
{
function verify(
bytes calldata,
bytes calldata
) external view returns (bool) {
revert(failureMessage);
}
}
@ -242,11 +241,9 @@ contract InterchainAccountRouterTest is Test {
originRouter.enrollRemoteRouterAndIsm(destination, router, ism);
}
function getCalls(bytes32 data)
private
view
returns (CallLib.Call[] memory)
{
function getCalls(
bytes32 data
) private view returns (CallLib.Call[] memory) {
vm.assume(data != bytes32(0));
CallLib.Call memory call = CallLib.Call(
TypeCasts.addressToBytes32(address(target)),

@ -449,9 +449,9 @@ contract MailboxTest is Test, Versioned {
mailbox.process("", message);
}
function test_process_revertsWhenBadDestination(bytes calldata body)
public
{
function test_process_revertsWhenBadDestination(
bytes calldata body
) public {
bytes memory message = Message.formatMessage(
VERSION,
0,

@ -93,9 +93,10 @@ contract RouterTest is Test {
assertEq(router.isRemoteRouter(origin, remoteRouter), false);
}
function testNotOwnerEnrollRouter(address notOwner, bytes32 remoteRouter)
public
{
function testNotOwnerEnrollRouter(
address notOwner,
bytes32 remoteRouter
) public {
vm.prank(notOwner);
vm.expectRevert(bytes("Ownable: caller is not the owner"));
router.enrollRemoteRouter(origin, remoteRouter);

@ -44,9 +44,10 @@ contract ValidatorAnnounceTest is Test {
assertEq(encodedA, encodedB);
}
function assertEqStrArrArr(string[][] memory a, string[][] memory b)
internal
{
function assertEqStrArrArr(
string[][] memory a,
string[][] memory b
) internal {
bytes memory encodedA = abi.encode(a);
bytes memory encodedB = abi.encode(b);
assertEq(encodedA, encodedB);

@ -18,10 +18,10 @@ contract AggregationHookTest is Test {
factory = new StaticAggregationHookFactory();
}
function deployHooks(uint8 n, uint256 fee)
internal
returns (address[] memory)
{
function deployHooks(
uint8 n,
uint256 fee
) internal returns (address[] memory) {
address[] memory hooks = new address[](n);
for (uint8 i = 0; i < n; i++) {
TestPostDispatchHook subHook = new TestPostDispatchHook();

@ -94,9 +94,9 @@ contract InterchainGasPaymasterTest is Test {
);
}
function testdestinationGasLimit_whenOverheadNotSet(uint32 _otherDomains)
public
{
function testdestinationGasLimit_whenOverheadNotSet(
uint32 _otherDomains
) public {
vm.assume(_otherDomains != testDestinationDomain);
assertEq(
igp.destinationGasLimit(_otherDomains, testGasLimit),
@ -347,9 +347,10 @@ contract InterchainGasPaymasterTest is Test {
);
}
function testPayForGas_withOverhead(uint128 _gasLimit, uint96 _gasOverhead)
public
{
function testPayForGas_withOverhead(
uint128 _gasLimit,
uint96 _gasOverhead
) public {
setRemoteGasData(
testDestinationDomain,
1 * TEST_EXCHANGE_RATE,
@ -501,9 +502,9 @@ contract InterchainGasPaymasterTest is Test {
assertEq(_igpBalanceAfter - _igpBalanceBefore, _quote);
}
function testPostDispatch_customWithMetadataAndOverhead(uint96 _gasOverhead)
public
{
function testPostDispatch_customWithMetadataAndOverhead(
uint96 _gasOverhead
) public {
vm.deal(address(this), _gasOverhead + testGasLimit);
setRemoteGasData(

@ -32,11 +32,10 @@ contract AggregationIsmTest is Test {
return isms;
}
function getMetadata(uint8 m, bytes32 seed)
private
view
returns (bytes memory)
{
function getMetadata(
uint8 m,
bytes32 seed
) private view returns (bytes memory) {
(address[] memory choices, ) = ism.modulesAndThreshold("");
address[] memory chosen = ThresholdTestUtils.choose(m, choices, seed);
bytes memory offsets;
@ -63,11 +62,7 @@ contract AggregationIsmTest is Test {
return abi.encodePacked(offsets, metametadata);
}
function testVerify(
uint8 m,
uint8 n,
bytes32 seed
) public {
function testVerify(uint8 m, uint8 n, bytes32 seed) public {
vm.assume(0 < m && m <= n && n < 10);
deployIsms(m, n, seed);
@ -91,11 +86,7 @@ contract AggregationIsmTest is Test {
assertTrue(ism.verify(metadata, ""));
}
function testVerifyMissingMetadata(
uint8 m,
uint8 n,
bytes32 seed
) public {
function testVerifyMissingMetadata(uint8 m, uint8 n, bytes32 seed) public {
vm.assume(0 < m && m <= n && n < 10);
deployIsms(m, n, seed);
@ -121,11 +112,7 @@ contract AggregationIsmTest is Test {
ism.verify(metadata, "");
}
function testModulesAndThreshold(
uint8 m,
uint8 n,
bytes32 seed
) public {
function testModulesAndThreshold(uint8 m, uint8 n, bytes32 seed) public {
vm.assume(0 < m && m <= n && n < 10);
address[] memory expectedIsms = deployIsms(m, n, seed);
(address[] memory actualIsms, uint8 actualThreshold) = ism

@ -21,10 +21,9 @@ contract DomainRoutingIsmTest is Test {
ism.initialize(address(this));
}
function deployTestIsm(bytes32 requiredMetadata)
internal
returns (TestIsm)
{
function deployTestIsm(
bytes32 requiredMetadata
) internal returns (TestIsm) {
return new TestIsm(abi.encode(requiredMetadata));
}
@ -63,9 +62,10 @@ contract DomainRoutingIsmTest is Test {
}
}
function testSetNonOwner(uint32 domain, IInterchainSecurityModule _ism)
public
{
function testSetNonOwner(
uint32 domain,
IInterchainSecurityModule _ism
) public {
vm.prank(NON_OWNER);
vm.expectRevert("Ownable: caller is not the owner");
ism.set(domain, _ism);

@ -214,11 +214,10 @@ contract ERC5164IsmTest is Test {
/* ============ helper functions ============ */
function _encodeTestMessage(uint32 _msgCount, address _receipient)
internal
view
returns (bytes memory)
{
function _encodeTestMessage(
uint32 _msgCount,
address _receipient
) internal view returns (bytes memory) {
return
MessageUtils.formatMessage(
VERSION,

@ -45,11 +45,10 @@ contract TestIsm is IInterchainSecurityModule {
requiredMetadata = _requiredMetadata;
}
function verify(bytes calldata _metadata, bytes calldata)
external
view
returns (bool)
{
function verify(
bytes calldata _metadata,
bytes calldata
) external view returns (bool) {
return keccak256(_metadata) == keccak256(requiredMetadata);
}
}

@ -28,11 +28,9 @@ abstract contract AbstractMultisigIsmTest is Test {
TestPostDispatchHook internal noopHook;
TestMailbox mailbox;
function metadataPrefix(bytes memory message)
internal
view
virtual
returns (bytes memory);
function metadataPrefix(
bytes memory message
) internal view virtual returns (bytes memory);
function getMetadata(
uint8 m,
@ -138,12 +136,9 @@ contract MerkleRootMultisigIsmTest is AbstractMultisigIsmTest {
}
// TODO: test merkleIndex != signedIndex
function metadataPrefix(bytes memory message)
internal
view
override
returns (bytes memory)
{
function metadataPrefix(
bytes memory message
) internal view override returns (bytes memory) {
uint32 checkpointIndex = uint32(merkleTreeHook.count() - 1);
return
abi.encodePacked(
@ -169,12 +164,9 @@ contract MessageIdMultisigIsmTest is AbstractMultisigIsmTest {
mailbox.setRequiredHook(address(noopHook));
}
function metadataPrefix(bytes memory)
internal
view
override
returns (bytes memory)
{
function metadataPrefix(
bytes memory
) internal view override returns (bytes memory) {
(bytes32 root, uint32 index) = merkleTreeHook.latestCheckpoint();
return
abi.encodePacked(

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save