Skip to content

Commit

Permalink
Merge branch 'main' into hoang/stalebot
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangdv2429 authored May 20, 2024
2 parents e98deb4 + 9bfd030 commit 4bfc392
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 46 deletions.
37 changes: 37 additions & 0 deletions .githook/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
# pre-push hook script

# Ensure golangci-lint is installed
if ! command -v golangci-lint >/dev/null 2>&1; then
echo "golangci-lint is not installed. Please install it with 'go install github.com/golangci/golangci-lint/cmd/[email protected]'"
exit 1
fi

# Ensure markdownlint is installed
if ! command -v markdownlint >/dev/null 2>&1; then
echo "markdownlint-cli is not installed. Please install it with 'npm install -g markdownlint-cli'"
exit 1
fi

# Run golangci-lint
golangci-lint run

# Capture the exit status of golangci-lint
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "golangci-lint checks failed. Aborting push."
exit 1
fi

# Run markdownlint
markdownlint . --config .markdownlint.yaml

# Capture the exit status of markdownlint
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "markdownlint checks failed. Aborting push."
exit 1
fi

# If all tests pass, allow the push to proceed
exit 0
88 changes: 52 additions & 36 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,77 @@
# Creating Pr with following name convention. Common types include feat (a new feature), fix (a bug fix), docs (documentation changes),
# style (formatting, missing semi colons, etc.), refactor (code refactoring), test (adding missing tests),
# chore (changes to the build process or auxiliary tools and libraries such as documentation generation)
# e.g: feat(ci): Add auto generate changelog workflow
name: Changelog Update
name: Auto Changelog Update

on:
pull_request:
push:
branches:
- main
types: [closed]

permissions: write-all

jobs:
update_changelog:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout code
- name: Checkout the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 1

- name: Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Install conventional-changelog-cli
run: npm install -g conventional-changelog-cli
node-version: '18'

- name: Configure Git
run: |
git config user.name 'github-actions'
git config user.email 'github-actions@github.com'
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Simulate commit for PR title
- name: Check if "auto-changelog-update-do-not-create-manually" branch exists
id: check_branch
run: |
echo "${{ github.event.pull_request.title }}" > temp_message.txt
git commit --allow-empty -F temp_message.txt
if [ -n "$(git ls-remote --heads origin auto-changelog-update-do-not-create-manually)" ]; then
git fetch origin auto-changelog-update-do-not-create-manually
echo "branch_exists=true" >> $GITHUB_ENV
else
echo "branch_exists=false" >> $GITHUB_ENV
fi
- name: Generate changelog
- name: Generate Changelog Update and update if branch exists
run: |
conventional-changelog -p angular -i CHANGELOG.md -s -r 0
npm install -g conventional-changelog-cli
if [ "$branch_exists" == "true" ]; then
git checkout auto-changelog-update-do-not-create-manually
git merge main --strategy-option theirs --allow-unrelated-histories --no-edit
conventional-changelog -p angular -i CHANGELOG.md -s
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md [skip ci]"
git push origin auto-changelog-update-do-not-create-manually
exit 0
else
git checkout main
git checkout -b auto-changelog-update-do-not-create-manually
git push origin auto-changelog-update-do-not-create-manually
conventional-changelog -p angular -i CHANGELOG.md -s
fi
- name: Show git status and changelog contents
run: |
git status
echo "Changelog contents:"
cat CHANGELOG.md
- name: Create Pull Request
if: env.branch_exists == 'false'
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update CHANGELOG.md [skip ci]"
title: "Chore(changelog): Automated Changelog Update [skip ci]"
body: "Update the CHANGELOG.md with recent pushes to branch main."
base: "main"
branch: "auto-changelog-update-do-not-create-manually"
delete-branch: true

- name: Revert temporary commit
run: git reset HEAD~
- name: Check outputs
if: env.branch_exists == 'false'
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Commit and push changelog update
- name: Log if PR updated
if: steps.cpr.outputs.pull-request-operation == 'updated'
run: |
git add CHANGELOG.md
git diff --staged --quiet || git commit -m "Update CHANGELOG.md based on PR #${{ github.event.pull_request.number }} title"
git push origin HEAD:refs/heads/main
echo "Changelog PR updated due to new commit to main."
58 changes: 58 additions & 0 deletions .github/workflows/e2e_test_upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: E2E Tests Upgrade

