Skip to content

Commit

Permalink
Merge branch 'main' into trevor/new-featv3-cosmos-oct-28
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-savu committed Nov 22, 2023
2 parents b0f1128 + c41345c commit dbc351e
Show file tree
Hide file tree
Showing 306 changed files with 18,314 additions and 13,594 deletions.
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@typescript-eslint/no-require-imports": ["warn"],
"@typescript-eslint/no-unused-vars": [
"error",
{
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
Expand All @@ -48,4 +48,4 @@
}
]
}
}
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
typescript/sdk/src/cw-types/*.types.ts linguist-generated=true
rust/chains/hyperlane-ethereum/abis/*.abi.json linguist-generated=true
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ typescript/token @yorhodes @jmrossy @tkporter @aroralanuk
## Hello World
typescript/helloworld @yorhodes @nambrot

## CLI
typescript/cli @jmrossy @yorhodes @aroralanuk

## Infra
typescript/infra @tkporter @nambrot
6 changes: 3 additions & 3 deletions .github/workflows/agent-release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
matrix:
include:
- TARGET: x86_64-unknown-linux-gnu
OS: ubuntu-latest
OS: larger-runner
- TARGET: x86_64-apple-darwin
OS: macos-latest
- TARGET: aarch64-apple-darwin
Expand All @@ -45,7 +45,7 @@ jobs:
- name: checkout
uses: actions/checkout@v3
- name: ubuntu setup
if: ${{ matrix.OS == 'ubuntu-latest' }}
if: ${{ matrix.OS == 'larger-runner' }}
run: |
sudo apt-get update -qq
sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf
Expand All @@ -70,7 +70,7 @@ jobs:
run: cargo build --release --target ${{ matrix.TARGET }} --bin relayer --bin scraper --bin validator
working-directory: ./rust
- name: make executable
if: ${{ matrix.OS == 'ubuntu-latest' || matrix.OS == 'macos-latest' }}
if: ${{ matrix.OS == 'larger-runner' || matrix.OS == 'macos-latest' }}
run: chmod ug+x,-w relayer scraper validator
working-directory: rust/target/${{ matrix.TARGET }}/release
- name: upload binaries
Expand Down
66 changes: 41 additions & 25 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: node
on:
# Triggers the workflow on push or pull request against main
push:
branches: [v3]
branches: [main]
pull_request:
branches: [v3]
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -115,26 +112,45 @@ jobs:
- name: infra
run: yarn workspace @hyperlane-xyz/infra run test

# test-env:
# runs-on: larger-runner
# needs: [yarn-build]
# strategy:
# matrix:
# environment: [testnet4, mainnet3]
# module: [ism, core, igp, ica, helloworld]

# steps:
# - uses: actions/checkout@v3
# - uses: actions/cache@v3
# with:
# path: ./*
# key: ${{ github.sha }}

# - name: Install Foundry
# uses: onbjerg/foundry-toolchain@v1

# - name: Test ${{ matrix.environment }} ${{ matrix.module }} deployment (check, deploy, govern, check again)
# run: cd typescript/infra && ./fork.sh ${{ matrix.environment }} ${{ matrix.module }}
test-cli:
runs-on: larger-runner
needs: [yarn-build]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1

- uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}

- name: test
run: ./typescript/cli/ci-test.sh

test-env:
runs-on: larger-runner
needs: [yarn-build]
strategy:
matrix:
environment: [testnet4, mainnet3]
module: [ism, core, helloworld]

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1

- name: Test ${{ matrix.environment }} ${{ matrix.module }} deployment (check, deploy, govern, check again)
run: cd typescript/infra && ./fork.sh ${{ matrix.environment }} ${{ matrix.module }}

test-sol:
env:
Expand Down
6 changes: 3 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
785 changes: 0 additions & 785 deletions .yarn/releases/yarn-3.2.0.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.1.cjs

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 ./
Expand All @@ -14,6 +13,7 @@ COPY .yarn/releases ./.yarn/releases
COPY typescript/utils/package.json ./typescript/utils/
COPY typescript/sdk/package.json ./typescript/sdk/
COPY typescript/helloworld/package.json ./typescript/helloworld/
COPY typescript/cli/package.json ./typescript/cli/
COPY typescript/infra/package.json ./typescript/infra/
COPY solidity/package.json ./solidity/

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
[codecov-badge]: https://img.shields.io/codecov/c/github/hyperlane-xyz/hyperlane-monorepo
[foundry]: https://getfoundry.sh/
[foundry-badge]: https://img.shields.io/badge/Built%20with-Foundry-FFDB1C.svg
[license]: https://opensource.org/licenses/MIT
[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg
[license]: https://www.apache.org/licenses/LICENSE-2.0
[license-badge]: https://img.shields.io/badge/License-Apache-blue.svg

## Versioning

Note this is the branch for Hyperlane v3.

V2 is on the main branch but is eventually being phased out.
V2 is still in operation but is not being actively developed. The code for V2 can be found in the [v2](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/v2) branch.

V1 has since been deprecated in favor of V2, but if you are looking for code relating to the existing V1 deployments of the `testnet2` or `mainnet` environments, refer to the [v1](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/v1) branch.
V1 has since been deprecated in favor of V2, but if you are looking for code relating to the existing V1 deployments, refer to the [v1](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/v1) branch.

## Overview

Expand Down
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.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",
Expand All @@ -37,6 +37,7 @@
"lodash": "^4.17.21",
"recursive-readdir": "^2.2.3",
"underscore": "^1.13",
"undici": "^5.11"
"undici": "^5.11",
"@trivago/prettier-plugin-sort-imports/@babel/parser": "^7.22.7"
}
}
27 changes: 7 additions & 20 deletions rust/agents/relayer/src/merkle_tree/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt::Display;
use eyre::{Context, Result};
use tracing::{debug, error, instrument};

use hyperlane_base::db::{DbError, HyperlaneRocksDB};
use hyperlane_base::db::DbError;
use hyperlane_core::{
accumulator::{incremental::IncrementalMerkle, merkle::Proof},
ChainCommunicationError, H256,
Expand All @@ -14,7 +14,6 @@ use crate::prover::{Prover, ProverError};
/// Struct to sync prover.
#[derive(Debug)]
pub struct MerkleTreeBuilder {
db: HyperlaneRocksDB,
prover: Prover,
incremental: IncrementalMerkle,
}
Expand Down Expand Up @@ -62,36 +61,24 @@ pub enum MerkleTreeBuilderError {
}

impl MerkleTreeBuilder {
pub fn new(db: HyperlaneRocksDB) -> Self {
pub fn new() -> Self {
let prover = Prover::default();
let incremental = IncrementalMerkle::default();
Self {
prover,
incremental,
db,
}
}

#[instrument(err, skip(self), level="debug", fields(prover_latest_index=self.count()-1))]
pub fn get_proof(
&self,
message_nonce: u32,
leaf_index: u32,
root_index: u32,
) -> Result<Option<Proof>, MerkleTreeBuilderError> {
self.db
.retrieve_message_id_by_nonce(&message_nonce)?
.and_then(|message_id| {
self.db
.retrieve_merkle_leaf_index_by_message_id(&message_id)
.ok()
.flatten()
})
.map(|leaf_index| {
self.prover
.prove_against_previous(leaf_index as usize, root_index as usize)
})
.transpose()
.map_err(Into::into)
) -> Result<Proof, MerkleTreeBuilderError> {
self.prover
.prove_against_previous(leaf_index as usize, root_index as usize)
.map_err(MerkleTreeBuilderError::from)
}

pub fn count(&self) -> u32 {
Expand Down
2 changes: 2 additions & 0 deletions rust/agents/relayer/src/msg/gas_payment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub struct GasPaymentEnforcer {
}

impl GasPaymentEnforcer {
/// Note that `policy_configs` should not be empty. In the settings,
/// a default of vec![GasPaymentEnforcementConf::default()] is used.
pub fn new(
policy_configs: impl IntoIterator<Item = GasPaymentEnforcementConf>,
db: HyperlaneRocksDB,
Expand Down
Loading

0 comments on commit dbc351e

Please sign in to comment.