Skip to content

Commit

Permalink
fix: docker agent build (hyperlane-xyz#4481)
Browse files Browse the repository at this point in the history
fix: docker agent build
- update image from 1.72.1 -> 1.80.1

drive-by: update more `rust/` --> `rust/main/`

drive-by: consolidate e2e non-cosmwasm cache, multiple cache steps per
job can get in the way of each other

---------

Signed-off-by: pbio <[email protected]>
  • Loading branch information
paulbalaji authored Sep 12, 2024
1 parent 096aeff commit 1ab8751
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
typescript/sdk/src/cw-types/*.types.ts linguist-generated=true
rust/chains/hyperlane-ethereum/abis/*.abi.json linguist-generated=true
rust/main/chains/hyperlane-ethereum/abis/*.abi.json linguist-generated=true
solidity/contracts/interfaces/avs/*.sol linguist-vendored=true
solidity/contracts/avs/ECDSA*.sol linguist-vendored=true
18 changes: 9 additions & 9 deletions .github/workflows/agent-release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,23 @@ jobs:
target: ${{ matrix.TARGET }}
- name: setup target
run: rustup target add ${{ matrix.TARGET }}
working-directory: ./rust
working-directory: ./rust/main
- name: build
run: cargo build --release --target ${{ matrix.TARGET }} --bin relayer --bin scraper --bin validator
working-directory: ./rust
working-directory: ./rust/main
- name: make executable
if: ${{ matrix.OS == 'larger-runner' || matrix.OS == 'macos-latest' }}
run: chmod ug+x,-w relayer scraper validator
working-directory: rust/target/${{ matrix.TARGET }}/release
working-directory: rust/main/target/${{ matrix.TARGET }}/release
- name: upload binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.TARGET }}-${{ needs.prepare.outputs.tag_sha }}-${{ needs.prepare.outputs.tag_date }}
path: |
rust/target/${{ matrix.TARGET }}/release/relayer
rust/target/${{ matrix.TARGET }}/release/relayer.exe
rust/target/${{ matrix.TARGET }}/release/scraper
rust/target/${{ matrix.TARGET }}/release/scraper.exe
rust/target/${{ matrix.TARGET }}/release/validator
rust/target/${{ matrix.TARGET }}/release/validator.exe
rust/main/target/${{ matrix.TARGET }}/release/relayer
rust/main/target/${{ matrix.TARGET }}/release/relayer.exe
rust/main/target/${{ matrix.TARGET }}/release/scraper
rust/main/target/${{ matrix.TARGET }}/release/scraper.exe
rust/main/target/${{ matrix.TARGET }}/release/validator
rust/main/target/${{ matrix.TARGET }}/release/validator.exe
if-no-files-found: error
14 changes: 2 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,23 +172,13 @@ jobs:
- name: rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'v2-rust-main'
prefix-key: 'v2-rust-e2e'
shared-key: ${{ matrix.e2e-type }}
cache-provider: 'buildjet'
save-if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
workspaces: |
./rust/main
- name: rust cache
uses: Swatinem/rust-cache@v2
if: matrix.e2e-type == 'non-cosmwasm'
with:
prefix-key: 'v2-rust-sealevel'
shared-key: ${{ matrix.e2e-type }}
cache-provider: 'buildjet'
save-if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
workspaces: |
./rust/sealevel
${{ matrix.e2e-type == 'non-cosmwasm' && './rust/sealevel' || '' }}
- name: Free disk space
run: |
Expand Down
7 changes: 5 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ echo "📝 If you haven't yet, please add a changeset for your changes via 'yarn

# if any *.rs files have changed
if git diff --staged --exit-code --name-only | grep -q -E ".*\.rs$"; then
echo "Running cargo fmt pre-commit hook"
cargo fmt --all --check --manifest-path rust/Cargo.toml
echo "Running cargo fmt pre-commit hook for rust/main"
cargo fmt --all --check --manifest-path rust/main/Cargo.toml

echo "Running cargo fmt pre-commit hook for rust/sealevel"
cargo fmt --all --check --manifest-path rust/sealevel/Cargo.toml
fi
9 changes: 2 additions & 7 deletions rust/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:experimental

FROM rust:1.72.1 as builder
FROM rust:1.80.1 as builder
WORKDIR /usr/src

# 1a: Prepare for static linking
Expand All @@ -23,18 +23,13 @@ COPY rust/main/utils rust/main/utils
COPY rust/sealevel rust/sealevel

COPY rust/main/Cargo.toml rust/main/.
COPY rust/main/Cargo.toml rust/main/.
COPY rust/sealevel/Cargo.lock rust/sealevel/.
COPY rust/sealevel/Cargo.lock rust/sealevel/.
COPY rust/main/Cargo.lock rust/main/.


WORKDIR /usr/src/rust/main

# Build binaries
RUN \
--mount=id=cargo,type=cache,sharing=locked,target=/usr/src/target \
--mount=id=cargo-home-registry,type=cache,sharing=locked,target=/usr/local/cargo/registry \
--mount=id=cargo-home-git,type=cache,sharing=locked,target=/usr/local/cargo/git \
RUSTFLAGS="--cfg tokio_unstable" cargo build --release --bin validator --bin relayer --bin scraper && \
mkdir -p /release && \
cp /usr/src/rust/main/target/release/validator /release && \
Expand Down
2 changes: 1 addition & 1 deletion rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ cd rust

### Deploy Procedure

The contract addresses of each deploy can be found in `rust/config`. The agents will
The contract addresses of each deploy can be found in `rust/main/config`. The agents will
automatically pull in all configs in this directory.

When agents are deployed to point at a new environment, they cease to point at
Expand Down
2 changes: 1 addition & 1 deletion rust/main/hyperlane-base/src/settings/loader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ where
let mut base_config_sources = vec![];
let mut builder = Config::builder();

// Always load the default config files (`rust/config/*.json`)
// Always load the default config files (`rust/main/config/*.json`)
for entry in PathBuf::from("./config")
.read_dir()
.context("Failed to open config directory")
Expand Down
2 changes: 1 addition & 1 deletion rust/main/hyperlane-base/tests/chain_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use hyperlane_base::settings::{parser::RawAgentConf, Settings};
use hyperlane_core::{config::*, KnownHyperlaneDomain};
use walkdir::WalkDir;

/// Relative path to the `hyperlane-monorepo/rust/config/`
/// Relative path to the `hyperlane-monorepo/rust/main/config/`
/// directory, which is where the agent's config files
/// currently live.
const AGENT_CONFIG_PATH_ROOT: &str = "../config";
Expand Down
2 changes: 1 addition & 1 deletion rust/main/utils/run-locally/src/cosmos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ fn run_locally() {
postgres,
};

// Mostly copy-pasta from `rust/utils/run-locally/src/main.rs`
// Mostly copy-pasta from `rust/main/utils/run-locally/src/main.rs`
// TODO: refactor to share code
let loop_start = Instant::now();
let mut failure_occurred = false;
Expand Down
4 changes: 2 additions & 2 deletions solidity/update_abis.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/sh
#!/bin/sh

# Must be ran from the `solidity` directory

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/hyperlane-ethereum/abis/"$CONTRACT_NAME".abi.json
jq .abi < artifacts/contracts/"$1".sol/"$CONTRACT_NAME".json > ../rust/main/chains/hyperlane-ethereum/abis/"$CONTRACT_NAME".abi.json
}

copy interfaces/IMailbox && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const constMetricLabels = {
const metricsRegister = new Registry();

const walletBalanceGauge = new Gauge({
// Mirror the rust/ethers-prometheus `wallet_balance` gauge metric.
// Mirror the rust/main/ethers-prometheus `wallet_balance` gauge metric.
name: 'hyperlane_wallet_balance',
help: 'Current balance of eth and other tokens in the `tokens` map for the wallet addresses in the `wallets` set',
registers: [metricsRegister],
Expand Down
6 changes: 3 additions & 3 deletions typescript/infra/src/config/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ export type DeepPartial<T> = T extends object
}
: T;

// See rust/helm/values.yaml for the full list of options and their defaults.
// See rust/main/helm/values.yaml for the full list of options and their defaults.
// This is the root object in the values file.
export interface HelmRootAgentValues {
image: HelmImageValues;
hyperlane: HelmHyperlaneValues;
nameOverride?: string;
}

// See rust/helm/values.yaml for the full list of options and their defaults.
// See rust/main/helm/values.yaml for the full list of options and their defaults.
// This is at `.hyperlane` in the values file.
interface HelmHyperlaneValues {
runEnv: DeployEnvironment;
Expand All @@ -54,7 +54,7 @@ interface HelmHyperlaneValues {
scraper?: HelmScraperValues;
}

// See rust/helm/values.yaml for the full list of options and their defaults.
// See rust/main/helm/values.yaml for the full list of options and their defaults.
// This is at `.hyperlane.chains` in the values file.
export interface HelmAgentChainOverride
extends DeepPartial<AgentChainMetadata> {
Expand Down
4 changes: 2 additions & 2 deletions typescript/infra/src/config/agent/relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ export interface BaseRelayerConfig {
// Full relayer-specific agent config for a single chain
export type RelayerConfig = Omit<RelayerAgentConfig, keyof AgentConfig>;

// See rust/helm/values.yaml for the full list of options and their defaults.
// See rust/main/helm/values.yaml for the full list of options and their defaults.
// This is at `.hyperlane.relayer` in the values file.
export interface HelmRelayerValues extends HelmStatefulSetValues {
aws: boolean;
config?: RelayerConfig;
}

// See rust/helm/values.yaml for the full list of options and their defaults.
// See rust/main/helm/values.yaml for the full list of options and their defaults.
// This is at `.hyperlane.relayerChains` in the values file.
export interface HelmRelayerChainValues {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion typescript/sdk/src/ism/metadata/aggregation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface AggregationMetadata<T = string> {

const RANGE_SIZE = 4;

// adapted from rust/agents/relayer/src/msg/metadata/aggregation.rs
// adapted from rust/main/agents/relayer/src/msg/metadata/aggregation.rs
export class AggregationMetadataBuilder implements MetadataBuilder {
protected logger = rootLogger.child({
module: 'AggregationIsmMetadataBuilder',
Expand Down

0 comments on commit 1ab8751

Please sign in to comment.