Skip to content

Commit

Permalink
Merge branch 'main' of github.com:abacus-network/abacus-monorepo into…
Browse files Browse the repository at this point in the history
… trevor/add-contract-address-bytes
  • Loading branch information
tkporter committed Jan 19, 2024
2 parents c092d9b + ae4476a commit df106ca
Show file tree
Hide file tree
Showing 53 changed files with 402 additions and 189 deletions.
7 changes: 0 additions & 7 deletions .changeset/dirty-ears-push.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/fast-pillows-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/utils': patch
---

Add isAddress function to check if string matches EVM, Cosmos, or Solana address formats
6 changes: 6 additions & 0 deletions .changeset/healthy-suits-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/infra': patch
'@hyperlane-xyz/sdk': patch
---

Bumped mantapacific reorgPeriod to 1, a reorg period in chain metadata is now required by infra.
5 changes: 0 additions & 5 deletions .changeset/healthy-waves-cheat.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/modern-guests-push.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/old-lizards-melt.md

This file was deleted.

7 changes: 7 additions & 0 deletions .changeset/thirty-pandas-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@hyperlane-xyz/core': patch
'@hyperlane-xyz/infra': patch
'@hyperlane-xyz/sdk': patch
---

Support pausable ISM in deployer and checker
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
key: ${{ github.sha }}

- name: Unit Tests
run: yarn test
run: yarn test:ci

metadata-check:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:

coverage:
runs-on: ubuntu-latest
needs: [yarn-build]
needs: [yarn-test]

steps:
- uses: actions/checkout@v3
Expand All @@ -283,6 +283,9 @@ jobs:
!./rust
key: ${{ github.sha }}

- name: foundry-install
uses: onbjerg/foundry-toolchain@v1

