Skip to content

Commit

Permalink
feat: add polytone (#169)
Browse files Browse the repository at this point in the history
* initial

* polytone --manifest-path

* wiki link

* cw deps & artifact compile

* rm artifact publish

* cosmwasm/polytone working dir

* remove unusable test ci

* polytone label, cargo fmt cmd

* daodao v1.1.0 changes https://github.com/DA0-DA0/polytone/releases/tag/v1.1.0

* cargo fmt

* nested audit-check workaround

* polytone release workflow

* `cargo audit fix`
  • Loading branch information
Reecepbcups authored Aug 8, 2024
1 parent bfecb68 commit 5780375
Show file tree
Hide file tree
Showing 100 changed files with 12,115 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ ibc-hooks:
packet-forward-middleware:
- middleware/packet-forward-middleware/**

polytone:
- cosmwasm/polytone/**

rate-limit:
- modules/rate-limit/**
- modules/rate-limit/**
92 changes: 92 additions & 0 deletions .github/workflows/polytone.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: polytone
on:
pull_request:
paths:
- 'cosmwasm/polytone/**'
- '.github/workflows/polytone.yml'

env:
WORKING_DIRECTORY: cosmwasm/polytone
JUST_VERSION: 1.25.2
GO_VERSION: 1.19

jobs:
clippy_check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ${{env.WORKING_DIRECTORY}}/Cargo.toml

# This utility formats all bin and lib files of the current crate using rustfmt.
rust_fmt:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
override: true
- name: Run cargo fmt
run: cargo fmt --all -- --check

build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Get cached just
uses: actions/cache@v3
with:
path: ~/.cargo/bin/just
key: ${{ runner.os }}-just-${{ env.JUST_VERSION }}

- name: Install just
run: cargo install just || true

- name: simulation tests
run: just simtest

test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ${{env.WORKING_DIRECTORY}}/Cargo.toml
27 changes: 27 additions & 0 deletions .github/workflows/polytone_audit_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: polytone audit dependencies

on:
schedule:
- cron: '0 0 1 * *'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
pull_request:

env:
WORKING_DIRECTORY: cosmwasm/polytone

jobs:
audit:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
steps:
- uses: actions/checkout@v2
# Hack to get around requirement for audit-check to use top-level dir
- run: cd $GITHUB_WORKSPACE && mv ${{ env.WORKING_DIRECTORY}}/* .
- uses: actions-rs/audit-check@v1.2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/polytone_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Builds and commits the artifacts whenever a polytone release is made.
name: polytone artifact compiler

permissions:
contents: write

on:
push:
tags:
- "cosmwasm/polytone/v*"

env:
WORKING_DIRECTORY: cosmwasm/polytone

jobs:
release-artifacts:
runs-on: ubuntu-latest
container: cosmwasm/workspace-optimizer:0.15.1
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}

steps:
- uses: actions/checkout@v3

# tar is required for cargo cache
- run: apk add --no-cache tar

- name: Set up cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Compile contracts
timeout-minutes: 30
run: optimize.sh .

- name: Upload contracts
uses: actions/upload-artifact@v3
with:
name: contracts
path: ${{ env.WORKING_DIRECTORY }}/artifacts/*

- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.WORKING_DIRECTORY }}/artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions cosmwasm/polytone/.cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[advisories]
# Ignoring two advisories that are introduced by cw-orchestrator.
# They are safe to ignore as cw-orch is excluded from the binary as it's feature flagged.
# Deps that triggered the audit: [tungstenite, webpki]
ignore = ["RUSTSEC-2023-0065","RUSTSEC-2023-0052"]
36 changes: 36 additions & 0 deletions cosmwasm/polytone/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# macOS
.DS_Store

# Text file backups
**/*.rs.bk

# Build results
target/

# IDEs
.vscode/
.idea/
*.iml
**/.editorconfig

# Auto-gen
.cargo-ok

# Build artifacts
*.wasm
hash.txt
contracts.txt
artifacts/

# code coverage
tarpaulin-report.*

# integration tests
gas_reports/
ci/configs/cosm-orc/local.yaml

contracts/**/Cargo.lock
packages/**/Cargo.lock

# Private env file
.env
25 changes: 25 additions & 0 deletions cosmwasm/polytone/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.1.0] - 2024-05-28

### Added

- Support configuring contract address lengths less than the default 32 bytes.

### Fixes

- Updated some dependencies and replaced deprecated functions.

## [1.0.0] - 2023-07-04

### Added

- Initial release.
Loading

0 comments on commit 5780375

Please sign in to comment.