diff --git a/.githook/pre-push b/.githook/pre-push new file mode 100644 index 0000000..f003fa0 --- /dev/null +++ b/.githook/pre-push @@ -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/golangci-lint@v1.58.0'" + 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 diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 38a2aaf..a18561b 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -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 \ No newline at end of file + echo "Changelog PR updated due to new commit to main." \ No newline at end of file diff --git a/.github/workflows/e2e_test_upgrade.yml b/.github/workflows/e2e_test_upgrade.yml new file mode 100644 index 0000000..33e3a5f --- /dev/null +++ b/.github/workflows/e2e_test_upgrade.yml @@ -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 }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index f581196..739ff3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) \ No newline at end of file +* **be:** bumps `block-explorer-rpc-cosmos v1.2.3` ([#76](https://github.com/dymensionxyz/rollapp-wasm/issues/76)) + diff --git a/README.md b/README.md index 3e1670e..61b8daf 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -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 +``` \ No newline at end of file diff --git a/go.mod b/go.mod index fdb4469..208f1ce 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 diff --git a/rollappd/cmd/genaccounts.go b/rollappd/cmd/genaccounts.go index c9d25a4..030cc3a 100644 --- a/rollappd/cmd/genaccounts.go +++ b/rollappd/cmd/genaccounts.go @@ -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 ( @@ -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) diff --git a/rollappd/cmd/root.go b/rollappd/cmd/root.go index 84f5c34..0aab1b6 100644 --- a/rollappd/cmd/root.go +++ b/rollappd/cmd/root.go @@ -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" @@ -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{ diff --git a/scripts/init.sh b/scripts/init.sh index 10d090d..16e5ab5 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -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 ---------------------------- # @@ -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 diff --git a/scripts/setup-git-hooks.sh b/scripts/setup-git-hooks.sh new file mode 100644 index 0000000..185f0fb --- /dev/null +++ b/scripts/setup-git-hooks.sh @@ -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." diff --git a/scripts/wasm/deploy_contract.sh b/scripts/wasm/deploy_contract.sh index f1284b8..6e0987e 100755 --- a/scripts/wasm/deploy_contract.sh +++ b/scripts/wasm/deploy_contract.sh @@ -15,7 +15,7 @@ INIT_CW20=$(cat <