- name: Run tests with coverage
run: yarn coverage
env:
Expand All @@ -291,4 +294,4 @@ jobs:
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"prettier": "yarn workspaces foreach --since --parallel run prettier",
"lint": "yarn workspaces foreach --since --parallel run lint",
"test": "yarn workspaces foreach --all --parallel run test",
"coverage": "yarn workspaces foreach --since --parallel run coverage",
"test:ci": "yarn workspaces foreach --all --parallel run test:ci",
"coverage": "yarn workspaces foreach --all --parallel run coverage",
"version:prepare": "yarn changeset version && yarn workspaces foreach --all --parallel run version:update && yarn install --no-immutable",
"version:check": "yarn changeset status",
"release": "yarn build && yarn changeset publish",
Expand Down
2 changes: 1 addition & 1 deletion rust/config/mainnet3_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
},
"blocks": {
"confirmations": 1,
"reorgPeriod": 0,
"reorgPeriod": 1,
"estimateBlockTime": 3
},
"rpcUrls": [
Expand Down
6 changes: 6 additions & 0 deletions solidity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @hyperlane-xyz/core

## 3.6.0

### Patch Changes

- @hyperlane-xyz/utils@3.6.0

## 3.5.1

### Patch Changes
Expand Down
4 changes: 4 additions & 0 deletions solidity/contracts/isms/PausableIsm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import {IInterchainSecurityModule} from "../interfaces/IInterchainSecurityModule
contract PausableIsm is IInterchainSecurityModule, Ownable, Pausable {
uint8 public constant override moduleType = uint8(Types.NULL);

constructor(address owner) Ownable() Pausable() {
_transferOwnership(owner);
}

/**
* @inheritdoc IInterchainSecurityModule
* @dev Reverts when paused, otherwise returns `true`.
Expand Down
4 changes: 3 additions & 1 deletion solidity/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# generates lcov.info
forge coverage --report lcov
forge coverage --report lcov --no-match-test testFork

if ! command -v lcov &>/dev/null; then
echo "lcov is not installed. Installing..."
Expand Down
4 changes: 2 additions & 2 deletions solidity/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ optimizer_runs = 999_999
verbosity = 4

[rpc_endpoints]
mainnet = "https://rpc.ankr.com/eth"
optimism = "https://rpc.ankr.com/optimism"
mainnet = "https://eth.merkle.io"
optimism = "https://optimism.llamarpc.com"
5 changes: 3 additions & 2 deletions solidity/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@hyperlane-xyz/core",
"description": "Core solidity contracts for Hyperlane",
"version": "3.5.1",
"version": "3.6.0",
"dependencies": {
"@eth-optimism/contracts": "^0.6.0",
"@hyperlane-xyz/utils": "3.5.1",
"@hyperlane-xyz/utils": "3.6.0",
"@openzeppelin/contracts": "^4.9.3",
"@openzeppelin/contracts-upgradeable": "^v4.9.3"
},
Expand Down Expand Up @@ -54,6 +54,7 @@
"storage": "./storage.sh",
"prettier": "prettier --write ./contracts ./test",
"test": "hardhat test && forge test -vvv",
"test:ci": "hardhat test && forge test --no-match-test testFork -vvv",
"gas": "forge snapshot",
"gas-ci": "yarn gas --check --tolerance 2 || (echo 'Manually update gas snapshot' && exit 1)",
"slither": "slither ."
Expand Down
4 changes: 2 additions & 2 deletions solidity/test/isms/OPStackIsm.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ contract OPStackIsmTest is Test {

function setUp() public {
// block numbers to fork from, chain data is cached to ../../forge-cache/
mainnetFork = vm.createFork(vm.rpcUrl("mainnet"), 17_586_909);
optimismFork = vm.createFork(vm.rpcUrl("optimism"), 106_233_774);
mainnetFork = vm.createFork(vm.rpcUrl("mainnet"), 18_992_500);
optimismFork = vm.createFork(vm.rpcUrl("optimism"), 114_696_811);

testRecipient = new TestRecipient();

Expand Down
13 changes: 12 additions & 1 deletion solidity/test/isms/PausableIsm.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,35 @@ import {PausableIsm} from "../../contracts/isms/PausableIsm.sol";
contract PausableIsmTest is Test {
PausableIsm ism;

address owner;

function setUp() public {
ism = new PausableIsm();
owner = msg.sender;
ism = new PausableIsm(owner);
}

function test_verify() public {
assertTrue(ism.verify("", ""));
vm.prank(owner);
ism.pause();
vm.expectRevert(bytes("Pausable: paused"));
ism.verify("", "");
}

function test_pause() public {
vm.expectRevert(bytes("Ownable: caller is not the owner"));
ism.pause();
vm.prank(owner);
ism.pause();
assertTrue(ism.paused());
}

function test_unpause() public {
vm.prank(owner);
ism.pause();
vm.expectRevert(bytes("Ownable: caller is not the owner"));
ism.unpause();
vm.prank(owner);
ism.unpause();
assertFalse(ism.paused());
}
Expand Down
12 changes: 12 additions & 0 deletions typescript/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @hyperlane-xyz/cli

## 3.6.0

### Patch Changes

- 67a6d971e: Added `shouldRecover` flag to deployContractFromFactory so that the `TestRecipientDeployer` can deploy new contracts if it's not the owner of the prior deployments (We were recovering the SDK artifacts which meant the deployer won't be able to set the ISM as they needed)
- Updated dependencies [67a6d971e]
- Updated dependencies [612d4163a]
- Updated dependencies [0488ef31d]
- Updated dependencies [8d8ba3f7a]
- @hyperlane-xyz/sdk@3.6.0
- @hyperlane-xyz/utils@3.6.0

## 3.5.1

### Patch Changes
Expand Down
7 changes: 4 additions & 3 deletions typescript/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@hyperlane-xyz/cli",
"version": "3.5.1",
"version": "3.6.0",
"description": "A command-line utility for common Hyperlane operations",
"dependencies": {
"@hyperlane-xyz/sdk": "3.5.1",
"@hyperlane-xyz/utils": "3.5.1",
"@hyperlane-xyz/sdk": "3.6.0",
"@hyperlane-xyz/utils": "3.6.0",
"@inquirer/prompts": "^3.0.0",
"bignumber.js": "^9.1.1",
"chalk": "^5.3.0",
Expand Down Expand Up @@ -35,6 +35,7 @@
"lint": "eslint . --ext .ts",
"prettier": "prettier --write ./src ./examples",
"test": "mocha --config .mocharc.json",
"test:ci": "yarn test",
"version:update": "echo \"export const VERSION = '$npm_package_version';\" > src/version.ts"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion typescript/cli/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '3.5.1';
export const VERSION = '3.6.0';
11 changes: 11 additions & 0 deletions typescript/helloworld/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @hyperlane-xyz/helloworld

## 3.6.0

### Patch Changes

- Updated dependencies [67a6d971e]
- Updated dependencies [612d4163a]
- Updated dependencies [0488ef31d]
- Updated dependencies [8d8ba3f7a]
- @hyperlane-xyz/sdk@3.6.0
- @hyperlane-xyz/core@3.6.0

## 3.5.1

### Patch Changes
Expand Down
7 changes: 4 additions & 3 deletions typescript/helloworld/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@hyperlane-xyz/helloworld",
"description": "A basic skeleton of an Hyperlane app",
"version": "3.5.1",
"version": "3.6.0",
"dependencies": {
"@hyperlane-xyz/core": "3.5.1",
"@hyperlane-xyz/sdk": "3.5.1",
"@hyperlane-xyz/core": "3.6.0",
"@hyperlane-xyz/sdk": "3.6.0",
"@openzeppelin/contracts-upgradeable": "^4.9.3",
"ethers": "^5.7.2"
},
Expand Down Expand Up @@ -56,6 +56,7 @@
"lint": "solhint contracts/**/*.sol && eslint . --ext .ts",
"prettier": "prettier --write ./contracts ./src",
"test": "hardhat test ./src/test/**/*.test.ts",
"test:ci": "yarn test",
"sync": "ts-node scripts/sync-with-template-repo.ts"
},
"types": "dist/src/index.d.ts",
Expand Down
13 changes: 13 additions & 0 deletions typescript/infra/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @hyperlane-xyz/infra

## 3.6.0

### Patch Changes

- 67a6d971e: Added `shouldRecover` flag to deployContractFromFactory so that the `TestRecipientDeployer` can deploy new contracts if it's not the owner of the prior deployments (We were recovering the SDK artifacts which meant the deployer won't be able to set the ISM as they needed)
- Updated dependencies [67a6d971e]
- Updated dependencies [612d4163a]
- Updated dependencies [0488ef31d]
- Updated dependencies [8d8ba3f7a]
- @hyperlane-xyz/sdk@3.6.0
- @hyperlane-xyz/helloworld@3.6.0
- @hyperlane-xyz/utils@3.6.0

