Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migration to cargo near #184

Merged
merged 73 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
30a4c91
feat: added mpc getter and updated near-plugins
frolvanya Jan 12, 2025
60ee6c2
fix: check amount after normalization
frolvanya Jan 12, 2025
473b29c
chore: elided lifetimes
frolvanya Jan 12, 2025
5b581f9
chore: downgrade to rustc v1.81.0 only when building wasm files
frolvanya Jan 12, 2025
5dc97af
chore: downgraded to 1.81.0 and bumped near-workspaces to v0.16
frolvanya Jan 12, 2025
e474713
chore: working combination of `near-*` crates with v1.81.0
frolvanya Jan 12, 2025
241f0c9
chore: returned back to 1.79.0 and pinned `alloy-*` crates
frolvanya Jan 12, 2025
774e15d
chore: bumped back to 1.84.0
frolvanya Jan 12, 2025
73e1fef
feat: scratch implementation of migration to cargo-near
frolvanya Jan 12, 2025
642e5cf
fix: lint job
frolvanya Jan 12, 2025
e9c462a
chore: updated build process
frolvanya Jan 13, 2025
6c94a7e
chore: bring back `check_wasm.yaml` + `build.sh` for now
frolvanya Jan 13, 2025
ca4faef
chore: minor changes
frolvanya Jan 13, 2025
973bb52
fix: dependency issue with `omni-token`
frolvanya Jan 13, 2025
64fa0a2
chore: testing reproducible build
frolvanya Jan 13, 2025
50d11f4
fix: added schemas for abi
frolvanya Jan 15, 2025
135f878
feat: properly added json/borsh schemas for abi generation
frolvanya Jan 16, 2025
d859bdf
chore: added reproducible info in tomls
frolvanya Jan 16, 2025
0e3cef7
chore: updated `cargo-near-build`
frolvanya Jan 16, 2025
ae1c25a
fix: deadlock during builing token-deployer
frolvanya Jan 16, 2025
7f0e759
feat: added reproducible section to all contracts toml
frolvanya Jan 16, 2025
4914b6c
feat: migration to reproducible builds
frolvanya Jan 16, 2025
91be708
chore: install cargo-near
frolvanya Jan 16, 2025
6e56fb9
chore: create res dir before copying
frolvanya Jan 16, 2025
f8ea532
chore: pushed wasm files
frolvanya Jan 16, 2025
78b7249
chore: build with a commit with last modification of `res/`
frolvanya Jan 16, 2025
825c5ec
chore: get parent of prev commit hash
frolvanya Jan 16, 2025
3de5c00
chore: removed logic with setting snapshot explicitly
frolvanya Jan 16, 2025
eabe495
chore: removed wasm checker
frolvanya Jan 17, 2025
9df12a5
chore: patched `cargo-near-build`
frolvanya Jan 17, 2025
932dc08
feat: updated lazy locks accordingly to the latest patch
frolvanya Jan 17, 2025
237a5cb
feat: added mock contracts to the build process
frolvanya Jan 17, 2025
2c50b9d
chore: updated wasm files
frolvanya Jan 17, 2025
6fcc716
feat: attempt to speed up tests
frolvanya Jan 17, 2025
f9dc0bb
chore: added logs to tests
frolvanya Jan 17, 2025
53c10fd
fix: disable parallelism in nextest
frolvanya Jan 18, 2025
88048cb
chore: added test to compile all contracts
frolvanya Jan 18, 2025
b1b8b51
chore: try using cargo test instead of nextest
frolvanya Jan 18, 2025
41f273d
feat: added workflow to update contracts
frolvanya Jan 18, 2025
41719ed
chore: install cargo-near
frolvanya Jan 18, 2025
18b22b6
fix: added ci skip flag to avoid recursion
frolvanya Jan 18, 2025
6af7e69
chore: updated manifest path to mock contracts
frolvanya Jan 18, 2025
89a10ee
fix: maxdepth for find command
frolvanya Jan 18, 2025
4a73452
chore: used "stefanzweifel/git-auto-commit-action@v4"
frolvanya Jan 18, 2025
d97f239
chore: updated git-commit action to the latest version
frolvanya Jan 18, 2025
e3440db
fix: try using fixtures for building wasm
frolvanya Jan 18, 2025
044d317
chore: added logs
frolvanya Jan 18, 2025
ae77265
chore: migrated to sccache
frolvanya Jan 18, 2025
39e2481
chore: removed with blocks
frolvanya Jan 18, 2025
8153023
chore: removed things that were used to debug
frolvanya Jan 18, 2025
b6df720
chore: added usage of PAT token
frolvanya Jan 20, 2025
b4961c6
chore: removed patch for `cargo-near-build`
frolvanya Jan 20, 2025
be18b9f
chore: added patch back for `cargo-near-build`
frolvanya Jan 20, 2025
1f917f7
fix: push to releases page instead of pushing a commit
frolvanya Jan 20, 2025
815a36c
chore: enable manual contract updates through the workflow
frolvanya Jan 22, 2025
a6667b6
chore: enable manual contract updates during PR
frolvanya Jan 22, 2025
7a4db10
chore: testing release workflow
frolvanya Jan 22, 2025
e2c9577
Fix e2e tests building.
kisialiou Jan 22, 2025
9ac114a
chore: testing release workflow with multiple jobs
frolvanya Jan 22, 2025
fae48ce
chore: removed `-j` option
frolvanya Jan 22, 2025
38cd098
fix: paths in makefiles
frolvanya Jan 22, 2025
9df1028
chore: try make with 2 jobs
frolvanya Jan 22, 2025
9a9f739
chore: try make with 4 jobs
frolvanya Jan 22, 2025
841b997
chore: try modifying permissions
frolvanya Jan 22, 2025
86a1f98
chore: try building contracts
frolvanya Jan 22, 2025
9fb7ed5
fix: issues after merging
frolvanya Jan 22, 2025
61b80d6
chore: remove `pull_requrest` dispatch
frolvanya Jan 22, 2025
27b3bf4
chore: bumped `cargo-near-build` version
frolvanya Jan 22, 2025
9147bd2
chore: removed `res`
frolvanya Jan 22, 2025
5211a34
chore: bring patch back
frolvanya Jan 22, 2025
d4858e0
chore: removed patch
frolvanya Jan 30, 2025
6d5ef9e
chore: try different patch
frolvanya Jan 30, 2025
8f67f14
chore: removed version prefix
frolvanya Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
if: matrix.platform == 'near' || matrix.platform == 'solana'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.80.0
toolchain: 1.84.0
target: wasm32-unknown-unknown

