From 68a45f117543f75f9cfc2aa07bb691a52aba0108 Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Tue, 18 Jun 2024 10:13:06 -0700 Subject: [PATCH 1/2] setup release/1.13.x github actions --- .../astria-build-and-publish-image.yml | 10 ++--- .github/workflows/pages.yaml | 41 ------------------- .github/workflows/run-tests.yml | 6 +-- 3 files changed, 8 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/pages.yaml diff --git a/.github/workflows/astria-build-and-publish-image.yml b/.github/workflows/astria-build-and-publish-image.yml index 648e38ec3..f1e593f63 100644 --- a/.github/workflows/astria-build-and-publish-image.yml +++ b/.github/workflows/astria-build-and-publish-image.yml @@ -5,13 +5,13 @@ on: workflow_dispatch: push: branches: - - "main" + - "release/geth-1.13.x" tags: - - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-geth-1.13.x" # trigger on pull request updates when target is `astria` branch pull_request: branches: - - "main" + - "release/geth-1.13.x" jobs: build-and-publish-latest: @@ -59,7 +59,7 @@ jobs: type=match,pattern=v(.*),group=1 type=sha # set latest tag for `astria` branch - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} + type=raw,value=latest-geth-1.13.x,enable=${{ github.ref == format('refs/heads/{0}', 'release/geth-1.13.x') }} - name: Build and push uses: depot/build-push-action@v1 with: @@ -68,7 +68,7 @@ jobs: provenance: false context: . # It takes a long time to build the arm image right now, so we only build it on tags which is what we use for releases, or on merges to the default branch. - platforms: ${{ (contains(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') && 'linux/amd64,linux/arm64' || 'linux/amd64' }} + platforms: ${{ (contains(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/release/geth-1.13.x') && 'linux/amd64,linux/arm64' || 'linux/amd64' }} push: true tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }} diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml deleted file mode 100644 index 338793e70..000000000 --- a/.github/workflows/pages.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build and publish forkdiff github-pages -permissions: - contents: write -on: - push: - branches: - - main -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 1000 # make sure to fetch the old commit we diff against - - - name: Build forkdiff - uses: "docker://protolambda/forkdiff:latest" - with: - args: -repo=./ -fork=./fork.yaml -out=./index.html - - - name: Build pages - run: | - mkdir -p ./tmp/pages - mv ./index.html ./tmp/pages/index.html - touch ./tmp/pages/.nojekyll - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - # Build output to publish to the `gh-pages` branch: - publish_dir: ./tmp/pages - # The following lines assign commit authorship to the official - # GH-Actions bot for deploys to `gh-pages` branch: - # https://github.com/actions/checkout/issues/13#issuecomment-724415212 - # The GH actions bot is used by default if you didn't specify the two fields. - # You can swap them out with your own user credentials. - user_name: github-actions[bot] - user_email: 41898282+github-actions[bot]@users.noreply.github.com - diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a5433809e..7c5292743 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -3,12 +3,12 @@ name: Run tests on: push: branches: - - "main" + - "release/geth-1.13.x" tags: - - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-geth-1.13.x" pull_request: branches: - - "main" + - "release/geth-1.13.x" jobs: build: From d68ace3ed827c4720c02505fb39baf21a81bc947 Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Wed, 12 Jun 2024 14:43:33 -0700 Subject: [PATCH 2/2] feat: support bech32 addresses (cherry picked from commit 39c8871d624224f669ab58801699850e33f797c5) --- genesis.json | 5 +-- go.mod | 9 +++--- go.sum | 53 ++++++++++++++++++++++++------- grpc/execution/server.go | 6 ++-- grpc/execution/server_test.go | 4 +-- grpc/execution/test_utils.go | 12 ++++--- grpc/execution/validation.go | 2 +- grpc/execution/validation_test.go | 6 ++-- params/astria_config_test.go | 22 +++++++------ params/config.go | 20 +++++++++--- 10 files changed, 96 insertions(+), 43 deletions(-) diff --git a/genesis.json b/genesis.json index 9199771da..416dfa26d 100644 --- a/genesis.json +++ b/genesis.json @@ -18,17 +18,18 @@ "astriaRollupName": "astria", "astriaOverrideGenesisExtraData": true, "astriaSequencerInitialHeight": 2, + "astriaSequencerHrpPrefix": "astria", "astriaCelestiaInitialHeight": 2, "astriaCelestiaHeightVariance": 10, "astriaBridgeAddresses": [ { - "bridgeAddress": "684ae50c49a434199199c9c698115391152d7b3f", + "bridgeAddress": "astria1dp9w2rzf5s6pnyvee8rfsy2njy2j67eln842y0", "startHeight": 1, "assetDenom": "nria", "assetPrecision": 9 }, { - "bridgeAddress": "34fec43c7fcab9aef3b3cf8aba855e41ee69ca3a", + "bridgeAddress": "astria1xnlvg0rle2u6auane79t4p27g8hxnj36ja960z", "startHeight": 1, "assetDenom": "transfer/channel-1/usdc", "assetPrecision": 6, diff --git a/go.mod b/go.mod index d625f8123..505eb34bb 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.21 require ( buf.build/gen/go/astria/execution-apis/grpc/go v1.3.0-20240601032207-1bcb86793146.3 - buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.1-20240601032207-1bcb86793146.1 - buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.1-20240529204957-2697e2110d78.1 - buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.1-20240529204957-1b3cb2034833.1 + buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.2-20240607202648-1575a82b8092.2 + buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.2-20240607202648-0eefaac9f5b8.2 + buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.2-20240607202648-a25091c45180.2 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0 github.com/Microsoft/go-winio v0.6.1 github.com/VictoriaMetrics/fastcache v1.12.1 @@ -15,6 +15,7 @@ require ( github.com/aws/aws-sdk-go-v2/credentials v1.13.43 github.com/aws/aws-sdk-go-v2/service/route53 v1.30.2 github.com/btcsuite/btcd/btcec/v2 v2.2.0 + github.com/btcsuite/btcd/btcutil v1.1.5 github.com/cespare/cp v0.1.0 github.com/cloudflare/cloudflare-go v0.79.0 github.com/cockroachdb/errors v1.8.1 @@ -75,7 +76,7 @@ require ( golang.org/x/time v0.3.0 golang.org/x/tools v0.13.0 google.golang.org/grpc v1.61.2 - google.golang.org/protobuf v1.34.1 + google.golang.org/protobuf v1.34.2 gopkg.in/natefinch/lumberjack.v2 v2.0.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 0846f6b45..cf58a2553 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,16 @@ buf.build/gen/go/astria/execution-apis/grpc/go v1.3.0-20240601032207-1bcb86793146.3 h1:i8MoIU0AqTo/iydebYlwmjrWGDPQW6lFUoiQ45E6Pa4= buf.build/gen/go/astria/execution-apis/grpc/go v1.3.0-20240601032207-1bcb86793146.3/go.mod h1:X2jDNjqmRIVdmErR9o6wCtN9Cy/e3CdACHeKE9JVnIg= buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.0-20240601032207-1bcb86793146.1/go.mod h1:/LCeHy9fO3MXiOwoY9dQoTeIfS8UkBv9MC75gYsdLHw= -buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.1-20240601032207-1bcb86793146.1 h1:bLwaKvLfG/XsyXRrlp0bIZAXv5GEBj/DewSsGhy5Ftw= -buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.1-20240601032207-1bcb86793146.1/go.mod h1:dwuQzc8dbNWLqUHa7GwcsvDLe1eOHQifwlDlXOxeUWM= +buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.2-20240607202648-1575a82b8092.2 h1:UHhWlGGs0l0Rm3WIMO+9C6WGnBxU/pMZwa9Wz5+5Eps= +buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.2-20240607202648-1575a82b8092.2/go.mod h1:YmTUIZ+XJNmQc3Ob1liDvZPF36wdzOBtoZYbept5+e8= buf.build/gen/go/astria/primitives/grpc/go v1.3.0-20240528191859-2caf2e8901b3.3/go.mod h1:cy3v1yVidgYadPTyxoYcmI2ttaANZ4cK1eMltUT3Y8w= buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.0-20240528191859-2caf2e8901b3.1/go.mod h1:t7VCP+ORGGLNXUOwi6T6h99GntTUT7bWzK6BQa/uTbA= -buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.1-20240528191859-2caf2e8901b3.1/go.mod h1:pkz/GfhAgZSnDxyZ5bmGUzk6iQNAvyW72pYPkqb7Pbk= -buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.1-20240529204957-2697e2110d78.1 h1:FP1NQSG3SYFFFr4qRVIqD/VD51ipMzJ2XsnD6Qgc82w= -buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.1-20240529204957-2697e2110d78.1/go.mod h1:pkz/GfhAgZSnDxyZ5bmGUzk6iQNAvyW72pYPkqb7Pbk= +buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.2-20240607202648-0eefaac9f5b8.2 h1:iSoFn1fFx4EtH3Z/jyXbRuwxK/ULuuqVEidYNDdvWn0= +buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.2-20240607202648-0eefaac9f5b8.2/go.mod h1:J0Tk7JAHcrhzWNEf1lbePSfFZ1Kp78eAlnO8Cs2ELKg= buf.build/gen/go/astria/sequencerblock-apis/grpc/go v1.3.0-20240528191859-66d6f20a25a2.3/go.mod h1:nj0oXqy+Fx2X7duXc0n1keHiUxbmOHAzRUrP6nYILBo= buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.0-20240528191859-66d6f20a25a2.1/go.mod h1:qSoo/Wv1fQM3moFi8Auky4VF/Sh+QonAGSFPghPxjOc= -buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.1-20240528191859-66d6f20a25a2.1/go.mod h1:ho1LGPi0iGEw8pn0dEv5+f2/J7HwUvWhitx9jNl+lu8= -buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.1-20240529204957-1b3cb2034833.1 h1:TEGVCwN4J+dtp3MIyaDmbe04bRVRdKhcsWmCeAQ0aDw= -buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.1-20240529204957-1b3cb2034833.1/go.mod h1:Mty3/6h+D/YsYpSXjdj0BRy6HbMXbpovLw2Acnez714= +buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.2-20240607202648-a25091c45180.2 h1:uWdgyiBM/w4KXFnKE3rJsn0pLOxV1bnEsb0q9gzXVtI= +buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.2-20240607202648-a25091c45180.2/go.mod h1:0SoUfRtHokSlNy0rLau0I7CWAv+a4KpiwEC96nDdg74= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -1182,6 +1180,7 @@ github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDO github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= +github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= @@ -1236,10 +1235,31 @@ github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHl github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= +github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd h1:js1gPwhcFflTZ7Nzl7WHaOTlTr5hIrR4n1NM4v9n4Kw= +github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= +github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= +github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= +github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= +github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= +github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= +github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= +github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= @@ -1308,6 +1328,7 @@ github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBS github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -1317,6 +1338,7 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.6.0 h1:w/d1ntwh91XI0b/8ja7+u5SvA4IFfM0UNNLmiDR1gg0= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= @@ -1618,11 +1640,14 @@ github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7Bd github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 h1:TMtDYDHKYY15rFihtRfck/bfFqNfvcabqvXAFQfAUpY= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= +github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -1651,6 +1676,7 @@ github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhd github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -1746,11 +1772,14 @@ github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= @@ -1913,6 +1942,7 @@ go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/automaxprocs v1.5.2 h1:2LxUOGiR3O6tw8ui5sZa2LAaHnsviZdVOUZw4fvbnME= go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -2001,6 +2031,7 @@ golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -2719,8 +2750,8 @@ google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/grpc/execution/server.go b/grpc/execution/server.go index e09ee1319..1ff51957d 100644 --- a/grpc/execution/server.go +++ b/grpc/execution/server.go @@ -101,14 +101,14 @@ func NewExecutionServiceServerV1Alpha2(eth *eth.Ethereum) (*ExecutionServiceServ } else { nativeBridgeSeen := false for _, cfg := range bc.Config().AstriaBridgeAddressConfigs { - err := cfg.Validate() + err := cfg.Validate(bc.Config().AstriaSequencerHrpPrefix) if err != nil { return nil, fmt.Errorf("invalid bridge address config: %w", err) } if cfg.Erc20Asset == nil { if nativeBridgeSeen { - return nil, errors.New("only one native bridge address is allowed") + return nil, errors.New("only one native bridge address is allowed") } nativeBridgeSeen = true } @@ -117,7 +117,7 @@ func NewExecutionServiceServerV1Alpha2(eth *eth.Ethereum) (*ExecutionServiceServ return nil, errors.New("astria bridge sender address must be set for bridged ERC20 assets") } - bridgeAddresses[string(cfg.BridgeAddress)] = &cfg + bridgeAddresses[cfg.BridgeAddress] = &cfg assetID := sha256.Sum256([]byte(cfg.AssetDenom)) bridgeAllowedAssetIDs[assetID] = struct{}{} if cfg.Erc20Asset == nil { diff --git a/grpc/execution/server_test.go b/grpc/execution/server_test.go index e33fd6c1e..a054f1bff 100644 --- a/grpc/execution/server_test.go +++ b/grpc/execution/server_test.go @@ -295,7 +295,7 @@ func TestExecutionServiceServerV1Alpha2_ExecuteBlock(t *testing.T) { depositTx := &sequencerblockv1alpha1.RollupData{Value: &sequencerblockv1alpha1.RollupData_Deposit{Deposit: &sequencerblockv1alpha1.Deposit{ BridgeAddress: &primitivev1.Address{ - Inner: bridgeAddress, + Bech32M: bridgeAddress, }, AssetId: bridgeAssetDenom[:], Amount: depositAmount, @@ -388,7 +388,7 @@ func TestExecutionServiceServerV1Alpha2_ExecuteBlockAndUpdateCommitment(t *testi depositTx := &sequencerblockv1alpha1.RollupData{Value: &sequencerblockv1alpha1.RollupData_Deposit{Deposit: &sequencerblockv1alpha1.Deposit{ BridgeAddress: &primitivev1.Address{ - Inner: bridgeAddress, + Bech32M: bridgeAddress, }, AssetId: bridgeAssetDenom[:], Amount: depositAmount, diff --git a/grpc/execution/test_utils.go b/grpc/execution/test_utils.go index 794d0ece3..ae86c4be0 100644 --- a/grpc/execution/test_utils.go +++ b/grpc/execution/test_utils.go @@ -3,6 +3,11 @@ package execution import ( "crypto/ecdsa" "crypto/sha256" + "math/big" + "testing" + "time" + + "github.com/btcsuite/btcd/btcutil/bech32" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" beaconConsensus "github.com/ethereum/go-ethereum/consensus/beacon" @@ -16,9 +21,6 @@ import ( "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" "github.com/stretchr/testify/require" - "math/big" - "testing" - "time" ) var ( @@ -49,12 +51,14 @@ func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block, *ecd bridgeAddress := crypto.PubkeyToAddress(bridgeAddressKey.PublicKey) config.AstriaRollupName = "astria" + config.AstriaSequencerHrpPrefix = "astria" config.AstriaSequencerInitialHeight = 10 config.AstriaCelestiaInitialHeight = 10 config.AstriaCelestiaHeightVariance = 10 + bech32mBridgeAddress, _ := bech32.EncodeM(config.AstriaSequencerHrpPrefix, bridgeAddress.Bytes()) config.AstriaBridgeAddressConfigs = []params.AstriaBridgeAddressConfig{ { - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bech32mBridgeAddress, StartHeight: 2, AssetDenom: "nria", AssetPrecision: 18, diff --git a/grpc/execution/validation.go b/grpc/execution/validation.go index 70bd09181..67c7ce759 100644 --- a/grpc/execution/validation.go +++ b/grpc/execution/validation.go @@ -24,7 +24,7 @@ func validateAndUnmarshalSequencerTx( bridgeSenderAddress common.Address, ) (*types.Transaction, error) { if deposit := tx.GetDeposit(); deposit != nil { - bridgeAddress := string(deposit.BridgeAddress.GetInner()) + bridgeAddress := deposit.BridgeAddress.GetBech32M() bac, ok := bridgeAddresses[bridgeAddress] if !ok { return nil, fmt.Errorf("unknown bridge address: %s", bridgeAddress) diff --git a/grpc/execution/validation_test.go b/grpc/execution/validation_test.go index 47295419b..f51cc822d 100644 --- a/grpc/execution/validation_test.go +++ b/grpc/execution/validation_test.go @@ -115,7 +115,7 @@ func TestSequenceTxValidation(t *testing.T) { description: "deposit tx with an invalid asset id", sequencerTx: &sequencerblockv1alpha1.RollupData{Value: &sequencerblockv1alpha1.RollupData_Deposit{Deposit: &sequencerblockv1alpha1.Deposit{ BridgeAddress: &primitivev1.Address{ - Inner: bridgeAddress, + Bech32M: bridgeAddress, }, AssetId: []byte("invalid-asset-id"), Amount: bigIntToProtoU128(big.NewInt(1000000000000000000)), @@ -128,7 +128,7 @@ func TestSequenceTxValidation(t *testing.T) { description: "deposit tx with a disallowed asset id", sequencerTx: &sequencerblockv1alpha1.RollupData{Value: &sequencerblockv1alpha1.RollupData_Deposit{Deposit: &sequencerblockv1alpha1.Deposit{ BridgeAddress: &primitivev1.Address{ - Inner: bridgeAddress, + Bech32M: bridgeAddress, }, AssetId: invalidBridgeAssetDenom[:], Amount: bigIntToProtoU128(big.NewInt(1000000000000000000)), @@ -154,7 +154,7 @@ func TestSequenceTxValidation(t *testing.T) { description: "valid deposit tx", sequencerTx: &sequencerblockv1alpha1.RollupData{Value: &sequencerblockv1alpha1.RollupData_Deposit{Deposit: &sequencerblockv1alpha1.Deposit{ BridgeAddress: &primitivev1.Address{ - Inner: bridgeAddress, + Bech32M: bridgeAddress, }, AssetId: bridgeAssetDenom[:], Amount: bigIntToProtoU128(big.NewInt(1000000000000000000)), diff --git a/params/astria_config_test.go b/params/astria_config_test.go index 2a8625c47..2ca26ae5c 100644 --- a/params/astria_config_test.go +++ b/params/astria_config_test.go @@ -3,11 +3,13 @@ package params import ( "encoding/json" "fmt" - "github.com/ethereum/go-ethereum/crypto" "math/big" "reflect" "testing" + "github.com/btcsuite/btcd/btcutil/bech32" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/common" ) @@ -104,6 +106,8 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { panic(err) } bridgeAddress := crypto.PubkeyToAddress(bridgeAddressKey.PublicKey) + toEncode, _ := bech32.ConvertBits(bridgeAddress.Bytes(), 8, 5, false) + bridgeAddressBech32, err := bech32.EncodeM("astria", toEncode) erc20AssetKey, err := crypto.GenerateKey() if err != nil { @@ -119,7 +123,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { { description: "invalid bridge address", config: AstriaBridgeAddressConfig{ - BridgeAddress: []byte("rand address"), + BridgeAddress: "rand address", StartHeight: 2, AssetDenom: "nria", AssetPrecision: 18, @@ -130,7 +134,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { { description: "invalid start height", config: AstriaBridgeAddressConfig{ - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bridgeAddressBech32, StartHeight: 0, AssetDenom: "nria", AssetPrecision: 18, @@ -141,7 +145,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { { description: "invalid asset denom", config: AstriaBridgeAddressConfig{ - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bridgeAddressBech32, StartHeight: 2, AssetDenom: "", AssetPrecision: 18, @@ -152,7 +156,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { { description: "invalid asset precision", config: AstriaBridgeAddressConfig{ - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bridgeAddressBech32, StartHeight: 2, AssetDenom: "nria", AssetPrecision: 22, @@ -163,7 +167,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { { description: "invalid contract precision", config: AstriaBridgeAddressConfig{ - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bridgeAddressBech32, StartHeight: 2, AssetDenom: "nria", AssetPrecision: 22, @@ -177,7 +181,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { { description: "erc20 assets supported", config: AstriaBridgeAddressConfig{ - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bridgeAddressBech32, StartHeight: 2, AssetDenom: "nria", AssetPrecision: 18, @@ -191,7 +195,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { { description: "valid config", config: AstriaBridgeAddressConfig{ - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bridgeAddressBech32, StartHeight: 2, AssetDenom: "nria", AssetPrecision: 18, @@ -203,7 +207,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { for _, test := range tests { t.Run(test.description, func(t *testing.T) { - err := test.config.Validate() + err := test.config.Validate("astria") if test.wantErr != nil && err == nil { t.Errorf("expected error, got nil") } diff --git a/params/config.go b/params/config.go index 781c171d9..28b4971f6 100644 --- a/params/config.go +++ b/params/config.go @@ -26,6 +26,8 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rlp" + + "github.com/btcsuite/btcd/btcutil/bech32" ) // Genesis hashes to enforce below configs on. @@ -343,6 +345,7 @@ type ChainConfig struct { AstriaExtraDataOverride hexutil.Bytes `json:"astriaExtraDataOverride,omitempty"` AstriaRollupName string `json:"astriaRollupName"` AstriaSequencerInitialHeight uint32 `json:"astriaSequencerInitialHeight"` + AstriaSequencerHrpPrefix string `json:"astriaSequencerHrpPrefix"` AstriaCelestiaInitialHeight uint64 `json:"astriaCelestiaInitialHeight"` AstriaCelestiaHeightVariance uint64 `json:"astriaCelestiaHeightVariance,omitempty"` AstriaBridgeAddressConfigs []AstriaBridgeAddressConfig `json:"astriaBridgeAddresses,omitempty"` @@ -987,7 +990,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules } type AstriaBridgeAddressConfig struct { - BridgeAddress hexutil.Bytes `json:"bridgeAddress"` + BridgeAddress string `json:"bridgeAddress"` StartHeight uint32 `json:"startHeight"` AssetDenom string `json:"assetDenom"` AssetPrecision uint16 `json:"assetPrecision"` @@ -999,9 +1002,18 @@ type AstriaErc20AssetConfig struct { ContractPrecision uint16 `json:"contractPrecision"` } -func (abc *AstriaBridgeAddressConfig) Validate() error { - if len(abc.BridgeAddress) != 20 { - return fmt.Errorf("bridge address must be 20 bytes") +func (abc *AstriaBridgeAddressConfig) Validate(hrpPrefix string) error { + prefix, byteAddress, err := bech32.Decode(abc.BridgeAddress) + byteAddress, _ = bech32.ConvertBits(byteAddress, 5, 8, false) + + if err != nil { + return fmt.Errorf("bridge address must be a bech32 encoded string") + } + if prefix != hrpPrefix { + return fmt.Errorf("bridge address must have prefix %s", hrpPrefix) + } + if len(byteAddress) != 20 { + return fmt.Errorf("bridge address must have resolve to 20 byte address, got %d", len(byteAddress)) } if abc.StartHeight == 0 { return fmt.Errorf("start height must be greater than 0")