## 3.5.1

### Patch Changes
Expand Down
59 changes: 54 additions & 5 deletions typescript/infra/config/environments/mainnet3/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,67 @@ import { BigNumber, ethers } from 'ethers';

import {
AggregationHookConfig,
AggregationIsmConfig,
ChainMap,
CoreConfig,
HookType,
IgpHookConfig,
IsmType,
MerkleTreeHookConfig,
MultisigConfig,
MultisigIsmConfig,
PausableHookConfig,
PausableIsmConfig,
ProtocolFeeHookConfig,
RoutingIsmConfig,
defaultMultisigConfigs,
} from '@hyperlane-xyz/sdk';
import { objMap } from '@hyperlane-xyz/utils';

import { Contexts } from '../../contexts';
import { routingIsm } from '../../routingIsm';

import { supportedChainNames } from './chains';
import { igp } from './igp';
import { owners, safes } from './owners';

export const core: ChainMap<CoreConfig> = objMap(owners, (local, owner) => {
const defaultIsm = routingIsm('mainnet3', local, Contexts.Hyperlane);
const originMultisigs: ChainMap<MultisigConfig> = Object.fromEntries(
supportedChainNames
.filter((chain) => chain !== local)
.map((origin) => [origin, defaultMultisigConfigs[origin]]),
);

const merkleRoot = (multisig: MultisigConfig): MultisigIsmConfig => ({
type: IsmType.MERKLE_ROOT_MULTISIG,
...multisig,
});

const messageIdIsm = (multisig: MultisigConfig): MultisigIsmConfig => ({
type: IsmType.MESSAGE_ID_MULTISIG,
...multisig,
});

const routingIsm: RoutingIsmConfig = {
type: IsmType.ROUTING,
domains: objMap(
originMultisigs,
(_, multisig): AggregationIsmConfig => ({
type: IsmType.AGGREGATION,
modules: [messageIdIsm(multisig), merkleRoot(multisig)],
threshold: 1,
}),
),
owner,
};

const pausableIsm: PausableIsmConfig = {
type: IsmType.PAUSABLE,
owner,
};

const defaultIsm: AggregationIsmConfig = {
type: IsmType.AGGREGATION,
modules: [routingIsm, pausableIsm],
threshold: 2,
};

const merkleHook: MerkleTreeHookConfig = {
type: HookType.MERKLE_TREE,
Expand All @@ -29,9 +73,14 @@ export const core: ChainMap<CoreConfig> = objMap(owners, (local, owner) => {
...igp[local],
};

const pausableHook: PausableHookConfig = {
type: HookType.PAUSABLE,
owner,
};

const defaultHook: AggregationHookConfig = {
type: HookType.AGGREGATION,
hooks: [merkleHook, igpHook],
hooks: [pausableHook, merkleHook, igpHook],
};

const requiredHook: ProtocolFeeHookConfig = {
Expand Down
Loading

0 comments on commit df106ca

Please sign in to comment.