-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1b71e5d
Showing
15 changed files
with
323 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Earthly +build | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
GIT_LFS_SKIP_SMUDGE: 1 | ||
REGISTRY_URL: ghcr.io | ||
FORCE_COLOR: 1 | ||
EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }} | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
actions: read | ||
|
||
steps: | ||
- uses: earthly/actions-setup@v1 | ||
with: | ||
version: v0.8.0 | ||
- uses: actions/checkout@v4 | ||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run build | ||
run: earthly --ci +build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Created by https://www.toptal.com/developers/gitignore/api/osx,macos,git,rust,rust-analyzer | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=osx,macos,git,rust,rust-analyzer | ||
|
||
### Git ### | ||
# Created by git for backups. To disable backups in Git: | ||
# $ git config --global mergetool.keepBackup false | ||
*.orig | ||
|
||
# Created by git when using merge tools for conflicts | ||
*.BACKUP.* | ||
*.BASE.* | ||
*.LOCAL.* | ||
*.REMOTE.* | ||
*_BACKUP_*.txt | ||
*_BASE_*.txt | ||
*_LOCAL_*.txt | ||
*_REMOTE_*.txt | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### macOS Patch ### | ||
# iCloud generated files | ||
*.icloud | ||
|
||
### OSX ### | ||
# General | ||
|
||
# Icon must end with two \r | ||
|
||
# Thumbnails | ||
|
||
# Files that might appear in the root of a volume | ||
|
||
# Directories potentially created on remote AFP share | ||
|
||
### Rust ### | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
### rust-analyzer ### | ||
# Can be generated by other build systems other than cargo (ex: bazelbuild/rust_rules) | ||
rust-project.json | ||
|
||
|
||
# End of https://www.toptal.com/developers/gitignore/api/osx,macos,git,rust,rust-analyzer | ||
|
||
artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"yaml.schemas": { | ||
"https://json.schemastore.org/github-action.json": "file:///Users/fraccaman/heliax/namada-governance-upgrades/.github/worflows/build.yml" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[workspace] | ||
resolver = "2" | ||
|
||
members = [ | ||
"block_party", | ||
"staking_party", | ||
"shielding_party", | ||
"shielding_reward_party" | ||
] | ||
|
||
[workspace.package] | ||
authors = ["Heliax AG <hello@heliax.dev>"] | ||
edition = "2021" | ||
license = "GPL-3.0" | ||
version = "0.1.0" | ||
|
||
[workspace.dependencies] | ||
namada_tx_prelude = { git = "https://github.com/anoma/namada", tag = "v0.36.1" } | ||
wee_alloc = "0.4.5" | ||
getrandom = { version = "0.2", features = ["custom"] } | ||
|
||
[profile.release] | ||
lto = true | ||
panic = "abort" | ||
opt-level = 'z' | ||
strip = "debuginfo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
VERSION --global-cache 0.7 | ||
|
||
IMPORT github.com/earthly/lib/rust AS rust | ||
|
||
install: | ||
FROM rust:1.78.0-bookworm | ||
RUN rustup component add clippy rustfmt | ||
RUN rustup target add wasm32-unknown-unknown | ||
|
||
RUN cargo install wasm-opt@0.116.1 | ||
|
||
# Call +INIT before copying the source file to avoid installing function depencies every time source code changes | ||
# This parametrization will be used in future calls to functions of the library | ||
DO rust+INIT --keep_fingerprints=true | ||
RUN apt-get update && apt-get install -y protobuf-compiler build-essential clang-tools-14 | ||
|
||
source: | ||
FROM +install | ||
COPY --keep-ts Cargo.toml Cargo.lock ./ | ||
COPY --keep-ts --chmod 755 docker/optimize.sh ./optimize.sh | ||
COPY --keep-ts --dir block_party shielding_party staking_party shielding_reward_party ./ | ||
|
||
# lint runs cargo clippy on the source code | ||
lint: | ||
FROM +source | ||
DO rust+CARGO --args="clippy --all-features --all-targets -- -D warnings" | ||
|
||
# compilation check | ||
check: | ||
FROM +lint | ||
DO rust+CARGO --args="check" | ||
|
||
# build builds with the Cargo release profile | ||
build: | ||
FROM +lint | ||
DO rust+CARGO --args="build --release --target wasm32-unknown-unknown" --output="wasm32-unknown-unknown\/release\/[a-zA-Z_]+\.wasm" | ||
RUN ./optimize.sh | ||
SAVE ARTIFACT ./target/wasm32-unknown-unknown/release AS LOCAL artifacts | ||
|
||
# test executes all unit and integration tests via Cargo | ||
test: | ||
FROM +lint | ||
DO rust+CARGO --args="test" | ||
|
||
# fmt checks whether Rust code is formatted according to style guidelines | ||
fmt: | ||
FROM +lint | ||
DO rust+CARGO --args="fmt --check" | ||
|
||
# all runs all other targets in parallel | ||
all: | ||
BUILD +build | ||
BUILD +test | ||
BUILD +fmt | ||
BUILD +check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "block_party" | ||
description = "WASM transaction to transition from phase 1 to phase 2 of namada mainnet." | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
namada_tx_prelude.workspace = true | ||
wee_alloc.workspace = true | ||
getrandom.workspace = true | ||
|
||
[lib] | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use namada_tx_prelude::*; | ||
|
||
#[transaction] | ||
fn apply_tx(_ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
folder_path="target/wasm32-unknown-unknown/release" | ||
|
||
# Loop through all .wasm files in the folder | ||
for file in "$folder_path"/*.wasm; do | ||
# Check if the file exists (in case no .wasm files are found) | ||
if [[ -f "$file" ]]; then | ||
file_name=$(basename "$file") | ||
echo "Optimizing $file_name..." | ||
|
||
wasm-opt -Oz "$file" -o "$file" | ||
# You can add your specific commands here | ||
else | ||
echo "No .wasm files found in the directory." | ||
break | ||
fi | ||
done | ||
echo "Done." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[toolchain] | ||
channel = "1.78.0" | ||
components = ["rustc", "cargo", "rust-std", "rust-docs", "rls", "rust-src", "rust-analysis"] | ||
targets = ['wasm32-unknown-unknown'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "shielding_party" | ||
description = "WASM transaction to transition from phase 3 to phase 4 of namada mainnet." | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
namada_tx_prelude.workspace = true | ||
wee_alloc.workspace = true | ||
getrandom.workspace = true | ||
|
||
[lib] | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use namada_tx_prelude::*; | ||
|
||
#[transaction] | ||
fn apply_tx(_ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { | ||
log_string("asd12"); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "shielded_reward_party" | ||
description = "WASM transaction to transition from phase 4 to phase 5 of namada mainnet." | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
namada_tx_prelude.workspace = true | ||
wee_alloc.workspace = true | ||
getrandom.workspace = true | ||
|
||
[lib] | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use namada_tx_prelude::*; | ||
|
||
#[transaction] | ||
fn apply_tx(_ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "staking_party" | ||
description = "WASM transaction to transition from phase 2 to phase 3 of namada mainnet." | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
namada_tx_prelude.workspace = true | ||
wee_alloc.workspace = true | ||
getrandom.workspace = true | ||
|
||
[lib] | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use namada_tx_prelude::*; | ||
|
||
#[transaction] | ||
fn apply_tx(_ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { | ||
Ok(()) | ||
} |