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 a2ac86014..490c61834 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,10 @@ module github.com/ethereum/go-ethereum 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/grpc/go v1.4.0-20240626163506-6267d841fc26.1 + buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.2-20240626163506-6267d841fc26.2 + buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.2-20240626163506-691883836b9e.2 + buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.2-20240626163506-3df35f3e4d06.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/pebble v1.1.0 @@ -38,7 +39,7 @@ require ( github.com/golang/protobuf v1.5.4 github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa - github.com/google/uuid v1.4.0 + github.com/google/uuid v1.6.0 github.com/gorilla/websocket v1.5.0 github.com/graph-gophers/graphql-go v1.3.0 github.com/hashicorp/go-bexpr v0.1.10 @@ -77,8 +78,8 @@ require ( golang.org/x/text v0.14.0 golang.org/x/time v0.5.0 golang.org/x/tools v0.20.0 - google.golang.org/grpc v1.61.2 - google.golang.org/protobuf v1.34.1 + google.golang.org/grpc v1.64.0 + google.golang.org/protobuf v1.34.2 gopkg.in/natefinch/lumberjack.v2 v2.0.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -149,9 +150,8 @@ require ( golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.24.0 // indirect - google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 6bee95127..055a9bca5 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/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/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/execution-apis/grpc/go v1.4.0-20240626163506-6267d841fc26.1 h1:YYd471Be/s8tR25c8AqKheopi3pVqe1UEq8iihl4QYQ= +buf.build/gen/go/astria/execution-apis/grpc/go v1.4.0-20240626163506-6267d841fc26.1/go.mod h1:E/5TEy5OyZT3KWWeyGkQF6wMOExaKiq/Uh5WA3Hr/Hw= +buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.1-20240626163506-6267d841fc26.1/go.mod h1:RRvnadMnGUIiPLuPe7u7+ceMFziAif4+837MBE2oe6E= +buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.2-20240626163506-6267d841fc26.2 h1:1Yo2otKPFY5Q43uDTM1bp5rOPxa777A6KtFIjm0N2rU= +buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.2-20240626163506-6267d841fc26.2/go.mod h1:0x/TVFf+tWPurkqOHHvGqh6m+y3f69ffpu4lTkfNkyI= +buf.build/gen/go/astria/primitives/grpc/go v1.4.0-20240626163506-691883836b9e.1/go.mod h1:VU1xcDnHOU7++vCZHJzilQGWAd4m1SWTBYKuo4qx/cg= +buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.1-20240626163506-691883836b9e.1/go.mod h1:pkz/GfhAgZSnDxyZ5bmGUzk6iQNAvyW72pYPkqb7Pbk= +buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.2-20240626163506-691883836b9e.2 h1:bCHvCYyvhCPWGc3tpl164ONADbH+nKPSc6KhOWb9tfk= +buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.2-20240626163506-691883836b9e.2/go.mod h1:J0Tk7JAHcrhzWNEf1lbePSfFZ1Kp78eAlnO8Cs2ELKg= +buf.build/gen/go/astria/sequencerblock-apis/grpc/go v1.4.0-20240626163506-3df35f3e4d06.1/go.mod h1:Zt4fThI4h3dw3FjyWA8bkoB9R3pQ9zPxhlIqLuTp130= +buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.1-20240626163506-3df35f3e4d06.1/go.mod h1:KkZ92tBsbbl5HTuN/AbQLkW2ALXsaV5MsEU9PPy/n9c= +buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.2-20240626163506-3df35f3e4d06.2 h1:ZXnJ2iUreFCU/umNBaTo5iL2sVQtHPdjYC17/uSgA+s= +buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.2-20240626163506-3df35f3e4d06.2/go.mod h1:NEZbII2+dhqPXaQqMYN8ziELoYQgp7hbDFv5Oc45EZU= 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= @@ -1176,6 +1174,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/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= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -1227,10 +1226,31 @@ github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsy github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= 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= @@ -1290,6 +1310,7 @@ github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDF github.com/crate-crypto/go-kzg-4844 v1.0.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= @@ -1299,6 +1320,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/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= @@ -1504,8 +1526,9 @@ github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= @@ -1574,11 +1597,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= @@ -1597,6 +1623,7 @@ github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4 github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= 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.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= @@ -1680,10 +1707,13 @@ 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.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= @@ -1825,6 +1855,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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -1912,6 +1943,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.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +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= @@ -2511,7 +2543,6 @@ google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqv google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:EMfReVxb80Dq1hhioy0sOsY9jCE46YDgHlJ7fWVUWRE= google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:CgAqfJo+Xmu0GwA0411Ht3OU3OntXwsGmrmjI8ioGXI= google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405/go.mod h1:3WDQMjmJk36UQhjQ89emUzb1mdaHcPeeAh4SCBKznB4= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= google.golang.org/genproto/googleapis/api v0.0.0-20230525234020-1aefcd67740a/go.mod h1:ts19tUU+Z0ZShN1y3aPyq2+O3d5FUNNgT6FtOzmrNn8= google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= @@ -2529,8 +2560,9 @@ google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go. google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:SUBoKXbI1Efip18FClrQVGjWcyd0QZd8KkvdP34t7ww= google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:IBQ646DjkDkvUIsVq/cc03FUFQ9wbZu7yE396YcL870= google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405/go.mod h1:oT32Z4o8Zv2xPQTg0pbVaPr0MPOH6f14RgXt7zfIpwg= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= +google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4= +google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= google.golang.org/genproto/googleapis/bytestream v0.0.0-20230807174057-1744710a1577/go.mod h1:NjCQG/D8JandXxM57PZbAJL1DCNL6EypA0vPPwfsc7c= google.golang.org/genproto/googleapis/bytestream v0.0.0-20231030173426-d783a09b4405/go.mod h1:GRUCuLdzVqZte8+Dl/D4N25yLzcGqqWaYkeVOwulFqw= @@ -2550,8 +2582,9 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go. google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc= google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -2600,8 +2633,9 @@ google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= -google.golang.org/grpc v1.61.2 h1:TzJay21lXCf7BiNFKl7mSskt5DlkKAumAYTs52SpJeo= google.golang.org/grpc v1.61.2/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2621,9 +2655,9 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 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 6c85b1d56..5f1734914 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 895873c9f..f1146afc6 100644 --- a/grpc/execution/server_test.go +++ b/grpc/execution/server_test.go @@ -296,7 +296,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, @@ -389,7 +389,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 e5a9d7d0c..f1a415154 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" @@ -17,9 +22,6 @@ import ( "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" "github.com/stretchr/testify/require" - "math/big" - "testing" - "time" ) var ( @@ -34,7 +36,7 @@ var ( testBalance = big.NewInt(2e18) ) -func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block, *ecdsa.PrivateKey, *ecdsa.PrivateKey) { +func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block, string, *ecdsa.PrivateKey) { config := *params.AllEthashProtocolChanges engine := consensus.Engine(beaconConsensus.New(ethash.NewFaker())) if merged { @@ -48,14 +50,24 @@ func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block, *ecd panic(err) } bridgeAddress := crypto.PubkeyToAddress(bridgeAddressKey.PublicKey) + bridgeAddressBytes, err := bech32.ConvertBits(bridgeAddress.Bytes(), 8, 5, false) + if err != nil { + panic(err) + } config.AstriaRollupName = "astria" + config.AstriaSequencerHrpPrefix = "astria" config.AstriaSequencerInitialHeight = 10 config.AstriaCelestiaInitialHeight = 10 config.AstriaCelestiaHeightVariance = 10 + + bech32mBridgeAddress, err := bech32.EncodeM(config.AstriaSequencerHrpPrefix, bridgeAddressBytes) + if err != nil { + panic(err) + } config.AstriaBridgeAddressConfigs = []params.AstriaBridgeAddressConfig{ { - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bech32mBridgeAddress, StartHeight: 2, AssetDenom: "nria", AssetPrecision: 18, @@ -101,7 +113,7 @@ func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block, *ecd config.TerminalTotalDifficulty = totalDifficulty } - return genesis, blocks, bridgeAddressKey, feeCollectorKey + return genesis, blocks, bech32mBridgeAddress, feeCollectorKey } // startEthService creates a full node instance for testing. @@ -120,7 +132,7 @@ func startEthService(t *testing.T, genesis *core.Genesis) *eth.Ethereum { func setupExecutionService(t *testing.T, noOfBlocksToGenerate int) (*eth.Ethereum, *ExecutionServiceServerV1Alpha2) { t.Helper() - genesis, blocks, bridgeAddressKey, feeCollectorKey := generateMergeChain(noOfBlocksToGenerate, true) + genesis, blocks, bridgeAddress, feeCollectorKey := generateMergeChain(noOfBlocksToGenerate, true) ethservice := startEthService(t, genesis) serviceV1Alpha1, err := NewExecutionServiceServerV1Alpha2(ethservice) @@ -133,8 +145,7 @@ func setupExecutionService(t *testing.T, noOfBlocksToGenerate int) (*eth.Ethereu _, ok := serviceV1Alpha1.bridgeAllowedAssetIDs[bridgeAsset] require.True(t, ok, "bridgeAllowedAssetIDs does not contain bridge asset id") - bridgeAddress := crypto.PubkeyToAddress(bridgeAddressKey.PublicKey) - _, ok = serviceV1Alpha1.bridgeAddresses[string(bridgeAddress.Bytes())] + _, ok = serviceV1Alpha1.bridgeAddresses[bridgeAddress] require.True(t, ok, "bridgeAddress not set correctly") _, err = ethservice.BlockChain().InsertChain(blocks) 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..92118ccd3 100644 --- a/grpc/execution/validation_test.go +++ b/grpc/execution/validation_test.go @@ -1,17 +1,19 @@ package execution import ( + "crypto/sha256" + "math/big" + "testing" + primitivev1 "buf.build/gen/go/astria/primitives/protocolbuffers/go/astria/primitive/v1" sequencerblockv1alpha1 "buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go/astria/sequencerblock/v1alpha1" - "crypto/sha256" + "github.com/btcsuite/btcd/btcutil/bech32" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" "github.com/holiman/uint256" "github.com/stretchr/testify/require" - "math/big" - "testing" ) func testBlobTx() *types.Transaction { @@ -32,6 +34,25 @@ func testDepositTx() *types.Transaction { }) } +func generateBech32MAddress() string { + addressKey, err := crypto.GenerateKey() + if err != nil { + panic(err) + } + bridgeAddress := crypto.PubkeyToAddress(addressKey.PublicKey) + bridgeAddressBytes, err := bech32.ConvertBits(bridgeAddress.Bytes(), 8, 5, false) + if err != nil { + panic(err) + } + + bech32m, err := bech32.EncodeM("astria", bridgeAddressBytes) + if err != nil { + panic(err) + } + + return bech32m +} + func TestSequenceTxValidation(t *testing.T) { ethservice, serviceV1Alpha1 := setupExecutionService(t, 10) @@ -57,8 +78,8 @@ func TestSequenceTxValidation(t *testing.T) { invalidHeightBridgeAssetDenom := "invalid-height-asset-denom" invalidHeightBridgeAssetDenomID := sha256.Sum256([]byte(invalidHeightBridgeAssetDenom)) - invalidHeightBridgeAddress := "invalid-height-bridge-address" - serviceV1Alpha1.bridgeAddresses[invalidHeightBridgeAddress] = ¶ms.AstriaBridgeAddressConfig{ + invalidHeightBridgeAddressBech32m := generateBech32MAddress() + serviceV1Alpha1.bridgeAddresses[invalidHeightBridgeAddressBech32m] = ¶ms.AstriaBridgeAddressConfig{ AssetDenom: invalidHeightBridgeAssetDenom, StartHeight: 100, } @@ -102,7 +123,7 @@ func TestSequenceTxValidation(t *testing.T) { description: "deposit tx with an unknown bridge address", sequencerTx: &sequencerblockv1alpha1.RollupData{Value: &sequencerblockv1alpha1.RollupData_Deposit{Deposit: &sequencerblockv1alpha1.Deposit{ BridgeAddress: &primitivev1.Address{ - Inner: []byte("unknown-bridge-address"), + Bech32M: generateBech32MAddress(), }, AssetId: bridgeAssetDenom[:], Amount: bigIntToProtoU128(big.NewInt(1000000000000000000)), @@ -115,7 +136,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 +149,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)), @@ -141,7 +162,7 @@ func TestSequenceTxValidation(t *testing.T) { description: "deposit tx with a height and asset below the bridge start height", sequencerTx: &sequencerblockv1alpha1.RollupData{Value: &sequencerblockv1alpha1.RollupData_Deposit{Deposit: &sequencerblockv1alpha1.Deposit{ BridgeAddress: &primitivev1.Address{ - Inner: []byte(invalidHeightBridgeAddress), + Bech32M: invalidHeightBridgeAddressBech32m, }, AssetId: invalidHeightBridgeAssetDenomID[:], Amount: bigIntToProtoU128(big.NewInt(1000000000000000000)), @@ -154,7 +175,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..a91b41b14 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, _ := bech32.EncodeM("astria", toEncode) erc20AssetKey, err := crypto.GenerateKey() if err != nil { @@ -116,21 +120,43 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { config AstriaBridgeAddressConfig wantErr error }{ + { + description: "invalid bridge address, non bech32m", + config: AstriaBridgeAddressConfig{ + BridgeAddress: "rand address", + StartHeight: 2, + AssetDenom: "nria", + AssetPrecision: 18, + Erc20Asset: nil, + }, + wantErr: fmt.Errorf("bridge address must be a bech32 encoded string"), + }, + { + description: "invalid bridge address, invalid prefix", + config: AstriaBridgeAddressConfig{ + BridgeAddress: "badprefix1u54zke43yc2tpaecvjqj4uy7d3mdmkrj4vch35", + StartHeight: 2, + AssetDenom: "nria", + AssetPrecision: 18, + Erc20Asset: nil, + }, + wantErr: fmt.Errorf("bridge address must have prefix astria"), + }, { description: "invalid bridge address", config: AstriaBridgeAddressConfig{ - BridgeAddress: []byte("rand address"), + BridgeAddress: "astria1u54zke43yc2tpaecvjqj4uy7d3mdmkqjjq96x", StartHeight: 2, AssetDenom: "nria", AssetPrecision: 18, Erc20Asset: nil, }, - wantErr: fmt.Errorf("bridge address must be 20 bytes"), + wantErr: fmt.Errorf("bridge address must have resolve to 20 byte address, got 19"), }, { description: "invalid start height", config: AstriaBridgeAddressConfig{ - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bridgeAddressBech32, StartHeight: 0, AssetDenom: "nria", AssetPrecision: 18, @@ -141,7 +167,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { { description: "invalid asset denom", config: AstriaBridgeAddressConfig{ - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bridgeAddressBech32, StartHeight: 2, AssetDenom: "", AssetPrecision: 18, @@ -152,7 +178,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 +189,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 +203,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 +217,7 @@ func TestAstriaBridgeConfigValidation(t *testing.T) { { description: "valid config", config: AstriaBridgeAddressConfig{ - BridgeAddress: bridgeAddress.Bytes(), + BridgeAddress: bridgeAddressBech32, StartHeight: 2, AssetDenom: "nria", AssetPrecision: 18, @@ -203,7 +229,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 4c71f5220..700a28acf 100644 --- a/params/config.go +++ b/params/config.go @@ -27,6 +27,8 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params/forks" "github.com/ethereum/go-ethereum/rlp" + + "github.com/btcsuite/btcd/btcutil/bech32" ) // Genesis hashes to enforce below configs on. @@ -380,6 +382,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"` @@ -1051,7 +1054,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"` @@ -1063,9 +1066,20 @@ 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) + if err != nil { + return fmt.Errorf("bridge address must be a bech32 encoded string") + } + byteAddress, err = bech32.ConvertBits(byteAddress, 5, 8, false) + if err != nil { + return fmt.Errorf("failed to convert address to 8 bit") + } + 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")