on:
workflow_dispatch:
pull_request:
types:
# trigger workflow if PR is opened directly as R4R.
- opened
# trigger workflow if changes are pushed to the branch.
- synchronize
# trigger workflow if PR is marked ready for review.
- ready_for_review
paths:
- 'app/upgrades/**'

permissions:
contents: read
packages: write

jobs:
build-image:
runs-on: ubuntu-latest
outputs:
UPGRADE_NAME: ${{ steps.set-output.outputs.upgrade }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set environment variable
id: set-output
run: |
upgradeName=$(ls -d -- ./app/upgrades/v* | sort -Vr | head -n 1 | xargs basename)
echo "upgrade=$upgradeName" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and export
uses: docker/build-push-action@v5
with:
file: Dockerfile
context: .
outputs: type=docker,dest=/tmp/e2e.tar
platforms: linux/amd64
tags: |
ghcr.io/dymensionxyz/dymension:e2e
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: e2e
path: /tmp/e2e.tar

e2e-tests-upgrade:
needs: build-image
uses: dymensionxyz/e2e-tests/.github/workflows/e2e-test-rollapp-wasm-upgrade-workflow-call.yml@main
with:
dymension_ci: "e2e"
upgrade_name: "${{ needs.build-image.outputs.UPGRADE_NAME }}"
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
* **be:** bumps `block-explorer-rpc-cosmos v1.0.2` & `wasm-block-explorer-rpc-cosmos v1.0.2` ([#42](https://github.com/dymensionxyz/rollapp-wasm/issues/42)) ([eab8283](https://github.com/dymensionxyz/rollapp-wasm/commit/eab82830f8ac5586cdc5d67f134fe52cda48f502))
* **be:** bumps `block-explorer-rpc-cosmos v1.0.3` & `wasm-block-explorer-rpc-cosmos v1.0.3` ([#45](https://github.com/dymensionxyz/rollapp-wasm/issues/45)) ([349bb7c](https://github.com/dymensionxyz/rollapp-wasm/commit/349bb7cf51b954aba087f951bdce02f914d32d6c))
* **be:** bumps `block-explorer-rpc-cosmos v1.1.2` & `wasm-block-explorer-rpc-cosmos v1.1.2` ([#55](https://github.com/dymensionxyz/rollapp-wasm/issues/55)) ([15c563b](https://github.com/dymensionxyz/rollapp-wasm/commit/15c563b10b8e2e5be4d85acfa4362ddd711bf377))
* **be:** bumps `block-explorer-rpc-cosmos v1.2.3` ([#76](https://github.com/dymensionxyz/rollapp-wasm/issues/76))
* **be:** bumps `block-explorer-rpc-cosmos v1.2.3` ([#76](https://github.com/dymensionxyz/rollapp-wasm/issues/76))

14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ sudo systemctl daemon-reload
### Install dymension relayer

```shell
git clone https://github.com/dymensionxyz/go-relayer.git --branch v0.2.0-v2.3.1-relayer
git clone https://github.com/dymensionxyz/go-relayer.git --branch v0.3.2-v2.5.2-relayer
cd go-relayer && make install
```

Expand Down Expand Up @@ -287,3 +287,15 @@ Start the rollapp:
```shell
rollapp-wasm start
```

## Developer

For support, join our [Discord](http://discord.gg/dymension) community and find us in the Developer section.

### Setup push hooks

To setup push hooks, run the following command:

```sh
./scripts/setup_push_hooks.sh
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
github.com/dymensionxyz/dymension-rdk v1.6.0
github.com/dymensionxyz/dymint v1.1.0-rc02
github.com/ethereum/go-ethereum v1.12.0
github.com/evmos/evmos/v12 v12.1.6
github.com/gorilla/mux v1.8.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.18.0
Expand Down Expand Up @@ -105,7 +106,6 @@ require (
github.com/dymensionxyz/cosmosclient v0.4.2-beta // indirect
github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240411195658-f7cd96f53b56 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/evmos/evmos/v12 v12.1.6 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/filecoin-project/go-jsonrpc v0.3.1 // indirect
github.com/flynn/noise v1.1.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion rollappd/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
etherminthd "github.com/evmos/evmos/v12/crypto/hd"
)

const (
Expand All @@ -39,7 +40,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx := client.GetClientContextFromCmd(cmd).WithKeyringOptions(etherminthd.EthSecp256k1Option())
cdc := clientCtx.Codec

serverCtx := server.GetServerContextFromCmd(cmd)
Expand Down
2 changes: 2 additions & 0 deletions rollappd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
etherminthd "github.com/evmos/evmos/v12/crypto/hd"

berpcconfig "github.com/bcdevtools/block-explorer-rpc-cosmos/be_rpc/config"
rdkserver "github.com/dymensionxyz/dymension-rdk/server"
Expand Down Expand Up @@ -63,6 +64,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
WithInput(os.Stdin).
WithAccountRetriever(types.AccountRetriever{}).
WithHomeDir(app.DefaultNodeHome).
WithKeyringOptions(etherminthd.EthSecp256k1Option()).
WithViper("ROLLAPP")

rootCmd := &cobra.Command{
Expand Down
40 changes: 35 additions & 5 deletions scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,40 @@
tmp=$(mktemp)

set_denom() {
denom=$1
jq --arg denom $denom '.app_state.mint.params.mint_denom = $denom' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE"
jq --arg denom $denom '.app_state.staking.params.bond_denom = $denom' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE"
jq --arg denom $denom '.app_state.gov.deposit_params.min_deposit[0].denom = $denom' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE"
base_denom=$1
denom=$(echo "$base_denom" | sed 's/^.//')
jq --arg base_denom $base_denom '.app_state.mint.params.mint_denom = $base_denom' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE"
jq --arg base_denom $base_denom '.app_state.staking.params.bond_denom = $base_denom' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE"
jq --arg base_denom $base_denom '.app_state.gov.deposit_params.min_deposit[0].denom = $base_denom' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE"

jq --arg base_denom $base_denom --arg denom $denom '.app_state.bank.denom_metadata = [
{
"base": $base_denom,
"denom_units": [
{
"aliases": [],
"denom": $base_denom,
"exponent": 0
},
{
"aliases": [],
"denom": $denom,
"exponent": 18
}
],
"description": "Denom metadata for Rollapp Wasm",
"display": $denom,
"name": $denom,
"symbol": "WASM"
}
]' "$GENESIS_FILE" > "$tmp" && mv "$tmp" "$GENESIS_FILE"

}

set_consensus_params() {
BLOCK_SIZE="500000"
jq --arg block_size "$BLOCK_SIZE" '.consensus_params["block"]["max_bytes"] = $block_size' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE"
jq --arg block_size "$BLOCK_SIZE" '.consensus_params["evidence"]["max_bytes"] = $block_size' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE"
}

# ---------------------------- initial parameters ---------------------------- #
Expand Down Expand Up @@ -54,7 +84,7 @@ $EXECUTABLE config chain-id "$ROLLAPP_CHAIN_ID"
# -------------------------------- app config -------------------------------- #
sed -i'' -e "s/^minimum-gas-prices *= .*/minimum-gas-prices = \"0$BASE_DENOM\"/" "$APP_CONFIG_FILE"
set_denom "$BASE_DENOM"

set_consensus_params
# --------------------- adding keys and genesis accounts --------------------- #
#local genesis account
$EXECUTABLE keys add "$KEY_NAME_ROLLAPP" --keyring-backend test
Expand Down
9 changes: 9 additions & 0 deletions scripts/setup-git-hooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

# Copy pre-push hook to .git/hooks/
cp ./.githooks/pre-push ./.git/hooks/pre-push

# Make the pre-push hook executable
chmod +x .git/hooks/pre-push

echo "Git push hooks installed successfully."
2 changes: 1 addition & 1 deletion scripts/wasm/deploy_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ INIT_CW20=$(cat <<EOF
{
"name": "My first token",
"symbol": "test",
"decimals": 6,
"decimals": 18,
"initial_balances": [{
"address": "$ROLLAPP_GENESIS_ADDR",
"amount": "100000000000"
Expand Down

0 comments on commit 4bfc392

Please sign in to comment.