Merge core and app packages (#1169)

* Merge core and app packages

* Fix test

* Fix test

* Dockerfile

* Fix test
pull/1174/head
Nam Chu Hoai 2 years ago committed by GitHub
parent 03b2e4c5b7
commit 6bb358a0e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/node.yml
  2. 2
      .gitignore
  3. 3
      Dockerfile
  4. 2
      package.json
  5. 0
      solidity/.env.example
  6. 0
      solidity/.gitignore
  7. 3
      solidity/.solcover.js
  8. 0
      solidity/.solhint.json
  9. 0
      solidity/README.md
  10. 3
      solidity/app/.solcover.js
  11. 34
      solidity/app/hardhat.config.ts
  12. 54
      solidity/app/package.json
  13. 9
      solidity/app/tsconfig.json
  14. 6
      solidity/contracts/AbacusConnectionClient.sol
  15. 0
      solidity/contracts/AbacusConnectionManager.sol
  16. 0
      solidity/contracts/Create2Factory.sol
  17. 0
      solidity/contracts/Inbox.sol
  18. 0
      solidity/contracts/InterchainGasPaymaster.sol
  19. 0
      solidity/contracts/Mailbox.sol
  20. 0
      solidity/contracts/MerkleTreeManager.sol
  21. 0
      solidity/contracts/Outbox.sol
  22. 8
      solidity/contracts/Router.sol
  23. 0
      solidity/contracts/libs/Merkle.sol
  24. 0
      solidity/contracts/libs/Message.sol
  25. 0
      solidity/contracts/libs/TypeCasts.sol
  26. 0
      solidity/contracts/mock/MockInbox.sol
  27. 0
      solidity/contracts/mock/MockOutbox.sol
  28. 0
      solidity/contracts/test/MysteryMath.sol
  29. 0
      solidity/contracts/test/MysteryMathV1.sol
  30. 0
      solidity/contracts/test/MysteryMathV2.sol
  31. 2
      solidity/contracts/test/TestAbacusConnectionClient.sol
  32. 0
      solidity/contracts/test/TestInbox.sol
  33. 0
      solidity/contracts/test/TestMailbox.sol
  34. 0
      solidity/contracts/test/TestMerkle.sol
  35. 0
      solidity/contracts/test/TestMessage.sol
  36. 0
      solidity/contracts/test/TestMultisigValidatorManager.sol
  37. 0
      solidity/contracts/test/TestOutbox.sol
  38. 0
      solidity/contracts/test/TestRecipient.sol
  39. 0
      solidity/contracts/test/TestRouter.sol
  40. 0
      solidity/contracts/test/TestSendReceiver.sol
  41. 0
      solidity/contracts/test/TestValidatorManager.sol
  42. 0
      solidity/contracts/test/bad-recipient/BadRecipient1.sol
  43. 0
      solidity/contracts/test/bad-recipient/BadRecipient2.sol
  44. 0
      solidity/contracts/test/bad-recipient/BadRecipient3.sol
  45. 0
      solidity/contracts/test/bad-recipient/BadRecipient5.sol
  46. 0
      solidity/contracts/test/bad-recipient/BadRecipient6.sol
  47. 0
      solidity/contracts/upgrade/UpgradeBeacon.sol
  48. 0
      solidity/contracts/upgrade/UpgradeBeaconController.sol
  49. 0
      solidity/contracts/upgrade/UpgradeBeaconProxy.sol
  50. 0
      solidity/contracts/upgrade/Versioned.sol
  51. 0
      solidity/contracts/validator-manager/InboxValidatorManager.sol
  52. 0
      solidity/contracts/validator-manager/MultisigValidatorManager.sol
  53. 0
      solidity/contracts/validator-manager/OutboxValidatorManager.sol
  54. 8
      solidity/core/.gitignore
  55. 3
      solidity/core/.solcover.js
  56. 10
      solidity/core/.solhint.json
  57. 9
      solidity/core/tsconfig.json
  58. 0
      solidity/hardhat.config.ts
  59. 0
      solidity/interfaces/IAbacusConnectionManager.sol
  60. 0
      solidity/interfaces/IInbox.sol
  61. 0
      solidity/interfaces/IInterchainGasPaymaster.sol
  62. 0
      solidity/interfaces/IMailbox.sol
  63. 0
      solidity/interfaces/IMessageRecipient.sol
  64. 0
      solidity/interfaces/IMultisigValidatorManager.sol
  65. 0
      solidity/interfaces/IOutbox.sol
  66. 0
      solidity/package.json
  67. 0
      solidity/test/.eslintrc
  68. 3
      solidity/test/abacusConnectionClient.test.ts
  69. 0
      solidity/test/abacusConnectionManager.test.ts
  70. 0
      solidity/test/inbox.test.ts
  71. 0
      solidity/test/interchainGasPaymaster.test.ts
  72. 0
      solidity/test/lib/mailboxes.ts
  73. 0
      solidity/test/lib/upgrade.ts
  74. 0
      solidity/test/mailbox.test.ts
  75. 2
      solidity/test/merkle.test.ts
  76. 2
      solidity/test/message.test.ts
  77. 0
      solidity/test/mockMailbox.test.ts
  78. 0
      solidity/test/outbox.test.ts
  79. 6
      solidity/test/router.test.ts
  80. 0
      solidity/test/testSendReceiver.test.ts
  81. 0
      solidity/test/testrecipient.test.ts
  82. 0
      solidity/test/upgrade.test.ts
  83. 0
      solidity/test/validator-manager/inboxValidatorManager.test.ts
  84. 2
      solidity/test/validator-manager/multisigValidatorManager.test.ts
  85. 0
      solidity/test/validator-manager/outboxValidatorManager.test.ts
  86. 0
      solidity/test/validator-manager/utils.ts
  87. 8
      solidity/tsconfig.json
  88. 2
      solidity/update_abis.sh
  89. 2
      typescript/helloworld/contracts/HelloWorld.sol
  90. 2
      typescript/ica/contracts/InterchainAccountRouter.sol
  91. 2
      typescript/ica/contracts/InterchainQueryRouter.sol
  92. 2
      typescript/ica/package.json
  93. 1
      typescript/sdk/package.json
  94. 4
      typescript/sdk/src/router.ts
  95. 2
      typescript/sdk/src/test/envSubsetDeployer/app.ts
  96. 37
      yarn.lock

@ -109,5 +109,3 @@ jobs:
- name: core
run: yarn workspace @hyperlane-xyz/core run test
- name: app
run: yarn workspace @hyperlane-xyz/app run test

2
.gitignore vendored

@ -19,7 +19,7 @@ tmp.env
typescript/*/node_modules
typescript/infra/config/environments/test/create2/*json
typescript/infra/config/environments/test/testrecipient/*json
solidity/*/artifacts
solidity/artifacts
.yarn/install-state.gz
.yarn/cache

@ -16,8 +16,7 @@ COPY typescript/sdk/package.json ./typescript/sdk/
COPY typescript/helloworld/package.json ./typescript/helloworld/
COPY typescript/ica/package.json ./typescript/ica/
COPY typescript/infra/package.json ./typescript/infra/
COPY solidity/core/package.json ./solidity/core/
COPY solidity/app/package.json ./solidity/app/
COPY solidity/package.json ./solidity/
RUN yarn install && yarn cache clean

@ -26,7 +26,7 @@
"publish:all": "yarn workspaces foreach --no-private --verbose --topological npm publish --access public"
},
"workspaces": [
"solidity/*",
"solidity",
"typescript/*"
],
"resolutions": {

@ -0,0 +1,3 @@
module.exports = {
skipFiles: ['test'],
};

@ -1,3 +0,0 @@
module.exports = {
skipFiles: ["test"],
};

@ -1,34 +0,0 @@
import '@nomiclabs/hardhat-waffle';
import '@typechain/hardhat';
import 'hardhat-gas-reporter';
import 'solidity-coverage';
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
compilers: [
{
version: '0.8.16',
},
{
version: '0.7.6',
settings: {
optimizer: {
enabled: true,
runs: 999999,
},
},
},
],
},
gasReporter: {
currency: 'USD',
},
typechain: {
outDir: './types',
target: 'ethers-v5',
alwaysGenerateOverloads: false,
},
};