- name: Install NEAR CLI RS
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/check-wasm.yaml

This file was deleted.

44 changes: 20 additions & 24 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
- 'near/**'
- 'omni-relayer/**'

env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -25,18 +29,17 @@ jobs:
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.80.0
toolchain: 1.84.0
components: clippy, rustfmt
target: wasm32-unknown-unknown

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
shared-key: "lint-${{ matrix.component }}"
workspaces: ${{ matrix.component }}
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.7

- name: Install cargo-near
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh

- name: Run clippy
run: make clippy-${{ matrix.component }}

Expand All @@ -52,27 +55,20 @@ jobs:
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.80.0
toolchain: 1.84.0
target: wasm32-unknown-unknown

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
shared-key: "build-test"
workspaces: near
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.7

- name: Install cargo-near
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh

- name: Install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest

- name: Build token contract
run: make rust-build-near

- name: Build tests
run: cargo build --manifest-path ./near/Cargo.toml --tests --all-features

- name: Run tests
run: cargo nextest run --manifest-path ./near/Cargo.toml
- name: Rust tests
run: make rust-run-tests
38 changes: 38 additions & 0 deletions .github/workflows/update-contracts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
push:
branches: [ main, develop ]

workflow_dispatch:

name: Update Contracts
jobs:
update-contracts:
runs-on: ubuntu-latest
name: Update Contracts
permissions:
contents: write
steps:
- name: Clone the repository
uses: actions/checkout@v3

- name: Install cargo-near
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh

- name: Build NEAR contracts
run: |
make rust-build-near
timeout-minutes: 60

- name: Archive built WASM files
run: |
mkdir -p artifacts
find ./near/target/near -name "*.wasm" -exec cp {} artifacts/ \;
zip -j contracts.zip artifacts/*.wasm
shell: bash

- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.sha }}
files: contracts.zip
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
**/.env
.history
node_modules
near/res/mock_token.wasm
near/res/mock_prover.wasm
near/res/omni_tests.wasm
54 changes: 43 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
.PHONY: rust-lint rust-lint-near rust-lint-omni-relayer

MAKEFILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

