From ea8f69a9604b3d19f50ff593a6bca3e857bdb4d0 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:00:58 -0700 Subject: [PATCH 01/23] testing workflow --- .github/workflows/sync-subnet-evm-branch.yml | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/sync-subnet-evm-branch.yml diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml new file mode 100644 index 0000000000..5adc58ed37 --- /dev/null +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -0,0 +1,24 @@ +name: "Sync Subnet EVM Branch" +on: + workflow_dispatch: + inputs: + remoteBranch: + description: "Subnet EVM Branch" + required: true + default: "coreth-test-0" + +jobs: + sync_branch: + name: Sync Subnet EVM Branch + runs-on: ubuntu-20.04 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "~1.21.12" + check-latest: true + + - name: Add Remote + run: | + git remote add -f subnet-evm git@github.com:ava-labs/subnet-evm.git + git remote -v # Verify the new remote was added + \ No newline at end of file From d7cbe89da3d686cb5bcd057778f43e0b95b6b970 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:07:00 -0700 Subject: [PATCH 02/23] try again --- .github/workflows/sync-subnet-evm-branch.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 5adc58ed37..6aa0930c6a 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -1,5 +1,8 @@ name: "Sync Subnet EVM Branch" on: + push: + branches: + - sync-subnet-evm-branch # Hack to trigger workflow workflow_dispatch: inputs: remoteBranch: From 97eee8669334ec5329ad133933c6917fba7629c3 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:12:28 -0700 Subject: [PATCH 03/23] try --- .github/workflows/sync-subnet-evm-branch.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 6aa0930c6a..38f49c85a4 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -15,6 +15,8 @@ jobs: name: Sync Subnet EVM Branch runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: "~1.21.12" @@ -24,4 +26,8 @@ jobs: run: | git remote add -f subnet-evm git@github.com:ava-labs/subnet-evm.git git remote -v # Verify the new remote was added - \ No newline at end of file + + - name: Fetch Remote Branch (${{ github.events.inputs.remoteBranch }}) + run: | + git fetch ${{ github.events.inputs.remoteBranch }} + git branch -a # Verify the new branch was fetched \ No newline at end of file From 8e4e48fc44f6ae88dc3babcb4aa50e97c071d626 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:13:29 -0700 Subject: [PATCH 04/23] try --- .github/workflows/sync-subnet-evm-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 38f49c85a4..69cf6c41e9 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -24,7 +24,7 @@ jobs: - name: Add Remote run: | - git remote add -f subnet-evm git@github.com:ava-labs/subnet-evm.git + git remote add -f subnet-evm ava-labs/subnet-evm git remote -v # Verify the new remote was added - name: Fetch Remote Branch (${{ github.events.inputs.remoteBranch }}) From b3632178aae604876384098cc93249071e719356 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:14:36 -0700 Subject: [PATCH 05/23] try https for remote --- .github/workflows/sync-subnet-evm-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 69cf6c41e9..d497ef11c1 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -24,7 +24,7 @@ jobs: - name: Add Remote run: | - git remote add -f subnet-evm ava-labs/subnet-evm + git remote add -f subnet-evm https://github.com/ava-labs/subnet-evm git remote -v # Verify the new remote was added - name: Fetch Remote Branch (${{ github.events.inputs.remoteBranch }}) From 5642d53bb7ce5a8452ed36c00e02e5d653a8a072 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:17:05 -0700 Subject: [PATCH 06/23] move branch spec --- .github/workflows/sync-subnet-evm-branch.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index d497ef11c1..976fbe2faf 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -8,7 +8,6 @@ on: remoteBranch: description: "Subnet EVM Branch" required: true - default: "coreth-test-0" jobs: sync_branch: @@ -27,7 +26,7 @@ jobs: git remote add -f subnet-evm https://github.com/ava-labs/subnet-evm git remote -v # Verify the new remote was added - - name: Fetch Remote Branch (${{ github.events.inputs.remoteBranch }}) + - name: Fetch Remote Branch (${{ github.events.inputs.remoteBranch || 'coreth-test-0' }}) run: | - git fetch ${{ github.events.inputs.remoteBranch }} + git fetch ${{ github.events.inputs.remoteBranch || 'coreth-test-0' }} git branch -a # Verify the new branch was fetched \ No newline at end of file From 481f8a6a383f914348fd4f5963770cacf8563c68 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:29:17 -0700 Subject: [PATCH 07/23] try create pr --- .github/workflows/sync-subnet-evm-branch.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 976fbe2faf..9e25662090 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -26,7 +26,24 @@ jobs: git remote add -f subnet-evm https://github.com/ava-labs/subnet-evm git remote -v # Verify the new remote was added + # TODO: Can use default when we remove the push trigger hack + # TODO: Replace test branch with actual (eg, coreth) - name: Fetch Remote Branch (${{ github.events.inputs.remoteBranch || 'coreth-test-0' }}) run: | git fetch ${{ github.events.inputs.remoteBranch || 'coreth-test-0' }} - git branch -a # Verify the new branch was fetched \ No newline at end of file + git branch -a # Verify the new branch was fetched + + - name: Apply diff + run: | + ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.events.inputs.remoteBranch || 'coreth-test-0' }} + + # TODO: Add subnet-evm commit hash + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + commit-message: "Automated commit message" + branch: auto-sync-subnet-evm + title: "Sync Subnet EVM" + body: | + This PR was created automatically by a GitHub Action. + draft: true \ No newline at end of file From 22804b68ab692f7b5195762f43dd4a9851770d15 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:30:39 -0700 Subject: [PATCH 08/23] try --- .github/workflows/sync-subnet-evm-branch.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 9e25662090..b5db6a18aa 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -24,13 +24,12 @@ jobs: - name: Add Remote run: | git remote add -f subnet-evm https://github.com/ava-labs/subnet-evm - git remote -v # Verify the new remote was added # TODO: Can use default when we remove the push trigger hack # TODO: Replace test branch with actual (eg, coreth) - name: Fetch Remote Branch (${{ github.events.inputs.remoteBranch || 'coreth-test-0' }}) run: | - git fetch ${{ github.events.inputs.remoteBranch || 'coreth-test-0' }} + git fetch subnet-evm ${{ github.events.inputs.remoteBranch || 'coreth-test-0' }} git branch -a # Verify the new branch was fetched - name: Apply diff From 7792adc6ceed867e650ff71f55d931a85f77c4b8 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:32:09 -0700 Subject: [PATCH 09/23] try --- .github/workflows/sync-subnet-evm-branch.yml | 2 +- scripts/apply_diff_and_rename.sh | 30 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 scripts/apply_diff_and_rename.sh diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index b5db6a18aa..80d38c09a3 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -23,7 +23,7 @@ jobs: - name: Add Remote run: | - git remote add -f subnet-evm https://github.com/ava-labs/subnet-evm + git remote add subnet-evm https://github.com/ava-labs/subnet-evm # TODO: Can use default when we remove the push trigger hack # TODO: Replace test branch with actual (eg, coreth) diff --git a/scripts/apply_diff_and_rename.sh b/scripts/apply_diff_and_rename.sh new file mode 100755 index 0000000000..24fbfc3e45 --- /dev/null +++ b/scripts/apply_diff_and_rename.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Add other repo as a remote: `git remote add -f coreth git@github.com:ava-labs/coreth.git`. +# Usage: ./scripts/apply_diff_and_rename.sh coreth/master (or subnet-evm/master) + +set -e; +set -u; + +ROOT=$(git rev-parse --show-toplevel); +cd "${ROOT}"; + +BASE="${1}"; + +git diff .."${BASE}" --binary | git apply --whitespace=nowarn + +if [[ "${BASE}" == coreth* ]]; then + echo "Replacing coreth with subnet-evm" + sed_command='s!github.com/ava-labs/coreth!github.com/ava-labs/subnet-evm!g' +else + echo "Replacing subnet-evm with coreth" + sed_command='s!github.com/ava-labs/subnet-evm!github.com/ava-labs/coreth!g' +fi + +# TODO: improve this command that finds all the "coreth" references and replaces them with "subnet-evm" +LANG=C find . -type f \! -name 'apply_diff_and_rename.sh' \! -path './.git/*' \! -path './contracts/node_modules/*' -exec sed -i '' -e "${sed_command}" {} \; +gofmt -w . +go mod tidy + +# Restore contracts/.gitignore +git checkout -- contracts/.gitignore \ No newline at end of file From 6cc18baa486c4ed2c40021bfe21fb15fb4aba91a Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:38:02 -0700 Subject: [PATCH 10/23] try --- scripts/apply_diff_and_rename.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/apply_diff_and_rename.sh b/scripts/apply_diff_and_rename.sh index 24fbfc3e45..0681db69ad 100755 --- a/scripts/apply_diff_and_rename.sh +++ b/scripts/apply_diff_and_rename.sh @@ -22,7 +22,11 @@ else fi # TODO: improve this command that finds all the "coreth" references and replaces them with "subnet-evm" -LANG=C find . -type f \! -name 'apply_diff_and_rename.sh' \! -path './.git/*' \! -path './contracts/node_modules/*' -exec sed -i '' -e "${sed_command}" {} \; +sed_inplace="sed -i" # Linux +if [[ $(uname) == "Darwin" ]]; then + sed_inplace="sed -i ''" +fi +LANG=C find . -type f \! -name 'apply_diff_and_rename.sh' \! -path './.git/*' \! -path './contracts/node_modules/*' -exec "${sed_inplace} -e "${sed_command}" {} \; gofmt -w . go mod tidy From 33543f67025640545a6dd9c55e0359903f5f62ad Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:41:26 -0700 Subject: [PATCH 11/23] rm script --- scripts/apply_diff_and_rename.sh | 34 -------------------------------- 1 file changed, 34 deletions(-) delete mode 100755 scripts/apply_diff_and_rename.sh diff --git a/scripts/apply_diff_and_rename.sh b/scripts/apply_diff_and_rename.sh deleted file mode 100755 index 0681db69ad..0000000000 --- a/scripts/apply_diff_and_rename.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Add other repo as a remote: `git remote add -f coreth git@github.com:ava-labs/coreth.git`. -# Usage: ./scripts/apply_diff_and_rename.sh coreth/master (or subnet-evm/master) - -set -e; -set -u; - -ROOT=$(git rev-parse --show-toplevel); -cd "${ROOT}"; - -BASE="${1}"; - -git diff .."${BASE}" --binary | git apply --whitespace=nowarn - -if [[ "${BASE}" == coreth* ]]; then - echo "Replacing coreth with subnet-evm" - sed_command='s!github.com/ava-labs/coreth!github.com/ava-labs/subnet-evm!g' -else - echo "Replacing subnet-evm with coreth" - sed_command='s!github.com/ava-labs/subnet-evm!github.com/ava-labs/coreth!g' -fi - -# TODO: improve this command that finds all the "coreth" references and replaces them with "subnet-evm" -sed_inplace="sed -i" # Linux -if [[ $(uname) == "Darwin" ]]; then - sed_inplace="sed -i ''" -fi -LANG=C find . -type f \! -name 'apply_diff_and_rename.sh' \! -path './.git/*' \! -path './contracts/node_modules/*' -exec "${sed_inplace} -e "${sed_command}" {} \; -gofmt -w . -go mod tidy - -# Restore contracts/.gitignore -git checkout -- contracts/.gitignore \ No newline at end of file From aaf1b9cb1e80cddca798aac02d89b1477f8fc691 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:49:26 -0700 Subject: [PATCH 12/23] try --- .github/workflows/sync-subnet-evm-branch.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 80d38c09a3..c2a3241bee 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -30,8 +30,14 @@ jobs: - name: Fetch Remote Branch (${{ github.events.inputs.remoteBranch || 'coreth-test-0' }}) run: | git fetch subnet-evm ${{ github.events.inputs.remoteBranch || 'coreth-test-0' }} + git fetch subnet-evm coreth-diff-script git branch -a # Verify the new branch was fetched + # TODO: Remove this step when the script is checked in + - name: Checkout script + run: | + git checkout subnet-evm/coreth-diff-script -- ./scripts/apply_diff_and_rename.sh + - name: Apply diff run: | ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.events.inputs.remoteBranch || 'coreth-test-0' }} From 1dad2f81125513fa4c269cb01ea7f77ea4bd6dc2 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 11:57:39 -0700 Subject: [PATCH 13/23] restore workflows --- .github/workflows/sync-subnet-evm-branch.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index c2a3241bee..0b513770b1 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -42,6 +42,11 @@ jobs: run: | ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.events.inputs.remoteBranch || 'coreth-test-0' }} + # TODO: Should this step be removed? + - name: Restore .github/workflows + run: | + git checkout -- .github/workflows + # TODO: Add subnet-evm commit hash - name: Create Pull Request uses: peter-evans/create-pull-request@v6 From b0e7f416674fa8bde03cdae9cf3503cd43a60ee3 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 13:51:58 -0700 Subject: [PATCH 14/23] try rev-parse --- .github/workflows/sync-subnet-evm-branch.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 2102cab6ee..c0f25fcf15 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -23,13 +23,13 @@ jobs: run: | git remote add subnet-evm https://github.com/ava-labs/subnet-evm - # TODO: Can use default when we remove the push trigger hack # TODO: Replace test branch with actual (eg, coreth) - name: Fetch Remote Branch (${{ github.event.inputs.remoteBranch }}) + id: fetch_remote_branch run: | git fetch subnet-evm ${{ github.event.inputs.remoteBranch }} git fetch subnet-evm coreth-diff-script - git branch -a # Verify the new branch was fetched + git rev-parse --short=8 subnet-evm/coreth-test-0 >> $GITHUB_OUTPUT # TODO: Remove this step when the script is checked in - name: Checkout script @@ -45,13 +45,12 @@ jobs: run: | git checkout -- .github/workflows - # TODO: Add subnet-evm commit hash - name: Create Pull Request uses: peter-evans/create-pull-request@v6 with: - commit-message: "Automated commit message" - branch: auto-sync-subnet-evm - title: "Sync Subnet EVM" + commit-message: "Sync subnet-evm to ${{ steps.fetch_remote_branch.outputs.result }}" + branch: sync-subnet-evm-${{ steps.fetch_remote_branch.outputs.result }} + title: "Sync Subnet EVM to ${{ steps.fetch_remote_branch.outputs.result }}" body: | This PR was created automatically by a GitHub Action. draft: true From 4ac814086ac8830badb664df33a5406f291670f1 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 13:52:53 -0700 Subject: [PATCH 15/23] consistent wspace --- .github/workflows/sync-subnet-evm-branch.yml | 80 ++++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index c0f25fcf15..e6c6e8f3f6 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -8,49 +8,49 @@ on: default: "coreth-test-0" jobs: - sync_branch: - name: Sync Subnet EVM Branch - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 + sync_branch: + name: Sync Subnet EVM Branch + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: "~1.21.12" - check-latest: true + - uses: actions/setup-go@v5 + with: + go-version: "~1.21.12" + check-latest: true - - name: Add Remote - run: | - git remote add subnet-evm https://github.com/ava-labs/subnet-evm - - # TODO: Replace test branch with actual (eg, coreth) - - name: Fetch Remote Branch (${{ github.event.inputs.remoteBranch }}) - id: fetch_remote_branch - run: | - git fetch subnet-evm ${{ github.event.inputs.remoteBranch }} - git fetch subnet-evm coreth-diff-script - git rev-parse --short=8 subnet-evm/coreth-test-0 >> $GITHUB_OUTPUT + - name: Add Remote + run: | + git remote add subnet-evm https://github.com/ava-labs/subnet-evm + + # TODO: Replace test branch with actual (eg, coreth) + - name: Fetch Remote Branch (${{ github.event.inputs.remoteBranch }}) + id: fetch_remote_branch + run: | + git fetch subnet-evm ${{ github.event.inputs.remoteBranch }} + git fetch subnet-evm coreth-diff-script + git rev-parse --short=8 subnet-evm/coreth-test-0 >> $GITHUB_OUTPUT - # TODO: Remove this step when the script is checked in - - name: Checkout script - run: | - git checkout subnet-evm/coreth-diff-script -- ./scripts/apply_diff_and_rename.sh + # TODO: Remove this step when the script is checked in + - name: Checkout script + run: | + git checkout subnet-evm/coreth-diff-script -- ./scripts/apply_diff_and_rename.sh - - name: Apply diff - run: | - ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.event.inputs.remoteBranch }} + - name: Apply diff + run: | + ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.event.inputs.remoteBranch }} - # TODO: Should this step be removed? - - name: Restore .github/workflows - run: | - git checkout -- .github/workflows + # TODO: Should this step be removed? + - name: Restore .github/workflows + run: | + git checkout -- .github/workflows - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - commit-message: "Sync subnet-evm to ${{ steps.fetch_remote_branch.outputs.result }}" - branch: sync-subnet-evm-${{ steps.fetch_remote_branch.outputs.result }} - title: "Sync Subnet EVM to ${{ steps.fetch_remote_branch.outputs.result }}" - body: | - This PR was created automatically by a GitHub Action. - draft: true + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + commit-message: "Sync subnet-evm to ${{ steps.fetch_remote_branch.outputs.result }}" + branch: sync-subnet-evm-${{ steps.fetch_remote_branch.outputs.result }} + title: "Sync Subnet EVM to ${{ steps.fetch_remote_branch.outputs.result }}" + body: | + This PR was created automatically by a GitHub Action. + draft: true From b2330720bc710683a7318315fd447bcc720038e7 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 13:54:05 -0700 Subject: [PATCH 16/23] more wspace --- .github/workflows/sync-subnet-evm-branch.yml | 78 ++++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index e6c6e8f3f6..7253739db3 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -9,48 +9,48 @@ on: jobs: sync_branch: - name: Sync Subnet EVM Branch - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 + name: Sync Subnet EVM Branch + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: "~1.21.12" - check-latest: true + - uses: actions/setup-go@v5 + with: + go-version: "~1.21.12" + check-latest: true - - name: Add Remote - run: | - git remote add subnet-evm https://github.com/ava-labs/subnet-evm - - # TODO: Replace test branch with actual (eg, coreth) - - name: Fetch Remote Branch (${{ github.event.inputs.remoteBranch }}) - id: fetch_remote_branch - run: | - git fetch subnet-evm ${{ github.event.inputs.remoteBranch }} - git fetch subnet-evm coreth-diff-script - git rev-parse --short=8 subnet-evm/coreth-test-0 >> $GITHUB_OUTPUT + - name: Add Remote + run: | + git remote add subnet-evm https://github.com/ava-labs/subnet-evm + + # TODO: Replace test branch with actual (eg, coreth) + - name: Fetch Remote Branch (${{ github.event.inputs.remoteBranch }}) + id: fetch_remote_branch + run: | + git fetch subnet-evm ${{ github.event.inputs.remoteBranch }} + git fetch subnet-evm coreth-diff-script + git rev-parse --short=8 subnet-evm/coreth-test-0 >> $GITHUB_OUTPUT - # TODO: Remove this step when the script is checked in - - name: Checkout script - run: | - git checkout subnet-evm/coreth-diff-script -- ./scripts/apply_diff_and_rename.sh + # TODO: Remove this step when the script is checked in + - name: Checkout script + run: | + git checkout subnet-evm/coreth-diff-script -- ./scripts/apply_diff_and_rename.sh - - name: Apply diff - run: | - ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.event.inputs.remoteBranch }} + - name: Apply diff + run: | + ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.event.inputs.remoteBranch }} - # TODO: Should this step be removed? - - name: Restore .github/workflows - run: | - git checkout -- .github/workflows + # TODO: Should this step be removed? + - name: Restore .github/workflows + run: | + git checkout -- .github/workflows - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - commit-message: "Sync subnet-evm to ${{ steps.fetch_remote_branch.outputs.result }}" - branch: sync-subnet-evm-${{ steps.fetch_remote_branch.outputs.result }} - title: "Sync Subnet EVM to ${{ steps.fetch_remote_branch.outputs.result }}" - body: | - This PR was created automatically by a GitHub Action. - draft: true + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + commit-message: "Sync subnet-evm to ${{ steps.fetch_remote_branch.outputs.result }}" + branch: sync-subnet-evm-${{ steps.fetch_remote_branch.outputs.result }} + title: "Sync Subnet EVM to ${{ steps.fetch_remote_branch.outputs.result }}" + body: | + This PR was created automatically by a GitHub Action. + draft: true From 089c6b9f3608d4755f67562695e71f67abf6b698 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 13:54:26 -0700 Subject: [PATCH 17/23] more wspace --- .github/workflows/sync-subnet-evm-branch.yml | 80 ++++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 7253739db3..1de580b202 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -8,49 +8,49 @@ on: default: "coreth-test-0" jobs: - sync_branch: - name: Sync Subnet EVM Branch - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 + sync_branch: + name: Sync Subnet EVM Branch + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: "~1.21.12" - check-latest: true + - uses: actions/setup-go@v5 + with: + go-version: "~1.21.12" + check-latest: true - - name: Add Remote - run: | - git remote add subnet-evm https://github.com/ava-labs/subnet-evm - - # TODO: Replace test branch with actual (eg, coreth) - - name: Fetch Remote Branch (${{ github.event.inputs.remoteBranch }}) - id: fetch_remote_branch - run: | - git fetch subnet-evm ${{ github.event.inputs.remoteBranch }} - git fetch subnet-evm coreth-diff-script - git rev-parse --short=8 subnet-evm/coreth-test-0 >> $GITHUB_OUTPUT + - name: Add Remote + run: | + git remote add subnet-evm https://github.com/ava-labs/subnet-evm + + # TODO: Replace test branch with actual (eg, coreth) + - name: Fetch Remote Branch (${{ github.event.inputs.remoteBranch }}) + id: fetch_remote_branch + run: | + git fetch subnet-evm ${{ github.event.inputs.remoteBranch }} + git fetch subnet-evm coreth-diff-script + git rev-parse --short=8 subnet-evm/coreth-test-0 >> $GITHUB_OUTPUT - # TODO: Remove this step when the script is checked in - - name: Checkout script - run: | - git checkout subnet-evm/coreth-diff-script -- ./scripts/apply_diff_and_rename.sh + # TODO: Remove this step when the script is checked in + - name: Checkout script + run: | + git checkout subnet-evm/coreth-diff-script -- ./scripts/apply_diff_and_rename.sh - - name: Apply diff - run: | - ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.event.inputs.remoteBranch }} + - name: Apply diff + run: | + ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.event.inputs.remoteBranch }} - # TODO: Should this step be removed? - - name: Restore .github/workflows - run: | - git checkout -- .github/workflows + # TODO: Should this step be removed? + - name: Restore .github/workflows + run: | + git checkout -- .github/workflows - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - commit-message: "Sync subnet-evm to ${{ steps.fetch_remote_branch.outputs.result }}" - branch: sync-subnet-evm-${{ steps.fetch_remote_branch.outputs.result }} - title: "Sync Subnet EVM to ${{ steps.fetch_remote_branch.outputs.result }}" - body: | - This PR was created automatically by a GitHub Action. - draft: true + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + commit-message: "Sync subnet-evm to ${{ steps.fetch_remote_branch.outputs.result }}" + branch: sync-subnet-evm-${{ steps.fetch_remote_branch.outputs.result }} + title: "Sync Subnet EVM to ${{ steps.fetch_remote_branch.outputs.result }}" + body: | + This PR was created automatically by a GitHub Action. + draft: true From 91d3ac41dc26ebe762953e994ab627dd5d0f03f6 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 13:58:25 -0700 Subject: [PATCH 18/23] try --- .github/workflows/sync-subnet-evm-branch.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 1de580b202..2ed9467be9 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -29,7 +29,8 @@ jobs: run: | git fetch subnet-evm ${{ github.event.inputs.remoteBranch }} git fetch subnet-evm coreth-diff-script - git rev-parse --short=8 subnet-evm/coreth-test-0 >> $GITHUB_OUTPUT + result=$(git rev-parse --short=8 subnet-evm/coreth-test-0) + echo "result=${result}" >> $GITHUB_OUTPUT # TODO: Remove this step when the script is checked in - name: Checkout script From e40f0608af88a2e475a3be95bb8b2faf510bef42 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 14:06:00 -0700 Subject: [PATCH 19/23] fixes --- .github/workflows/sync-subnet-evm-branch.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 2ed9467be9..803b5af4d2 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -29,8 +29,8 @@ jobs: run: | git fetch subnet-evm ${{ github.event.inputs.remoteBranch }} git fetch subnet-evm coreth-diff-script - result=$(git rev-parse --short=8 subnet-evm/coreth-test-0) - echo "result=${result}" >> $GITHUB_OUTPUT + result=$(git rev-parse --short=8 subnet-evm/${{ github.event.inputs.remoteBranch }}) + echo result="${result}" >> "${GITHUB_OUTPUT}" # TODO: Remove this step when the script is checked in - name: Checkout script @@ -42,6 +42,7 @@ jobs: ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.event.inputs.remoteBranch }} # TODO: Should this step be removed? + # TODO: Using a single branch to iterate for now (avoid maing noise in notifications) - name: Restore .github/workflows run: | git checkout -- .github/workflows @@ -50,7 +51,7 @@ jobs: uses: peter-evans/create-pull-request@v6 with: commit-message: "Sync subnet-evm to ${{ steps.fetch_remote_branch.outputs.result }}" - branch: sync-subnet-evm-${{ steps.fetch_remote_branch.outputs.result }} + branch: auto-sync-subnet-evm title: "Sync Subnet EVM to ${{ steps.fetch_remote_branch.outputs.result }}" body: | This PR was created automatically by a GitHub Action. From 83efa1bdf80943ce0eb69d3c66604c5a8f61b9be Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 14:08:28 -0700 Subject: [PATCH 20/23] try --- .github/workflows/sync-subnet-evm-branch.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 803b5af4d2..bcf64a2403 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -56,3 +56,9 @@ jobs: body: | This PR was created automatically by a GitHub Action. draft: true + + - name: PR Outputs + if: ${{ steps.cpr.outputs.pull-request-number }} + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" From 7d0b7618a66737ad0d497bd633061c2cae63878f Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 14:09:18 -0700 Subject: [PATCH 21/23] add id --- .github/workflows/sync-subnet-evm-branch.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index bcf64a2403..7edd0eec14 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -48,6 +48,7 @@ jobs: git checkout -- .github/workflows - name: Create Pull Request + id: create_pr uses: peter-evans/create-pull-request@v6 with: commit-message: "Sync subnet-evm to ${{ steps.fetch_remote_branch.outputs.result }}" @@ -58,7 +59,7 @@ jobs: draft: true - name: PR Outputs - if: ${{ steps.cpr.outputs.pull-request-number }} + if: ${{ steps.create_pr.outputs.pull-request-number }} run: | - echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" + echo "Pull Request Number - ${{ steps.create_pr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.create_pr.outputs.pull-request-url }}" From 06bcfdee735b5e2145c545dc54658c387744c998 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 21 Aug 2024 14:09:52 -0700 Subject: [PATCH 22/23] nit --- .github/workflows/sync-subnet-evm-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-subnet-evm-branch.yml b/.github/workflows/sync-subnet-evm-branch.yml index 7edd0eec14..c330ce5781 100644 --- a/.github/workflows/sync-subnet-evm-branch.yml +++ b/.github/workflows/sync-subnet-evm-branch.yml @@ -42,11 +42,11 @@ jobs: ./scripts/apply_diff_and_rename.sh subnet-evm/${{ github.event.inputs.remoteBranch }} # TODO: Should this step be removed? - # TODO: Using a single branch to iterate for now (avoid maing noise in notifications) - name: Restore .github/workflows run: | git checkout -- .github/workflows + # TODO: Using a single branch to iterate for now (avoid maing noise in notifications) - name: Create Pull Request id: create_pr uses: peter-evans/create-pull-request@v6 From d85a02afc9a243fff77fc9bdf61fab9f1fe1c044 Mon Sep 17 00:00:00 2001 From: darioush <4575758+darioush@users.noreply.github.com> Date: Tue, 27 Aug 2024 19:10:14 +0000 Subject: [PATCH 23/23] Sync subnet-evm to 684b0114 --- contracts/.gitignore | 150 +++++++++++++++++++++++++++++++ core/gen_genesis.go | 52 +++++------ scripts/apply_diff_and_rename.sh | 34 +++++++ 3 files changed, 210 insertions(+), 26 deletions(-) create mode 100644 contracts/.gitignore create mode 100755 scripts/apply_diff_and_rename.sh diff --git a/contracts/.gitignore b/contracts/.gitignore new file mode 100644 index 0000000000..46f9335b51 --- /dev/null +++ b/contracts/.gitignore @@ -0,0 +1,150 @@ +/dist + +/.idea +*.tsbuildinfo + +.DS_Store + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +node_modules/ +.env* +!.env*.default +.vscode/* +!.vscode/settings.json.default + +cache/ +artifacts/ + +.yalc +yalc.lock + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +local_rpc.json + +# TypeChain files +/typechain +/typechain-types diff --git a/core/gen_genesis.go b/core/gen_genesis.go index a05cee87f1..ac00615c16 100644 --- a/core/gen_genesis.go +++ b/core/gen_genesis.go @@ -18,19 +18,19 @@ var _ = (*genesisSpecMarshaling)(nil) // MarshalJSON marshals as JSON. func (g Genesis) MarshalJSON() ([]byte, error) { type Genesis struct { - Config *params.ChainConfig `json:"config"` - Nonce math.HexOrDecimal64 `json:"nonce"` - Timestamp math.HexOrDecimal64 `json:"timestamp"` - ExtraData hexutil.Bytes `json:"extraData"` - GasLimit math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"` - Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"` - Mixhash common.Hash `json:"mixHash"` - Coinbase common.Address `json:"coinbase"` - Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"` - Number math.HexOrDecimal64 `json:"number"` - GasUsed math.HexOrDecimal64 `json:"gasUsed"` - ParentHash common.Hash `json:"parentHash"` - BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas"` + Config *params.ChainConfig `json:"config"` + Nonce math.HexOrDecimal64 `json:"nonce"` + Timestamp math.HexOrDecimal64 `json:"timestamp"` + ExtraData hexutil.Bytes `json:"extraData"` + GasLimit math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"` + Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"` + Mixhash common.Hash `json:"mixHash"` + Coinbase common.Address `json:"coinbase"` + Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"` + Number math.HexOrDecimal64 `json:"number"` + GasUsed math.HexOrDecimal64 `json:"gasUsed"` + ParentHash common.Hash `json:"parentHash"` + BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas"` ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas"` BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed"` } @@ -61,19 +61,19 @@ func (g Genesis) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals from JSON. func (g *Genesis) UnmarshalJSON(input []byte) error { type Genesis struct { - Config *params.ChainConfig `json:"config"` - Nonce *math.HexOrDecimal64 `json:"nonce"` - Timestamp *math.HexOrDecimal64 `json:"timestamp"` - ExtraData *hexutil.Bytes `json:"extraData"` - GasLimit *math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"` - Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"` - Mixhash *common.Hash `json:"mixHash"` - Coinbase *common.Address `json:"coinbase"` - Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"` - Number *math.HexOrDecimal64 `json:"number"` - GasUsed *math.HexOrDecimal64 `json:"gasUsed"` - ParentHash *common.Hash `json:"parentHash"` - BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas"` + Config *params.ChainConfig `json:"config"` + Nonce *math.HexOrDecimal64 `json:"nonce"` + Timestamp *math.HexOrDecimal64 `json:"timestamp"` + ExtraData *hexutil.Bytes `json:"extraData"` + GasLimit *math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"` + Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"` + Mixhash *common.Hash `json:"mixHash"` + Coinbase *common.Address `json:"coinbase"` + Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"` + Number *math.HexOrDecimal64 `json:"number"` + GasUsed *math.HexOrDecimal64 `json:"gasUsed"` + ParentHash *common.Hash `json:"parentHash"` + BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas"` ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas"` BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed"` } diff --git a/scripts/apply_diff_and_rename.sh b/scripts/apply_diff_and_rename.sh new file mode 100755 index 0000000000..d160c8c10f --- /dev/null +++ b/scripts/apply_diff_and_rename.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Add other repo as a remote: `git remote add -f coreth git@github.com:ava-labs/coreth.git`. +# Usage: ./scripts/apply_diff_and_rename.sh coreth/master (or subnet-evm/master) + +set -e; +set -u; + +ROOT=$(git rev-parse --show-toplevel); +cd "${ROOT}"; + +BASE="${1}"; + +git diff .."${BASE}" --binary | git apply --whitespace=nowarn + +if [[ "${BASE}" == coreth* ]]; then + echo "Replacing coreth with subnet-evm" + sed_command='s!github.com/ava-labs/coreth!github.com/ava-labs/subnet-evm!g' +else + echo "Replacing subnet-evm with coreth" + sed_command='s!github.com/ava-labs/subnet-evm!github.com/ava-labs/coreth!g' +fi + +# TODO: improve this command that finds all the "coreth" references and replaces them with "subnet-evm" +sed_inplace=(sed -i) # Linux +if [[ $(uname) == "Darwin" ]]; then + sed_inplace=(sed -i '') +fi +LANG=C find . -type f \! -name 'apply_diff_and_rename.sh' \! -path './.git/*' \! -path './contracts/node_modules/*' -exec "${sed_inplace[@]}" -e "${sed_command}" {} \; +gofmt -w . +go mod tidy + +# Restore contracts/.gitignore +git checkout -- contracts/.gitignore 2>/dev/null || true # Ignore if the file doesn't exist \ No newline at end of file