@ -1,54 +0,0 @@
{
"name": "@hyperlane-xyz/app",
"description": "Solidity contracts for Hyperlane apps",
"version": "0.5.1",
"dependencies": {
"@hyperlane-xyz/core": "0.5.1",
"@hyperlane-xyz/utils": "0.5.1",
"@openzeppelin/contracts-upgradeable": "^4.5.0"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@nomiclabs/hardhat-waffle": "^2.0.2",
"@typechain/ethers-v5": "10.0.0",
"@typechain/hardhat": "^6.0.0",
"@types/mocha": "^9.1.0",
"chai": "^4.3.0",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.6.8",
"hardhat": "^2.8.4",
"hardhat-gas-reporter": "^1.0.7",
"prettier": "^2.4.1",
"prettier-plugin-solidity": "^1.0.0-beta.5",
"solhint": "^3.3.2",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.7.14",
"ts-node": "^10.8.0",
"typechain": "8.0.0",
"typescript": "^4.7.2"
},
"directories": {
"test": "test"
},
"files": [
"/dist",
"/contracts",
"/interfaces"
],
"homepage": "https://www.hyperlane.xyz",
"keywords": [
"Hyperlane",
"Solidity"
],
"license": "Apache-2.0",
"main": "dist/index.js",
"repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo",
"scripts": {
"build": "hardhat compile && tsc",
"clean": "hardhat clean && rm -rf ./dist ./cache",
"coverage": "hardhat coverage",
"prettier": "prettier --write ./contracts ./test",
"test": "hardhat test"
},
"types": "dist/index.d.ts"
}