OUT_DIR ?= $(MAKEFILE_DIR)/near/target/near

LINT_OPTIONS = -D warnings -D clippy::pedantic -A clippy::missing_errors_doc -A clippy::must_use_candidate -A clippy::module_name_repetitions
RUSTFLAGS = -C link-arg=-s

NEAR_MANIFEST = ./near/Cargo.toml
OMNI_RELAYER_MANIFEST = ./omni-relayer/Cargo.toml
NEAR_MANIFEST := $(MAKEFILE_DIR)/near/Cargo.toml
OMNI_BRIDGE_MANIFEST := $(MAKEFILE_DIR)/near/omni-bridge/Cargo.toml
OMNI_TOKEN_MANIFEST := $(MAKEFILE_DIR)/near/omni-token/Cargo.toml
TOKEN_DEPLOYER := $(MAKEFILE_DIR)/near/token-deployer/Cargo.toml
OMNI_PROVER_MANIFEST := $(MAKEFILE_DIR)/near/omni-prover/omni-prover/Cargo.toml
EVM_PROVER_MANIFEST := $(MAKEFILE_DIR)/near/omni-prover/evm-prover/Cargo.toml
WORMHOLE_OMNI_PROVER_PROXY_MANIFEST := $(MAKEFILE_DIR)/near/omni-prover/wormhole-omni-prover-proxy/Cargo.toml
MOCK_PROVER_MANIFEST := $(MAKEFILE_DIR)/near/mock/mock-prover/Cargo.toml
MOCK_TOKEN_MANIFEST := $(MAKEFILE_DIR)/near/mock/mock-token/Cargo.toml

OMNI_RELAYER_MANIFEST := $(MAKEFILE_DIR)/omni-relayer/Cargo.toml

clippy: clippy-near clippy-omni-relayer

clippy-near: rust-build-token
clippy-near:
cargo clippy --manifest-path $(NEAR_MANIFEST) -- $(LINT_OPTIONS)

fmt-near:
Expand All @@ -20,11 +32,31 @@ fmt-omni-relayer:
clippy-omni-relayer:
cargo clippy --manifest-path $(OMNI_RELAYER_MANIFEST) -- $(LINT_OPTIONS)

rust-build-token:
RUSTFLAGS='$(RUSTFLAGS)' cargo build --target wasm32-unknown-unknown --release --manifest-path $(NEAR_MANIFEST) --package omni-token

rust-build-near: rust-build-token
RUSTFLAGS='$(RUSTFLAGS)' cargo build --target wasm32-unknown-unknown --release --manifest-path $(NEAR_MANIFEST)

test-near: rust-build-near
rust-build-omni-bridge:
cargo near build reproducible-wasm --manifest-path $(OMNI_BRIDGE_MANIFEST) --out-dir $(OUT_DIR)

rust-build-omni-token:
cargo near build reproducible-wasm --manifest-path $(OMNI_TOKEN_MANIFEST) --out-dir $(OUT_DIR)

rust-build-token-deployer:
cargo near build reproducible-wasm --manifest-path $(TOKEN_DEPLOYER) --out-dir $(OUT_DIR)

rust-build-omni-prover:
cargo near build reproducible-wasm --manifest-path $(OMNI_PROVER_MANIFEST) --out-dir $(OUT_DIR)

rust-build-evm-prover:
cargo near build reproducible-wasm --manifest-path $(EVM_PROVER_MANIFEST) --out-dir $(OUT_DIR)

rust-build-wormhole-omni-prover-proxy:
cargo near build reproducible-wasm --manifest-path $(WORMHOLE_OMNI_PROVER_PROXY_MANIFEST) --out-dir $(OUT_DIR)

rust-build-mock-prover:
cargo near build reproducible-wasm --manifest-path $(MOCK_PROVER_MANIFEST) --out-dir $(OUT_DIR)

rust-build-mock-token:
cargo near build reproducible-wasm --manifest-path $(MOCK_TOKEN_MANIFEST) --out-dir $(OUT_DIR)

rust-build-near: rust-build-omni-bridge rust-build-omni-token rust-build-token-deployer rust-build-omni-prover rust-build-evm-prover rust-build-wormhole-omni-prover-proxy rust-build-mock-prover rust-build-mock-token

rust-run-tests:
cargo nextest run --manifest-path $(NEAR_MANIFEST)
Loading
Loading