@ -1,9 +0,0 @@
{
"compilerOptions": {
"outDir": "./dist/",
"rootDir": "./types/"
},
"exclude": ["./node_modules/", "./dist/", "./types/hardhat.d.ts"],
"extends": "../../tsconfig.json",
"include": ["./types/**/*.ts"]
}

@ -2,9 +2,9 @@
pragma solidity >=0.6.11;
// ============ Internal Imports ============
import {IInterchainGasPaymaster} from "@hyperlane-xyz/core/interfaces/IInterchainGasPaymaster.sol";
import {IOutbox} from "@hyperlane-xyz/core/interfaces/IOutbox.sol";
import {IAbacusConnectionManager} from "@hyperlane-xyz/core/interfaces/IAbacusConnectionManager.sol";
import {IInterchainGasPaymaster} from "../interfaces/IInterchainGasPaymaster.sol";
import {IOutbox} from "../interfaces/IOutbox.sol";
import {IAbacusConnectionManager} from "../interfaces/IAbacusConnectionManager.sol";
// ============ External Imports ============
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

@ -3,10 +3,10 @@ pragma solidity >=0.6.11;
// ============ Internal Imports ============
import {AbacusConnectionClient} from "./AbacusConnectionClient.sol";
import {IAbacusConnectionManager} from "@hyperlane-xyz/core/interfaces/IAbacusConnectionManager.sol";
import {IInterchainGasPaymaster} from "@hyperlane-xyz/core/interfaces/IInterchainGasPaymaster.sol";
import {IMessageRecipient} from "@hyperlane-xyz/core/interfaces/IMessageRecipient.sol";
import {IOutbox} from "@hyperlane-xyz/core/interfaces/IOutbox.sol";
import {IAbacusConnectionManager} from "../interfaces/IAbacusConnectionManager.sol";
import {IInterchainGasPaymaster} from "../interfaces/IInterchainGasPaymaster.sol";
import {IMessageRecipient} from "../interfaces/IMessageRecipient.sol";
import {IOutbox} from "../interfaces/IOutbox.sol";
abstract contract Router is AbacusConnectionClient, IMessageRecipient {
string constant NO_ROUTER_ENROLLED_REVERT_MESSAGE =

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
import {IOutbox} from "@hyperlane-xyz/core/interfaces/IOutbox.sol";
import {IOutbox} from "../../interfaces/IOutbox.sol";
import "../AbacusConnectionClient.sol";

@ -1,8 +0,0 @@
node_modules/
cache/
artifacts/
types/
dist/
coverage/
coverage.json
.env

@ -1,3 +0,0 @@
module.exports = {
skipFiles: ["test"],
};

@ -1,10 +0,0 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "^0.6.11"],
"func-visibility": ["warn", {"ignoreConstructors":true}],
"not-rely-on-time": "off",
"avoid-low-level-calls": "off",
"no-inline-assembly": "off"
}
}

@ -1,9 +0,0 @@
{
"compilerOptions": {
"outDir": "./dist/",
"rootDir": "./types/"
},
"exclude": ["./node_modules/", "./dist/", "./types/hardhat.d.ts"],
"extends": "../../tsconfig.json",
"include": ["./types/**/*.ts"]
}

@ -10,8 +10,7 @@ import {
Outbox__factory,
TestInbox__factory,
TestMultisigValidatorManager__factory,
} from '@hyperlane-xyz/core';
} from '../types';
import {
TestAbacusConnectionClient,
TestAbacusConnectionClient__factory,

@ -1,7 +1,7 @@
import { expect } from 'chai';
import { ethers } from 'hardhat';
import merkleTestCases from '../../../vectors/merkle.json';
import merkleTestCases from '../../vectors/merkle.json';
import { TestMerkle, TestMerkle__factory } from '../types';
describe('Merkle', async () => {

@ -5,7 +5,7 @@ import { utils } from '@hyperlane-xyz/utils';
import { TestMessage, TestMessage__factory } from '../types';
const testCases = require('../../../vectors/message.json');
const testCases = require('../../vectors/message.json');
const remoteDomain = 1000;
const localDomain = 2000;

@ -4,6 +4,8 @@ import { expect } from 'chai';
import { ContractTransaction } from 'ethers';
import { ethers } from 'hardhat';
import { utils } from '@hyperlane-xyz/utils';
import {
AbacusConnectionManager,
AbacusConnectionManager__factory,
@ -14,9 +16,7 @@ import {
TestInbox,
TestInbox__factory,
TestMultisigValidatorManager__factory,
} from '@hyperlane-xyz/core';
import { utils } from '@hyperlane-xyz/utils';
} from '../types';
import { TestRouter, TestRouter__factory } from '../types';
const ONLY_OWNER_REVERT_MSG = 'Ownable: caller is not the owner';

@ -16,7 +16,7 @@ const OUTBOX_DOMAIN = 1234;
const QUORUM_THRESHOLD = 1;
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
const domainHashTestCases = require('../../../../vectors/domainHash.json');
const domainHashTestCases = require('../../../vectors/domainHash.json');
describe('MultisigValidatorManager', async () => {
let validatorManager: TestMultisigValidatorManager,

@ -1,3 +1,9 @@
{
"extends": "../tsconfig.json"
"compilerOptions": {
"outDir": "./dist/",
"rootDir": "./types/"
},
"exclude": ["./node_modules/", "./dist/", "./types/hardhat.d.ts"],
"extends": "../tsconfig.json",
"include": ["./types/**/*.ts"]
}

@ -4,7 +4,7 @@ copy() {
# Optionally allow path to be passed in, and extract the contract name
# as the string following the last instance of `/`
CONTRACT_NAME="${1##*/}"
jq .abi < artifacts/contracts/"$1".sol/"$CONTRACT_NAME".json > ../../rust/chains/abacus-ethereum/abis/"$CONTRACT_NAME".abi.json
jq .abi < artifacts/contracts/"$1".sol/"$CONTRACT_NAME".json > ../rust/chains/abacus-ethereum/abis/"$CONTRACT_NAME".abi.json
}
copy Inbox && copy Outbox && copy validator-manager/InboxValidatorManager && copy InterchainGasPaymaster

@ -2,7 +2,7 @@
pragma solidity ^0.8.13;
// ============ External Imports ============
import {Router} from "@hyperlane-xyz/app/contracts/Router.sol";
import {Router} from "@hyperlane-xyz/core/contracts/Router.sol";
/*
* @title The Hello World App

@ -4,7 +4,7 @@ pragma solidity ^0.8.13;
import {OwnableMulticall, Call} from "./OwnableMulticall.sol";
// ============ External Imports ============
import {Router} from "@hyperlane-xyz/app/contracts/Router.sol";
import {Router} from "@hyperlane-xyz/core/contracts/Router.sol";
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

@ -4,7 +4,7 @@ pragma solidity ^0.8.13;
import {OwnableMulticall, Call} from "./OwnableMulticall.sol";
// ============ External Imports ============
import {Router} from "@hyperlane-xyz/app/contracts/Router.sol";
import {Router} from "@hyperlane-xyz/core/contracts/Router.sol";
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

@ -3,7 +3,7 @@
"description": "A router middleware for interchain accounts",
"version": "0.5.1",
"dependencies": {
"@hyperlane-xyz/app": "0.5.1",
"@hyperlane-xyz/core": "0.5.1",
"@hyperlane-xyz/sdk": "0.5.1",
"@hyperlane-xyz/utils": "0.5.1",
"@openzeppelin/contracts-upgradeable": "^4.6.0",

@ -3,7 +3,6 @@
"description": "The official SDK for the Hyperlane Network",
"version": "0.5.1",
"dependencies": {
"@hyperlane-xyz/app": "0.5.1",
"@hyperlane-xyz/celo-ethers-provider": "^0.1.1",
"@hyperlane-xyz/core": "0.5.1",
"@hyperlane-xyz/utils": "0.5.1",

@ -1,6 +1,6 @@
import type { ethers } from 'ethers';
import { Router } from '@hyperlane-xyz/app';
import { Router } from '@hyperlane-xyz/core';
import type { types } from '@hyperlane-xyz/utils';
import { HyperlaneContracts, HyperlaneFactories } from './contracts';
@ -25,4 +25,4 @@ export type ConnectionClientConfig = {
interchainGasPaymaster: types.Address;
};
export { Router } from '@hyperlane-xyz/app';
export { Router } from '@hyperlane-xyz/core';

@ -1,4 +1,4 @@
import { TestRouter__factory } from '@hyperlane-xyz/app';
import { TestRouter__factory } from '@hyperlane-xyz/core';
import { HyperlaneApp } from '../../HyperlaneApp';
import { chainConnectionConfigs } from '../../consts/chainConnectionConfigs';

@ -3677,34 +3677,6 @@ __metadata:
languageName: node
linkType: hard
"@hyperlane-xyz/app@0.5.1, @hyperlane-xyz/app@workspace:solidity/app":
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/app@workspace:solidity/app"
dependencies:
"@hyperlane-xyz/core": 0.5.1
"@hyperlane-xyz/utils": 0.5.1
"@nomiclabs/hardhat-ethers": ^2.0.5
"@nomiclabs/hardhat-waffle": ^2.0.2
"@openzeppelin/contracts-upgradeable": ^4.5.0
"@typechain/ethers-v5": 10.0.0
"@typechain/hardhat": ^6.0.0
"@types/mocha": ^9.1.0
chai: ^4.3.0
ethereum-waffle: ^3.4.4
ethers: ^5.6.8
hardhat: ^2.8.4
hardhat-gas-reporter: ^1.0.7
prettier: ^2.4.1
prettier-plugin-solidity: ^1.0.0-beta.5
solhint: ^3.3.2
solhint-plugin-prettier: ^0.0.5
solidity-coverage: ^0.7.14
ts-node: ^10.8.0
typechain: 8.0.0
typescript: ^4.7.2
languageName: unknown
linkType: soft
"@hyperlane-xyz/celo-ethers-provider@npm:^0.1.1":
version: 0.1.1
resolution: "@hyperlane-xyz/celo-ethers-provider@npm:0.1.1"
@ -3714,9 +3686,9 @@ __metadata:
languageName: node
linkType: hard
"@hyperlane-xyz/core@0.5.1, @hyperlane-xyz/core@workspace:solidity/core":
"@hyperlane-xyz/core@0.5.1, @hyperlane-xyz/core@workspace:solidity":
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/core@workspace:solidity/core"
resolution: "@hyperlane-xyz/core@workspace:solidity"
dependencies:
"@hyperlane-xyz/utils": 0.5.1
"@nomiclabs/hardhat-ethers": ^2.0.5
@ -3819,7 +3791,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/interchain-accounts@workspace:typescript/ica"
dependencies:
"@hyperlane-xyz/app": 0.5.1
"@hyperlane-xyz/core": 0.5.1
"@hyperlane-xyz/sdk": 0.5.1
"@hyperlane-xyz/utils": 0.5.1
"@nomicfoundation/hardhat-chai-matchers": ^1.0.3
@ -3870,7 +3842,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/sdk@workspace:typescript/sdk"
dependencies:
"@hyperlane-xyz/app": 0.5.1
"@hyperlane-xyz/celo-ethers-provider": ^0.1.1
"@hyperlane-xyz/core": 0.5.1
"@hyperlane-xyz/utils": 0.5.1
@ -4235,7 +4206,7 @@ __metadata:
languageName: node
linkType: hard
"@openzeppelin/contracts-upgradeable@npm:^4.5.0, @openzeppelin/contracts-upgradeable@npm:^4.6.0":
"@openzeppelin/contracts-upgradeable@npm:^4.6.0":
version: 4.6.0
resolution: "@openzeppelin/contracts-upgradeable@npm:4.6.0"
checksum: f9802c9cccf31bd475412ba5d862ed15eed5352302c30b29c38f84aed2dcfe0d957687935a72068f3d44292a4a55b0ff26cd018b2e14a47f16f74f087009aa29

Loading…
Cancel
Save