diff --git a/bridge-history-api/go.mod b/bridge-history-api/go.mod index ae2f1ff61f..a8468a1dc2 100644 --- a/bridge-history-api/go.mod +++ b/bridge-history-api/go.mod @@ -8,7 +8,7 @@ require ( github.com/go-redis/redis/v8 v8.11.5 github.com/pressly/goose/v3 v3.16.0 github.com/prometheus/client_golang v1.14.0 - github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 + github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.25.7 golang.org/x/sync v0.5.0 @@ -31,11 +31,14 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set v1.8.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 // indirect github.com/fjl/memsize v0.0.2 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-kit/kit v0.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect @@ -47,6 +50,9 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.4.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/hashicorp/go-bexpr v0.1.10 // indirect + github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/iden3/go-iden3-crypto v0.0.15 // indirect @@ -61,24 +67,31 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/pointerstructure v1.2.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onsi/gomega v1.27.1 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.39.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/tsdb v0.7.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/rs/cors v1.7.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/scroll-tech/zktrie v0.7.1 // indirect github.com/sethvargo/go-retry v0.2.4 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect @@ -96,6 +109,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + gopkg.in/urfave/cli.v1 v1.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/bridge-history-api/go.sum b/bridge-history-api/go.sum index 3eeca06d66..1c2588f4c8 100644 --- a/bridge-history-api/go.sum +++ b/bridge-history-api/go.sum @@ -3,11 +3,16 @@ github.com/ClickHouse/ch-go v0.58.2 h1:jSm2szHbT9MCAB1rJ3WuCJqmGLi5UTjlNu+f530UT github.com/ClickHouse/clickhouse-go/v2 v2.15.0 h1:G0hTKyO8fXXR1bGnZ0DY3vTG01xYfOGW76zgjg5tmC4= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= 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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bits-and-blooms/bitset v1.12.0 h1:U/q1fAF7xXRhFCrhROzIfffYnu+dlS38vCZtmFVPHmA= @@ -27,6 +32,7 @@ github.com/bytedance/sonic v1.10.1 h1:7a1wuFXL1cMy7a3f7/VFcEtriuXQnUBhtoVfOZiays github.com/bytedance/sonic v1.10.1/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= @@ -53,12 +59,14 @@ github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsP github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elastic/go-sysinfo v1.11.1 h1:g9mwl05njS4r69TisC+vwHWTSKywZFYYUu3so3T/Lao= github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0= github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 h1:B2mpK+MNqgPqk2/KNi1LbqwtZDy5F7iy0mynQiBr8VA= @@ -66,11 +74,13 @@ github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4/go github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gin-contrib/cors v1.5.0 h1:DgGKV7DDoOn36DFkNtbHrjoRiT5ExCe+PC9/xp7aKvk= github.com/gin-contrib/cors v1.5.0/go.mod h1:TvU7MAZ3EwrPLI2ztzTt3tqgvBCq+wn8WpZmfADjupI= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -79,6 +89,11 @@ github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= github.com/go-faster/errors v0.6.1 h1:nNIPOBkprlKzkThvS/0YaX8Zs9KewLCOSFQS5BU06FI= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= @@ -92,20 +107,31 @@ github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QX github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -117,8 +143,11 @@ github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -150,6 +179,7 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02 github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -161,12 +191,17 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= @@ -176,12 +211,19 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= 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.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= 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/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.1 h1:rfztXRbg6nv/5f+Raen9RcGoSecHIFgBBLQK3Wdj754= github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -192,20 +234,27 @@ github.com/paulmach/orb v0.10.0 h1:guVYVqzxHE/CQ1KpfGO077TR0ATHSNjp4s6XGLn3W9s= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pressly/goose/v3 v3.16.0 h1:xMJUsZdHLqSnCqESyKSqEfcYVYsUuup1nrOhaEFftQg= github.com/pressly/goose/v3 v3.16.0/go.mod h1:JwdKVnmCRhnF6XLQs2mHEQtucFD49cQBdRM4UiwkxsM= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.39.0 h1:oOyhkDq05hPZKItWVBkJ6g6AtGxi+fy7F4JvUV8uhsI= github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= @@ -215,10 +264,11 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 h1:EDnM5yoGAeUHEu1v3RUPTrHzInm3au2QWXpl+q3XnUo= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 h1:H7LzbJMrmkFkyPAl+F0NMMg0Wiq/qQv/iKKmuo/7/Yc= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= github.com/scroll-tech/zktrie v0.7.1 h1:NrmZNjuBzsbrKePqdHDG+t2cXnimbtezPAFS0+L9ElE= github.com/scroll-tech/zktrie v0.7.1/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= @@ -228,11 +278,13 @@ github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKl github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -244,6 +296,7 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 h1:wh1wzwAhZBNiZO37uWS/nDaKiIwHz4mDo4pnA+fqTO0= github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -281,17 +334,27 @@ golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -302,19 +365,30 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +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= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +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-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -323,7 +397,10 @@ gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHN gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/common/go.mod b/common/go.mod index 5434aa8a2a..00749ae274 100644 --- a/common/go.mod +++ b/common/go.mod @@ -15,7 +15,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 github.com/orcaman/concurrent-map v1.0.0 github.com/prometheus/client_golang v1.14.0 - github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 + github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.25.7 gorm.io/driver/postgres v1.5.0 @@ -41,10 +41,14 @@ require ( github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect + github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 // indirect github.com/fjl/memsize v0.0.2 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-kit/kit v0.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect @@ -58,6 +62,9 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.4.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/hashicorp/go-bexpr v0.1.10 // indirect + github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/iden3/go-iden3-crypto v0.0.15 // indirect @@ -75,10 +82,14 @@ require ( github.com/mattn/go-sqlite3 v1.14.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/pointerstructure v1.2.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/moby/term v0.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/morikuni/aec v1.0.0 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.27.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc5 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect @@ -87,14 +98,17 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.39.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/tsdb v0.7.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/rs/cors v1.7.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/scroll-tech/zktrie v0.7.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect @@ -113,6 +127,7 @@ require ( golang.org/x/tools v0.15.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + gopkg.in/urfave/cli.v1 v1.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.4.0 // indirect rsc.io/tmplfunc v0.0.3 // indirect diff --git a/common/go.sum b/common/go.sum index f27f4a42c8..27c44db9b4 100644 --- a/common/go.sum +++ b/common/go.sum @@ -4,10 +4,15 @@ github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0 github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= 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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bits-and-blooms/bitset v1.12.0 h1:U/q1fAF7xXRhFCrhROzIfffYnu+dlS38vCZtmFVPHmA= @@ -26,6 +31,7 @@ github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ github.com/bytedance/sonic v1.10.1 h1:7a1wuFXL1cMy7a3f7/VFcEtriuXQnUBhtoVfOZiaysc= github.com/bytedance/sonic v1.10.1/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= @@ -49,6 +55,7 @@ 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= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= @@ -58,14 +65,19 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 h1:B2mpK+MNqgPqk2/KNi1LbqwtZDy5F7iy0mynQiBr8VA= github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4/go.mod h1:y4GA2JbAUama1S4QwYjC2hefgGLU8Ul0GMtL/ADMF1c= github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gin-contrib/pprof v1.4.0 h1:XxiBSf5jWZ5i16lNOPbMTVdgHBdhfGRD5PZ1LWazzvg= github.com/gin-contrib/pprof v1.4.0/go.mod h1:RrehPJasUVBPK6yTUwOl8/NP6i0vbUgmxtis+Z5KE90= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -73,6 +85,11 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= @@ -90,21 +107,33 @@ github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QX github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -115,8 +144,11 @@ github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -153,6 +185,7 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02 github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= @@ -174,16 +207,20 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= @@ -196,10 +233,23 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= 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.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= 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/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.27.1 h1:rfztXRbg6nv/5f+Raen9RcGoSecHIFgBBLQK3Wdj754= +github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= @@ -210,19 +260,25 @@ github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZO github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.39.0 h1:oOyhkDq05hPZKItWVBkJ6g6AtGxi+fy7F4JvUV8uhsI= github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -233,20 +289,24 @@ github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6po github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 h1:EDnM5yoGAeUHEu1v3RUPTrHzInm3au2QWXpl+q3XnUo= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 h1:H7LzbJMrmkFkyPAl+F0NMMg0Wiq/qQv/iKKmuo/7/Yc= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= github.com/scroll-tech/zktrie v0.7.1 h1:NrmZNjuBzsbrKePqdHDG+t2cXnimbtezPAFS0+L9ElE= github.com/scroll-tech/zktrie v0.7.1/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -258,6 +318,7 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 h1:wh1wzwAhZBNiZO37uWS/nDaKiIwHz4mDo4pnA+fqTO0= github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -300,6 +361,8 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -307,6 +370,7 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -317,11 +381,19 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -330,6 +402,7 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -341,6 +414,7 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -352,6 +426,7 @@ golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= @@ -361,11 +436,18 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +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= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +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= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= @@ -374,9 +456,14 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/common/testdata/blockTrace_03.json b/common/testdata/blockTrace_03.json index caec0da39e..97f715d981 100644 --- a/common/testdata/blockTrace_03.json +++ b/common/testdata/blockTrace_03.json @@ -31,9 +31,11 @@ { "type": 2, "nonce": 2, - "txHash": "0x6b50040f5f14bad253f202b0775d6742131bcaee6b992f05578386f00e53b7e4", + "txHash": "0xfc4325f39825616a241d0c52d536c892e21b6df32bb75d8bdc70de54ae175318", "gas": 1152994, "gasPrice": "0x3b9b0a17", + "gasTipCap": "0x3b9b0a17", + "gasFeeCap": "0x3b9b0a17", "from": "0x1c5a77d9fa7ef466951b2f01f724bca3a5820b63", "to": null, "chainId": "0xcf55", diff --git a/common/testdata/blockTrace_delegate.json b/common/testdata/blockTrace_delegate.json deleted file mode 100644 index 4d98e998fc..0000000000 --- a/common/testdata/blockTrace_delegate.json +++ /dev/null @@ -1,995 +0,0 @@ -{ - "coinbase": { - "address": "0x1c5a77d9fa7ef466951b2f01f724bca3a5820b63", - "nonce": 3, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d683461ce98", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - "header": { - "parentHash": "0xc7b6c7022c8386cdaf6fcd3d4f8d03dce257ae3664a072fdce511ecefce73ad0", - "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "miner": "0x0000000000000000000000000000000000000000", - "stateRoot": "0x26712be2a2a671df99555f95b601e2e907bd0276db5fb7d3cab35c061b39a91c", - "transactionsRoot": "0x6c4bdf11857e89cf8b34424d31be1db20974460a5b89dcf948adc88e743ebf3e", - "receiptsRoot": "0x3771127daa833dd70db4c01cd854543867176087a16b67154fa8b96a8549e97f", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "difficulty": "0x2", - "number": "0x3", - "gasLimit": "0x3546c3cbb39e5", - "gasUsed": "0x1197e2", - "timestamp": "0x63807b2d", - "extraData": "0xd983010a0d846765746889676f312e31372e3133856c696e75780000000000000b5467bbc3ca30260309add44eddd3242b6bbac2456e5f65df801113f5d39ad43089a888b7755db442cd6aa2b4a869bc657b219a2daf5927fce87cf47dcad48101", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "nonce": "0x0000000000000000", - "baseFeePerGas": "0x1a2c", - "hash": "0x13ddd94de9c585c50c6885d4ef649292c2624ae7c8fc73781ee8785f2564b44c" - }, - "row_consumption": [ - ], - "transactions": [ - { - "type": 2, - "nonce": 2, - "txHash": "0xaaaeb971adfac989c7db5426737bc2932756091a5730ea6d5324f93e4cff9713", - "gas": 1152994, - "gasPrice": "0x3b9b0a17", - "from": "0x1c5a77d9fa7ef466951b2f01f724bca3a5820b63", - "to": null, - "chainId": "0xcf55", - "value": "0x0", - "data": "0x60806040523480156200001157600080fd5b50604051620014b2380380620014b2833981810160405260a08110156200003757600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200006357600080fd5b9083019060208201858111156200007957600080fd5b82516401000000008111828201881017156200009457600080fd5b82525081516020918201929091019080838360005b83811015620000c3578181015183820152602001620000a9565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b9083019060208201858111156200012b57600080fd5b82516401000000008111828201881017156200014657600080fd5b82525081516020918201929091019080838360005b83811015620001755781810151838201526020016200015b565b50505050905090810190601f168015620001a35780820380516001836020036101000a031916815260200191505b5060405260209081015185519093508592508491620001c8916003918501906200026b565b508051620001de9060049060208401906200026b565b50506005805461ff001960ff1990911660121716905550600680546001600160a01b038088166001600160a01b0319928316179092556007805492871692909116919091179055620002308162000255565b50506005805462010000600160b01b0319163362010000021790555062000307915050565b6005805460ff191660ff92909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002ae57805160ff1916838001178555620002de565b82800160010185558215620002de579182015b82811115620002de578251825591602001919060010190620002c1565b50620002ec929150620002f0565b5090565b5b80821115620002ec5760008155600101620002f1565b61119b80620003176000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80635c975abb116100a257806395d89b411161007157806395d89b41146103015780639dc29fac14610309578063a457c2d714610335578063a9059cbb14610361578063dd62ed3e1461038d5761010b565b80635c975abb1461029d57806370a08231146102a55780638456cb59146102cb5780638e50817a146102d35761010b565b8063313ce567116100de578063313ce5671461021d578063395093511461023b5780633f4ba83a1461026757806340c10f19146102715761010b565b806306fdde0314610110578063095ea7b31461018d57806318160ddd146101cd57806323b872dd146101e7575b600080fd5b6101186103bb565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015257818101518382015260200161013a565b50505050905090810190601f16801561017f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b9600480360360408110156101a357600080fd5b506001600160a01b038135169060200135610451565b604080519115158252519081900360200190f35b6101d561046e565b60408051918252519081900360200190f35b6101b9600480360360608110156101fd57600080fd5b506001600160a01b03813581169160208101359091169060400135610474565b6102256104fb565b6040805160ff9092168252519081900360200190f35b6101b96004803603604081101561025157600080fd5b506001600160a01b038135169060200135610504565b61026f610552565b005b61026f6004803603604081101561028757600080fd5b506001600160a01b0381351690602001356105a9565b6101b9610654565b6101d5600480360360208110156102bb57600080fd5b50356001600160a01b0316610662565b61026f61067d565b61026f600480360360408110156102e957600080fd5b506001600160a01b03813581169160200135166106d2565b610118610757565b61026f6004803603604081101561031f57600080fd5b506001600160a01b0381351690602001356107b8565b6101b96004803603604081101561034b57600080fd5b506001600160a01b03813516906020013561085f565b6101b96004803603604081101561037757600080fd5b506001600160a01b0381351690602001356108c7565b6101d5600480360360408110156103a357600080fd5b506001600160a01b03813581169160200135166108db565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104475780601f1061041c57610100808354040283529160200191610447565b820191906000526020600020905b81548152906001019060200180831161042a57829003601f168201915b5050505050905090565b600061046561045e610906565b848461090a565b50600192915050565b60025490565b60006104818484846109f6565b6104f18461048d610906565b6104ec85604051806060016040528060288152602001611085602891396001600160a01b038a166000908152600160205260408120906104cb610906565b6001600160a01b031681526020810191909152604001600020549190610b51565b61090a565b5060019392505050565b60055460ff1690565b6000610465610511610906565b846104ec8560016000610522610906565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610be8565b6007546001600160a01b0316331461059f576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6105a7610c49565b565b600554610100900460ff16156105f9576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6006546001600160a01b03163314610646576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6106508282610ced565b5050565b600554610100900460ff1690565b6001600160a01b031660009081526020819052604090205490565b6007546001600160a01b031633146106ca576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6105a7610ddd565b6005546201000090046001600160a01b03163314610726576040805162461bcd60e51b815260206004820152600c60248201526b6f6e6c7920466163746f727960a01b604482015290519081900360640190fd5b600780546001600160a01b039283166001600160a01b03199182161790915560068054939092169216919091179055565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104475780601f1061041c57610100808354040283529160200191610447565b600554610100900460ff1615610808576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6006546001600160a01b03163314610855576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6106508282610e65565b600061046561086c610906565b846104ec856040518060600160405280602581526020016111176025913960016000610896610906565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610b51565b60006104656108d4610906565b84846109f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661094f5760405162461bcd60e51b81526004018080602001828103825260248152602001806110f36024913960400191505060405180910390fd5b6001600160a01b0382166109945760405162461bcd60e51b815260040180806020018281038252602281526020018061103d6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610a3b5760405162461bcd60e51b81526004018080602001828103825260258152602001806110ce6025913960400191505060405180910390fd5b6001600160a01b038216610a805760405162461bcd60e51b8152600401808060200182810382526023815260200180610ff86023913960400191505060405180910390fd5b610a8b838383610f61565b610ac88160405180606001604052806026815260200161105f602691396001600160a01b0386166000908152602081905260409020549190610b51565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610af79082610be8565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610be05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ba5578181015183820152602001610b8d565b50505050905090810190601f168015610bd25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610c42576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600554610100900460ff16610c9c576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6005805461ff00191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa610cd0610906565b604080516001600160a01b039092168252519081900360200190a1565b6001600160a01b038216610d48576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610d5460008383610f61565b600254610d619082610be8565b6002556001600160a01b038216600090815260208190526040902054610d879082610be8565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600554610100900460ff1615610e2d576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6005805461ff0019166101001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610cd0610906565b6001600160a01b038216610eaa5760405162461bcd60e51b81526004018080602001828103825260218152602001806110ad6021913960400191505060405180910390fd5b610eb682600083610f61565b610ef38160405180606001604052806022815260200161101b602291396001600160a01b0385166000908152602081905260409020549190610b51565b6001600160a01b038316600090815260208190526040902055600254610f199082610fb5565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b610f6c838383610fb0565b610f74610654565b15610fb05760405162461bcd60e51b815260040180806020018281038252602a81526020018061113c602a913960400191505060405180910390fd5b505050565b6000610c4283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b5156fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f45524332305061757361626c653a20746f6b656e207472616e73666572207768696c6520706175736564a2646970667358221220e96342bec8f6c2bf72815a39998973b64c3bed57770f402e9a7b7eeda0265d4c64736f6c634300060c00330000000000000000000000001c5a77d9fa7ef466951b2f01f724bca3a5820b630000000000000000000000001c5a77d9fa7ef466951b2f01f724bca3a5820b6300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000095745544820636f696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045745544800000000000000000000000000000000000000000000000000000000", - "isCreate": true, - "v": "0x1", - "r": "0x235c1a8d40e8c347890397f1a92e6eadbd6422cf7c210e3e1737f0553c633172", - "s": "0x2f7c0384ddd06970446e74229cd96216da62196dc62395bda52095d44b8a9af7" - } - ], - "storageTrace": { - "rootBefore": "0x25b792bfd6d6456451f996e9383225e026fff469da205bb916768c0a78fd16af", - "rootAfter": "0x26712be2a2a671df99555f95b601e2e907bd0276db5fb7d3cab35c061b39a91c", - "proofs": { - "0x03F8133DD5Ed58838B20AF1296F62F44e69bAa48": [ - "0x0006e87db4b9b3a22a55eaec059b5896ca15c93c227708181cab416887090cf234133a13918f4fa1eb2bdecb129b9506dfa77feb64eadff903b28564e6e797be5b", - "0x00000000000000000000000000000000000000000000000000000000000000000002cf0e006d7e01c8f6a13d46d695bdfd24a7e1a494ad357c11b32ab05713592e", - "0x02", - "0x5448495320495320534f4d45204d4147494320425954455320464f5220534d54206d3172525867503278704449" - ], - "0x1C5A77d9FA7eF466951B2F01F724BCa3A5820b63": [ - "0x0006e87db4b9b3a22a55eaec059b5896ca15c93c227708181cab416887090cf234133a13918f4fa1eb2bdecb129b9506dfa77feb64eadff903b28564e6e797be5b", - "0x01204920151d7e3cd9d1b5ba09d3ad6ea157c82d1cc425731f209e71a007165a9c04040000000000000000000000000000000000000000000000000000000000000000000201ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d6a00d4dd70c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4700000000000000000000000000000000000000000000000000000000000000000201c5a77d9fa7ef466951b2f01f724bca3a5820b63000000000000000000000000", - "0x5448495320495320534f4d45204d4147494320425954455320464f5220534d54206d3172525867503278704449" - ] - }, - "storageProofs": { - "0x03F8133DD5Ed58838B20AF1296F62F44e69bAa48": { - "0x0000000000000000000000000000000000000000000000000000000000000003": [ - "0x02", - "0x5448495320495320534f4d45204d4147494320425954455320464f5220534d54206d3172525867503278704449" - ], - "0x0000000000000000000000000000000000000000000000000000000000000004": [ - "0x02", - "0x5448495320495320534f4d45204d4147494320425954455320464f5220534d54206d3172525867503278704449" - ], - "0x0000000000000000000000000000000000000000000000000000000000000005": [ - "0x02", - "0x5448495320495320534f4d45204d4147494320425954455320464f5220534d54206d3172525867503278704449" - ], - "0x0000000000000000000000000000000000000000000000000000000000000006": [ - "0x02", - "0x5448495320495320534f4d45204d4147494320425954455320464f5220534d54206d3172525867503278704449" - ], - "0x0000000000000000000000000000000000000000000000000000000000000007": [ - "0x02", - "0x5448495320495320534f4d45204d4147494320425954455320464f5220534d54206d3172525867503278704449" - ] - } - } - }, - "executionResults": [ - { - "gas": 1152994, - "failed": false, - "returnValue": "608060405234801561001057600080fd5b506004361061010b5760003560e01c80635c975abb116100a257806395d89b411161007157806395d89b41146103015780639dc29fac14610309578063a457c2d714610335578063a9059cbb14610361578063dd62ed3e1461038d5761010b565b80635c975abb1461029d57806370a08231146102a55780638456cb59146102cb5780638e50817a146102d35761010b565b8063313ce567116100de578063313ce5671461021d578063395093511461023b5780633f4ba83a1461026757806340c10f19146102715761010b565b806306fdde0314610110578063095ea7b31461018d57806318160ddd146101cd57806323b872dd146101e7575b600080fd5b6101186103bb565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015257818101518382015260200161013a565b50505050905090810190601f16801561017f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b9600480360360408110156101a357600080fd5b506001600160a01b038135169060200135610451565b604080519115158252519081900360200190f35b6101d561046e565b60408051918252519081900360200190f35b6101b9600480360360608110156101fd57600080fd5b506001600160a01b03813581169160208101359091169060400135610474565b6102256104fb565b6040805160ff9092168252519081900360200190f35b6101b96004803603604081101561025157600080fd5b506001600160a01b038135169060200135610504565b61026f610552565b005b61026f6004803603604081101561028757600080fd5b506001600160a01b0381351690602001356105a9565b6101b9610654565b6101d5600480360360208110156102bb57600080fd5b50356001600160a01b0316610662565b61026f61067d565b61026f600480360360408110156102e957600080fd5b506001600160a01b03813581169160200135166106d2565b610118610757565b61026f6004803603604081101561031f57600080fd5b506001600160a01b0381351690602001356107b8565b6101b96004803603604081101561034b57600080fd5b506001600160a01b03813516906020013561085f565b6101b96004803603604081101561037757600080fd5b506001600160a01b0381351690602001356108c7565b6101d5600480360360408110156103a357600080fd5b506001600160a01b03813581169160200135166108db565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104475780601f1061041c57610100808354040283529160200191610447565b820191906000526020600020905b81548152906001019060200180831161042a57829003601f168201915b5050505050905090565b600061046561045e610906565b848461090a565b50600192915050565b60025490565b60006104818484846109f6565b6104f18461048d610906565b6104ec85604051806060016040528060288152602001611085602891396001600160a01b038a166000908152600160205260408120906104cb610906565b6001600160a01b031681526020810191909152604001600020549190610b51565b61090a565b5060019392505050565b60055460ff1690565b6000610465610511610906565b846104ec8560016000610522610906565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610be8565b6007546001600160a01b0316331461059f576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6105a7610c49565b565b600554610100900460ff16156105f9576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6006546001600160a01b03163314610646576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6106508282610ced565b5050565b600554610100900460ff1690565b6001600160a01b031660009081526020819052604090205490565b6007546001600160a01b031633146106ca576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6105a7610ddd565b6005546201000090046001600160a01b03163314610726576040805162461bcd60e51b815260206004820152600c60248201526b6f6e6c7920466163746f727960a01b604482015290519081900360640190fd5b600780546001600160a01b039283166001600160a01b03199182161790915560068054939092169216919091179055565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104475780601f1061041c57610100808354040283529160200191610447565b600554610100900460ff1615610808576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6006546001600160a01b03163314610855576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6106508282610e65565b600061046561086c610906565b846104ec856040518060600160405280602581526020016111176025913960016000610896610906565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610b51565b60006104656108d4610906565b84846109f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661094f5760405162461bcd60e51b81526004018080602001828103825260248152602001806110f36024913960400191505060405180910390fd5b6001600160a01b0382166109945760405162461bcd60e51b815260040180806020018281038252602281526020018061103d6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610a3b5760405162461bcd60e51b81526004018080602001828103825260258152602001806110ce6025913960400191505060405180910390fd5b6001600160a01b038216610a805760405162461bcd60e51b8152600401808060200182810382526023815260200180610ff86023913960400191505060405180910390fd5b610a8b838383610f61565b610ac88160405180606001604052806026815260200161105f602691396001600160a01b0386166000908152602081905260409020549190610b51565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610af79082610be8565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610be05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ba5578181015183820152602001610b8d565b50505050905090810190601f168015610bd25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610c42576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600554610100900460ff16610c9c576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6005805461ff00191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa610cd0610906565b604080516001600160a01b039092168252519081900360200190a1565b6001600160a01b038216610d48576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610d5460008383610f61565b600254610d619082610be8565b6002556001600160a01b038216600090815260208190526040902054610d879082610be8565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600554610100900460ff1615610e2d576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6005805461ff0019166101001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610cd0610906565b6001600160a01b038216610eaa5760405162461bcd60e51b81526004018080602001828103825260218152602001806110ad6021913960400191505060405180910390fd5b610eb682600083610f61565b610ef38160405180606001604052806022815260200161101b602291396001600160a01b0385166000908152602081905260409020549190610b51565b6001600160a01b038316600090815260208190526040902055600254610f199082610fb5565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b610f6c838383610fb0565b610f74610654565b15610fb05760405162461bcd60e51b815260040180806020018281038252602a81526020018061113c602a913960400191505060405180910390fd5b505050565b6000610c4283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b5156fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f45524332305061757361626c653a20746f6b656e207472616e73666572207768696c6520706175736564a2646970667358221220e96342bec8f6c2bf72815a39998973b64c3bed57770f402e9a7b7eeda0265d4c64736f6c634300060c0033", - "from": { - "address": "0x1c5a77d9fa7ef466951b2f01f724bca3a5820b63", - "nonce": 2, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d6a00d4dd70", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - "accountCreated": { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "nonce": 1, - "balance": "0x0", - "codeHash": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - "accountAfter": [ - { - "address": "0x1c5a77d9fa7ef466951b2f01f724bca3a5820b63", - "nonce": 3, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d683461ce98", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - }, - { - "address": "0x1c5a77d9fa7ef466951b2f01f724bca3a5820b63", - "nonce": 3, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d683461ce98", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - } - ], - "byteCode": "0x60806040523480156200001157600080fd5b50604051620014b2380380620014b2833981810160405260a08110156200003757600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200006357600080fd5b9083019060208201858111156200007957600080fd5b82516401000000008111828201881017156200009457600080fd5b82525081516020918201929091019080838360005b83811015620000c3578181015183820152602001620000a9565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b9083019060208201858111156200012b57600080fd5b82516401000000008111828201881017156200014657600080fd5b82525081516020918201929091019080838360005b83811015620001755781810151838201526020016200015b565b50505050905090810190601f168015620001a35780820380516001836020036101000a031916815260200191505b5060405260209081015185519093508592508491620001c8916003918501906200026b565b508051620001de9060049060208401906200026b565b50506005805461ff001960ff1990911660121716905550600680546001600160a01b038088166001600160a01b0319928316179092556007805492871692909116919091179055620002308162000255565b50506005805462010000600160b01b0319163362010000021790555062000307915050565b6005805460ff191660ff92909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002ae57805160ff1916838001178555620002de565b82800160010185558215620002de579182015b82811115620002de578251825591602001919060010190620002c1565b50620002ec929150620002f0565b5090565b5b80821115620002ec5760008155600101620002f1565b61119b80620003176000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80635c975abb116100a257806395d89b411161007157806395d89b41146103015780639dc29fac14610309578063a457c2d714610335578063a9059cbb14610361578063dd62ed3e1461038d5761010b565b80635c975abb1461029d57806370a08231146102a55780638456cb59146102cb5780638e50817a146102d35761010b565b8063313ce567116100de578063313ce5671461021d578063395093511461023b5780633f4ba83a1461026757806340c10f19146102715761010b565b806306fdde0314610110578063095ea7b31461018d57806318160ddd146101cd57806323b872dd146101e7575b600080fd5b6101186103bb565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015257818101518382015260200161013a565b50505050905090810190601f16801561017f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b9600480360360408110156101a357600080fd5b506001600160a01b038135169060200135610451565b604080519115158252519081900360200190f35b6101d561046e565b60408051918252519081900360200190f35b6101b9600480360360608110156101fd57600080fd5b506001600160a01b03813581169160208101359091169060400135610474565b6102256104fb565b6040805160ff9092168252519081900360200190f35b6101b96004803603604081101561025157600080fd5b506001600160a01b038135169060200135610504565b61026f610552565b005b61026f6004803603604081101561028757600080fd5b506001600160a01b0381351690602001356105a9565b6101b9610654565b6101d5600480360360208110156102bb57600080fd5b50356001600160a01b0316610662565b61026f61067d565b61026f600480360360408110156102e957600080fd5b506001600160a01b03813581169160200135166106d2565b610118610757565b61026f6004803603604081101561031f57600080fd5b506001600160a01b0381351690602001356107b8565b6101b96004803603604081101561034b57600080fd5b506001600160a01b03813516906020013561085f565b6101b96004803603604081101561037757600080fd5b506001600160a01b0381351690602001356108c7565b6101d5600480360360408110156103a357600080fd5b506001600160a01b03813581169160200135166108db565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104475780601f1061041c57610100808354040283529160200191610447565b820191906000526020600020905b81548152906001019060200180831161042a57829003601f168201915b5050505050905090565b600061046561045e610906565b848461090a565b50600192915050565b60025490565b60006104818484846109f6565b6104f18461048d610906565b6104ec85604051806060016040528060288152602001611085602891396001600160a01b038a166000908152600160205260408120906104cb610906565b6001600160a01b031681526020810191909152604001600020549190610b51565b61090a565b5060019392505050565b60055460ff1690565b6000610465610511610906565b846104ec8560016000610522610906565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610be8565b6007546001600160a01b0316331461059f576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6105a7610c49565b565b600554610100900460ff16156105f9576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6006546001600160a01b03163314610646576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6106508282610ced565b5050565b600554610100900460ff1690565b6001600160a01b031660009081526020819052604090205490565b6007546001600160a01b031633146106ca576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6105a7610ddd565b6005546201000090046001600160a01b03163314610726576040805162461bcd60e51b815260206004820152600c60248201526b6f6e6c7920466163746f727960a01b604482015290519081900360640190fd5b600780546001600160a01b039283166001600160a01b03199182161790915560068054939092169216919091179055565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104475780601f1061041c57610100808354040283529160200191610447565b600554610100900460ff1615610808576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6006546001600160a01b03163314610855576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6106508282610e65565b600061046561086c610906565b846104ec856040518060600160405280602581526020016111176025913960016000610896610906565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610b51565b60006104656108d4610906565b84846109f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661094f5760405162461bcd60e51b81526004018080602001828103825260248152602001806110f36024913960400191505060405180910390fd5b6001600160a01b0382166109945760405162461bcd60e51b815260040180806020018281038252602281526020018061103d6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610a3b5760405162461bcd60e51b81526004018080602001828103825260258152602001806110ce6025913960400191505060405180910390fd5b6001600160a01b038216610a805760405162461bcd60e51b8152600401808060200182810382526023815260200180610ff86023913960400191505060405180910390fd5b610a8b838383610f61565b610ac88160405180606001604052806026815260200161105f602691396001600160a01b0386166000908152602081905260409020549190610b51565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610af79082610be8565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610be05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ba5578181015183820152602001610b8d565b50505050905090810190601f168015610bd25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610c42576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600554610100900460ff16610c9c576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6005805461ff00191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa610cd0610906565b604080516001600160a01b039092168252519081900360200190a1565b6001600160a01b038216610d48576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610d5460008383610f61565b600254610d619082610be8565b6002556001600160a01b038216600090815260208190526040902054610d879082610be8565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600554610100900460ff1615610e2d576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6005805461ff0019166101001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610cd0610906565b6001600160a01b038216610eaa5760405162461bcd60e51b81526004018080602001828103825260218152602001806110ad6021913960400191505060405180910390fd5b610eb682600083610f61565b610ef38160405180606001604052806022815260200161101b602291396001600160a01b0385166000908152602081905260409020549190610b51565b6001600160a01b038316600090815260208190526040902055600254610f199082610fb5565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b610f6c838383610fb0565b610f74610654565b15610fb05760405162461bcd60e51b815260040180806020018281038252602a81526020018061113c602a913960400191505060405180910390fd5b505050565b6000610c4283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b5156fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f45524332305061757361626c653a20746f6b656e207472616e73666572207768696c6520706175736564a2646970667358221220e96342bec8f6c2bf72815a39998973b64c3bed57770f402e9a7b7eeda0265d4c64736f6c634300060c00330000000000000000000000001c5a77d9fa7ef466951b2f01f724bca3a5820b630000000000000000000000001c5a77d9fa7ef466951b2f01f724bca3a5820b6300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000095745544820636f696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045745544800000000000000000000000000000000000000000000000000000000", - "structLogs": [ - { - "pc": 0, - "op": "DELEGATECALL", - "gas": 1015274, - "gasCost": 3, - "depth": 1 - } - ] - } - ], - "mptwitness": [ - { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "accountKey": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c", - "accountPath": [ - { - "pathPart": "0x1", - "root": "0xaf16fd780a8c7616b95b20da69f4ff26e0253238e996f9516445d6d6bf92b725", - "path": [ - { - "value": "0x5bbe97e7e66485b203f9dfea64eb7fa7df06959b12cbde2beba14f8f91133a13", - "sibling": "0x34f20c09876841ab1c180877223cc915ca96589b05ecea552aa2b3b9b47de806" - }, - { - "value": "0x0000000000000000000000000000000000000000000000000000000000000000", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ] - }, - { - "pathPart": "0x1", - "root": "0x08ebb525664ab0c02c49587ec298d42388319f0c57a3018a7984f77a69b06a20", - "path": [ - { - "value": "0xf0a9432907471588a0e83aa9201193de159efe3b31e9112d6981c2be8ce45104", - "sibling": "0x34f20c09876841ab1c180877223cc915ca96589b05ecea552aa2b3b9b47de806" - }, - { - "value": "0x5c70b599f4da7e6c8271703a7677e703fa0cab9088232a1c0ee99aa3112fd51e", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x33c5435c783d711eca3cb21179f8afaf6dd0be8ca0f066d0daace28b17fc281d", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - } - ], - "accountUpdate": [ - null, - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x0000000000000000000000000000000000000000000000000000000000000000" - } - ], - "commonStateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", - "statePath": [ - null, - null - ], - "stateUpdate": [ - null, - null - ] - }, - { - "address": "0x1c5a77d9fa7ef466951b2f01f724bca3a5820b63", - "accountKey": "0x9c5a1607a0719e201f7325c41c2dc857a16eadd309bab5d1d93c7e1d15204920", - "accountPath": [ - { - "pathPart": "0x0", - "root": "0x08ebb525664ab0c02c49587ec298d42388319f0c57a3018a7984f77a69b06a20", - "path": [ - { - "value": "0x34f20c09876841ab1c180877223cc915ca96589b05ecea552aa2b3b9b47de806", - "sibling": "0xf0a9432907471588a0e83aa9201193de159efe3b31e9112d6981c2be8ce45104" - } - ], - "leaf": { - "value": "0xf199fe1a085b5bb134e90d0bfdaf70579fa703ab3db986a6730b44cfd5207b15", - "sibling": "0x9c5a1607a0719e201f7325c41c2dc857a16eadd309bab5d1d93c7e1d15204920" - } - }, - { - "pathPart": "0x0", - "root": "0x5ccb01b192af8237bf448abf2c7fb6531ce162936172524eac258b40f32f0812", - "path": [ - { - "value": "0xdae1cffcb0f5fe3e341a9a514f9c06a6feaac97547b8ee2db69b239b880b9e19", - "sibling": "0xf0a9432907471588a0e83aa9201193de159efe3b31e9112d6981c2be8ce45104" - } - ], - "leaf": { - "value": "0xaa040d2c798b9c0db0484dcb8461200c9a92fa6a76c1bb58ec582d2c2d2edd22", - "sibling": "0x9c5a1607a0719e201f7325c41c2dc857a16eadd309bab5d1d93c7e1d15204920" - } - } - ], - "accountUpdate": [ - { - "nonce": 2, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d6a00d4dd70", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "nonce": 3, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d6a00d4dd70", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - } - ], - "commonStateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", - "statePath": [ - null, - null - ], - "stateUpdate": [ - null, - null - ] - }, - { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "accountKey": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c", - "accountPath": [ - { - "pathPart": "0x1", - "root": "0x5ccb01b192af8237bf448abf2c7fb6531ce162936172524eac258b40f32f0812", - "path": [ - { - "value": "0xf0a9432907471588a0e83aa9201193de159efe3b31e9112d6981c2be8ce45104", - "sibling": "0xdae1cffcb0f5fe3e341a9a514f9c06a6feaac97547b8ee2db69b239b880b9e19" - }, - { - "value": "0x5c70b599f4da7e6c8271703a7677e703fa0cab9088232a1c0ee99aa3112fd51e", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x33c5435c783d711eca3cb21179f8afaf6dd0be8ca0f066d0daace28b17fc281d", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - }, - { - "pathPart": "0x1", - "root": "0x5ccb01b192af8237bf448abf2c7fb6531ce162936172524eac258b40f32f0812", - "path": [ - { - "value": "0xf0a9432907471588a0e83aa9201193de159efe3b31e9112d6981c2be8ce45104", - "sibling": "0xdae1cffcb0f5fe3e341a9a514f9c06a6feaac97547b8ee2db69b239b880b9e19" - }, - { - "value": "0x5c70b599f4da7e6c8271703a7677e703fa0cab9088232a1c0ee99aa3112fd51e", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x33c5435c783d711eca3cb21179f8afaf6dd0be8ca0f066d0daace28b17fc281d", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - } - ], - "accountUpdate": [ - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x0000000000000000000000000000000000000000000000000000000000000000" - } - ], - "commonStateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", - "statePath": [ - null, - null - ], - "stateUpdate": [ - null, - null - ] - }, - { - "address": "0x1c5a77d9fa7ef466951b2f01f724bca3a5820b63", - "accountKey": "0x9c5a1607a0719e201f7325c41c2dc857a16eadd309bab5d1d93c7e1d15204920", - "accountPath": [ - { - "pathPart": "0x0", - "root": "0x5ccb01b192af8237bf448abf2c7fb6531ce162936172524eac258b40f32f0812", - "path": [ - { - "value": "0xdae1cffcb0f5fe3e341a9a514f9c06a6feaac97547b8ee2db69b239b880b9e19", - "sibling": "0xf0a9432907471588a0e83aa9201193de159efe3b31e9112d6981c2be8ce45104" - } - ], - "leaf": { - "value": "0xaa040d2c798b9c0db0484dcb8461200c9a92fa6a76c1bb58ec582d2c2d2edd22", - "sibling": "0x9c5a1607a0719e201f7325c41c2dc857a16eadd309bab5d1d93c7e1d15204920" - } - }, - { - "pathPart": "0x0", - "root": "0xe1aa47a8831f65f972375542bbb23710ec9c671be8e9eafe81d1bb7136aab928", - "path": [ - { - "value": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24", - "sibling": "0xf0a9432907471588a0e83aa9201193de159efe3b31e9112d6981c2be8ce45104" - } - ], - "leaf": { - "value": "0x882042a20c02edac064ed39dbcf5350bd3399c7747a7703d7960686e3101dd02", - "sibling": "0x9c5a1607a0719e201f7325c41c2dc857a16eadd309bab5d1d93c7e1d15204920" - } - } - ], - "accountUpdate": [ - { - "nonce": 3, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d6a00d4dd70", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "nonce": 3, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d683461ce98", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - } - ], - "commonStateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", - "statePath": [ - null, - null - ], - "stateUpdate": [ - null, - null - ] - }, - { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "accountKey": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c", - "accountPath": [ - { - "pathPart": "0x1", - "root": "0xe1aa47a8831f65f972375542bbb23710ec9c671be8e9eafe81d1bb7136aab928", - "path": [ - { - "value": "0xf0a9432907471588a0e83aa9201193de159efe3b31e9112d6981c2be8ce45104", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0x5c70b599f4da7e6c8271703a7677e703fa0cab9088232a1c0ee99aa3112fd51e", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x33c5435c783d711eca3cb21179f8afaf6dd0be8ca0f066d0daace28b17fc281d", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - }, - { - "pathPart": "0x1", - "root": "0xf09f669e4c99f58724043334be91d4474f70f1b893d7fd38764cec3917e65527", - "path": [ - { - "value": "0xe29200112e851398dda8f8932f2d348b9a1a13a247d81c6ad74a9102c220e62a", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0x2ecc09123c5664b42e67e469c75a3692135a4d24b077a20c162fadf5ffde0f0c", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x4e7dad23bae2633b0173032b06fa8576108b3e9c12070849666bd3e38439a10a", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - } - ], - "accountUpdate": [ - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - } - ], - "commonStateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", - "statePath": [ - null, - null - ], - "stateUpdate": [ - null, - null - ] - }, - { - "address": "0x1c5a77d9fa7ef466951b2f01f724bca3a5820b63", - "accountKey": "0x9c5a1607a0719e201f7325c41c2dc857a16eadd309bab5d1d93c7e1d15204920", - "accountPath": [ - { - "pathPart": "0x0", - "root": "0xf09f669e4c99f58724043334be91d4474f70f1b893d7fd38764cec3917e65527", - "path": [ - { - "value": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24", - "sibling": "0xe29200112e851398dda8f8932f2d348b9a1a13a247d81c6ad74a9102c220e62a" - } - ], - "leaf": { - "value": "0x882042a20c02edac064ed39dbcf5350bd3399c7747a7703d7960686e3101dd02", - "sibling": "0x9c5a1607a0719e201f7325c41c2dc857a16eadd309bab5d1d93c7e1d15204920" - } - }, - { - "pathPart": "0x0", - "root": "0xf09f669e4c99f58724043334be91d4474f70f1b893d7fd38764cec3917e65527", - "path": [ - { - "value": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24", - "sibling": "0xe29200112e851398dda8f8932f2d348b9a1a13a247d81c6ad74a9102c220e62a" - } - ], - "leaf": { - "value": "0x882042a20c02edac064ed39dbcf5350bd3399c7747a7703d7960686e3101dd02", - "sibling": "0x9c5a1607a0719e201f7325c41c2dc857a16eadd309bab5d1d93c7e1d15204920" - } - } - ], - "accountUpdate": [ - { - "nonce": 3, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d683461ce98", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - }, - { - "nonce": 3, - "balance": "0x1ffffffffffffffffffffffffffffffffffffffffffd5a5fa703d683461ce98", - "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" - } - ], - "commonStateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", - "statePath": [ - null, - null - ], - "stateUpdate": [ - null, - null - ] - }, - { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "accountKey": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c", - "accountPath": [ - { - "pathPart": "0x1", - "root": "0xf09f669e4c99f58724043334be91d4474f70f1b893d7fd38764cec3917e65527", - "path": [ - { - "value": "0xe29200112e851398dda8f8932f2d348b9a1a13a247d81c6ad74a9102c220e62a", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0x2ecc09123c5664b42e67e469c75a3692135a4d24b077a20c162fadf5ffde0f0c", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x4e7dad23bae2633b0173032b06fa8576108b3e9c12070849666bd3e38439a10a", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - }, - { - "pathPart": "0x1", - "root": "0x3ff0a2bcb6d82f6c65b9743f2167554a38c00f716d30bf176550e9bbf211de02", - "path": [ - { - "value": "0x1bfd41162e3f41ae3e58194190067b7106d4de0c16b555f8a3d962b7e75a9127", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0xb7a86f10915a67ec505541bdc1fe3e00ae12ff4f817c2a8ef8d8f72861531f1a", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x5ae28e9db9a7b45743017db7696411292e9af5adb0ff11737a8936b69ef28403", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - } - ], - "accountUpdate": [ - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - }, - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - } - ], - "stateKey": "0x84d07ce01938a8e3278d5a7b52cf4b853666886e48d30f623413b0a36e2b8e17", - "statePath": [ - { - "pathPart": "0x0", - "root": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "pathPart": "0x0", - "root": "0x9ed40c6ac1bdb532038ee26104d46ebe84b2184716fc96410c5228e05c901017", - "leaf": { - "value": "0x5cdff6c2c2ed92a182c2eeed8a689f39d0af361f9f15ceb8ffc2309f3a746920", - "sibling": "0x84d07ce01938a8e3278d5a7b52cf4b853666886e48d30f623413b0a36e2b8e17" - } - } - ], - "stateUpdate": [ - null, - { - "key": "0x0000000000000000000000000000000000000000000000000000000000000003", - "value": "0x5745544820636f696e0000000000000000000000000000000000000000000012" - } - ] - }, - { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "accountKey": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c", - "accountPath": [ - { - "pathPart": "0x1", - "root": "0x3ff0a2bcb6d82f6c65b9743f2167554a38c00f716d30bf176550e9bbf211de02", - "path": [ - { - "value": "0x1bfd41162e3f41ae3e58194190067b7106d4de0c16b555f8a3d962b7e75a9127", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0xb7a86f10915a67ec505541bdc1fe3e00ae12ff4f817c2a8ef8d8f72861531f1a", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x5ae28e9db9a7b45743017db7696411292e9af5adb0ff11737a8936b69ef28403", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - }, - { - "pathPart": "0x1", - "root": "0x2e941dbce9c9463767e526ff1dc64448b54c4f38206985b291d08ff65f572c2b", - "path": [ - { - "value": "0x1f197a0287d09d7e4900d018a82a827087484a0df5333b12691a3cd4370ba911", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0x9d5e14515e7dfae33e52c8267bc216c26e0a14e70235f5e562419a156a43a305", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x428cf4a59656f7c6327c6e90e01288157ce4d9e8de13c4868bbccd18d1fc112c", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - } - ], - "accountUpdate": [ - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - }, - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - } - ], - "stateKey": "0x8e1ee9fe8054b1fa6d3989af4e3ca88a801f67f4a497c85ca0fe469d89272923", - "statePath": [ - { - "pathPart": "0x0", - "root": "0x9ed40c6ac1bdb532038ee26104d46ebe84b2184716fc96410c5228e05c901017", - "leaf": { - "value": "0x5cdff6c2c2ed92a182c2eeed8a689f39d0af361f9f15ceb8ffc2309f3a746920", - "sibling": "0x84d07ce01938a8e3278d5a7b52cf4b853666886e48d30f623413b0a36e2b8e17" - } - }, - { - "pathPart": "0x2", - "root": "0x89e588c8124ca0250a33c78c46584d603e4c12cea897c47dfc6cefa83402c41e", - "path": [ - { - "value": "0x73719ac007efd4480d52c2f7803dd61d2647851dd99df6a81303d484b617e213", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0x37dbfd51b8cacf779ca71e9cfc9d13acc3db6cb917642dd18ca03b10bd9a2f18", - "sibling": "0x9ed40c6ac1bdb532038ee26104d46ebe84b2184716fc96410c5228e05c901017" - } - ], - "leaf": { - "value": "0xf03a062f7dac12aa4a8e1ecf3706890ce02e02be5e95d00650d1c43b6f5d0026", - "sibling": "0x8e1ee9fe8054b1fa6d3989af4e3ca88a801f67f4a497c85ca0fe469d89272923" - } - } - ], - "stateUpdate": [ - null, - { - "key": "0x0000000000000000000000000000000000000000000000000000000000000004", - "value": "0x5745544800000000000000000000000000000000000000000000000000000008" - } - ] - }, - { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "accountKey": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c", - "accountPath": [ - { - "pathPart": "0x1", - "root": "0x2e941dbce9c9463767e526ff1dc64448b54c4f38206985b291d08ff65f572c2b", - "path": [ - { - "value": "0x1f197a0287d09d7e4900d018a82a827087484a0df5333b12691a3cd4370ba911", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0x9d5e14515e7dfae33e52c8267bc216c26e0a14e70235f5e562419a156a43a305", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x428cf4a59656f7c6327c6e90e01288157ce4d9e8de13c4868bbccd18d1fc112c", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - }, - { - "pathPart": "0x1", - "root": "0xf5ebd4c93bb15cd7e6be4adc0406d735327d712d6d0e5b6dd587739baca12907", - "path": [ - { - "value": "0xcd4f19c0ea5a8b7177bcdd705074451332d09ee076b071d08ac5bceb44566d19", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0x088f92b5290bf701751c5bf33463ba87323c4546c0c059ce061c33fc759a9424", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x120a27869531ba07c327622f2e437105062409003b859a79bdd8673c7f989b29", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - } - ], - "accountUpdate": [ - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - }, - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - } - ], - "stateKey": "0x68af6119e1c208c6d4e4a54e37e40c0ae109e97895d0970707e4b8face49940e", - "statePath": [ - { - "pathPart": "0x0", - "root": "0x89e588c8124ca0250a33c78c46584d603e4c12cea897c47dfc6cefa83402c41e", - "path": [ - { - "value": "0x73719ac007efd4480d52c2f7803dd61d2647851dd99df6a81303d484b617e213", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0x9ed40c6ac1bdb532038ee26104d46ebe84b2184716fc96410c5228e05c901017", - "sibling": "0x37dbfd51b8cacf779ca71e9cfc9d13acc3db6cb917642dd18ca03b10bd9a2f18" - } - ], - "leaf": { - "value": "0x5cdff6c2c2ed92a182c2eeed8a689f39d0af361f9f15ceb8ffc2309f3a746920", - "sibling": "0x84d07ce01938a8e3278d5a7b52cf4b853666886e48d30f623413b0a36e2b8e17" - } - }, - { - "pathPart": "0x0", - "root": "0xa2ca8943f203126deccf79c17dc15904e4f5c15961f7bf869cef74053802ea28", - "path": [ - { - "value": "0x6c1ec8ffe1a58a389a0e3b733d1213b88983aacab48d06d8d923fe3fc9d0422e", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0xfc8dcec425a54dcee11a565b2448cd4422d93b16e60ff73c484c2ce8e138b52b", - "sibling": "0x37dbfd51b8cacf779ca71e9cfc9d13acc3db6cb917642dd18ca03b10bd9a2f18" - }, - { - "value": "0x65a94cbfc1b45c9e0abd5e951a14145d5c8d10628e023b788358e5550d4a7824", - "sibling": "0x9ed40c6ac1bdb532038ee26104d46ebe84b2184716fc96410c5228e05c901017" - } - ], - "leaf": { - "value": "0xacce20d02c097a1d31fba5c0b1df801db982fc92bb9414a8587b800f52b6f61c", - "sibling": "0x68af6119e1c208c6d4e4a54e37e40c0ae109e97895d0970707e4b8face49940e" - } - } - ], - "stateUpdate": [ - null, - { - "key": "0x0000000000000000000000000000000000000000000000000000000000000005", - "value": "0x000000000000000000001c5a77d9fa7ef466951b2f01f724bca3a5820b630012" - } - ] - }, - { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "accountKey": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c", - "accountPath": [ - { - "pathPart": "0x1", - "root": "0xf5ebd4c93bb15cd7e6be4adc0406d735327d712d6d0e5b6dd587739baca12907", - "path": [ - { - "value": "0xcd4f19c0ea5a8b7177bcdd705074451332d09ee076b071d08ac5bceb44566d19", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0x088f92b5290bf701751c5bf33463ba87323c4546c0c059ce061c33fc759a9424", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x120a27869531ba07c327622f2e437105062409003b859a79bdd8673c7f989b29", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - }, - { - "pathPart": "0x1", - "root": "0xfea77ab872522019f637cb99a0a35fab9fd7584f55b818622f5d04c496d8d912", - "path": [ - { - "value": "0x8bc098f2af6fc222476a060d160298ae3f123e2ac7c601869229f369b225f40f", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0x7c15f1737fc59c2a1afebe163ee856733a4a6b82de66d50843ab7b46a97a9909", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x000f9969c209a3805df18d1e43e7a40409553d4ff3753e4d0571a6e944b1c517", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - } - ], - "accountUpdate": [ - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - }, - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - } - ], - "stateKey": "0x046b3f7277dd2bb9226a061aa719407156457c66b932f8c7241f7b754470dc20", - "statePath": [ - { - "pathPart": "0x4", - "root": "0xa2ca8943f203126deccf79c17dc15904e4f5c15961f7bf869cef74053802ea28", - "path": [ - { - "value": "0x6c1ec8ffe1a58a389a0e3b733d1213b88983aacab48d06d8d923fe3fc9d0422e", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0xfc8dcec425a54dcee11a565b2448cd4422d93b16e60ff73c484c2ce8e138b52b", - "sibling": "0x37dbfd51b8cacf779ca71e9cfc9d13acc3db6cb917642dd18ca03b10bd9a2f18" - }, - { - "value": "0x9ed40c6ac1bdb532038ee26104d46ebe84b2184716fc96410c5228e05c901017", - "sibling": "0x65a94cbfc1b45c9e0abd5e951a14145d5c8d10628e023b788358e5550d4a7824" - } - ], - "leaf": { - "value": "0x5cdff6c2c2ed92a182c2eeed8a689f39d0af361f9f15ceb8ffc2309f3a746920", - "sibling": "0x84d07ce01938a8e3278d5a7b52cf4b853666886e48d30f623413b0a36e2b8e17" - } - }, - { - "pathPart": "0x4", - "root": "0x1f176cbfa5e0254f11c0146aa502cd1c84aac713c124c677b1bfafabf15f892b", - "path": [ - { - "value": "0x31a041ed93b6641f89e8295967d7cd4801aa8ca73e1f81e439122f36f3b7f710", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0xe5f76af6ebb792a20b480a6994b5c2264054d10c610fb8fbb75f2ab5ae9fcb01", - "sibling": "0x37dbfd51b8cacf779ca71e9cfc9d13acc3db6cb917642dd18ca03b10bd9a2f18" - }, - { - "value": "0x7d1b789f4a5411516280fd3b0104a3b5fdc5bbd6df8ea767168c373f15d8ff2d", - "sibling": "0x65a94cbfc1b45c9e0abd5e951a14145d5c8d10628e023b788358e5550d4a7824" - }, - { - "value": "0x3bdbeda9aef8d46ff022e68dff577618fe293b56e576f511353dc0345b89222d", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0x0b20aef3078beadd95e24db8e1c2d204637fa6ad65a7177fb374818f7c953d1f", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0x128c276138eb3d65b85b8c4444a6ce99c7c8f1bbf5346702ab7970a7afdc2123", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0x1c3730c4f23bd1e76d6c9f8a2ae1374ef08b8d19c36afef8ffed8969fcfd9529", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0x0658a357d896574c898607cb184a4c7f17e85191f40d1e7a0bfce95b8803f713", - "sibling": "0x9ed40c6ac1bdb532038ee26104d46ebe84b2184716fc96410c5228e05c901017" - } - ], - "leaf": { - "value": "0xa2c927e0a1f39fba117081072216e7c98a8ba79511734bb5e2ef40b12dcc2c12", - "sibling": "0x046b3f7277dd2bb9226a061aa719407156457c66b932f8c7241f7b754470dc20" - } - } - ], - "stateUpdate": [ - null, - { - "key": "0x0000000000000000000000000000000000000000000000000000000000000006", - "value": "0x0000000000000000000000001c5a77d9fa7ef466951b2f01f724bca3a5820b63" - } - ] - }, - { - "address": "0x03f8133dd5ed58838b20af1296f62f44e69baa48", - "accountKey": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c", - "accountPath": [ - { - "pathPart": "0x1", - "root": "0xfea77ab872522019f637cb99a0a35fab9fd7584f55b818622f5d04c496d8d912", - "path": [ - { - "value": "0x8bc098f2af6fc222476a060d160298ae3f123e2ac7c601869229f369b225f40f", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0x7c15f1737fc59c2a1afebe163ee856733a4a6b82de66d50843ab7b46a97a9909", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0x000f9969c209a3805df18d1e43e7a40409553d4ff3753e4d0571a6e944b1c517", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - }, - { - "pathPart": "0x1", - "root": "0x1ca9391b065cb3cad3b75fdb7602bd07e9e201b6955f5599df71a6a2e22b7126", - "path": [ - { - "value": "0x6c8ac076e40ea7a2bacfa1f2eb4d16228358901eaeb2ff23de2617c2d69d761a", - "sibling": "0x549430921a06705ecd4ebf9a8635f5c735807a4d1aebcdaf6010c8241c8a7e24" - }, - { - "value": "0xc57a28be62e1405f969d7c595ca68ee57ff8c1ea8c1152110958fe5c04993b02", - "sibling": "0x2e591357b02ab3117c35ad94a4e1a724fdbd95d6463da1f6c8017e6d000ecf02" - } - ], - "leaf": { - "value": "0xa4d874cdd5069fb3049ab6fa98e8a38c4147b3aee9ee81c51898a1d95fd9d805", - "sibling": "0x357d8fb5134f3dc48eb1118c6a16ba14eee5d49fe9adaebd5879932694bf320c" - } - } - ], - "accountUpdate": [ - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - }, - { - "nonce": 1, - "balance": "0x0", - "codeHash": "0x07c28a1f146e6cc6b10bf3e1b0072b4e11300b7fe80d4543dc3bc8bef3e95843" - } - ], - "stateKey": "0x9e288b3b74343a5f7113836c1764ad0b125ea3cccfa1164bb0bf061d8f409e00", - "statePath": [ - { - "pathPart": "0x2", - "root": "0x1f176cbfa5e0254f11c0146aa502cd1c84aac713c124c677b1bfafabf15f892b", - "path": [ - { - "value": "0x31a041ed93b6641f89e8295967d7cd4801aa8ca73e1f81e439122f36f3b7f710", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0x37dbfd51b8cacf779ca71e9cfc9d13acc3db6cb917642dd18ca03b10bd9a2f18", - "sibling": "0xe5f76af6ebb792a20b480a6994b5c2264054d10c610fb8fbb75f2ab5ae9fcb01" - } - ], - "leaf": { - "value": "0xf03a062f7dac12aa4a8e1ecf3706890ce02e02be5e95d00650d1c43b6f5d0026", - "sibling": "0x8e1ee9fe8054b1fa6d3989af4e3ca88a801f67f4a497c85ca0fe469d89272923" - } - }, - { - "pathPart": "0x1e", - "root": "0x6415bf82698d10370b73f5729ca9744ad2c933d642c1d59db83708e2eddfab25", - "path": [ - { - "value": "0x05d10e87783ea65c9d90f440ceb8c2f147012020a7dbd6f9fd95de35720dd616", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0x8047642edb3ed776a59784d319750041a9721b507b98941a8c3d723039a52c1a", - "sibling": "0xe5f76af6ebb792a20b480a6994b5c2264054d10c610fb8fbb75f2ab5ae9fcb01" - }, - { - "value": "0x20b3db0acca1e9b17bb14d3990d75f2a112e1658c75a151bceb5976912a8072b", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0xd71ff7f2d6d380b7b5d964421c3306112edea7598b290d7c383873354ae0d31a", - "sibling": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "value": "0x82b38622562739a63a73c983080da4bf23621a5b834eed4bc96f8b60cabe7a29", - "sibling": "0x37dbfd51b8cacf779ca71e9cfc9d13acc3db6cb917642dd18ca03b10bd9a2f18" - } - ], - "leaf": { - "value": "0xa2c927e0a1f39fba117081072216e7c98a8ba79511734bb5e2ef40b12dcc2c12", - "sibling": "0x9e288b3b74343a5f7113836c1764ad0b125ea3cccfa1164bb0bf061d8f409e00" - } - } - ], - "stateUpdate": [ - null, - { - "key": "0x0000000000000000000000000000000000000000000000000000000000000007", - "value": "0x0000000000000000000000001c5a77d9fa7ef466951b2f01f724bca3a5820b63" - } - ] - } - ] -} diff --git a/common/types/batch_header.go b/common/types/batch_header.go deleted file mode 100644 index 85ebfcebd8..0000000000 --- a/common/types/batch_header.go +++ /dev/null @@ -1,168 +0,0 @@ -package types - -import ( - "encoding/binary" - "fmt" - "math/big" - - "github.com/scroll-tech/go-ethereum/common" - "github.com/scroll-tech/go-ethereum/core/types" - "github.com/scroll-tech/go-ethereum/crypto" -) - -// BatchMeta contains metadata of a batch. -type BatchMeta struct { - StartChunkIndex uint64 - StartChunkHash string - EndChunkIndex uint64 - EndChunkHash string - TotalL1CommitGas uint64 - TotalL1CommitCalldataSize uint32 -} - -// BatchHeader contains batch header info to be committed. -type BatchHeader struct { - // Encoded in BatchHeaderV0Codec - version uint8 - batchIndex uint64 - l1MessagePopped uint64 - totalL1MessagePopped uint64 - dataHash common.Hash - parentBatchHash common.Hash - skippedL1MessageBitmap []byte -} - -// NewBatchHeader creates a new BatchHeader -func NewBatchHeader(version uint8, batchIndex, totalL1MessagePoppedBefore uint64, parentBatchHash common.Hash, chunks []*Chunk) (*BatchHeader, error) { - // buffer for storing chunk hashes in order to compute the batch data hash - var dataBytes []byte - - // skipped L1 message bitmap, an array of 256-bit bitmaps - var skippedBitmap []*big.Int - - // the first queue index that belongs to this batch - baseIndex := totalL1MessagePoppedBefore - - // the next queue index that we need to process - nextIndex := totalL1MessagePoppedBefore - - for chunkID, chunk := range chunks { - // build data hash - totalL1MessagePoppedBeforeChunk := nextIndex - chunkHash, err := chunk.Hash(totalL1MessagePoppedBeforeChunk) - if err != nil { - return nil, err - } - dataBytes = append(dataBytes, chunkHash.Bytes()...) - - // build skip bitmap - for blockID, block := range chunk.Blocks { - for _, tx := range block.Transactions { - if tx.Type != types.L1MessageTxType { - continue - } - currentIndex := tx.Nonce - - if currentIndex < nextIndex { - return nil, fmt.Errorf("unexpected batch payload, expected queue index: %d, got: %d. Batch index: %d, chunk index in batch: %d, block index in chunk: %d, block hash: %v, transaction hash: %v", nextIndex, currentIndex, batchIndex, chunkID, blockID, block.Header.Hash(), tx.TxHash) - } - - // mark skipped messages - for skippedIndex := nextIndex; skippedIndex < currentIndex; skippedIndex++ { - quo := int((skippedIndex - baseIndex) / 256) - rem := int((skippedIndex - baseIndex) % 256) - for len(skippedBitmap) <= quo { - bitmap := big.NewInt(0) - skippedBitmap = append(skippedBitmap, bitmap) - } - skippedBitmap[quo].SetBit(skippedBitmap[quo], rem, 1) - } - - // process included message - quo := int((currentIndex - baseIndex) / 256) - for len(skippedBitmap) <= quo { - bitmap := big.NewInt(0) - skippedBitmap = append(skippedBitmap, bitmap) - } - - nextIndex = currentIndex + 1 - } - } - } - - // compute data hash - dataHash := crypto.Keccak256Hash(dataBytes) - - // compute skipped bitmap - bitmapBytes := make([]byte, len(skippedBitmap)*32) - for ii, num := range skippedBitmap { - bytes := num.Bytes() - padding := 32 - len(bytes) - copy(bitmapBytes[32*ii+padding:], bytes) - } - - return &BatchHeader{ - version: version, - batchIndex: batchIndex, - l1MessagePopped: nextIndex - totalL1MessagePoppedBefore, - totalL1MessagePopped: nextIndex, - dataHash: dataHash, - parentBatchHash: parentBatchHash, - skippedL1MessageBitmap: bitmapBytes, - }, nil -} - -// Version returns the version of the BatchHeader. -func (b *BatchHeader) Version() uint8 { - return b.version -} - -// BatchIndex returns the batch index of the BatchHeader. -func (b *BatchHeader) BatchIndex() uint64 { - return b.batchIndex -} - -// TotalL1MessagePopped returns the total number of L1 messages popped in the BatchHeader. -func (b *BatchHeader) TotalL1MessagePopped() uint64 { - return b.totalL1MessagePopped -} - -// SkippedL1MessageBitmap returns the skipped L1 message bitmap in the BatchHeader. -func (b *BatchHeader) SkippedL1MessageBitmap() []byte { - return b.skippedL1MessageBitmap -} - -// Encode encodes the BatchHeader into RollupV2 BatchHeaderV0Codec Encoding. -func (b *BatchHeader) Encode() []byte { - batchBytes := make([]byte, 89+len(b.skippedL1MessageBitmap)) - batchBytes[0] = b.version - binary.BigEndian.PutUint64(batchBytes[1:], b.batchIndex) - binary.BigEndian.PutUint64(batchBytes[9:], b.l1MessagePopped) - binary.BigEndian.PutUint64(batchBytes[17:], b.totalL1MessagePopped) - copy(batchBytes[25:], b.dataHash[:]) - copy(batchBytes[57:], b.parentBatchHash[:]) - copy(batchBytes[89:], b.skippedL1MessageBitmap[:]) - return batchBytes -} - -// Hash calculates the hash of the batch header. -func (b *BatchHeader) Hash() common.Hash { - return crypto.Keccak256Hash(b.Encode()) -} - -// DecodeBatchHeader attempts to decode the given byte slice into a BatchHeader. -func DecodeBatchHeader(data []byte) (*BatchHeader, error) { - if len(data) < 89 { - return nil, fmt.Errorf("insufficient data for BatchHeader") - } - b := &BatchHeader{ - version: data[0], - batchIndex: binary.BigEndian.Uint64(data[1:9]), - l1MessagePopped: binary.BigEndian.Uint64(data[9:17]), - totalL1MessagePopped: binary.BigEndian.Uint64(data[17:25]), - dataHash: common.BytesToHash(data[25:57]), - parentBatchHash: common.BytesToHash(data[57:89]), - skippedL1MessageBitmap: data[89:], - } - return b, nil -} diff --git a/common/types/batch_header_test.go b/common/types/batch_header_test.go deleted file mode 100644 index c0de7575b1..0000000000 --- a/common/types/batch_header_test.go +++ /dev/null @@ -1,251 +0,0 @@ -package types - -import ( - "encoding/json" - "os" - "testing" - - "github.com/scroll-tech/go-ethereum/common" - "github.com/stretchr/testify/assert" -) - -func TestNewBatchHeader(t *testing.T) { - // Without L1 Msg - templateBlockTrace, err := os.ReadFile("../testdata/blockTrace_02.json") - assert.NoError(t, err) - - wrappedBlock := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace, wrappedBlock)) - chunk := &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock, - }, - } - parentBatchHeader := &BatchHeader{ - version: 1, - batchIndex: 0, - l1MessagePopped: 0, - totalL1MessagePopped: 0, - dataHash: common.HexToHash("0x0"), - parentBatchHash: common.HexToHash("0x0"), - skippedL1MessageBitmap: nil, - } - batchHeader, err := NewBatchHeader(1, 1, 0, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - assert.Equal(t, 0, len(batchHeader.skippedL1MessageBitmap)) - - // 1 L1 Msg in 1 bitmap - templateBlockTrace2, err := os.ReadFile("../testdata/blockTrace_04.json") - assert.NoError(t, err) - - wrappedBlock2 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace2, wrappedBlock2)) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock2, - }, - } - batchHeader, err = NewBatchHeader(1, 1, 0, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - assert.Equal(t, 32, len(batchHeader.skippedL1MessageBitmap)) - expectedBitmap := "00000000000000000000000000000000000000000000000000000000000003ff" // skip first 10 - assert.Equal(t, expectedBitmap, common.Bytes2Hex(batchHeader.skippedL1MessageBitmap)) - - // many consecutive L1 Msgs in 1 bitmap, no leading skipped msgs - templateBlockTrace3, err := os.ReadFile("../testdata/blockTrace_05.json") - assert.NoError(t, err) - - wrappedBlock3 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace3, wrappedBlock3)) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock3, - }, - } - batchHeader, err = NewBatchHeader(1, 1, 37, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - assert.Equal(t, uint64(5), batchHeader.l1MessagePopped) - assert.Equal(t, 32, len(batchHeader.skippedL1MessageBitmap)) - expectedBitmap = "0000000000000000000000000000000000000000000000000000000000000000" // all bits are included, so none are skipped - assert.Equal(t, expectedBitmap, common.Bytes2Hex(batchHeader.skippedL1MessageBitmap)) - - // many consecutive L1 Msgs in 1 bitmap, with leading skipped msgs - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock3, - }, - } - batchHeader, err = NewBatchHeader(1, 1, 0, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - assert.Equal(t, uint64(42), batchHeader.l1MessagePopped) - assert.Equal(t, 32, len(batchHeader.skippedL1MessageBitmap)) - expectedBitmap = "0000000000000000000000000000000000000000000000000000001fffffffff" // skipped the first 37 messages - assert.Equal(t, expectedBitmap, common.Bytes2Hex(batchHeader.skippedL1MessageBitmap)) - - // many sparse L1 Msgs in 1 bitmap - templateBlockTrace4, err := os.ReadFile("../testdata/blockTrace_06.json") - assert.NoError(t, err) - - wrappedBlock4 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace4, wrappedBlock4)) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock4, - }, - } - batchHeader, err = NewBatchHeader(1, 1, 0, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - assert.Equal(t, uint64(10), batchHeader.l1MessagePopped) - assert.Equal(t, 32, len(batchHeader.skippedL1MessageBitmap)) - expectedBitmap = "00000000000000000000000000000000000000000000000000000000000001dd" // 0111011101 - assert.Equal(t, expectedBitmap, common.Bytes2Hex(batchHeader.skippedL1MessageBitmap)) - - // many L1 Msgs in each of 2 bitmaps - templateBlockTrace5, err := os.ReadFile("../testdata/blockTrace_07.json") - assert.NoError(t, err) - - wrappedBlock5 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace5, wrappedBlock5)) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock5, - }, - } - batchHeader, err = NewBatchHeader(1, 1, 0, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - assert.Equal(t, uint64(257), batchHeader.l1MessagePopped) - assert.Equal(t, 64, len(batchHeader.skippedL1MessageBitmap)) - expectedBitmap = "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd0000000000000000000000000000000000000000000000000000000000000000" - assert.Equal(t, expectedBitmap, common.Bytes2Hex(batchHeader.skippedL1MessageBitmap)) -} - -func TestBatchHeaderEncode(t *testing.T) { - // Without L1 Msg - templateBlockTrace, err := os.ReadFile("../testdata/blockTrace_02.json") - assert.NoError(t, err) - - wrappedBlock := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace, wrappedBlock)) - chunk := &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock, - }, - } - parentBatchHeader := &BatchHeader{ - version: 1, - batchIndex: 0, - l1MessagePopped: 0, - totalL1MessagePopped: 0, - dataHash: common.HexToHash("0x0"), - parentBatchHash: common.HexToHash("0x0"), - skippedL1MessageBitmap: nil, - } - batchHeader, err := NewBatchHeader(1, 1, 0, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - bytes := batchHeader.Encode() - assert.Equal(t, 89, len(bytes)) - assert.Equal(t, "0100000000000000010000000000000000000000000000000010a64c9bd905f8caf5d668fbda622d6558c5a42cdb4b3895709743d159c22e534136709aabc8a23aa17fbcc833da2f7857d3c2884feec9aae73429c135f94985", common.Bytes2Hex(bytes)) - - // With L1 Msg - templateBlockTrace2, err := os.ReadFile("../testdata/blockTrace_04.json") - assert.NoError(t, err) - - wrappedBlock2 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace2, wrappedBlock2)) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock2, - }, - } - batchHeader, err = NewBatchHeader(1, 1, 0, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - bytes = batchHeader.Encode() - assert.Equal(t, 121, len(bytes)) - assert.Equal(t, "010000000000000001000000000000000b000000000000000b34f419ce7e882295bdb5aec6cce56ffa788a5fed4744d7fbd77e4acbf409f1ca4136709aabc8a23aa17fbcc833da2f7857d3c2884feec9aae73429c135f9498500000000000000000000000000000000000000000000000000000000000003ff", common.Bytes2Hex(bytes)) -} - -func TestBatchHeaderHash(t *testing.T) { - // Without L1 Msg - templateBlockTrace, err := os.ReadFile("../testdata/blockTrace_02.json") - assert.NoError(t, err) - - wrappedBlock := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace, wrappedBlock)) - chunk := &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock, - }, - } - parentBatchHeader := &BatchHeader{ - version: 1, - batchIndex: 0, - l1MessagePopped: 0, - totalL1MessagePopped: 0, - dataHash: common.HexToHash("0x0"), - parentBatchHash: common.HexToHash("0x0"), - skippedL1MessageBitmap: nil, - } - batchHeader, err := NewBatchHeader(1, 1, 0, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - hash := batchHeader.Hash() - assert.Equal(t, "d69da4357da0073f4093c76e49f077e21bb52f48f57ee3e1fbd9c38a2881af81", common.Bytes2Hex(hash.Bytes())) - - templateBlockTrace, err = os.ReadFile("../testdata/blockTrace_03.json") - assert.NoError(t, err) - - wrappedBlock2 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace, wrappedBlock2)) - chunk2 := &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock2, - }, - } - batchHeader2, err := NewBatchHeader(1, 2, 0, batchHeader.Hash(), []*Chunk{chunk2}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader2) - hash2 := batchHeader2.Hash() - assert.Equal(t, "34de600163aa745d4513113137a5b54960d13f0d3f2849e490c4b875028bf930", common.Bytes2Hex(hash2.Bytes())) - - // With L1 Msg - templateBlockTrace3, err := os.ReadFile("../testdata/blockTrace_04.json") - assert.NoError(t, err) - - wrappedBlock3 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace3, wrappedBlock3)) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock3, - }, - } - batchHeader, err = NewBatchHeader(1, 1, 0, parentBatchHeader.Hash(), []*Chunk{chunk}) - assert.NoError(t, err) - assert.NotNil(t, batchHeader) - hash = batchHeader.Hash() - assert.Equal(t, "1c3007880f0eafe74572ede7d164ff1ee5376e9ac9bff6f7fb837b2630cddc9a", common.Bytes2Hex(hash.Bytes())) -} - -func TestBatchHeaderDecode(t *testing.T) { - header := &BatchHeader{ - version: 1, - batchIndex: 10, - l1MessagePopped: 20, - totalL1MessagePopped: 30, - dataHash: common.HexToHash("0x01"), - parentBatchHash: common.HexToHash("0x02"), - skippedL1MessageBitmap: []byte{0x01, 0x02, 0x03}, - } - - encoded := header.Encode() - decoded, err := DecodeBatchHeader(encoded) - assert.NoError(t, err) - assert.Equal(t, header, decoded) -} diff --git a/common/types/block.go b/common/types/block.go deleted file mode 100644 index 64b8c70e8c..0000000000 --- a/common/types/block.go +++ /dev/null @@ -1,193 +0,0 @@ -package types - -import ( - "encoding/binary" - "errors" - "fmt" - "math" - - "github.com/scroll-tech/go-ethereum/common" - "github.com/scroll-tech/go-ethereum/common/hexutil" - "github.com/scroll-tech/go-ethereum/core/types" - "github.com/scroll-tech/go-ethereum/log" -) - -// CalldataNonZeroByteGas is the gas consumption per non zero byte in calldata. -const CalldataNonZeroByteGas = 16 - -// GetKeccak256Gas calculates the gas cost for computing the keccak256 hash of a given size. -func GetKeccak256Gas(size uint64) uint64 { - return GetMemoryExpansionCost(size) + 30 + 6*((size+31)/32) -} - -// GetMemoryExpansionCost calculates the cost of memory expansion for a given memoryByteSize. -func GetMemoryExpansionCost(memoryByteSize uint64) uint64 { - memorySizeWord := (memoryByteSize + 31) / 32 - memoryCost := (memorySizeWord*memorySizeWord)/512 + (3 * memorySizeWord) - return memoryCost -} - -// WrappedBlock contains the block's Header, Transactions and WithdrawTrieRoot hash. -type WrappedBlock struct { - Header *types.Header `json:"header"` - // Transactions is only used for recover types.Transactions, the from of types.TransactionData field is missing. - Transactions []*types.TransactionData `json:"transactions"` - WithdrawRoot common.Hash `json:"withdraw_trie_root,omitempty"` - RowConsumption *types.RowConsumption `json:"row_consumption"` - txPayloadLengthCache map[string]uint64 -} - -// NumL1Messages returns the number of L1 messages in this block. -// This number is the sum of included and skipped L1 messages. -func (w *WrappedBlock) NumL1Messages(totalL1MessagePoppedBefore uint64) uint64 { - var lastQueueIndex *uint64 - for _, txData := range w.Transactions { - if txData.Type == types.L1MessageTxType { - lastQueueIndex = &txData.Nonce - } - } - if lastQueueIndex == nil { - return 0 - } - // note: last queue index included before this block is totalL1MessagePoppedBefore - 1 - // TODO: cache results - return *lastQueueIndex - totalL1MessagePoppedBefore + 1 -} - -// NumL2Transactions returns the number of L2 transactions in this block. -func (w *WrappedBlock) NumL2Transactions() uint64 { - var count uint64 - for _, txData := range w.Transactions { - if txData.Type != types.L1MessageTxType { - count++ - } - } - return count -} - -// Encode encodes the WrappedBlock into RollupV2 BlockContext Encoding. -func (w *WrappedBlock) Encode(totalL1MessagePoppedBefore uint64) ([]byte, error) { - bytes := make([]byte, 60) - - if !w.Header.Number.IsUint64() { - return nil, errors.New("block number is not uint64") - } - - // note: numL1Messages includes skipped messages - numL1Messages := w.NumL1Messages(totalL1MessagePoppedBefore) - if numL1Messages > math.MaxUint16 { - return nil, errors.New("number of L1 messages exceeds max uint16") - } - - // note: numTransactions includes skipped messages - numL2Transactions := w.NumL2Transactions() - numTransactions := numL1Messages + numL2Transactions - if numTransactions > math.MaxUint16 { - return nil, errors.New("number of transactions exceeds max uint16") - } - - binary.BigEndian.PutUint64(bytes[0:], w.Header.Number.Uint64()) - binary.BigEndian.PutUint64(bytes[8:], w.Header.Time) - // TODO: [16:47] Currently, baseFee is 0, because we disable EIP-1559. - binary.BigEndian.PutUint64(bytes[48:], w.Header.GasLimit) - binary.BigEndian.PutUint16(bytes[56:], uint16(numTransactions)) - binary.BigEndian.PutUint16(bytes[58:], uint16(numL1Messages)) - - return bytes, nil -} - -// EstimateL1CommitCalldataSize calculates the calldata size in l1 commit approximately. -// TODO: The calculation could be more accurate by using 58 + len(l2TxDataBytes) (see Chunk). -// This needs to be adjusted in the future. -func (w *WrappedBlock) EstimateL1CommitCalldataSize() uint64 { - var size uint64 - for _, txData := range w.Transactions { - if txData.Type == types.L1MessageTxType { - continue - } - size += 4 // 4 bytes payload length - size += w.getTxPayloadLength(txData) - } - size += 60 // 60 bytes BlockContext - return size -} - -// EstimateL1CommitGas calculates the total L1 commit gas for this block approximately. -func (w *WrappedBlock) EstimateL1CommitGas() uint64 { - var total uint64 - var numL1Messages uint64 - for _, txData := range w.Transactions { - if txData.Type == types.L1MessageTxType { - numL1Messages++ - continue - } - - txPayloadLength := w.getTxPayloadLength(txData) - total += CalldataNonZeroByteGas * txPayloadLength // an over-estimate: treat each byte as non-zero - total += CalldataNonZeroByteGas * 4 // 4 bytes payload length - total += GetKeccak256Gas(txPayloadLength) // l2 tx hash - } - - // 60 bytes BlockContext calldata - total += CalldataNonZeroByteGas * 60 - - // sload - total += 2100 * numL1Messages // numL1Messages times cold sload in L1MessageQueue - - // staticcall - total += 100 * numL1Messages // numL1Messages times call to L1MessageQueue - total += 100 * numL1Messages // numL1Messages times warm address access to L1MessageQueue - - total += GetMemoryExpansionCost(36) * numL1Messages // staticcall to proxy - total += 100 * numL1Messages // read admin in proxy - total += 100 * numL1Messages // read impl in proxy - total += 100 * numL1Messages // access impl - total += GetMemoryExpansionCost(36) * numL1Messages // delegatecall to impl - - return total -} - -func (w *WrappedBlock) getTxPayloadLength(txData *types.TransactionData) uint64 { - if w.txPayloadLengthCache == nil { - w.txPayloadLengthCache = make(map[string]uint64) - } - - if length, exists := w.txPayloadLengthCache[txData.TxHash]; exists { - return length - } - - rlpTxData, err := convertTxDataToRLPEncoding(txData) - if err != nil { - log.Crit("convertTxDataToRLPEncoding failed, which should not happen", "hash", txData.TxHash, "err", err) - return 0 - } - txPayloadLength := uint64(len(rlpTxData)) - w.txPayloadLengthCache[txData.TxHash] = txPayloadLength - return txPayloadLength -} - -func convertTxDataToRLPEncoding(txData *types.TransactionData) ([]byte, error) { - data, err := hexutil.Decode(txData.Data) - if err != nil { - return nil, fmt.Errorf("failed to decode txData.Data: %s, err: %w", txData.Data, err) - } - - tx := types.NewTx(&types.LegacyTx{ - Nonce: txData.Nonce, - To: txData.To, - Value: txData.Value.ToInt(), - Gas: txData.Gas, - GasPrice: txData.GasPrice.ToInt(), - Data: data, - V: txData.V.ToInt(), - R: txData.R.ToInt(), - S: txData.S.ToInt(), - }) - - rlpTxData, err := tx.MarshalBinary() - if err != nil { - return nil, fmt.Errorf("failed to marshal binary of the tx: %+v, err: %w", tx, err) - } - - return rlpTxData, nil -} diff --git a/common/types/chunk.go b/common/types/chunk.go deleted file mode 100644 index feba818def..0000000000 --- a/common/types/chunk.go +++ /dev/null @@ -1,138 +0,0 @@ -package types - -import ( - "encoding/binary" - "encoding/hex" - "errors" - "fmt" - "strings" - - "github.com/scroll-tech/go-ethereum/common" - "github.com/scroll-tech/go-ethereum/core/types" - "github.com/scroll-tech/go-ethereum/crypto" -) - -// Chunk contains blocks to be encoded -type Chunk struct { - Blocks []*WrappedBlock `json:"blocks"` -} - -// NumL1Messages returns the number of L1 messages in this chunk. -// This number is the sum of included and skipped L1 messages. -func (c *Chunk) NumL1Messages(totalL1MessagePoppedBefore uint64) uint64 { - var numL1Messages uint64 - for _, block := range c.Blocks { - numL1MessagesInBlock := block.NumL1Messages(totalL1MessagePoppedBefore) - numL1Messages += numL1MessagesInBlock - totalL1MessagePoppedBefore += numL1MessagesInBlock - } - // TODO: cache results - return numL1Messages -} - -// Encode encodes the Chunk into RollupV2 Chunk Encoding. -func (c *Chunk) Encode(totalL1MessagePoppedBefore uint64) ([]byte, error) { - numBlocks := len(c.Blocks) - - if numBlocks > 255 { - return nil, errors.New("number of blocks exceeds 1 byte") - } - if numBlocks == 0 { - return nil, errors.New("number of blocks is 0") - } - - var chunkBytes []byte - chunkBytes = append(chunkBytes, byte(numBlocks)) - - var l2TxDataBytes []byte - - for _, block := range c.Blocks { - blockBytes, err := block.Encode(totalL1MessagePoppedBefore) - if err != nil { - return nil, fmt.Errorf("failed to encode block: %v", err) - } - totalL1MessagePoppedBefore += block.NumL1Messages(totalL1MessagePoppedBefore) - - if len(blockBytes) != 60 { - return nil, fmt.Errorf("block encoding is not 60 bytes long %x", len(blockBytes)) - } - - chunkBytes = append(chunkBytes, blockBytes...) - - // Append rlp-encoded l2Txs - for _, txData := range block.Transactions { - if txData.Type == types.L1MessageTxType { - continue - } - rlpTxData, err := convertTxDataToRLPEncoding(txData) - if err != nil { - return nil, err - } - var txLen [4]byte - binary.BigEndian.PutUint32(txLen[:], uint32(len(rlpTxData))) - l2TxDataBytes = append(l2TxDataBytes, txLen[:]...) - l2TxDataBytes = append(l2TxDataBytes, rlpTxData...) - } - } - - chunkBytes = append(chunkBytes, l2TxDataBytes...) - - return chunkBytes, nil -} - -// Hash hashes the Chunk into RollupV2 Chunk Hash -func (c *Chunk) Hash(totalL1MessagePoppedBefore uint64) (common.Hash, error) { - chunkBytes, err := c.Encode(totalL1MessagePoppedBefore) - if err != nil { - return common.Hash{}, err - } - numBlocks := chunkBytes[0] - - // concatenate block contexts - var dataBytes []byte - for i := 0; i < int(numBlocks); i++ { - // only the first 58 bytes of each BlockContext are needed for the hashing process - dataBytes = append(dataBytes, chunkBytes[1+60*i:60*i+59]...) - } - - // concatenate l1 and l2 tx hashes - for _, block := range c.Blocks { - var l1TxHashes []byte - var l2TxHashes []byte - for _, txData := range block.Transactions { - txHash := strings.TrimPrefix(txData.TxHash, "0x") - hashBytes, err := hex.DecodeString(txHash) - if err != nil { - return common.Hash{}, err - } - if txData.Type == types.L1MessageTxType { - l1TxHashes = append(l1TxHashes, hashBytes...) - } else { - l2TxHashes = append(l2TxHashes, hashBytes...) - } - } - dataBytes = append(dataBytes, l1TxHashes...) - dataBytes = append(dataBytes, l2TxHashes...) - } - - hash := crypto.Keccak256Hash(dataBytes) - return hash, nil -} - -// EstimateL1CommitGas calculates the total L1 commit gas for this chunk approximately -func (c *Chunk) EstimateL1CommitGas() uint64 { - var totalTxNum uint64 - var totalL1CommitGas uint64 - for _, block := range c.Blocks { - totalTxNum += uint64(len(block.Transactions)) - totalL1CommitGas += block.EstimateL1CommitGas() - } - - numBlocks := uint64(len(c.Blocks)) - totalL1CommitGas += 100 * numBlocks // numBlocks times warm sload - totalL1CommitGas += CalldataNonZeroByteGas // numBlocks field of chunk encoding in calldata - totalL1CommitGas += CalldataNonZeroByteGas * numBlocks * 60 // numBlocks of BlockContext in chunk - - totalL1CommitGas += GetKeccak256Gas(58*numBlocks + 32*totalTxNum) // chunk hash - return totalL1CommitGas -} diff --git a/common/types/chunk_test.go b/common/types/chunk_test.go deleted file mode 100644 index 8d7e27f08b..0000000000 --- a/common/types/chunk_test.go +++ /dev/null @@ -1,226 +0,0 @@ -package types - -import ( - "encoding/hex" - "encoding/json" - "os" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestChunkEncode(t *testing.T) { - // Test case 1: when the chunk contains no blocks. - chunk := &Chunk{ - Blocks: []*WrappedBlock{}, - } - bytes, err := chunk.Encode(0) - assert.Nil(t, bytes) - assert.Error(t, err) - assert.Contains(t, err.Error(), "number of blocks is 0") - - // Test case 2: when the chunk contains more than 255 blocks. - chunk = &Chunk{ - Blocks: []*WrappedBlock{}, - } - for i := 0; i < 256; i++ { - chunk.Blocks = append(chunk.Blocks, &WrappedBlock{}) - } - bytes, err = chunk.Encode(0) - assert.Nil(t, bytes) - assert.Error(t, err) - assert.Contains(t, err.Error(), "number of blocks exceeds 1 byte") - - // Test case 3: when the chunk contains one block. - templateBlockTrace, err := os.ReadFile("../testdata/blockTrace_02.json") - assert.NoError(t, err) - - wrappedBlock := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace, wrappedBlock)) - assert.Equal(t, uint64(0), wrappedBlock.NumL1Messages(0)) - assert.Equal(t, uint64(298), wrappedBlock.EstimateL1CommitCalldataSize()) - assert.Equal(t, uint64(2), wrappedBlock.NumL2Transactions()) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock, - }, - } - assert.Equal(t, uint64(0), chunk.NumL1Messages(0)) - assert.Equal(t, uint64(6042), chunk.EstimateL1CommitGas()) - bytes, err = chunk.Encode(0) - hexString := hex.EncodeToString(bytes) - assert.NoError(t, err) - assert.Equal(t, 299, len(bytes)) - assert.Equal(t, "0100000000000000020000000063807b2a0000000000000000000000000000000000000000000000000000000000000000000355418d1e81840002000000000073f87180843b9aec2e8307a12094c0c4c8baea3f6acb49b6e1fb9e2adeceeacb0ca28a152d02c7e14af60000008083019ecea0ab07ae99c67aa78e7ba5cf6781e90cc32b219b1de102513d56548a41e86df514a034cbd19feacd73e8ce64d00c4d1996b9b5243c578fd7f51bfaec288bbaf42a8b00000073f87101843b9aec2e8307a1209401bae6bf68e9a03fb2bc0615b1bf0d69ce9411ed8a152d02c7e14af60000008083019ecea0f039985866d8256f10c1be4f7b2cace28d8f20bde27e2604393eb095b7f77316a05a3e6e81065f2b4604bcec5bd4aba684835996fc3f879380aac1c09c6eed32f1", hexString) - - // Test case 4: when the chunk contains one block with 1 L1MsgTx - templateBlockTrace2, err := os.ReadFile("../testdata/blockTrace_04.json") - assert.NoError(t, err) - - wrappedBlock2 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace2, wrappedBlock2)) - assert.Equal(t, uint64(11), wrappedBlock2.NumL1Messages(0)) // 0..=9 skipped, 10 included - assert.Equal(t, uint64(96), wrappedBlock2.EstimateL1CommitCalldataSize()) - assert.Equal(t, uint64(1), wrappedBlock2.NumL2Transactions()) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock2, - }, - } - assert.Equal(t, uint64(11), chunk.NumL1Messages(0)) - assert.Equal(t, uint64(5329), chunk.EstimateL1CommitGas()) - bytes, err = chunk.Encode(0) - hexString = hex.EncodeToString(bytes) - assert.NoError(t, err) - assert.Equal(t, 97, len(bytes)) - assert.Equal(t, "01000000000000000d00000000646b6e13000000000000000000000000000000000000000000000000000000000000000000000000007a1200000c000b00000020df0b80825dc0941a258d17bf244c4df02d40343a7626a9d321e1058080808080", hexString) - - // Test case 5: when the chunk contains two blocks each with 1 L1MsgTx - // TODO: revise this test, we cannot reuse the same L1MsgTx twice - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock2, - wrappedBlock2, - }, - } - assert.Equal(t, uint64(11), chunk.NumL1Messages(0)) - assert.Equal(t, uint64(10612), chunk.EstimateL1CommitGas()) - bytes, err = chunk.Encode(0) - hexString = hex.EncodeToString(bytes) - assert.NoError(t, err) - assert.Equal(t, 193, len(bytes)) - assert.Equal(t, "02000000000000000d00000000646b6e13000000000000000000000000000000000000000000000000000000000000000000000000007a1200000c000b000000000000000d00000000646b6e13000000000000000000000000000000000000000000000000000000000000000000000000007a12000001000000000020df0b80825dc0941a258d17bf244c4df02d40343a7626a9d321e105808080808000000020df0b80825dc0941a258d17bf244c4df02d40343a7626a9d321e1058080808080", hexString) -} - -func TestChunkHash(t *testing.T) { - // Test case 1: when the chunk contains no blocks - chunk := &Chunk{ - Blocks: []*WrappedBlock{}, - } - hash, err := chunk.Hash(0) - assert.Error(t, err) - assert.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000000", hash.Hex()) - assert.Contains(t, err.Error(), "number of blocks is 0") - - // Test case 2: successfully hashing a chunk on one block - templateBlockTrace, err := os.ReadFile("../testdata/blockTrace_02.json") - assert.NoError(t, err) - wrappedBlock := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace, wrappedBlock)) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock, - }, - } - hash, err = chunk.Hash(0) - assert.NoError(t, err) - assert.Equal(t, "0x78c839dfc494396c16b40946f32b3f4c3e8c2d4bfd04aefcf235edec474482f8", hash.Hex()) - - // Test case 3: successfully hashing a chunk on two blocks - templateBlockTrace1, err := os.ReadFile("../testdata/blockTrace_03.json") - assert.NoError(t, err) - wrappedBlock1 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace1, wrappedBlock1)) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock, - wrappedBlock1, - }, - } - hash, err = chunk.Hash(0) - assert.NoError(t, err) - assert.Equal(t, "0xaa9e494f72bc6965857856f0fae6916f27b2a6591c714a573b2fab46df03b8ae", hash.Hex()) - - // Test case 4: successfully hashing a chunk on two blocks each with L1 and L2 txs - templateBlockTrace2, err := os.ReadFile("../testdata/blockTrace_04.json") - assert.NoError(t, err) - wrappedBlock2 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace2, wrappedBlock2)) - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock2, - wrappedBlock2, - }, - } - hash, err = chunk.Hash(0) - assert.NoError(t, err) - assert.Equal(t, "0x2eb7dd63bf8fc29a0f8c10d16c2ae6f9da446907c79d50f5c164d30dc8526b60", hash.Hex()) -} - -func TestErrorPaths(t *testing.T) { - // test 1: Header.Number is not a uint64 - templateBlockTrace, err := os.ReadFile("../testdata/blockTrace_02.json") - assert.NoError(t, err) - - wrappedBlock := &WrappedBlock{} - - assert.NoError(t, json.Unmarshal(templateBlockTrace, wrappedBlock)) - wrappedBlock.Header.Number = wrappedBlock.Header.Number.Lsh(wrappedBlock.Header.Number, 64) - bytes, err := wrappedBlock.Encode(0) - assert.Nil(t, bytes) - assert.Error(t, err) - assert.Contains(t, err.Error(), "block number is not uint64") - - assert.NoError(t, json.Unmarshal(templateBlockTrace, wrappedBlock)) - for i := 0; i < 65537; i++ { - wrappedBlock.Transactions = append(wrappedBlock.Transactions, wrappedBlock.Transactions[0]) - } - - bytes, err = wrappedBlock.Encode(0) - assert.Nil(t, bytes) - assert.Error(t, err) - assert.Contains(t, err.Error(), "number of transactions exceeds max uint16") - - chunk := &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock, - }, - } - - bytes, err = chunk.Encode(0) - assert.Nil(t, bytes) - assert.Error(t, err) - assert.Contains(t, err.Error(), "number of transactions exceeds max uint16") - - wrappedBlock.Transactions = wrappedBlock.Transactions[:1] - wrappedBlock.Transactions[0].Data = "not-a-hex" - bytes, err = chunk.Encode(0) - assert.Nil(t, bytes) - assert.Error(t, err) - assert.Contains(t, err.Error(), "hex string without 0x prefix") - - assert.NoError(t, json.Unmarshal(templateBlockTrace, wrappedBlock)) - wrappedBlock.Transactions[0].TxHash = "not-a-hex" - _, err = chunk.Hash(0) - assert.Error(t, err) - assert.Contains(t, err.Error(), "invalid byte") - - templateBlockTrace2, err := os.ReadFile("../testdata/blockTrace_04.json") - assert.NoError(t, err) - - wrappedBlock2 := &WrappedBlock{} - assert.NoError(t, json.Unmarshal(templateBlockTrace2, wrappedBlock2)) - for i := 0; i < 65535; i++ { - tx := &wrappedBlock2.Transactions[i] - txCopy := *tx - txCopy.Nonce = uint64(i + 1) - wrappedBlock2.Transactions = append(wrappedBlock2.Transactions, txCopy) - } - - bytes, err = wrappedBlock2.Encode(0) - assert.Nil(t, bytes) - assert.Error(t, err) - assert.Contains(t, err.Error(), "number of L1 messages exceeds max uint16") - - chunk = &Chunk{ - Blocks: []*WrappedBlock{ - wrappedBlock2, - }, - } - - bytes, err = chunk.Encode(0) - assert.Nil(t, bytes) - assert.Error(t, err) - assert.Contains(t, err.Error(), "number of L1 messages exceeds max uint16") - -} diff --git a/common/types/encoding/codecv0/codecv0.go b/common/types/encoding/codecv0/codecv0.go new file mode 100644 index 0000000000..03fa903b51 --- /dev/null +++ b/common/types/encoding/codecv0/codecv0.go @@ -0,0 +1,507 @@ +package codecv0 + +import ( + "encoding/binary" + "encoding/hex" + "errors" + "fmt" + "math" + "math/big" + "strings" + + "github.com/scroll-tech/go-ethereum/common" + "github.com/scroll-tech/go-ethereum/core/types" + "github.com/scroll-tech/go-ethereum/crypto" + + "scroll-tech/common/types/encoding" +) + +// CodecV0Version denotes the version of the codec. +const CodecV0Version = 0 + +// DABlock represents a Data Availability Block. +type DABlock struct { + BlockNumber uint64 + Timestamp uint64 + BaseFee *big.Int + GasLimit uint64 + NumTransactions uint16 + NumL1Messages uint16 +} + +// DAChunk groups consecutive DABlocks with their transactions. +type DAChunk struct { + Blocks []*DABlock + Transactions [][]*types.TransactionData +} + +// DABatch contains metadata about a batch of DAChunks. +type DABatch struct { + Version uint8 + BatchIndex uint64 + L1MessagePopped uint64 + TotalL1MessagePopped uint64 + DataHash common.Hash + ParentBatchHash common.Hash + SkippedL1MessageBitmap []byte +} + +// NewDABlock creates a new DABlock from the given encoding.Block and the total number of L1 messages popped before. +func NewDABlock(block *encoding.Block, totalL1MessagePoppedBefore uint64) (*DABlock, error) { + if !block.Header.Number.IsUint64() { + return nil, errors.New("block number is not uint64") + } + + // note: numL1Messages includes skipped messages + numL1Messages := block.NumL1Messages(totalL1MessagePoppedBefore) + if numL1Messages > math.MaxUint16 { + return nil, errors.New("number of L1 messages exceeds max uint16") + } + + // note: numTransactions includes skipped messages + numL2Transactions := block.NumL2Transactions() + numTransactions := numL1Messages + numL2Transactions + if numTransactions > math.MaxUint16 { + return nil, errors.New("number of transactions exceeds max uint16") + } + + daBlock := DABlock{ + BlockNumber: block.Header.Number.Uint64(), + Timestamp: block.Header.Time, + BaseFee: block.Header.BaseFee, + GasLimit: block.Header.GasLimit, + NumTransactions: uint16(numTransactions), + NumL1Messages: uint16(numL1Messages), + } + + return &daBlock, nil +} + +// Encode serializes the DABlock into a slice of bytes. +func (b *DABlock) Encode() []byte { + bytes := make([]byte, 60) + binary.BigEndian.PutUint64(bytes[0:], b.BlockNumber) + binary.BigEndian.PutUint64(bytes[8:], b.Timestamp) + if b.BaseFee != nil { + binary.BigEndian.PutUint64(bytes[40:], b.BaseFee.Uint64()) + } + binary.BigEndian.PutUint64(bytes[48:], b.GasLimit) + binary.BigEndian.PutUint16(bytes[56:], b.NumTransactions) + binary.BigEndian.PutUint16(bytes[58:], b.NumL1Messages) + return bytes +} + +// NewDAChunk creates a new DAChunk from the given encoding.Chunk and the total number of L1 messages popped before. +func NewDAChunk(chunk *encoding.Chunk, totalL1MessagePoppedBefore uint64) (*DAChunk, error) { + var blocks []*DABlock + var txs [][]*types.TransactionData + + if chunk == nil { + return nil, errors.New("chunk is nil") + } + + if len(chunk.Blocks) == 0 { + return nil, errors.New("number of blocks is 0") + } + + if len(chunk.Blocks) > 255 { + return nil, errors.New("number of blocks exceeds 1 byte") + } + + for _, block := range chunk.Blocks { + b, err := NewDABlock(block, totalL1MessagePoppedBefore) + if err != nil { + return nil, err + } + blocks = append(blocks, b) + totalL1MessagePoppedBefore += block.NumL1Messages(totalL1MessagePoppedBefore) + txs = append(txs, block.Transactions) + } + + daChunk := DAChunk{ + Blocks: blocks, + Transactions: txs, + } + + return &daChunk, nil +} + +// Encode serializes the DAChunk into a slice of bytes. +func (c *DAChunk) Encode() ([]byte, error) { + var chunkBytes []byte + chunkBytes = append(chunkBytes, byte(len(c.Blocks))) + + var l2TxDataBytes []byte + + for _, block := range c.Blocks { + chunkBytes = append(chunkBytes, block.Encode()...) + } + + for _, blockTxs := range c.Transactions { + for _, txData := range blockTxs { + if txData.Type == types.L1MessageTxType { + continue + } + var txLen [4]byte + rlpTxData, err := encoding.ConvertTxDataToRLPEncoding(txData) + if err != nil { + return nil, err + } + binary.BigEndian.PutUint32(txLen[:], uint32(len(rlpTxData))) + l2TxDataBytes = append(l2TxDataBytes, txLen[:]...) + l2TxDataBytes = append(l2TxDataBytes, rlpTxData...) + } + } + + chunkBytes = append(chunkBytes, l2TxDataBytes...) + return chunkBytes, nil +} + +// Hash computes the hash of the DAChunk data. +func (c *DAChunk) Hash() (common.Hash, error) { + chunkBytes, err := c.Encode() + if err != nil { + return common.Hash{}, err + } + + if len(chunkBytes) == 0 { + return common.Hash{}, errors.New("chunk data is empty and cannot be processed") + } + numBlocks := chunkBytes[0] + + // concatenate block contexts + var dataBytes []byte + for i := 0; i < int(numBlocks); i++ { + // only the first 58 bytes of each BlockContext are needed for the hashing process + dataBytes = append(dataBytes, chunkBytes[1+60*i:60*i+59]...) + } + + // concatenate l1 and l2 tx hashes + for _, blockTxs := range c.Transactions { + var l1TxHashes []byte + var l2TxHashes []byte + for _, txData := range blockTxs { + txHash := strings.TrimPrefix(txData.TxHash, "0x") + hashBytes, err := hex.DecodeString(txHash) + if err != nil { + return common.Hash{}, fmt.Errorf("failed to decode tx hash from TransactionData: hash=%v, err=%w", txData.TxHash, err) + } + if txData.Type == types.L1MessageTxType { + l1TxHashes = append(l1TxHashes, hashBytes...) + } else { + l2TxHashes = append(l2TxHashes, hashBytes...) + } + } + dataBytes = append(dataBytes, l1TxHashes...) + dataBytes = append(dataBytes, l2TxHashes...) + } + + hash := crypto.Keccak256Hash(dataBytes) + return hash, nil +} + +// NewDABatch creates a DABatch from the provided encoding.Batch. +func NewDABatch(batch *encoding.Batch) (*DABatch, error) { + // storing chunk hashes in order to compute the batch data hash + var dataBytes []byte + + // skipped L1 message bitmap, an array of 256-bit bitmaps + var skippedBitmap []*big.Int + + // the first queue index that belongs to this batch + baseIndex := batch.TotalL1MessagePoppedBefore + + // the next queue index that we need to process + nextIndex := batch.TotalL1MessagePoppedBefore + + for chunkID, chunk := range batch.Chunks { + // build data hash + totalL1MessagePoppedBeforeChunk := nextIndex + daChunk, err := NewDAChunk(chunk, totalL1MessagePoppedBeforeChunk) + if err != nil { + return nil, err + } + daChunkHash, err := daChunk.Hash() + if err != nil { + return nil, err + } + dataBytes = append(dataBytes, daChunkHash.Bytes()...) + + // build skip bitmap + for blockID, block := range chunk.Blocks { + for _, tx := range block.Transactions { + if tx.Type != types.L1MessageTxType { + continue + } + currentIndex := tx.Nonce + + if currentIndex < nextIndex { + return nil, fmt.Errorf("unexpected batch payload, expected queue index: %d, got: %d. Batch index: %d, chunk index in batch: %d, block index in chunk: %d, block hash: %v, transaction hash: %v", nextIndex, currentIndex, batch.Index, chunkID, blockID, block.Header.Hash(), tx.TxHash) + } + + // mark skipped messages + for skippedIndex := nextIndex; skippedIndex < currentIndex; skippedIndex++ { + quo := int((skippedIndex - baseIndex) / 256) + rem := int((skippedIndex - baseIndex) % 256) + for len(skippedBitmap) <= quo { + bitmap := big.NewInt(0) + skippedBitmap = append(skippedBitmap, bitmap) + } + skippedBitmap[quo].SetBit(skippedBitmap[quo], rem, 1) + } + + // process included message + quo := int((currentIndex - baseIndex) / 256) + for len(skippedBitmap) <= quo { + bitmap := big.NewInt(0) + skippedBitmap = append(skippedBitmap, bitmap) + } + + nextIndex = currentIndex + 1 + } + } + } + + // compute data hash + dataHash := crypto.Keccak256Hash(dataBytes) + + // compute skipped bitmap + bitmapBytes := make([]byte, len(skippedBitmap)*32) + for ii, num := range skippedBitmap { + bytes := num.Bytes() + padding := 32 - len(bytes) + copy(bitmapBytes[32*ii+padding:], bytes) + } + + daBatch := DABatch{ + Version: CodecV0Version, + BatchIndex: batch.Index, + L1MessagePopped: nextIndex - baseIndex, + TotalL1MessagePopped: nextIndex, + DataHash: dataHash, + ParentBatchHash: batch.ParentBatchHash, + SkippedL1MessageBitmap: bitmapBytes, + } + + return &daBatch, nil +} + +// NewDABatchFromBytes attempts to decode the given byte slice into a DABatch. +func NewDABatchFromBytes(data []byte) (*DABatch, error) { + if len(data) < 89 { + return nil, fmt.Errorf("insufficient data for DABatch, expected at least 89 bytes but got %d", len(data)) + } + + b := &DABatch{ + Version: data[0], + BatchIndex: binary.BigEndian.Uint64(data[1:9]), + L1MessagePopped: binary.BigEndian.Uint64(data[9:17]), + TotalL1MessagePopped: binary.BigEndian.Uint64(data[17:25]), + DataHash: common.BytesToHash(data[25:57]), + ParentBatchHash: common.BytesToHash(data[57:89]), + SkippedL1MessageBitmap: data[89:], + } + + return b, nil +} + +// Encode serializes the DABatch into bytes. +func (b *DABatch) Encode() []byte { + batchBytes := make([]byte, 89+len(b.SkippedL1MessageBitmap)) + batchBytes[0] = b.Version + binary.BigEndian.PutUint64(batchBytes[1:], b.BatchIndex) + binary.BigEndian.PutUint64(batchBytes[9:], b.L1MessagePopped) + binary.BigEndian.PutUint64(batchBytes[17:], b.TotalL1MessagePopped) + copy(batchBytes[25:], b.DataHash[:]) + copy(batchBytes[57:], b.ParentBatchHash[:]) + copy(batchBytes[89:], b.SkippedL1MessageBitmap[:]) + return batchBytes +} + +// Hash computes the hash of the serialized DABatch. +func (b *DABatch) Hash() common.Hash { + bytes := b.Encode() + return crypto.Keccak256Hash(bytes) +} + +// DecodeFromCalldata attempts to decode a DABatch and an array of DAChunks from the provided calldata byte slice. +func DecodeFromCalldata(data []byte) (*DABatch, []*DAChunk, error) { + // TODO: implement this function. + return nil, nil, nil +} + +// CalldataNonZeroByteGas is the gas consumption per non zero byte in calldata. +const CalldataNonZeroByteGas = 16 + +// GetKeccak256Gas calculates the gas cost for computing the keccak256 hash of a given size. +func GetKeccak256Gas(size uint64) uint64 { + return GetMemoryExpansionCost(size) + 30 + 6*((size+31)/32) +} + +// GetMemoryExpansionCost calculates the cost of memory expansion for a given memoryByteSize. +func GetMemoryExpansionCost(memoryByteSize uint64) uint64 { + memorySizeWord := (memoryByteSize + 31) / 32 + memoryCost := (memorySizeWord*memorySizeWord)/512 + (3 * memorySizeWord) + return memoryCost +} + +// EstimateBlockL1CommitCalldataSize calculates the calldata size in l1 commit for this block approximately. +// TODO: The calculation could be more accurate by using 58 + len(l2TxDataBytes) (see Chunk). +// This needs to be adjusted in the future. +func EstimateBlockL1CommitCalldataSize(b *encoding.Block) (uint64, error) { + var size uint64 + for _, txData := range b.Transactions { + if txData.Type == types.L1MessageTxType { + continue + } + size += 4 // 4 bytes payload length + txPayloadLength, err := getTxPayloadLength(txData) + if err != nil { + return 0, err + } + size += txPayloadLength + } + size += 60 // 60 bytes BlockContext + return size, nil +} + +// EstimateBlockL1CommitGas calculates the total L1 commit gas for this block approximately. +func EstimateBlockL1CommitGas(b *encoding.Block) (uint64, error) { + var total uint64 + var numL1Messages uint64 + for _, txData := range b.Transactions { + if txData.Type == types.L1MessageTxType { + numL1Messages++ + continue + } + + txPayloadLength, err := getTxPayloadLength(txData) + if err != nil { + return 0, err + } + total += CalldataNonZeroByteGas * txPayloadLength // an over-estimate: treat each byte as non-zero + total += CalldataNonZeroByteGas * 4 // 4 bytes payload length + total += GetKeccak256Gas(txPayloadLength) // l2 tx hash + } + + // 60 bytes BlockContext calldata + total += CalldataNonZeroByteGas * 60 + + // sload + total += 2100 * numL1Messages // numL1Messages times cold sload in L1MessageQueue + + // staticcall + total += 100 * numL1Messages // numL1Messages times call to L1MessageQueue + total += 100 * numL1Messages // numL1Messages times warm address access to L1MessageQueue + + total += GetMemoryExpansionCost(36) * numL1Messages // staticcall to proxy + total += 100 * numL1Messages // read admin in proxy + total += 100 * numL1Messages // read impl in proxy + total += 100 * numL1Messages // access impl + total += GetMemoryExpansionCost(36) * numL1Messages // delegatecall to impl + + return total, nil +} + +// EstimateChunkL1CommitCalldataSize calculates the calldata size needed for committing a chunk to L1 approximately. +func EstimateChunkL1CommitCalldataSize(c *encoding.Chunk) (uint64, error) { + var totalL1CommitCalldataSize uint64 + for _, block := range c.Blocks { + blockL1CommitCalldataSize, err := EstimateBlockL1CommitCalldataSize(block) + if err != nil { + return 0, err + } + totalL1CommitCalldataSize += blockL1CommitCalldataSize + } + return totalL1CommitCalldataSize, nil +} + +// EstimateChunkL1CommitGas calculates the total L1 commit gas for this chunk approximately. +func EstimateChunkL1CommitGas(c *encoding.Chunk) (uint64, error) { + var totalTxNum uint64 + var totalL1CommitGas uint64 + for _, block := range c.Blocks { + totalTxNum += uint64(len(block.Transactions)) + blockL1CommitGas, err := EstimateBlockL1CommitGas(block) + if err != nil { + return 0, err + } + totalL1CommitGas += blockL1CommitGas + } + + numBlocks := uint64(len(c.Blocks)) + totalL1CommitGas += 100 * numBlocks // numBlocks times warm sload + totalL1CommitGas += CalldataNonZeroByteGas // numBlocks field of chunk encoding in calldata + totalL1CommitGas += CalldataNonZeroByteGas * numBlocks * 60 // numBlocks of BlockContext in chunk + + totalL1CommitGas += GetKeccak256Gas(58*numBlocks + 32*totalTxNum) // chunk hash + return totalL1CommitGas, nil +} + +// EstimateBatchL1CommitGas calculates the total L1 commit gas for this batch approximately. +func EstimateBatchL1CommitGas(b *encoding.Batch) (uint64, error) { + var totalL1CommitGas uint64 + + // Add extra gas costs + totalL1CommitGas += 100000 // constant to account for ops like _getAdmin, _implementation, _requireNotPaused, etc + totalL1CommitGas += 4 * 2100 // 4 one-time cold sload for commitBatch + totalL1CommitGas += 20000 // 1 time sstore + totalL1CommitGas += 21000 // base fee for tx + totalL1CommitGas += CalldataNonZeroByteGas // version in calldata + + // adjusting gas: + // add 1 time cold sload (2100 gas) for L1MessageQueue + // add 1 time cold address access (2600 gas) for L1MessageQueue + // minus 1 time warm sload (100 gas) & 1 time warm address access (100 gas) + totalL1CommitGas += (2100 + 2600 - 100 - 100) + totalL1CommitGas += GetKeccak256Gas(89 + 32) // parent batch header hash, length is estimated as 89 (constant part)+ 32 (1 skippedL1MessageBitmap) + totalL1CommitGas += CalldataNonZeroByteGas * (89 + 32) // parent batch header in calldata + + // adjust batch data hash gas cost + totalL1CommitGas += GetKeccak256Gas(uint64(32 * len(b.Chunks))) + + totalL1MessagePoppedBefore := b.TotalL1MessagePoppedBefore + + for _, chunk := range b.Chunks { + chunkL1CommitGas, err := EstimateChunkL1CommitGas(chunk) + if err != nil { + return 0, err + } + totalL1CommitGas += chunkL1CommitGas + + totalL1MessagePoppedInChunk := chunk.NumL1Messages(totalL1MessagePoppedBefore) + totalL1MessagePoppedBefore += totalL1MessagePoppedInChunk + + totalL1CommitGas += CalldataNonZeroByteGas * (32 * (totalL1MessagePoppedInChunk + 255) / 256) + totalL1CommitGas += GetKeccak256Gas(89 + 32*(totalL1MessagePoppedInChunk+255)/256) + + totalL1CommitCalldataSize, err := EstimateChunkL1CommitCalldataSize(chunk) + if err != nil { + return 0, err + } + totalL1CommitGas += GetMemoryExpansionCost(totalL1CommitCalldataSize) + } + + return totalL1CommitGas, nil +} + +// EstimateBatchL1CommitCalldataSize calculates the calldata size in l1 commit for this batch approximately. +func EstimateBatchL1CommitCalldataSize(c *encoding.Batch) (uint64, error) { + var totalL1CommitCalldataSize uint64 + for _, chunk := range c.Chunks { + chunkL1CommitCalldataSize, err := EstimateChunkL1CommitCalldataSize(chunk) + if err != nil { + return 0, err + } + totalL1CommitCalldataSize += chunkL1CommitCalldataSize + } + return totalL1CommitCalldataSize, nil +} + +func getTxPayloadLength(txData *types.TransactionData) (uint64, error) { + rlpTxData, err := encoding.ConvertTxDataToRLPEncoding(txData) + if err != nil { + return 0, err + } + return uint64(len(rlpTxData)), nil +} diff --git a/common/types/encoding/codecv0/codecv0_test.go b/common/types/encoding/codecv0/codecv0_test.go new file mode 100644 index 0000000000..03e6eb23f7 --- /dev/null +++ b/common/types/encoding/codecv0/codecv0_test.go @@ -0,0 +1,634 @@ +package codecv0 + +import ( + "encoding/hex" + "encoding/json" + "math/big" + "os" + "testing" + + "github.com/scroll-tech/go-ethereum/common" + "github.com/scroll-tech/go-ethereum/log" + "github.com/stretchr/testify/assert" + + "scroll-tech/common/types/encoding" +) + +func TestCodecV0(t *testing.T) { + glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.LogfmtFormat())) + glogger.Verbosity(log.LvlInfo) + log.Root().SetHandler(glogger) + + parentDABatch, err := NewDABatch(&encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: nil, + }) + assert.NoError(t, err) + parentBatchHash := parentDABatch.Hash() + + block1 := readBlockFromJSON(t, "../../../testdata/blockTrace_02.json") + block2 := readBlockFromJSON(t, "../../../testdata/blockTrace_03.json") + block3 := readBlockFromJSON(t, "../../../testdata/blockTrace_04.json") + block4 := readBlockFromJSON(t, "../../../testdata/blockTrace_05.json") + block5 := readBlockFromJSON(t, "../../../testdata/blockTrace_06.json") + block6 := readBlockFromJSON(t, "../../../testdata/blockTrace_07.json") + + blockL1CommitCalldataSize, err := EstimateBlockL1CommitCalldataSize(block1) + assert.NoError(t, err) + assert.Equal(t, uint64(298), blockL1CommitCalldataSize) + blockL1CommitGas, err := EstimateBlockL1CommitGas(block1) + assert.NoError(t, err) + assert.Equal(t, uint64(4900), blockL1CommitGas) + blockL1CommitCalldataSize, err = EstimateBlockL1CommitCalldataSize(block2) + assert.NoError(t, err) + assert.Equal(t, uint64(5745), blockL1CommitCalldataSize) + blockL1CommitGas, err = EstimateBlockL1CommitGas(block2) + assert.NoError(t, err) + assert.Equal(t, uint64(93613), blockL1CommitGas) + blockL1CommitCalldataSize, err = EstimateBlockL1CommitCalldataSize(block3) + assert.NoError(t, err) + assert.Equal(t, uint64(96), blockL1CommitCalldataSize) + blockL1CommitGas, err = EstimateBlockL1CommitGas(block3) + assert.NoError(t, err) + assert.Equal(t, uint64(4187), blockL1CommitGas) + blockL1CommitCalldataSize, err = EstimateBlockL1CommitCalldataSize(block4) + assert.NoError(t, err) + assert.Equal(t, uint64(60), blockL1CommitCalldataSize) + blockL1CommitGas, err = EstimateBlockL1CommitGas(block4) + assert.NoError(t, err) + assert.Equal(t, uint64(14020), blockL1CommitGas) + blockL1CommitCalldataSize, err = EstimateBlockL1CommitCalldataSize(block5) + assert.NoError(t, err) + assert.Equal(t, uint64(60), blockL1CommitCalldataSize) + blockL1CommitGas, err = EstimateBlockL1CommitGas(block5) + assert.NoError(t, err) + assert.Equal(t, uint64(8796), blockL1CommitGas) + blockL1CommitCalldataSize, err = EstimateBlockL1CommitCalldataSize(block6) + assert.NoError(t, err) + assert.Equal(t, uint64(60), blockL1CommitCalldataSize) + blockL1CommitGas, err = EstimateBlockL1CommitGas(block6) + assert.NoError(t, err) + assert.Equal(t, uint64(6184), blockL1CommitGas) + + // Test case: when the batch and chunk contains one block. + chunk := &encoding.Chunk{ + Blocks: []*encoding.Block{block1}, + } + chunkL1CommitCalldataSize, err := EstimateChunkL1CommitCalldataSize(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(298), chunkL1CommitCalldataSize) + chunkL1CommitGas, err := EstimateChunkL1CommitGas(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(6042), chunkL1CommitGas) + + daChunk, err := NewDAChunk(chunk, 0) + assert.NoError(t, err) + chunkBytes, err := daChunk.Encode() + assert.NoError(t, err) + chunkHexString := hex.EncodeToString(chunkBytes) + assert.Equal(t, 299, len(chunkBytes)) + assert.Equal(t, "0100000000000000020000000063807b2a0000000000000000000000000000000000000000000000000000000000001de9000355418d1e81840002000000000073f87180843b9aec2e8307a12094c0c4c8baea3f6acb49b6e1fb9e2adeceeacb0ca28a152d02c7e14af60000008083019ecea0ab07ae99c67aa78e7ba5cf6781e90cc32b219b1de102513d56548a41e86df514a034cbd19feacd73e8ce64d00c4d1996b9b5243c578fd7f51bfaec288bbaf42a8b00000073f87101843b9aec2e8307a1209401bae6bf68e9a03fb2bc0615b1bf0d69ce9411ed8a152d02c7e14af60000008083019ecea0f039985866d8256f10c1be4f7b2cace28d8f20bde27e2604393eb095b7f77316a05a3e6e81065f2b4604bcec5bd4aba684835996fc3f879380aac1c09c6eed32f1", chunkHexString) + daChunkHash, err := daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, common.HexToHash("0xde642c68122634b33fa1e6e4243b17be3bfd0dc6f996f204ef6d7522516bd840"), daChunkHash) + + batch := &encoding.Batch{ + Index: 1, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: parentBatchHash, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + EndChunkIndex: 0, + StartChunkHash: daChunkHash, + EndChunkHash: daChunkHash, + } + + batchL1CommitCalldataSize, err := EstimateBatchL1CommitCalldataSize(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(298), batchL1CommitCalldataSize) + batchL1CommitGas, err := EstimateBatchL1CommitGas(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(162591), batchL1CommitGas) + + daBatch, err := NewDABatch(batch) + assert.NoError(t, err) + batchBytes := daBatch.Encode() + batchHexString := hex.EncodeToString(batchBytes) + assert.Equal(t, 89, len(batchBytes)) + assert.Equal(t, "000000000000000001000000000000000000000000000000008fbc5eecfefc5bd9d1618ecef1fed160a7838448383595a2257d4c9bd5c5fa3eb0a62a3048a2e6efb4e56e471eb826de86f8ccaa4af27c572b68db6f687b3ab0", batchHexString) + assert.Equal(t, 0, len(daBatch.SkippedL1MessageBitmap)) + assert.Equal(t, uint64(0), daBatch.TotalL1MessagePopped) + assert.Equal(t, uint64(0), daBatch.L1MessagePopped) + assert.Equal(t, common.HexToHash("0xa906c7d2b6b68ea5fec3ff9d60d41858676e0d365e5d5ef07b2ce20fcf24ecd7"), daBatch.Hash()) + + decodedDABatch, err := NewDABatchFromBytes(batchBytes) + assert.NoError(t, err) + decodedBatchBytes := decodedDABatch.Encode() + decodedBatchHexString := hex.EncodeToString(decodedBatchBytes) + assert.Equal(t, batchHexString, decodedBatchHexString) + + // Test case: when the batch and chunk contains two block. + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block1, block2}, + } + chunkL1CommitCalldataSize, err = EstimateChunkL1CommitCalldataSize(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(6043), chunkL1CommitCalldataSize) + chunkL1CommitGas, err = EstimateChunkL1CommitGas(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(100742), chunkL1CommitGas) + + daChunk, err = NewDAChunk(chunk, 0) + assert.NoError(t, err) + chunkBytes, err = daChunk.Encode() + assert.NoError(t, err) + assert.Equal(t, 6044, len(chunkBytes)) + daChunkHash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, common.HexToHash("0x014916a83eccdb0d01e814b4d4ab90eb9049ba9a3cb0994919b86ad873bcd028"), daChunkHash) + + batch = &encoding.Batch{ + Index: 1, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: parentBatchHash, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + EndChunkIndex: 0, + StartChunkHash: daChunkHash, + EndChunkHash: daChunkHash, + } + + batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(6043), batchL1CommitCalldataSize) + batchL1CommitGas, err = EstimateBatchL1CommitGas(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(257897), batchL1CommitGas) + + daBatch, err = NewDABatch(batch) + assert.NoError(t, err) + batchBytes = daBatch.Encode() + batchHexString = hex.EncodeToString(batchBytes) + assert.Equal(t, 89, len(batchBytes)) + assert.Equal(t, "0000000000000000010000000000000000000000000000000074dd561a36921590926bee01fd0d53747c5f3e48e48a2d5538b9ab0e1511cfd7b0a62a3048a2e6efb4e56e471eb826de86f8ccaa4af27c572b68db6f687b3ab0", batchHexString) + assert.Equal(t, 0, len(daBatch.SkippedL1MessageBitmap)) + assert.Equal(t, uint64(0), daBatch.TotalL1MessagePopped) + assert.Equal(t, uint64(0), daBatch.L1MessagePopped) + assert.Equal(t, common.HexToHash("0xb02e39b740756824d20b2cac322ac365121411ced9d6e34de98a0b247c6e23e6"), daBatch.Hash()) + + decodedDABatch, err = NewDABatchFromBytes(batchBytes) + assert.NoError(t, err) + decodedBatchBytes = decodedDABatch.Encode() + decodedBatchHexString = hex.EncodeToString(decodedBatchBytes) + assert.Equal(t, batchHexString, decodedBatchHexString) + + // Test case: when the chunk contains one block with 1 L1MsgTx. + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block3}, + } + chunkL1CommitCalldataSize, err = EstimateChunkL1CommitCalldataSize(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(96), chunkL1CommitCalldataSize) + chunkL1CommitGas, err = EstimateChunkL1CommitGas(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(5329), chunkL1CommitGas) + + daChunk, err = NewDAChunk(chunk, 0) + assert.NoError(t, err) + chunkBytes, err = daChunk.Encode() + assert.NoError(t, err) + chunkHexString = hex.EncodeToString(chunkBytes) + assert.Equal(t, 97, len(chunkBytes)) + assert.Equal(t, "01000000000000000d00000000646b6e13000000000000000000000000000000000000000000000000000000000000000000000000007a1200000c000b00000020df0b80825dc0941a258d17bf244c4df02d40343a7626a9d321e1058080808080", chunkHexString) + daChunkHash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, common.HexToHash("0x9e643c8a9203df542e39d9bfdcb07c99575b3c3d557791329fef9d83cc4147d0"), daChunkHash) + + batch = &encoding.Batch{ + Index: 1, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: parentBatchHash, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + EndChunkIndex: 0, + StartChunkHash: daChunkHash, + EndChunkHash: daChunkHash, + } + + batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(96), batchL1CommitCalldataSize) + batchL1CommitGas, err = EstimateBatchL1CommitGas(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(161889), batchL1CommitGas) + + daBatch, err = NewDABatch(batch) + assert.NoError(t, err) + batchBytes = daBatch.Encode() + batchHexString = hex.EncodeToString(batchBytes) + assert.Equal(t, 121, len(batchBytes)) + assert.Equal(t, "000000000000000001000000000000000b000000000000000b34f419ce7e882295bdb5aec6cce56ffa788a5fed4744d7fbd77e4acbf409f1cab0a62a3048a2e6efb4e56e471eb826de86f8ccaa4af27c572b68db6f687b3ab000000000000000000000000000000000000000000000000000000000000003ff", batchHexString) + assert.Equal(t, 32, len(daBatch.SkippedL1MessageBitmap)) + expectedBitmap := "00000000000000000000000000000000000000000000000000000000000003ff" + assert.Equal(t, expectedBitmap, common.Bytes2Hex(daBatch.SkippedL1MessageBitmap)) + assert.Equal(t, uint64(11), daBatch.TotalL1MessagePopped) + assert.Equal(t, uint64(11), daBatch.L1MessagePopped) + assert.Equal(t, common.HexToHash("0xa18f07cb56ab4f2db5914d9b5699c5932bea4b5c73e71c8cec79151c11e9e986"), daBatch.Hash()) + + decodedDABatch, err = NewDABatchFromBytes(batchBytes) + assert.NoError(t, err) + decodedBatchBytes = decodedDABatch.Encode() + decodedBatchHexString = hex.EncodeToString(decodedBatchBytes) + assert.Equal(t, batchHexString, decodedBatchHexString) + + // Test case: batch contains multiple chunks, chunk contains multiple blocks. + chunk1 := &encoding.Chunk{ + Blocks: []*encoding.Block{block1, block2, block3}, + } + chunk1L1CommitCalldataSize, err := EstimateChunkL1CommitCalldataSize(chunk1) + assert.NoError(t, err) + assert.Equal(t, uint64(6139), chunk1L1CommitCalldataSize) + chunk1L1CommitGas, err := EstimateChunkL1CommitGas(chunk1) + assert.NoError(t, err) + assert.Equal(t, uint64(106025), chunk1L1CommitGas) + + daChunk1, err := NewDAChunk(chunk1, 0) + assert.NoError(t, err) + chunkBytes1, err := daChunk1.Encode() + assert.NoError(t, err) + assert.Equal(t, 6140, len(chunkBytes1)) + + chunk2 := &encoding.Chunk{ + Blocks: []*encoding.Block{block4}, + } + chunk2L1CommitCalldataSize, err := EstimateChunkL1CommitCalldataSize(chunk2) + assert.NoError(t, err) + assert.Equal(t, uint64(60), chunk2L1CommitCalldataSize) + chunk2L1CommitGas, err := EstimateChunkL1CommitGas(chunk2) + assert.NoError(t, err) + assert.Equal(t, uint64(15189), chunk2L1CommitGas) + + daChunk2, err := NewDAChunk(chunk2, 0) + assert.NoError(t, err) + chunkBytes2, err := daChunk2.Encode() + assert.NoError(t, err) + assert.Equal(t, 61, len(chunkBytes2)) + + daChunk1Hash, err := daChunk1.Hash() + assert.NoError(t, err) + daChunk2Hash, err := daChunk2.Hash() + assert.NoError(t, err) + + batch = &encoding.Batch{ + Index: 1, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: parentBatchHash, + Chunks: []*encoding.Chunk{chunk1, chunk2}, + StartChunkIndex: 0, + EndChunkIndex: 1, + StartChunkHash: daChunk1Hash, + EndChunkHash: daChunk2Hash, + } + + batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(6199), batchL1CommitCalldataSize) + batchL1CommitGas, err = EstimateBatchL1CommitGas(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(279054), batchL1CommitGas) + + daBatch, err = NewDABatch(batch) + assert.NoError(t, err) + batchBytes = daBatch.Encode() + batchHexString = hex.EncodeToString(batchBytes) + assert.Equal(t, 121, len(batchBytes)) + assert.Equal(t, "000000000000000001000000000000002a000000000000002a1f9b3d942a6ee14e7afc52225c91fa44faa0a7ec511df9a2d9348d33bcd142fcb0a62a3048a2e6efb4e56e471eb826de86f8ccaa4af27c572b68db6f687b3ab00000000000000000000000000000000000000000000000000000001ffffffbff", batchHexString) + assert.Equal(t, 32, len(daBatch.SkippedL1MessageBitmap)) + expectedBitmap = "0000000000000000000000000000000000000000000000000000001ffffffbff" + assert.Equal(t, expectedBitmap, common.Bytes2Hex(daBatch.SkippedL1MessageBitmap)) + assert.Equal(t, uint64(42), daBatch.TotalL1MessagePopped) + assert.Equal(t, uint64(42), daBatch.L1MessagePopped) + assert.Equal(t, common.HexToHash("0xf7bd6afe02764e4e6df23a374d753182b57fa77be71aaf1cd8365e15a51872d1"), daBatch.Hash()) + + decodedDABatch, err = NewDABatchFromBytes(batchBytes) + assert.NoError(t, err) + decodedBatchBytes = decodedDABatch.Encode() + decodedBatchHexString = hex.EncodeToString(decodedBatchBytes) + assert.Equal(t, batchHexString, decodedBatchHexString) + + // Test case: many consecutive L1 Msgs in 1 bitmap, no leading skipped msgs. + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block4}, + } + chunkL1CommitCalldataSize, err = EstimateChunkL1CommitCalldataSize(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(60), chunkL1CommitCalldataSize) + chunkL1CommitGas, err = EstimateChunkL1CommitGas(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(15189), chunkL1CommitGas) + + daChunk, err = NewDAChunk(chunk, 0) + assert.NoError(t, err) + chunkBytes, err = daChunk.Encode() + assert.NoError(t, err) + assert.Equal(t, 61, len(chunkBytes)) + daChunkHash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, common.HexToHash("0x854fc3136f47ce482ec85ee3325adfa16a1a1d60126e1c119eaaf0c3a9e90f8e"), daChunkHash) + + batch = &encoding.Batch{ + Index: 1, + TotalL1MessagePoppedBefore: 37, + ParentBatchHash: parentBatchHash, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + EndChunkIndex: 0, + StartChunkHash: daChunkHash, + EndChunkHash: daChunkHash, + } + + batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(60), batchL1CommitCalldataSize) + batchL1CommitGas, err = EstimateBatchL1CommitGas(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(171730), batchL1CommitGas) + + daBatch, err = NewDABatch(batch) + assert.NoError(t, err) + batchBytes = daBatch.Encode() + batchHexString = hex.EncodeToString(batchBytes) + assert.Equal(t, 121, len(batchBytes)) + assert.Equal(t, "0000000000000000010000000000000005000000000000002ac62fb58ec2d5393e00960f1cc23cab883b685296efa03d13ea2dd4c6de79cc55b0a62a3048a2e6efb4e56e471eb826de86f8ccaa4af27c572b68db6f687b3ab00000000000000000000000000000000000000000000000000000000000000000", batchHexString) + assert.Equal(t, 32, len(daBatch.SkippedL1MessageBitmap)) + expectedBitmap = "0000000000000000000000000000000000000000000000000000000000000000" + assert.Equal(t, expectedBitmap, common.Bytes2Hex(daBatch.SkippedL1MessageBitmap)) + assert.Equal(t, uint64(42), daBatch.TotalL1MessagePopped) + assert.Equal(t, uint64(5), daBatch.L1MessagePopped) + assert.Equal(t, common.HexToHash("0x841f4657b7eb723cae35377cf2963b51191edad6a3b182d4c8524cb928d2a413"), daBatch.Hash()) + + decodedDABatch, err = NewDABatchFromBytes(batchBytes) + assert.NoError(t, err) + decodedBatchBytes = decodedDABatch.Encode() + decodedBatchHexString = hex.EncodeToString(decodedBatchBytes) + assert.Equal(t, batchHexString, decodedBatchHexString) + + // Test case: many consecutive L1 Msgs in 1 bitmap, with leading skipped msgs. + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block4}, + } + chunkL1CommitCalldataSize, err = EstimateChunkL1CommitCalldataSize(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(60), chunkL1CommitCalldataSize) + chunkL1CommitGas, err = EstimateChunkL1CommitGas(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(15189), chunkL1CommitGas) + + daChunk, err = NewDAChunk(chunk, 0) + assert.NoError(t, err) + chunkBytes, err = daChunk.Encode() + assert.NoError(t, err) + assert.Equal(t, 61, len(chunkBytes)) + daChunkHash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, common.HexToHash("0x854fc3136f47ce482ec85ee3325adfa16a1a1d60126e1c119eaaf0c3a9e90f8e"), daChunkHash) + + batch = &encoding.Batch{ + Index: 1, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: parentBatchHash, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + EndChunkIndex: 0, + StartChunkHash: daChunkHash, + EndChunkHash: daChunkHash, + } + + batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(60), batchL1CommitCalldataSize) + batchL1CommitGas, err = EstimateBatchL1CommitGas(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(171810), batchL1CommitGas) + + daBatch, err = NewDABatch(batch) + assert.NoError(t, err) + batchBytes = daBatch.Encode() + batchHexString = hex.EncodeToString(batchBytes) + assert.Equal(t, 121, len(batchBytes)) + assert.Equal(t, "000000000000000001000000000000002a000000000000002a93255aa24dd468c5645f1e6901b8131a7a78a0eeb2a17cbb09ba64688a8de6b4b0a62a3048a2e6efb4e56e471eb826de86f8ccaa4af27c572b68db6f687b3ab00000000000000000000000000000000000000000000000000000001fffffffff", batchHexString) + assert.Equal(t, 32, len(daBatch.SkippedL1MessageBitmap)) + expectedBitmap = "0000000000000000000000000000000000000000000000000000001fffffffff" + assert.Equal(t, expectedBitmap, common.Bytes2Hex(daBatch.SkippedL1MessageBitmap)) + assert.Equal(t, uint64(42), daBatch.TotalL1MessagePopped) + assert.Equal(t, uint64(42), daBatch.L1MessagePopped) + assert.Equal(t, common.HexToHash("0xa28766a3617cf244cc397fc4ce4c23022ec80f152b9f618807ac7e7c11486612"), daBatch.Hash()) + + decodedDABatch, err = NewDABatchFromBytes(batchBytes) + assert.NoError(t, err) + decodedBatchBytes = decodedDABatch.Encode() + decodedBatchHexString = hex.EncodeToString(decodedBatchBytes) + assert.Equal(t, batchHexString, decodedBatchHexString) + + // Test case: many sparse L1 Msgs in 1 bitmap. + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block5}, + } + chunkL1CommitCalldataSize, err = EstimateChunkL1CommitCalldataSize(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(60), chunkL1CommitCalldataSize) + chunkL1CommitGas, err = EstimateChunkL1CommitGas(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(9947), chunkL1CommitGas) + + daChunk, err = NewDAChunk(chunk, 0) + assert.NoError(t, err) + chunkBytes, err = daChunk.Encode() + assert.NoError(t, err) + assert.Equal(t, 61, len(chunkBytes)) + daChunkHash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, common.HexToHash("0x2aa220ca7bd1368e59e8053eb3831e30854aa2ec8bd3af65cee350c1c0718ba6"), daChunkHash) + + batch = &encoding.Batch{ + Index: 1, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: parentBatchHash, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + EndChunkIndex: 0, + StartChunkHash: daChunkHash, + EndChunkHash: daChunkHash, + } + + batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(60), batchL1CommitCalldataSize) + batchL1CommitGas, err = EstimateBatchL1CommitGas(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(166504), batchL1CommitGas) + + daBatch, err = NewDABatch(batch) + assert.NoError(t, err) + batchBytes = daBatch.Encode() + batchHexString = hex.EncodeToString(batchBytes) + assert.Equal(t, 121, len(batchBytes)) + assert.Equal(t, "000000000000000001000000000000000a000000000000000ac7bcc8da943dd83404e84d9ce7e894ab97ce4829df4eb51ebbbe13c90b5a3f4db0a62a3048a2e6efb4e56e471eb826de86f8ccaa4af27c572b68db6f687b3ab000000000000000000000000000000000000000000000000000000000000001dd", batchHexString) + assert.Equal(t, 32, len(daBatch.SkippedL1MessageBitmap)) + expectedBitmap = "00000000000000000000000000000000000000000000000000000000000001dd" + assert.Equal(t, expectedBitmap, common.Bytes2Hex(daBatch.SkippedL1MessageBitmap)) + assert.Equal(t, uint64(10), daBatch.TotalL1MessagePopped) + assert.Equal(t, uint64(10), daBatch.L1MessagePopped) + assert.Equal(t, common.HexToHash("0x2fee2073639eb9795007f7e765b3318f92658822de40b2134d34a478a0e9058a"), daBatch.Hash()) + + decodedDABatch, err = NewDABatchFromBytes(batchBytes) + assert.NoError(t, err) + decodedBatchBytes = decodedDABatch.Encode() + decodedBatchHexString = hex.EncodeToString(decodedBatchBytes) + assert.Equal(t, batchHexString, decodedBatchHexString) + + // Test case: many L1 Msgs in each of 2 bitmaps. + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block6}, + } + chunkL1CommitCalldataSize, err = EstimateChunkL1CommitCalldataSize(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(60), chunkL1CommitCalldataSize) + chunkL1CommitGas, err = EstimateChunkL1CommitGas(chunk) + assert.NoError(t, err) + assert.Equal(t, uint64(7326), chunkL1CommitGas) + + daChunk, err = NewDAChunk(chunk, 0) + assert.NoError(t, err) + chunkBytes, err = daChunk.Encode() + assert.NoError(t, err) + assert.Equal(t, 61, len(chunkBytes)) + daChunkHash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, common.HexToHash("0xb65521bea7daff75838de07951c3c055966750fb5a270fead5e0e727c32455c3"), daChunkHash) + + batch = &encoding.Batch{ + Index: 1, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: parentBatchHash, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + EndChunkIndex: 0, + StartChunkHash: daChunkHash, + EndChunkHash: daChunkHash, + } + + batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(60), batchL1CommitCalldataSize) + batchL1CommitGas, err = EstimateBatchL1CommitGas(batch) + assert.NoError(t, err) + assert.Equal(t, uint64(164388), batchL1CommitGas) + + daBatch, err = NewDABatch(batch) + assert.NoError(t, err) + batchBytes = daBatch.Encode() + batchHexString = hex.EncodeToString(batchBytes) + assert.Equal(t, 153, len(batchBytes)) + assert.Equal(t, "00000000000000000100000000000001010000000000000101899a411a3309c6491701b7b955c7b1115ac015414bbb71b59a0ca561668d5208b0a62a3048a2e6efb4e56e471eb826de86f8ccaa4af27c572b68db6f687b3ab0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd0000000000000000000000000000000000000000000000000000000000000000", batchHexString) + assert.Equal(t, 64, len(daBatch.SkippedL1MessageBitmap)) + expectedBitmap = "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd0000000000000000000000000000000000000000000000000000000000000000" + assert.Equal(t, expectedBitmap, common.Bytes2Hex(daBatch.SkippedL1MessageBitmap)) + assert.Equal(t, uint64(257), daBatch.TotalL1MessagePopped) + assert.Equal(t, uint64(257), daBatch.L1MessagePopped) + assert.Equal(t, common.HexToHash("0x84206bc6d0076a233fc7120a0bec4e03bf2512207437768828384dddb335ba2e"), daBatch.Hash()) + + decodedDABatch, err = NewDABatchFromBytes(batchBytes) + assert.NoError(t, err) + decodedBatchBytes = decodedDABatch.Encode() + decodedBatchHexString = hex.EncodeToString(decodedBatchBytes) + assert.Equal(t, batchHexString, decodedBatchHexString) +} + +func TestErrorPaths(t *testing.T) { + // Test case: when the chunk is nil. + _, err := NewDAChunk(nil, 100) + assert.Error(t, err) + assert.Contains(t, err.Error(), "chunk is nil") + + // Test case: when the chunk contains no blocks. + chunk := &encoding.Chunk{ + Blocks: []*encoding.Block{}, + } + _, err = NewDAChunk(chunk, 0) + assert.Error(t, err) + assert.Contains(t, err.Error(), "number of blocks is 0") + + // Test case: when the chunk contains more than 255 blocks. + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{}, + } + for i := 0; i < 256; i++ { + chunk.Blocks = append(chunk.Blocks, &encoding.Block{}) + } + _, err = NewDAChunk(chunk, 0) + assert.Error(t, err) + assert.Contains(t, err.Error(), "number of blocks exceeds 1 byte") + + // Test case: Header.Number is not a uint64. + block := readBlockFromJSON(t, "../../../testdata/blockTrace_02.json") + block.Header.Number = new(big.Int).Lsh(block.Header.Number, 64) + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block}, + } + _, err = NewDAChunk(chunk, 0) + assert.Error(t, err) + assert.Contains(t, err.Error(), "block number is not uint64") + + // Test case: number of transactions exceeds max uint16. + block = readBlockFromJSON(t, "../../../testdata/blockTrace_02.json") + for i := 0; i < 65537; i++ { + block.Transactions = append(block.Transactions, block.Transactions[0]) + } + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block}, + } + _, err = NewDAChunk(chunk, 0) + assert.Error(t, err) + assert.Contains(t, err.Error(), "number of transactions exceeds max uint16") + + // Test case: decode transaction with hex string without 0x prefix error. + block = readBlockFromJSON(t, "../../../testdata/blockTrace_02.json") + block.Transactions = block.Transactions[:1] + block.Transactions[0].Data = "not-a-hex" + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block}, + } + _, err = EstimateChunkL1CommitCalldataSize(chunk) + assert.Error(t, err) + assert.Contains(t, err.Error(), "hex string without 0x prefix") + _, err = EstimateChunkL1CommitGas(chunk) + assert.Error(t, err) + assert.Contains(t, err.Error(), "hex string without 0x prefix") + + // Test case: number of L1 messages exceeds max uint16. + block = readBlockFromJSON(t, "../../../testdata/blockTrace_04.json") + for i := 0; i < 65535; i++ { + tx := &block.Transactions[i] + txCopy := *tx + txCopy.Nonce = uint64(i + 1) + block.Transactions = append(block.Transactions, txCopy) + } + chunk = &encoding.Chunk{ + Blocks: []*encoding.Block{block}, + } + _, err = NewDAChunk(chunk, 0) + assert.Error(t, err) + assert.Contains(t, err.Error(), "number of L1 messages exceeds max uint16") +} + +func readBlockFromJSON(t *testing.T, filename string) *encoding.Block { + data, err := os.ReadFile(filename) + assert.NoError(t, err) + + block := &encoding.Block{} + assert.NoError(t, json.Unmarshal(data, block)) + return block +} diff --git a/common/types/encoding/da.go b/common/types/encoding/da.go new file mode 100644 index 0000000000..efc61226ed --- /dev/null +++ b/common/types/encoding/da.go @@ -0,0 +1,222 @@ +package encoding + +import ( + "fmt" + + "github.com/scroll-tech/go-ethereum/common" + "github.com/scroll-tech/go-ethereum/common/hexutil" + "github.com/scroll-tech/go-ethereum/core/types" +) + +// Block represents an L2 block. +type Block struct { + Header *types.Header + Transactions []*types.TransactionData + WithdrawRoot common.Hash `json:"withdraw_trie_root,omitempty"` + RowConsumption *types.RowConsumption `json:"row_consumption,omitempty"` +} + +// Chunk represents a group of blocks. +type Chunk struct { + Blocks []*Block `json:"blocks"` +} + +// Batch represents a batch of chunks. +type Batch struct { + Index uint64 + TotalL1MessagePoppedBefore uint64 + ParentBatchHash common.Hash + Chunks []*Chunk + + // Only used in updating db info. + StartChunkIndex uint64 + EndChunkIndex uint64 + StartChunkHash common.Hash + EndChunkHash common.Hash +} + +// NumL1Messages returns the number of L1 messages in this block. +// This number is the sum of included and skipped L1 messages. +func (b *Block) NumL1Messages(totalL1MessagePoppedBefore uint64) uint64 { + var lastQueueIndex *uint64 + for _, txData := range b.Transactions { + if txData.Type == types.L1MessageTxType { + lastQueueIndex = &txData.Nonce + } + } + if lastQueueIndex == nil { + return 0 + } + // note: last queue index included before this block is totalL1MessagePoppedBefore - 1 + // TODO: cache results + return *lastQueueIndex - totalL1MessagePoppedBefore + 1 +} + +// NumL2Transactions returns the number of L2 transactions in this block. +func (b *Block) NumL2Transactions() uint64 { + var count uint64 + for _, txData := range b.Transactions { + if txData.Type != types.L1MessageTxType { + count++ + } + } + return count +} + +// NumL1Messages returns the number of L1 messages in this chunk. +// This number is the sum of included and skipped L1 messages. +func (c *Chunk) NumL1Messages(totalL1MessagePoppedBefore uint64) uint64 { + var numL1Messages uint64 + for _, block := range c.Blocks { + numL1MessagesInBlock := block.NumL1Messages(totalL1MessagePoppedBefore) + numL1Messages += numL1MessagesInBlock + totalL1MessagePoppedBefore += numL1MessagesInBlock + } + // TODO: cache results + return numL1Messages +} + +// ConvertTxDataToRLPEncoding transforms []*TransactionData into []*types.Transaction. +func ConvertTxDataToRLPEncoding(txData *types.TransactionData) ([]byte, error) { + data, err := hexutil.Decode(txData.Data) + if err != nil { + return nil, fmt.Errorf("failed to decode txData.Data: data=%v, err=%w", txData.Data, err) + } + + var tx *types.Transaction + switch txData.Type { + case types.LegacyTxType: + tx = types.NewTx(&types.LegacyTx{ + Nonce: txData.Nonce, + To: txData.To, + Value: txData.Value.ToInt(), + Gas: txData.Gas, + GasPrice: txData.GasPrice.ToInt(), + Data: data, + V: txData.V.ToInt(), + R: txData.R.ToInt(), + S: txData.S.ToInt(), + }) + + case types.AccessListTxType: + tx = types.NewTx(&types.AccessListTx{ + ChainID: txData.ChainId.ToInt(), + Nonce: txData.Nonce, + To: txData.To, + Value: txData.Value.ToInt(), + Gas: txData.Gas, + GasPrice: txData.GasPrice.ToInt(), + Data: data, + AccessList: txData.AccessList, + V: txData.V.ToInt(), + R: txData.R.ToInt(), + S: txData.S.ToInt(), + }) + + case types.DynamicFeeTxType: + tx = types.NewTx(&types.DynamicFeeTx{ + ChainID: txData.ChainId.ToInt(), + Nonce: txData.Nonce, + To: txData.To, + Value: txData.Value.ToInt(), + Gas: txData.Gas, + GasTipCap: txData.GasTipCap.ToInt(), + GasFeeCap: txData.GasFeeCap.ToInt(), + Data: data, + AccessList: txData.AccessList, + V: txData.V.ToInt(), + R: txData.R.ToInt(), + S: txData.S.ToInt(), + }) + + case types.L1MessageTxType: // L1MessageTxType is not supported + default: + return nil, fmt.Errorf("unsupported tx type: %d", txData.Type) + } + + rlpTxData, err := tx.MarshalBinary() + if err != nil { + return nil, fmt.Errorf("failed to marshal binary of the tx: tx=%v, err=%w", tx, err) + } + + return rlpTxData, nil +} + +// CrcMax calculates the maximum row consumption of crc. +func (c *Chunk) CrcMax() (uint64, error) { + // Map sub-circuit name to row count + crc := make(map[string]uint64) + + // Iterate over blocks, accumulate row consumption + for _, block := range c.Blocks { + if block.RowConsumption == nil { + return 0, fmt.Errorf("block (%d, %v) has nil RowConsumption", block.Header.Number, block.Header.Hash().Hex()) + } + for _, subCircuit := range *block.RowConsumption { + crc[subCircuit.Name] += subCircuit.RowNumber + } + } + + // Find the maximum row consumption + var maxVal uint64 + for _, value := range crc { + if value > maxVal { + maxVal = value + } + } + + // Return the maximum row consumption + return maxVal, nil +} + +// NumTransactions calculates the total number of transactions in a Chunk. +func (c *Chunk) NumTransactions() uint64 { + var totalTxNum uint64 + for _, block := range c.Blocks { + totalTxNum += uint64(len(block.Transactions)) + } + return totalTxNum +} + +// NumL2Transactions calculates the total number of L2 transactions in a Chunk. +func (c *Chunk) NumL2Transactions() uint64 { + var totalTxNum uint64 + for _, block := range c.Blocks { + totalTxNum += block.NumL2Transactions() + } + return totalTxNum +} + +// L2GasUsed calculates the total gas of L2 transactions in a Chunk. +func (c *Chunk) L2GasUsed() uint64 { + var totalTxNum uint64 + for _, block := range c.Blocks { + totalTxNum += block.Header.GasUsed + } + return totalTxNum +} + +// StateRoot gets the state root after committing/finalizing the batch. +func (b *Batch) StateRoot() common.Hash { + numChunks := len(b.Chunks) + if len(b.Chunks) == 0 { + return common.Hash{} + } + lastChunkBlockNum := len(b.Chunks[numChunks-1].Blocks) + return b.Chunks[len(b.Chunks)-1].Blocks[lastChunkBlockNum-1].Header.Root +} + +// WithdrawRoot gets the withdraw root after committing/finalizing the batch. +func (b *Batch) WithdrawRoot() common.Hash { + numChunks := len(b.Chunks) + if len(b.Chunks) == 0 { + return common.Hash{} + } + lastChunkBlockNum := len(b.Chunks[numChunks-1].Blocks) + return b.Chunks[len(b.Chunks)-1].Blocks[lastChunkBlockNum-1].WithdrawRoot +} + +// NumChunks gets the number of chunks of the batch. +func (b *Batch) NumChunks() uint64 { + return uint64(len(b.Chunks)) +} diff --git a/common/types/encoding/da_test.go b/common/types/encoding/da_test.go new file mode 100644 index 0000000000..525194c0d8 --- /dev/null +++ b/common/types/encoding/da_test.go @@ -0,0 +1,122 @@ +package encoding + +import ( + "encoding/json" + "os" + "testing" + + "github.com/scroll-tech/go-ethereum/common" + "github.com/scroll-tech/go-ethereum/core/types" + "github.com/scroll-tech/go-ethereum/log" + "github.com/stretchr/testify/assert" +) + +func TestMain(m *testing.M) { + glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.LogfmtFormat())) + glogger.Verbosity(log.LvlInfo) + log.Root().SetHandler(glogger) + + m.Run() +} + +func TestUtilFunctions(t *testing.T) { + block1 := readBlockFromJSON(t, "../../testdata/blockTrace_02.json") + block2 := readBlockFromJSON(t, "../../testdata/blockTrace_03.json") + block3 := readBlockFromJSON(t, "../../testdata/blockTrace_04.json") + block4 := readBlockFromJSON(t, "../../testdata/blockTrace_05.json") + block5 := readBlockFromJSON(t, "../../testdata/blockTrace_06.json") + block6 := readBlockFromJSON(t, "../../testdata/blockTrace_07.json") + + chunk1 := &Chunk{Blocks: []*Block{block1, block2}} + chunk2 := &Chunk{Blocks: []*Block{block3, block4}} + chunk3 := &Chunk{Blocks: []*Block{block5, block6}} + + batch := &Batch{Chunks: []*Chunk{chunk1, chunk2, chunk3}} + + // Test Block methods + assert.Equal(t, uint64(0), block1.NumL1Messages(0)) + assert.Equal(t, uint64(2), block1.NumL2Transactions()) + assert.Equal(t, uint64(0), block2.NumL1Messages(0)) + assert.Equal(t, uint64(1), block2.NumL2Transactions()) + assert.Equal(t, uint64(11), block3.NumL1Messages(0)) + assert.Equal(t, uint64(1), block3.NumL2Transactions()) + assert.Equal(t, uint64(42), block4.NumL1Messages(0)) + assert.Equal(t, uint64(0), block4.NumL2Transactions()) + assert.Equal(t, uint64(10), block5.NumL1Messages(0)) + assert.Equal(t, uint64(0), block5.NumL2Transactions()) + assert.Equal(t, uint64(257), block6.NumL1Messages(0)) + assert.Equal(t, uint64(0), block6.NumL2Transactions()) + + // Test Chunk methods + assert.Equal(t, uint64(0), chunk1.NumL1Messages(0)) + assert.Equal(t, uint64(3), chunk1.NumL2Transactions()) + crc1Max, err := chunk1.CrcMax() + assert.NoError(t, err) + assert.Equal(t, uint64(11), crc1Max) + assert.Equal(t, uint64(3), chunk1.NumTransactions()) + assert.Equal(t, uint64(1194994), chunk1.L2GasUsed()) + + assert.Equal(t, uint64(42), chunk2.NumL1Messages(0)) + assert.Equal(t, uint64(1), chunk2.NumL2Transactions()) + crc2Max, err := chunk2.CrcMax() + assert.NoError(t, err) + assert.Equal(t, uint64(0), crc2Max) + assert.Equal(t, uint64(7), chunk2.NumTransactions()) + assert.Equal(t, uint64(144000), chunk2.L2GasUsed()) + + assert.Equal(t, uint64(257), chunk3.NumL1Messages(0)) + assert.Equal(t, uint64(0), chunk3.NumL2Transactions()) + chunk3.Blocks[0].RowConsumption = nil + crc3Max, err := chunk3.CrcMax() + assert.Error(t, err) + assert.EqualError(t, err, "block (17, 0x003fee335455c0c293dda17ea9365fe0caa94071ed7216baf61f7aeb808e8a28) has nil RowConsumption") + assert.Equal(t, uint64(0), crc3Max) + assert.Equal(t, uint64(5), chunk3.NumTransactions()) + assert.Equal(t, uint64(240000), chunk3.L2GasUsed()) + + // Test Batch methods + assert.Equal(t, uint64(3), batch.NumChunks()) + assert.Equal(t, block6.Header.Root, batch.StateRoot()) + assert.Equal(t, block6.WithdrawRoot, batch.WithdrawRoot()) +} + +func TestConvertTxDataToRLPEncoding(t *testing.T) { + blocks := []*Block{ + readBlockFromJSON(t, "../../testdata/blockTrace_02.json"), + readBlockFromJSON(t, "../../testdata/blockTrace_03.json"), + readBlockFromJSON(t, "../../testdata/blockTrace_04.json"), + readBlockFromJSON(t, "../../testdata/blockTrace_05.json"), + readBlockFromJSON(t, "../../testdata/blockTrace_06.json"), + readBlockFromJSON(t, "../../testdata/blockTrace_07.json"), + } + + for _, block := range blocks { + for _, txData := range block.Transactions { + if txData.Type == types.L1MessageTxType { + continue + } + + rlpTxData, err := ConvertTxDataToRLPEncoding(txData) + assert.NoError(t, err) + var tx types.Transaction + err = tx.UnmarshalBinary(rlpTxData) + assert.NoError(t, err) + assert.Equal(t, txData.TxHash, tx.Hash().Hex()) + } + } +} + +func TestEmptyBatchRoots(t *testing.T) { + emptyBatch := &Batch{Chunks: []*Chunk{}} + assert.Equal(t, common.Hash{}, emptyBatch.StateRoot()) + assert.Equal(t, common.Hash{}, emptyBatch.WithdrawRoot()) +} + +func readBlockFromJSON(t *testing.T, filename string) *Block { + data, err := os.ReadFile(filename) + assert.NoError(t, err) + + block := &Block{} + assert.NoError(t, json.Unmarshal(data, block)) + return block +} diff --git a/common/version/version.go b/common/version/version.go index fefe2b8ba3..45a7803fd7 100644 --- a/common/version/version.go +++ b/common/version/version.go @@ -5,7 +5,7 @@ import ( "runtime/debug" ) -var tag = "v4.3.68" +var tag = "v4.3.69" var commit = func() string { if info, ok := debug.ReadBuildInfo(); ok { diff --git a/coordinator/go.mod b/coordinator/go.mod index 202590ff0c..8075c3ff8a 100644 --- a/coordinator/go.mod +++ b/coordinator/go.mod @@ -7,7 +7,7 @@ require ( github.com/gin-gonic/gin v1.9.1 github.com/go-resty/resty/v2 v2.7.0 github.com/mitchellh/mapstructure v1.5.0 - github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 + github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 github.com/shopspring/decimal v1.3.1 github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.25.7 diff --git a/coordinator/go.sum b/coordinator/go.sum index 52d9d472de..737c05093c 100644 --- a/coordinator/go.sum +++ b/coordinator/go.sum @@ -174,8 +174,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 h1:EDnM5yoGAeUHEu1v3RUPTrHzInm3au2QWXpl+q3XnUo= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 h1:H7LzbJMrmkFkyPAl+F0NMMg0Wiq/qQv/iKKmuo/7/Yc= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= github.com/scroll-tech/zktrie v0.7.1 h1:NrmZNjuBzsbrKePqdHDG+t2cXnimbtezPAFS0+L9ElE= github.com/scroll-tech/zktrie v0.7.1/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= diff --git a/coordinator/internal/orm/batch.go b/coordinator/internal/orm/batch.go index fd31d66d8b..e9bcab7981 100644 --- a/coordinator/internal/orm/batch.go +++ b/coordinator/internal/orm/batch.go @@ -7,17 +7,16 @@ import ( "fmt" "time" - "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/log" "gorm.io/gorm" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/common/types/message" "scroll-tech/common/utils" ) -const defaultBatchHeaderVersion = 0 - // Batch represents a batch of chunks. type Batch struct { db *gorm.DB `gorm:"column:-"` @@ -186,63 +185,30 @@ func (o *Batch) GetAttemptsByHash(ctx context.Context, hash string) (int16, int1 } // InsertBatch inserts a new batch into the database. -// for unit test -func (o *Batch) InsertBatch(ctx context.Context, startChunkIndex, endChunkIndex uint64, startChunkHash, endChunkHash string, chunks []*types.Chunk, dbTX ...*gorm.DB) (*Batch, error) { - if len(chunks) == 0 { - return nil, errors.New("invalid args") - } - - parentBatch, err := o.GetLatestBatch(ctx) - if err != nil && !errors.Is(errors.Unwrap(err), gorm.ErrRecordNotFound) { - log.Error("failed to get the latest batch", "err", err) - return nil, err +func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, dbTX ...*gorm.DB) (*Batch, error) { + if batch == nil { + return nil, errors.New("invalid args: batch is nil") } - var batchIndex uint64 - var parentBatchHash common.Hash - var totalL1MessagePoppedBefore uint64 - var version uint8 = defaultBatchHeaderVersion - - // if parentBatch==nil then err==gorm.ErrRecordNotFound, which means there's - // not batch record in the db, we then use default empty values for the creating batch; - // if parentBatch!=nil then err=nil, then we fill the parentBatch-related data into the creating batch - if parentBatch != nil { - batchIndex = parentBatch.Index + 1 - parentBatchHash = common.HexToHash(parentBatch.Hash) - - var parentBatchHeader *types.BatchHeader - parentBatchHeader, err = types.DecodeBatchHeader(parentBatch.BatchHeader) - if err != nil { - log.Error("failed to decode parent batch header", "index", parentBatch.Index, "hash", parentBatch.Hash, "err", err) - return nil, err - } - - totalL1MessagePoppedBefore = parentBatchHeader.TotalL1MessagePopped() - version = parentBatchHeader.Version() - } - - batchHeader, err := types.NewBatchHeader(version, batchIndex, totalL1MessagePoppedBefore, parentBatchHash, chunks) + daBatch, err := codecv0.NewDABatch(batch) if err != nil { - log.Error("failed to create batch header", - "index", batchIndex, "total l1 message popped before", totalL1MessagePoppedBefore, - "parent hash", parentBatchHash, "number of chunks", len(chunks), "err", err) + log.Error("failed to create new DA batch", + "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore, + "parent hash", batch.ParentBatchHash, "number of chunks", len(batch.Chunks), "err", err) return nil, err } - numChunks := len(chunks) - lastChunkBlockNum := len(chunks[numChunks-1].Blocks) - newBatch := Batch{ - Index: batchIndex, - Hash: batchHeader.Hash().Hex(), - StartChunkHash: startChunkHash, - StartChunkIndex: startChunkIndex, - EndChunkHash: endChunkHash, - EndChunkIndex: endChunkIndex, - StateRoot: chunks[numChunks-1].Blocks[lastChunkBlockNum-1].Header.Root.Hex(), - WithdrawRoot: chunks[numChunks-1].Blocks[lastChunkBlockNum-1].WithdrawRoot.Hex(), - ParentBatchHash: parentBatchHash.Hex(), - BatchHeader: batchHeader.Encode(), + Index: batch.Index, + Hash: daBatch.Hash().Hex(), + StartChunkHash: batch.StartChunkHash.Hex(), + StartChunkIndex: batch.StartChunkIndex, + EndChunkHash: batch.EndChunkHash.Hex(), + EndChunkIndex: batch.EndChunkIndex, + StateRoot: batch.StateRoot().Hex(), + WithdrawRoot: batch.WithdrawRoot().Hex(), + ParentBatchHash: batch.ParentBatchHash.Hex(), + BatchHeader: daBatch.Encode(), ChunkProofsStatus: int16(types.ChunkProofsStatusPending), ProvingStatus: int16(types.ProvingTaskUnassigned), TotalAttempts: 0, diff --git a/coordinator/internal/orm/chunk.go b/coordinator/internal/orm/chunk.go index 965157a3be..141f49a29a 100644 --- a/coordinator/internal/orm/chunk.go +++ b/coordinator/internal/orm/chunk.go @@ -11,6 +11,8 @@ import ( "gorm.io/gorm" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/common/types/message" "scroll-tech/common/utils" ) @@ -28,7 +30,7 @@ type Chunk struct { EndBlockHash string `json:"end_block_hash" gorm:"column:end_block_hash"` StartBlockTime uint64 `json:"start_block_time" gorm:"column:start_block_time"` TotalL1MessagesPoppedBefore uint64 `json:"total_l1_messages_popped_before" gorm:"column:total_l1_messages_popped_before"` - TotalL1MessagesPoppedInChunk uint32 `json:"total_l1_messages_popped_in_chunk" gorm:"column:total_l1_messages_popped_in_chunk"` + TotalL1MessagesPoppedInChunk uint64 `json:"total_l1_messages_popped_in_chunk" gorm:"column:total_l1_messages_popped_in_chunk"` ParentChunkHash string `json:"parent_chunk_hash" gorm:"column:parent_chunk_hash"` StateRoot string `json:"state_root" gorm:"column:state_root"` ParentChunkStateRoot string `json:"parent_chunk_state_root" gorm:"column:parent_chunk_state_root"` @@ -48,8 +50,8 @@ type Chunk struct { // metadata TotalL2TxGas uint64 `json:"total_l2_tx_gas" gorm:"column:total_l2_tx_gas"` - TotalL2TxNum uint32 `json:"total_l2_tx_num" gorm:"column:total_l2_tx_num"` - TotalL1CommitCalldataSize uint32 `json:"total_l1_commit_calldata_size" gorm:"column:total_l1_commit_calldata_size"` + TotalL2TxNum uint64 `json:"total_l2_tx_num" gorm:"column:total_l2_tx_num"` + TotalL1CommitCalldataSize uint64 `json:"total_l1_commit_calldata_size" gorm:"column:total_l1_commit_calldata_size"` TotalL1CommitGas uint64 `json:"total_l1_commit_gas" gorm:"column:total_l1_commit_gas"` CreatedAt time.Time `json:"created_at" gorm:"column:created_at"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` @@ -219,7 +221,7 @@ func (o *Chunk) GetAttemptsByHash(ctx context.Context, hash string) (int16, int1 // InsertChunk inserts a new chunk into the database. // for unit test -func (o *Chunk) InsertChunk(ctx context.Context, chunk *types.Chunk, dbTX ...*gorm.DB) (*Chunk, error) { +func (o *Chunk) InsertChunk(ctx context.Context, chunk *encoding.Chunk, dbTX ...*gorm.DB) (*Chunk, error) { if chunk == nil || len(chunk.Blocks) == 0 { return nil, errors.New("invalid args") } @@ -239,43 +241,50 @@ func (o *Chunk) InsertChunk(ctx context.Context, chunk *types.Chunk, dbTX ...*go // if parentChunk!=nil then err=nil, then we fill the parentChunk-related data into the creating chunk if parentChunk != nil { chunkIndex = parentChunk.Index + 1 - totalL1MessagePoppedBefore = parentChunk.TotalL1MessagesPoppedBefore + uint64(parentChunk.TotalL1MessagesPoppedInChunk) + totalL1MessagePoppedBefore = parentChunk.TotalL1MessagesPoppedBefore + parentChunk.TotalL1MessagesPoppedInChunk parentChunkHash = parentChunk.Hash parentChunkStateRoot = parentChunk.StateRoot } - hash, err := chunk.Hash(totalL1MessagePoppedBefore) + daChunk, err := codecv0.NewDAChunk(chunk, totalL1MessagePoppedBefore) if err != nil { - log.Error("failed to get chunk hash", "err", err) + log.Error("failed to initialize new DA chunk", "err", err) return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) } - var totalL2TxGas uint64 - var totalL2TxNum uint64 - var totalL1CommitCalldataSize uint64 - var totalL1CommitGas uint64 - for _, block := range chunk.Blocks { - totalL2TxGas += block.Header.GasUsed - totalL2TxNum += block.NumL2Transactions() - totalL1CommitCalldataSize += block.EstimateL1CommitCalldataSize() - totalL1CommitGas += block.EstimateL1CommitGas() + daChunkHash, err := daChunk.Hash() + if err != nil { + log.Error("failed to get DA chunk hash", "err", err) + return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) + } + + totalL1CommitCalldataSize, err := codecv0.EstimateChunkL1CommitCalldataSize(chunk) + if err != nil { + log.Error("failed to estimate chunk L1 commit calldata size", "err", err) + return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) + } + + totalL1CommitGas, err := codecv0.EstimateChunkL1CommitGas(chunk) + if err != nil { + log.Error("failed to estimate chunk L1 commit gas", "err", err) + return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) } numBlocks := len(chunk.Blocks) newChunk := Chunk{ Index: chunkIndex, - Hash: hash.Hex(), + Hash: daChunkHash.Hex(), StartBlockNumber: chunk.Blocks[0].Header.Number.Uint64(), StartBlockHash: chunk.Blocks[0].Header.Hash().Hex(), EndBlockNumber: chunk.Blocks[numBlocks-1].Header.Number.Uint64(), EndBlockHash: chunk.Blocks[numBlocks-1].Header.Hash().Hex(), - TotalL2TxGas: totalL2TxGas, - TotalL2TxNum: uint32(totalL2TxNum), - TotalL1CommitCalldataSize: uint32(totalL1CommitCalldataSize), + TotalL2TxGas: chunk.L2GasUsed(), + TotalL2TxNum: chunk.NumL2Transactions(), + TotalL1CommitCalldataSize: totalL1CommitCalldataSize, TotalL1CommitGas: totalL1CommitGas, StartBlockTime: chunk.Blocks[0].Header.Time, TotalL1MessagesPoppedBefore: totalL1MessagePoppedBefore, - TotalL1MessagesPoppedInChunk: uint32(chunk.NumL1Messages(totalL1MessagePoppedBefore)), + TotalL1MessagesPoppedInChunk: chunk.NumL1Messages(totalL1MessagePoppedBefore), ParentChunkHash: parentChunkHash, StateRoot: chunk.Blocks[numBlocks-1].Header.Root.Hex(), ParentChunkStateRoot: parentChunkStateRoot, diff --git a/coordinator/internal/orm/l2_block.go b/coordinator/internal/orm/l2_block.go index 2030ba7ba0..4f8f122003 100644 --- a/coordinator/internal/orm/l2_block.go +++ b/coordinator/internal/orm/l2_block.go @@ -11,7 +11,7 @@ import ( "github.com/scroll-tech/go-ethereum/log" "gorm.io/gorm" - "scroll-tech/common/types" + "scroll-tech/common/types/encoding" ) // L2Block represents a l2 block in the database. @@ -77,7 +77,7 @@ func (o *L2Block) GetL2BlockHashesByChunkHash(ctx context.Context, chunkHash str // InsertL2Blocks inserts l2 blocks into the "l2_block" table. // for unit test -func (o *L2Block) InsertL2Blocks(ctx context.Context, blocks []*types.WrappedBlock) error { +func (o *L2Block) InsertL2Blocks(ctx context.Context, blocks []*encoding.Block) error { var l2Blocks []L2Block for _, block := range blocks { header, err := json.Marshal(block.Header) diff --git a/coordinator/internal/types/block.go b/coordinator/internal/types/block.go index 43bf9709b6..8dbde12ebc 100644 --- a/coordinator/internal/types/block.go +++ b/coordinator/internal/types/block.go @@ -1,18 +1,5 @@ package types -import ( - "github.com/scroll-tech/go-ethereum/common" - "github.com/scroll-tech/go-ethereum/core/types" -) - -// WrappedBlock contains the block's Header, Transactions and WithdrawTrieRoot hash. -type WrappedBlock struct { - Header *types.Header `json:"header"` - // Transactions is only used for recover types.Transactions, the from of types.TransactionData field is missing. - Transactions []*types.TransactionData `json:"transactions"` - WithdrawRoot common.Hash `json:"withdraw_trie_root,omitempty"` -} - // BatchInfo contains the BlockBatch's main info type BatchInfo struct { Index uint64 `json:"index"` diff --git a/coordinator/test/api_test.go b/coordinator/test/api_test.go index e2276037ac..179390300e 100644 --- a/coordinator/test/api_test.go +++ b/coordinator/test/api_test.go @@ -23,6 +23,7 @@ import ( "scroll-tech/common/database" "scroll-tech/common/docker" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" "scroll-tech/common/types/message" "scroll-tech/common/version" @@ -46,9 +47,10 @@ var ( proverTaskOrm *orm.ProverTask proverBlockListOrm *orm.ProverBlockList - wrappedBlock1 *types.WrappedBlock - wrappedBlock2 *types.WrappedBlock - chunk *types.Chunk + block1 *encoding.Block + block2 *encoding.Block + chunk *encoding.Chunk + batch *encoding.Batch tokenTimeout int ) @@ -144,18 +146,20 @@ func setEnv(t *testing.T) { templateBlockTrace, err := os.ReadFile("../../common/testdata/blockTrace_02.json") assert.NoError(t, err) - wrappedBlock1 = &types.WrappedBlock{} - err = json.Unmarshal(templateBlockTrace, wrappedBlock1) + block1 = &encoding.Block{} + err = json.Unmarshal(templateBlockTrace, block1) assert.NoError(t, err) templateBlockTrace, err = os.ReadFile("../../common/testdata/blockTrace_03.json") assert.NoError(t, err) - wrappedBlock2 = &types.WrappedBlock{} - err = json.Unmarshal(templateBlockTrace, wrappedBlock2) + block2 = &encoding.Block{} + err = json.Unmarshal(templateBlockTrace, block2) assert.NoError(t, err) - chunk = &types.Chunk{Blocks: []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}} + chunk = &encoding.Chunk{Blocks: []*encoding.Block{block1, block2}} assert.NoError(t, err) + + batch = &encoding.Batch{Chunks: []*encoding.Chunk{chunk}} } func TestApis(t *testing.T) { @@ -287,13 +291,13 @@ func testValidProof(t *testing.T) { assert.NoError(t, httpHandler.Shutdown(context.Background())) }() - err := l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) dbChunk, err := chunkOrm.InsertChunk(context.Background(), chunk) assert.NoError(t, err) err = l2BlockOrm.UpdateChunkHashInRange(context.Background(), 0, 100, dbChunk.Hash) assert.NoError(t, err) - batch, err := batchOrm.InsertBatch(context.Background(), 0, 0, dbChunk.Hash, dbChunk.Hash, []*types.Chunk{chunk}) + batch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) err = chunkOrm.UpdateBatchHashInRange(context.Background(), 0, 0, batch.Hash) assert.NoError(t, err) @@ -371,13 +375,13 @@ func testInvalidProof(t *testing.T) { assert.NoError(t, httpHandler.Shutdown(context.Background())) }() - err := l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) dbChunk, err := chunkOrm.InsertChunk(context.Background(), chunk) assert.NoError(t, err) err = l2BlockOrm.UpdateChunkHashInRange(context.Background(), 0, 100, dbChunk.Hash) assert.NoError(t, err) - batch, err := batchOrm.InsertBatch(context.Background(), 0, 0, dbChunk.Hash, dbChunk.Hash, []*types.Chunk{chunk}) + batch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) err = batchOrm.UpdateChunkProofsStatusByBatchHash(context.Background(), batch.Hash, types.ChunkProofsStatusReady) assert.NoError(t, err) @@ -447,13 +451,13 @@ func testProofGeneratedFailed(t *testing.T) { assert.NoError(t, httpHandler.Shutdown(context.Background())) }() - err := l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) dbChunk, err := chunkOrm.InsertChunk(context.Background(), chunk) assert.NoError(t, err) err = l2BlockOrm.UpdateChunkHashInRange(context.Background(), 0, 100, dbChunk.Hash) assert.NoError(t, err) - batch, err := batchOrm.InsertBatch(context.Background(), 0, 0, dbChunk.Hash, dbChunk.Hash, []*types.Chunk{chunk}) + batch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) err = batchOrm.UpdateChunkProofsStatusByBatchHash(context.Background(), batch.Hash, types.ChunkProofsStatusReady) assert.NoError(t, err) @@ -541,13 +545,13 @@ func testTimeoutProof(t *testing.T) { batchMaxAttempts int16 ) - err := l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) dbChunk, err := chunkOrm.InsertChunk(context.Background(), chunk) assert.NoError(t, err) err = l2BlockOrm.UpdateChunkHashInRange(context.Background(), 0, 100, dbChunk.Hash) assert.NoError(t, err) - batch, err := batchOrm.InsertBatch(context.Background(), 0, 0, dbChunk.Hash, dbChunk.Hash, []*types.Chunk{chunk}) + batch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) err = batchOrm.UpdateChunkProofsStatusByBatchHash(context.Background(), batch.Hash, types.ChunkProofsStatusReady) assert.NoError(t, err) diff --git a/database/go.mod b/database/go.mod index 478aaa5e65..9c539d5ae5 100644 --- a/database/go.mod +++ b/database/go.mod @@ -6,7 +6,7 @@ require ( github.com/jmoiron/sqlx v1.3.5 github.com/lib/pq v1.10.9 github.com/pressly/goose/v3 v3.16.0 - github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 + github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.25.7 ) diff --git a/database/go.sum b/database/go.sum index a61dd687da..7b89bde272 100644 --- a/database/go.sum +++ b/database/go.sum @@ -75,8 +75,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 h1:EDnM5yoGAeUHEu1v3RUPTrHzInm3au2QWXpl+q3XnUo= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 h1:H7LzbJMrmkFkyPAl+F0NMMg0Wiq/qQv/iKKmuo/7/Yc= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/sethvargo/go-retry v0.2.4 h1:T+jHEQy/zKJf5s95UkguisicE0zuF9y7+/vgz08Ocec= github.com/sethvargo/go-retry v0.2.4/go.mod h1:1afjQuvh7s4gflMObvjLPaWgluLLyhA1wmVZ6KLpICw= diff --git a/go.work.sum b/go.work.sum index 2e9dfb9034..5e1dffdae6 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1128,8 +1128,8 @@ github.com/scroll-tech/go-ethereum v1.10.14-0.20230306131930-03b4de32b78b/go.mod github.com/scroll-tech/go-ethereum v1.10.14-0.20230321020420-127af384ed04/go.mod h1:jH8c08L9K8Hieaf0r/ur2P/cpesn4dFhmLm2Mmoi8kI= github.com/scroll-tech/go-ethereum v1.10.14-0.20230802095950-4b2bbf6225e7/go.mod h1:DiN3p2inoXOxGffxSswDKqWjQ7bU+Mp0c9v0XQXKmaA= github.com/scroll-tech/go-ethereum v1.10.14-0.20230829000527-f883dcdc21fc/go.mod h1:DiN3p2inoXOxGffxSswDKqWjQ7bU+Mp0c9v0XQXKmaA= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 h1:EDnM5yoGAeUHEu1v3RUPTrHzInm3au2QWXpl+q3XnUo= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 h1:H7LzbJMrmkFkyPAl+F0NMMg0Wiq/qQv/iKKmuo/7/Yc= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= github.com/scroll-tech/zktrie v0.6.0/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= diff --git a/prover/go.mod b/prover/go.mod index 141872a434..d886cf61d6 100644 --- a/prover/go.mod +++ b/prover/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/go-resty/resty/v2 v2.7.0 github.com/google/uuid v1.4.0 - github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 + github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.25.7 go.etcd.io/bbolt v1.3.7 @@ -15,18 +15,28 @@ require ( github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/bits-and-blooms/bitset v1.12.0 // indirect github.com/btcsuite/btcd v0.20.1-beta // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set v1.8.0 // indirect + github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 // indirect github.com/fjl/memsize v0.0.2 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect + github.com/go-kit/kit v0.9.0 // indirect + github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/hashicorp/go-bexpr v0.1.10 // indirect + github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/iden3/go-iden3-crypto v0.0.15 // indirect @@ -36,15 +46,24 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/pointerstructure v1.2.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.27.1 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/tsdb v0.7.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect + github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/rs/cors v1.7.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/scroll-tech/zktrie v0.7.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect @@ -54,8 +73,10 @@ require ( golang.org/x/net v0.18.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + gopkg.in/urfave/cli.v1 v1.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/prover/go.sum b/prover/go.sum index aec018120d..9578fd6080 100644 --- a/prover/go.sum +++ b/prover/go.sum @@ -1,7 +1,12 @@ +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= 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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bits-and-blooms/bitset v1.12.0 h1:U/q1fAF7xXRhFCrhROzIfffYnu+dlS38vCZtmFVPHmA= github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= @@ -13,6 +18,8 @@ github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVa github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/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/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= @@ -30,32 +37,61 @@ 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= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 h1:B2mpK+MNqgPqk2/KNi1LbqwtZDy5F7iy0mynQiBr8VA= github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4/go.mod h1:y4GA2JbAUama1S4QwYjC2hefgGLU8Ul0GMtL/ADMF1c= github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY= github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= 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/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -68,6 +104,7 @@ github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+ github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -77,46 +114,77 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= 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.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= 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/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.27.1 h1:rfztXRbg6nv/5f+Raen9RcGoSecHIFgBBLQK3Wdj754= +github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= +github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 h1:EDnM5yoGAeUHEu1v3RUPTrHzInm3au2QWXpl+q3XnUo= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 h1:H7LzbJMrmkFkyPAl+F0NMMg0Wiq/qQv/iKKmuo/7/Yc= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= github.com/scroll-tech/zktrie v0.7.1 h1:NrmZNjuBzsbrKePqdHDG+t2cXnimbtezPAFS0+L9ElE= github.com/scroll-tech/zktrie v0.7.1/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 h1:wh1wzwAhZBNiZO37uWS/nDaKiIwHz4mDo4pnA+fqTO0= github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -127,31 +195,51 @@ github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -161,20 +249,42 @@ golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +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= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +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-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= diff --git a/rollup/go.mod b/rollup/go.mod index 0409b296d0..5f7479655f 100644 --- a/rollup/go.mod +++ b/rollup/go.mod @@ -7,7 +7,7 @@ require ( github.com/gin-gonic/gin v1.9.1 github.com/go-resty/resty/v2 v2.7.0 github.com/prometheus/client_golang v1.14.0 - github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 + github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 github.com/smartystreets/goconvey v1.8.0 github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.25.7 @@ -29,10 +29,12 @@ require ( github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set v1.8.0 // indirect + github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 // indirect github.com/fjl/memsize v0.0.2 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -47,6 +49,7 @@ require ( github.com/google/uuid v1.4.0 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/hashicorp/go-bexpr v0.1.10 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.4 // indirect @@ -65,6 +68,7 @@ require ( github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/pointerstructure v1.2.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -81,6 +85,7 @@ require ( github.com/rivo/uniseg v0.4.4 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/rs/cors v1.7.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/scroll-tech/zktrie v0.7.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect @@ -104,6 +109,7 @@ require ( golang.org/x/time v0.3.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + gopkg.in/urfave/cli.v1 v1.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/rollup/go.sum b/rollup/go.sum index 832939eab5..f00e75456c 100644 --- a/rollup/go.sum +++ b/rollup/go.sum @@ -53,6 +53,7 @@ github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsP github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 h1:B2mpK+MNqgPqk2/KNi1LbqwtZDy5F7iy0mynQiBr8VA= github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4/go.mod h1:y4GA2JbAUama1S4QwYjC2hefgGLU8Ul0GMtL/ADMF1c= github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= @@ -64,6 +65,7 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= @@ -122,6 +124,7 @@ github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfre github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= @@ -168,9 +171,11 @@ github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= @@ -225,10 +230,11 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 h1:EDnM5yoGAeUHEu1v3RUPTrHzInm3au2QWXpl+q3XnUo= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 h1:H7LzbJMrmkFkyPAl+F0NMMg0Wiq/qQv/iKKmuo/7/Yc= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= github.com/scroll-tech/zktrie v0.7.1 h1:NrmZNjuBzsbrKePqdHDG+t2cXnimbtezPAFS0+L9ElE= github.com/scroll-tech/zktrie v0.7.1/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= @@ -364,6 +370,7 @@ gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHN gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/rollup/internal/config/l2.go b/rollup/internal/config/l2.go index b78c2b1621..07912619a4 100644 --- a/rollup/internal/config/l2.go +++ b/rollup/internal/config/l2.go @@ -39,7 +39,7 @@ type ChunkProposerConfig struct { type BatchProposerConfig struct { MaxChunkNumPerBatch uint64 `json:"max_chunk_num_per_batch"` MaxL1CommitGasPerBatch uint64 `json:"max_l1_commit_gas_per_batch"` - MaxL1CommitCalldataSizePerBatch uint32 `json:"max_l1_commit_calldata_size_per_batch"` + MaxL1CommitCalldataSizePerBatch uint64 `json:"max_l1_commit_calldata_size_per_batch"` BatchTimeoutSec uint64 `json:"batch_timeout_sec"` GasCostIncreaseMultiplier float64 `json:"gas_cost_increase_multiplier"` } diff --git a/rollup/internal/controller/relayer/l2_relayer.go b/rollup/internal/controller/relayer/l2_relayer.go index 3d560c8004..a41b6e3477 100644 --- a/rollup/internal/controller/relayer/l2_relayer.go +++ b/rollup/internal/controller/relayer/l2_relayer.go @@ -18,6 +18,8 @@ import ( "gorm.io/gorm" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/common/utils" bridgeAbi "scroll-tech/rollup/abi" @@ -176,8 +178,8 @@ func (r *Layer2Relayer) initializeGenesis() error { log.Info("retrieved L2 genesis header", "hash", genesis.Hash().String()) - chunk := &types.Chunk{ - Blocks: []*types.WrappedBlock{{ + chunk := &encoding.Chunk{ + Blocks: []*encoding.Block{{ Header: genesis, Transactions: nil, WithdrawRoot: common.Hash{}, @@ -196,33 +198,38 @@ func (r *Layer2Relayer) initializeGenesis() error { return fmt.Errorf("failed to update genesis chunk proving status: %v", err) } - batchMeta := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: dbChunk.Hash, - EndChunkIndex: 0, - EndChunkHash: dbChunk.Hash, + batch := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + EndChunkIndex: 0, + StartChunkHash: common.HexToHash(dbChunk.Hash), + EndChunkHash: common.HexToHash(dbChunk.Hash), } - var batch *orm.Batch - batch, err = r.batchOrm.InsertBatch(r.ctx, []*types.Chunk{chunk}, batchMeta, dbTX) + + var dbBatch *orm.Batch + dbBatch, err = r.batchOrm.InsertBatch(r.ctx, batch, dbTX) if err != nil { return fmt.Errorf("failed to insert batch: %v", err) } - if err = r.chunkOrm.UpdateBatchHashInRange(r.ctx, 0, 0, batch.Hash, dbTX); err != nil { + if err = r.chunkOrm.UpdateBatchHashInRange(r.ctx, 0, 0, dbBatch.Hash, dbTX); err != nil { return fmt.Errorf("failed to update batch hash for chunks: %v", err) } - if err = r.batchOrm.UpdateProvingStatus(r.ctx, batch.Hash, types.ProvingTaskVerified, dbTX); err != nil { + if err = r.batchOrm.UpdateProvingStatus(r.ctx, dbBatch.Hash, types.ProvingTaskVerified, dbTX); err != nil { return fmt.Errorf("failed to update genesis batch proving status: %v", err) } - if err = r.batchOrm.UpdateRollupStatus(r.ctx, batch.Hash, types.RollupFinalized, dbTX); err != nil { + if err = r.batchOrm.UpdateRollupStatus(r.ctx, dbBatch.Hash, types.RollupFinalized, dbTX); err != nil { return fmt.Errorf("failed to update genesis batch rollup status: %v", err) } // commit genesis batch on L1 // note: we do this inside the DB transaction so that we can revert all DB changes if this step fails - return r.commitGenesisBatch(batch.Hash, batch.BatchHeader, common.HexToHash(batch.StateRoot)) + return r.commitGenesisBatch(dbBatch.Hash, dbBatch.BatchHeader, common.HexToHash(dbBatch.StateRoot)) }) if err != nil { @@ -335,9 +342,9 @@ func (r *Layer2Relayer) ProcessPendingBatches() { for _, batch := range batches { r.metrics.rollupL2RelayerProcessPendingBatchTotal.Inc() // get current header and parent header. - currentBatchHeader, err := types.DecodeBatchHeader(batch.BatchHeader) + daBatch, err := codecv0.NewDABatchFromBytes(batch.BatchHeader) if err != nil { - log.Error("Failed to decode batch header", "index", batch.Index, "error", err) + log.Error("Failed to initialize new DA batch from bytes", "index", batch.Index, "hash", batch.Hash, "err", err) return } parentBatch := &orm.Batch{} @@ -355,40 +362,42 @@ func (r *Layer2Relayer) ProcessPendingBatches() { } } - // get the chunks for the batch - startChunkIndex := batch.StartChunkIndex - endChunkIndex := batch.EndChunkIndex - dbChunks, err := r.chunkOrm.GetChunksInRange(r.ctx, startChunkIndex, endChunkIndex) + // get the metadata of chunks for the batch + dbChunks, err := r.chunkOrm.GetChunksInRange(r.ctx, batch.StartChunkIndex, batch.EndChunkIndex) if err != nil { log.Error("Failed to fetch chunks", - "start index", startChunkIndex, - "end index", endChunkIndex, "error", err) + "start index", batch.StartChunkIndex, + "end index", batch.EndChunkIndex, "error", err) return } encodedChunks := make([][]byte, len(dbChunks)) for i, c := range dbChunks { - var wrappedBlocks []*types.WrappedBlock - wrappedBlocks, err = r.l2BlockOrm.GetL2BlocksInRange(r.ctx, c.StartBlockNumber, c.EndBlockNumber) + var blocks []*encoding.Block + blocks, err = r.l2BlockOrm.GetL2BlocksInRange(r.ctx, c.StartBlockNumber, c.EndBlockNumber) if err != nil { - log.Error("Failed to fetch wrapped blocks", - "start number", c.StartBlockNumber, - "end number", c.EndBlockNumber, "error", err) + log.Error("Failed to fetch blocks", "start number", c.StartBlockNumber, "end number", c.EndBlockNumber, "error", err) return } - chunk := &types.Chunk{ - Blocks: wrappedBlocks, + chunk := &encoding.Chunk{ + Blocks: blocks, + } + var daChunk *codecv0.DAChunk + daChunk, err = codecv0.NewDAChunk(chunk, c.TotalL1MessagesPoppedBefore) + if err != nil { + log.Error("Failed to initialize new DA chunk", "start number", c.StartBlockNumber, "end number", c.EndBlockNumber, "error", err) + return } - var chunkBytes []byte - chunkBytes, err = chunk.Encode(c.TotalL1MessagesPoppedBefore) + var daChunkBytes []byte + daChunkBytes, err = daChunk.Encode() if err != nil { - log.Error("Failed to encode chunk", "error", err) + log.Error("Failed to encode DA chunk", "start number", c.StartBlockNumber, "end number", c.EndBlockNumber, "error", err) return } - encodedChunks[i] = chunkBytes + encodedChunks[i] = daChunkBytes } - calldata, err := r.l1RollupABI.Pack("commitBatch", currentBatchHeader.Version(), parentBatch.BatchHeader, encodedChunks, currentBatchHeader.SkippedL1MessageBitmap()) + calldata, err := r.l1RollupABI.Pack("commitBatch", daBatch.Version, parentBatch.BatchHeader, encodedChunks, daBatch.SkippedL1MessageBitmap) if err != nil { log.Error("Failed to pack commitBatch", "index", batch.Index, "error", err) return diff --git a/rollup/internal/controller/relayer/l2_relayer_test.go b/rollup/internal/controller/relayer/l2_relayer_test.go index 1c0fe7fd88..4e58c3bc38 100644 --- a/rollup/internal/controller/relayer/l2_relayer_test.go +++ b/rollup/internal/controller/relayer/l2_relayer_test.go @@ -17,6 +17,7 @@ import ( "scroll-tech/common/database" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" "scroll-tech/common/types/message" "scroll-tech/common/utils" @@ -52,26 +53,32 @@ func testL2RelayerProcessPendingBatches(t *testing.T) { assert.NoError(t, err) l2BlockOrm := orm.NewL2Block(db) - err = l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err = l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) chunkOrm := orm.NewChunk(db) - dbChunk1, err := chunkOrm.InsertChunk(context.Background(), chunk1) + _, err = chunkOrm.InsertChunk(context.Background(), chunk1) assert.NoError(t, err) - dbChunk2, err := chunkOrm.InsertChunk(context.Background(), chunk2) + _, err = chunkOrm.InsertChunk(context.Background(), chunk2) assert.NoError(t, err) - batchMeta := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: dbChunk1.Hash, - EndChunkIndex: 1, - EndChunkHash: dbChunk2.Hash, + + batch := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk1, chunk2}, + StartChunkIndex: 0, + StartChunkHash: chunkHash1, + EndChunkIndex: 1, + EndChunkHash: chunkHash2, } + batchOrm := orm.NewBatch(db) - batch, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk1, chunk2}, batchMeta) + dbBatch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) relayer.ProcessPendingBatches() - statuses, err := batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) + statuses, err := batchOrm.GetRollupStatusByHashList(context.Background(), []string{dbBatch.Hash}) assert.NoError(t, err) assert.Equal(t, 1, len(statuses)) assert.Equal(t, types.RollupCommitting, statuses[0]) @@ -84,25 +91,31 @@ func testL2RelayerProcessCommittedBatches(t *testing.T) { l2Cfg := cfg.L2Config relayer, err := NewLayer2Relayer(context.Background(), l2Cli, db, l2Cfg.RelayerConfig, false, ServiceTypeL2RollupRelayer, nil) assert.NoError(t, err) - batchMeta := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: chunkHash1.Hex(), - EndChunkIndex: 1, - EndChunkHash: chunkHash2.Hex(), + + batch := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk1, chunk2}, + StartChunkIndex: 0, + StartChunkHash: chunkHash1, + EndChunkIndex: 1, + EndChunkHash: chunkHash2, } + batchOrm := orm.NewBatch(db) - batch, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk1, chunk2}, batchMeta) + dbBatch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) - err = batchOrm.UpdateRollupStatus(context.Background(), batch.Hash, types.RollupCommitted) + err = batchOrm.UpdateRollupStatus(context.Background(), dbBatch.Hash, types.RollupCommitted) assert.NoError(t, err) - err = batchOrm.UpdateProvingStatus(context.Background(), batch.Hash, types.ProvingTaskVerified) + err = batchOrm.UpdateProvingStatus(context.Background(), dbBatch.Hash, types.ProvingTaskVerified) assert.NoError(t, err) relayer.ProcessCommittedBatches() - statuses, err := batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) + statuses, err := batchOrm.GetRollupStatusByHashList(context.Background(), []string{dbBatch.Hash}) assert.NoError(t, err) assert.Equal(t, 1, len(statuses)) // no valid proof, rollup status remains the same @@ -111,11 +124,11 @@ func testL2RelayerProcessCommittedBatches(t *testing.T) { proof := &message.BatchProof{ Proof: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}, } - err = batchOrm.UpdateProofByHash(context.Background(), batch.Hash, proof, 100) + err = batchOrm.UpdateProofByHash(context.Background(), dbBatch.Hash, proof, 100) assert.NoError(t, err) relayer.ProcessCommittedBatches() - statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) + statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{dbBatch.Hash}) assert.NoError(t, err) assert.Equal(t, 1, len(statuses)) assert.Equal(t, types.RollupFinalizing, statuses[0]) @@ -130,23 +143,29 @@ func testL2RelayerFinalizeTimeoutBatches(t *testing.T) { l2Cfg.RelayerConfig.FinalizeBatchWithoutProofTimeoutSec = 0 relayer, err := NewLayer2Relayer(context.Background(), l2Cli, db, l2Cfg.RelayerConfig, false, ServiceTypeL2RollupRelayer, nil) assert.NoError(t, err) - batchMeta := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: chunkHash1.Hex(), - EndChunkIndex: 1, - EndChunkHash: chunkHash2.Hex(), + + batch := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk1, chunk2}, + StartChunkIndex: 0, + StartChunkHash: chunkHash1, + EndChunkIndex: 1, + EndChunkHash: chunkHash2, } + batchOrm := orm.NewBatch(db) - batch, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk1, chunk2}, batchMeta) + dbBatch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) - err = batchOrm.UpdateRollupStatus(context.Background(), batch.Hash, types.RollupCommitted) + err = batchOrm.UpdateRollupStatus(context.Background(), dbBatch.Hash, types.RollupCommitted) assert.NoError(t, err) // Check the database for the updated status using TryTimes. ok := utils.TryTimes(5, func() bool { relayer.ProcessCommittedBatches() - statuses, err := batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) + statuses, err := batchOrm.GetRollupStatusByHashList(context.Background(), []string{dbBatch.Hash}) return err == nil && len(statuses) == 1 && statuses[0] == types.RollupFinalizing }) assert.True(t, ok) @@ -168,15 +187,20 @@ func testL2RelayerCommitConfirm(t *testing.T) { batchOrm := orm.NewBatch(db) batchHashes := make([]string, len(isSuccessful)) for i := range batchHashes { - batchMeta := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: chunkHash1.Hex(), - EndChunkIndex: 1, - EndChunkHash: chunkHash2.Hex(), + batch := &encoding.Batch{ + Index: uint64(i), + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk1, chunk2}, + StartChunkIndex: 0, + StartChunkHash: chunkHash1, + EndChunkIndex: 1, + EndChunkHash: chunkHash2, } - batch, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk1, chunk2}, batchMeta) + + dbBatch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) - batchHashes[i] = batch.Hash + batchHashes[i] = dbBatch.Hash } for i, batchHash := range batchHashes { @@ -222,15 +246,20 @@ func testL2RelayerFinalizeConfirm(t *testing.T) { batchOrm := orm.NewBatch(db) batchHashes := make([]string, len(isSuccessful)) for i := range batchHashes { - batchMeta := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: chunkHash1.Hex(), - EndChunkIndex: 1, - EndChunkHash: chunkHash2.Hex(), + batch := &encoding.Batch{ + Index: uint64(i), + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk1, chunk2}, + StartChunkIndex: 0, + StartChunkHash: chunkHash1, + EndChunkIndex: 1, + EndChunkHash: chunkHash2, } - batch, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk1, chunk2}, batchMeta) + + dbBatch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) - batchHashes[i] = batch.Hash + batchHashes[i] = dbBatch.Hash } for i, batchHash := range batchHashes { @@ -264,23 +293,33 @@ func testL2RelayerGasOracleConfirm(t *testing.T) { db := setupL2RelayerDB(t) defer database.CloseDB(db) - batchMeta1 := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: chunkHash1.Hex(), - EndChunkIndex: 0, - EndChunkHash: chunkHash1.Hex(), + batch1 := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk1}, + StartChunkIndex: 0, + StartChunkHash: chunkHash1, + EndChunkIndex: 0, + EndChunkHash: chunkHash1, } + batchOrm := orm.NewBatch(db) - batch1, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk1}, batchMeta1) + dbBatch1, err := batchOrm.InsertBatch(context.Background(), batch1) assert.NoError(t, err) - batchMeta2 := &types.BatchMeta{ - StartChunkIndex: 1, - StartChunkHash: chunkHash2.Hex(), - EndChunkIndex: 1, - EndChunkHash: chunkHash2.Hex(), + batch2 := &encoding.Batch{ + Index: batch1.Index + 1, + TotalL1MessagePoppedBefore: batch1.TotalL1MessagePoppedBefore, + ParentBatchHash: common.HexToHash(dbBatch1.Hash), + Chunks: []*encoding.Chunk{chunk2}, + StartChunkIndex: 1, + StartChunkHash: chunkHash2, + EndChunkIndex: 1, + EndChunkHash: chunkHash2, } - batch2, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk2}, batchMeta2) + + dbBatch2, err := batchOrm.InsertBatch(context.Background(), batch2) assert.NoError(t, err) // Create and set up the Layer2 Relayer. @@ -297,8 +336,8 @@ func testL2RelayerGasOracleConfirm(t *testing.T) { } confirmations := []BatchConfirmation{ - {batchHash: batch1.Hash, isSuccessful: true}, - {batchHash: batch2.Hash, isSuccessful: false}, + {batchHash: dbBatch1.Hash, isSuccessful: true}, + {batchHash: dbBatch2.Hash, isSuccessful: false}, } for _, confirmation := range confirmations { @@ -421,21 +460,27 @@ func testGetBatchStatusByIndex(t *testing.T) { defer database.CloseDB(db) l2BlockOrm := orm.NewL2Block(db) - err := l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) chunkOrm := orm.NewChunk(db) - dbChunk1, err := chunkOrm.InsertChunk(context.Background(), chunk1) + _, err = chunkOrm.InsertChunk(context.Background(), chunk1) assert.NoError(t, err) - dbChunk2, err := chunkOrm.InsertChunk(context.Background(), chunk2) + _, err = chunkOrm.InsertChunk(context.Background(), chunk2) assert.NoError(t, err) - batchMeta := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: dbChunk1.Hash, - EndChunkIndex: 1, - EndChunkHash: dbChunk2.Hash, + + batch := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk1, chunk2}, + StartChunkIndex: 0, + StartChunkHash: chunkHash1, + EndChunkIndex: 1, + EndChunkHash: chunkHash2, } + batchOrm := orm.NewBatch(db) - batch, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk1, chunk2}, batchMeta) + dbBatch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) cfg.L2Config.RelayerConfig.ChainMonitor.Enabled = true @@ -443,7 +488,7 @@ func testGetBatchStatusByIndex(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, relayer) - status, err := relayer.getBatchStatusByIndex(batch) + status, err := relayer.getBatchStatusByIndex(dbBatch) assert.NoError(t, err) assert.Equal(t, true, status) } diff --git a/rollup/internal/controller/relayer/relayer_test.go b/rollup/internal/controller/relayer/relayer_test.go index d2ddb12504..60f2137e59 100644 --- a/rollup/internal/controller/relayer/relayer_test.go +++ b/rollup/internal/controller/relayer/relayer_test.go @@ -15,7 +15,8 @@ import ( "scroll-tech/common/database" "scroll-tech/common/docker" - "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/rollup/internal/config" ) @@ -30,12 +31,12 @@ var ( l2Cli *ethclient.Client // l2 block - wrappedBlock1 *types.WrappedBlock - wrappedBlock2 *types.WrappedBlock + block1 *encoding.Block + block2 *encoding.Block // chunk - chunk1 *types.Chunk - chunk2 *types.Chunk + chunk1 *encoding.Chunk + chunk2 *encoding.Chunk chunkHash1 common.Hash chunkHash2 common.Hash ) @@ -71,20 +72,24 @@ func setupEnv(t *testing.T) { templateBlockTrace1, err := os.ReadFile("../../../testdata/blockTrace_02.json") assert.NoError(t, err) - wrappedBlock1 = &types.WrappedBlock{} - err = json.Unmarshal(templateBlockTrace1, wrappedBlock1) + block1 = &encoding.Block{} + err = json.Unmarshal(templateBlockTrace1, block1) assert.NoError(t, err) - chunk1 = &types.Chunk{Blocks: []*types.WrappedBlock{wrappedBlock1}} - chunkHash1, err = chunk1.Hash(0) + chunk1 = &encoding.Chunk{Blocks: []*encoding.Block{block1}} + daChunk1, err := codecv0.NewDAChunk(chunk1, 0) + assert.NoError(t, err) + chunkHash1, err = daChunk1.Hash() assert.NoError(t, err) templateBlockTrace2, err := os.ReadFile("../../../testdata/blockTrace_03.json") assert.NoError(t, err) - wrappedBlock2 = &types.WrappedBlock{} - err = json.Unmarshal(templateBlockTrace2, wrappedBlock2) + block2 = &encoding.Block{} + err = json.Unmarshal(templateBlockTrace2, block2) + assert.NoError(t, err) + chunk2 = &encoding.Chunk{Blocks: []*encoding.Block{block2}} + daChunk2, err := codecv0.NewDAChunk(chunk2, chunk1.NumL1Messages(0)) assert.NoError(t, err) - chunk2 = &types.Chunk{Blocks: []*types.WrappedBlock{wrappedBlock2}} - chunkHash2, err = chunk2.Hash(chunk1.NumL1Messages(0)) + chunkHash2, err = daChunk2.Hash() assert.NoError(t, err) } diff --git a/rollup/internal/controller/watcher/batch_proposer.go b/rollup/internal/controller/watcher/batch_proposer.go index ebce33510f..2e4c47b3fc 100644 --- a/rollup/internal/controller/watcher/batch_proposer.go +++ b/rollup/internal/controller/watcher/batch_proposer.go @@ -7,12 +7,14 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" + "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/log" "github.com/scroll-tech/go-ethereum/params" "gorm.io/gorm" "scroll-tech/common/forks" - "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/rollup/internal/config" "scroll-tech/rollup/internal/orm" @@ -29,7 +31,7 @@ type BatchProposer struct { maxChunkNumPerBatch uint64 maxL1CommitGasPerBatch uint64 - maxL1CommitCalldataSizePerBatch uint32 + maxL1CommitCalldataSizePerBatch uint64 batchTimeoutSec uint64 gasCostIncreaseMultiplier float64 forkMap map[uint64]bool @@ -111,92 +113,49 @@ func NewBatchProposer(ctx context.Context, cfg *config.BatchProposerConfig, chai // TryProposeBatch tries to propose a new batches. func (p *BatchProposer) TryProposeBatch() { p.batchProposerCircleTotal.Inc() - dbChunks, batchMeta, err := p.proposeBatchChunks() + batch, err := p.proposeBatch() if err != nil { p.proposeBatchFailureTotal.Inc() log.Error("proposeBatchChunks failed", "err", err) return } - if err := p.updateBatchInfoInDB(dbChunks, batchMeta); err != nil { - p.proposeBatchUpdateInfoFailureTotal.Inc() - log.Error("update batch info in db failed", "err", err) - } -} - -func (p *BatchProposer) updateBatchInfoInDB(dbChunks []*orm.Chunk, batchMeta *types.BatchMeta) error { - p.proposeBatchUpdateInfoTotal.Inc() - numChunks := len(dbChunks) - if numChunks <= 0 { - return nil - } - chunks, err := p.dbChunksToRollupChunks(dbChunks) - if err != nil { - return err + if batch == nil { + return } - - batchMeta.StartChunkIndex = dbChunks[0].Index - batchMeta.StartChunkHash = dbChunks[0].Hash - batchMeta.EndChunkIndex = dbChunks[numChunks-1].Index - batchMeta.EndChunkHash = dbChunks[numChunks-1].Hash err = p.db.Transaction(func(dbTX *gorm.DB) error { - batch, dbErr := p.batchOrm.InsertBatch(p.ctx, chunks, batchMeta, dbTX) + batch, dbErr := p.batchOrm.InsertBatch(p.ctx, batch, dbTX) if dbErr != nil { log.Warn("BatchProposer.updateBatchInfoInDB insert batch failure", - "start chunk index", batchMeta.StartChunkIndex, "end chunk index", batchMeta.EndChunkIndex, "error", dbErr) + "start chunk index", batch.StartChunkIndex, "end chunk index", batch.EndChunkIndex, "error", dbErr) return dbErr } - dbErr = p.chunkOrm.UpdateBatchHashInRange(p.ctx, batchMeta.StartChunkIndex, batchMeta.EndChunkIndex, batch.Hash, dbTX) + dbErr = p.chunkOrm.UpdateBatchHashInRange(p.ctx, batch.StartChunkIndex, batch.EndChunkIndex, batch.Hash, dbTX) if dbErr != nil { log.Warn("BatchProposer.UpdateBatchHashInRange update the chunk's batch hash failure", "hash", batch.Hash, "error", dbErr) return dbErr } return nil }) - return err + if err != nil { + p.proposeBatchUpdateInfoFailureTotal.Inc() + log.Error("update batch info in db failed", "err", err) + } } -func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, error) { +func (p *BatchProposer) proposeBatch() (*encoding.Batch, error) { unbatchedChunkIndex, err := p.batchOrm.GetFirstUnbatchedChunkIndex(p.ctx) if err != nil { - return nil, nil, err + return nil, err } // select at most p.maxChunkNumPerBatch chunks dbChunks, err := p.chunkOrm.GetChunksGEIndex(p.ctx, unbatchedChunkIndex, int(p.maxChunkNumPerBatch)) if err != nil { - return nil, nil, err + return nil, err } if len(dbChunks) == 0 { - return nil, nil, nil - } - - var totalL1CommitCalldataSize uint32 - var totalL1CommitGas uint64 - var totalChunks uint64 - var totalL1MessagePopped uint64 - var batchMeta types.BatchMeta - - parentBatch, err := p.batchOrm.GetLatestBatch(p.ctx) - if err != nil { - return nil, nil, err - } - - // Add extra gas costs - totalL1CommitGas += 100000 // constant to account for ops like _getAdmin, _implementation, _requireNotPaused, etc - totalL1CommitGas += 4 * 2100 // 4 one-time cold sload for commitBatch - totalL1CommitGas += 20000 // 1 time sstore - totalL1CommitGas += 21000 // base fee for tx - totalL1CommitGas += types.CalldataNonZeroByteGas // version in calldata - - // adjusting gas: - // add 1 time cold sload (2100 gas) for L1MessageQueue - // add 1 time cold address access (2600 gas) for L1MessageQueue - // minus 1 time warm sload (100 gas) & 1 time warm address access (100 gas) - totalL1CommitGas += (2100 + 2600 - 100 - 100) - if parentBatch != nil { - totalL1CommitGas += types.GetKeccak256Gas(uint64(len(parentBatch.BatchHeader))) // parent batch header hash - totalL1CommitGas += types.CalldataNonZeroByteGas * uint64(len(parentBatch.BatchHeader)) // parent batch header in calldata + return nil, nil } maxChunksThisBatch := p.maxChunkNumPerBatch @@ -211,25 +170,37 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er } } - for i, chunk := range dbChunks { - // metric values - batchMeta.TotalL1CommitGas = totalL1CommitGas - batchMeta.TotalL1CommitCalldataSize = totalL1CommitCalldataSize - - totalL1CommitCalldataSize += chunk.TotalL1CommitCalldataSize - totalL1CommitGas += chunk.TotalL1CommitGas - // adjust batch data hash gas cost - totalL1CommitGas -= types.GetKeccak256Gas(32 * totalChunks) - totalChunks++ - totalL1CommitGas += types.GetKeccak256Gas(32 * totalChunks) - // adjust batch header hash gas cost, batch header size: 89 + 32 * ceil(l1MessagePopped / 256) - totalL1CommitGas -= types.GetKeccak256Gas(89 + 32*(totalL1MessagePopped+255)/256) - totalL1CommitGas -= types.CalldataNonZeroByteGas * (32 * (totalL1MessagePopped + 255) / 256) - totalL1CommitGas -= types.GetMemoryExpansionCost(uint64(totalL1CommitCalldataSize)) - totalL1MessagePopped += uint64(chunk.TotalL1MessagesPoppedInChunk) - totalL1CommitGas += types.CalldataNonZeroByteGas * (32 * (totalL1MessagePopped + 255) / 256) - totalL1CommitGas += types.GetKeccak256Gas(89 + 32*(totalL1MessagePopped+255)/256) - totalL1CommitGas += types.GetMemoryExpansionCost(uint64(totalL1CommitCalldataSize)) + daChunks, err := p.getDAChunks(dbChunks) + if err != nil { + return nil, err + } + + parentDBBatch, err := p.batchOrm.GetLatestBatch(p.ctx) + if err != nil { + return nil, err + } + + var batch encoding.Batch + if parentDBBatch != nil { + batch.Index = parentDBBatch.Index + 1 + parentDABatch, err := codecv0.NewDABatchFromBytes(parentDBBatch.BatchHeader) + if err != nil { + return nil, err + } + batch.TotalL1MessagePoppedBefore = parentDABatch.TotalL1MessagePopped + batch.ParentBatchHash = common.HexToHash(parentDBBatch.Hash) + } + + for i, chunk := range daChunks { + batch.Chunks = append(batch.Chunks, chunk) + totalL1CommitCalldataSize, err := codecv0.EstimateBatchL1CommitCalldataSize(&batch) + if err != nil { + return nil, err + } + totalL1CommitGas, err := codecv0.EstimateBatchL1CommitGas(&batch) + if err != nil { + return nil, err + } totalOverEstimateL1CommitGas := uint64(p.gasCostIncreaseMultiplier * float64(totalL1CommitGas)) if totalL1CommitCalldataSize > p.maxL1CommitCalldataSizePerBatch || totalOverEstimateL1CommitGas > p.maxL1CommitGasPerBatch { @@ -237,7 +208,7 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er // If so, it indicates there are bugs in chunk-proposer, manual fix is needed. if i == 0 { if totalOverEstimateL1CommitGas > p.maxL1CommitGasPerBatch { - return nil, nil, fmt.Errorf( + return nil, fmt.Errorf( "the first chunk exceeds l1 commit gas limit; start block number: %v, end block number: %v, commit gas: %v, max commit gas limit: %v", dbChunks[0].StartBlockNumber, dbChunks[0].EndBlockNumber, @@ -246,7 +217,7 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er ) } if totalL1CommitCalldataSize > p.maxL1CommitCalldataSizePerBatch { - return nil, nil, fmt.Errorf( + return nil, fmt.Errorf( "the first chunk exceeds l1 commit calldata size limit; start block number: %v, end block number %v, calldata size: %v, max calldata size limit: %v", dbChunks[0].StartBlockNumber, dbChunks[0].EndBlockNumber, @@ -262,16 +233,32 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er "currentOverEstimateL1CommitGas", totalOverEstimateL1CommitGas, "maxL1CommitGasPerBatch", p.maxL1CommitGasPerBatch) - p.totalL1CommitGas.Set(float64(batchMeta.TotalL1CommitGas)) - p.totalL1CommitCalldataSize.Set(float64(batchMeta.TotalL1CommitCalldataSize)) - p.batchChunksNum.Set(float64(i)) - return dbChunks[:i], &batchMeta, nil + batch.Chunks = batch.Chunks[:len(batch.Chunks)-1] + batch.StartChunkIndex = dbChunks[0].Index + batch.EndChunkIndex = dbChunks[batch.NumChunks()-1].Index + batch.StartChunkHash = common.HexToHash(dbChunks[0].Hash) + batch.EndChunkHash = common.HexToHash(dbChunks[batch.NumChunks()-1].Hash) + + totalL1CommitCalldataSize, err := codecv0.EstimateBatchL1CommitCalldataSize(&batch) + if err != nil { + return nil, err + } + + totalL1CommitGas, err := codecv0.EstimateBatchL1CommitGas(&batch) + if err != nil { + return nil, err + } + + p.totalL1CommitGas.Set(float64(totalL1CommitCalldataSize)) + p.totalL1CommitCalldataSize.Set(float64(totalL1CommitGas)) + p.batchChunksNum.Set(float64(batch.NumChunks())) + return &batch, nil } } currentTimeSec := uint64(time.Now().Unix()) if dbChunks[0].StartBlockTime+p.batchTimeoutSec < currentTimeSec || - totalChunks == maxChunksThisBatch { + batch.NumChunks() == maxChunksThisBatch { if dbChunks[0].StartBlockTime+p.batchTimeoutSec < currentTimeSec { log.Warn("first block timeout", "start block number", dbChunks[0].StartBlockNumber, @@ -280,35 +267,48 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er ) } else { log.Info("reached maximum number of chunks in batch", - "chunk count", totalChunks, + "chunk count", batch.NumChunks(), ) } - batchMeta.TotalL1CommitGas = totalL1CommitGas - batchMeta.TotalL1CommitCalldataSize = totalL1CommitCalldataSize + totalL1CommitCalldataSize, err := codecv0.EstimateBatchL1CommitCalldataSize(&batch) + if err != nil { + return nil, err + } + + totalL1CommitGas, err := codecv0.EstimateBatchL1CommitGas(&batch) + if err != nil { + return nil, err + } + p.batchFirstBlockTimeoutReached.Inc() - p.totalL1CommitGas.Set(float64(batchMeta.TotalL1CommitGas)) - p.totalL1CommitCalldataSize.Set(float64(batchMeta.TotalL1CommitCalldataSize)) - p.batchChunksNum.Set(float64(len(dbChunks))) - return dbChunks, &batchMeta, nil + p.totalL1CommitGas.Set(float64(totalL1CommitCalldataSize)) + p.totalL1CommitCalldataSize.Set(float64(totalL1CommitGas)) + p.batchChunksNum.Set(float64(batch.NumChunks())) + + batch.StartChunkIndex = dbChunks[0].Index + batch.EndChunkIndex = dbChunks[batch.NumChunks()-1].Index + batch.StartChunkHash = common.HexToHash(dbChunks[0].Hash) + batch.EndChunkHash = common.HexToHash(dbChunks[batch.NumChunks()-1].Hash) + + return &batch, nil } log.Debug("pending chunks do not reach one of the constraints or contain a timeout block") p.batchChunksProposeNotEnoughTotal.Inc() - return nil, nil, nil + return nil, nil } -func (p *BatchProposer) dbChunksToRollupChunks(dbChunks []*orm.Chunk) ([]*types.Chunk, error) { - chunks := make([]*types.Chunk, len(dbChunks)) +func (p *BatchProposer) getDAChunks(dbChunks []*orm.Chunk) ([]*encoding.Chunk, error) { + chunks := make([]*encoding.Chunk, len(dbChunks)) for i, c := range dbChunks { - wrappedBlocks, err := p.l2BlockOrm.GetL2BlocksInRange(p.ctx, c.StartBlockNumber, c.EndBlockNumber) + blocks, err := p.l2BlockOrm.GetL2BlocksInRange(p.ctx, c.StartBlockNumber, c.EndBlockNumber) if err != nil { - log.Error("Failed to fetch wrapped blocks", - "start number", c.StartBlockNumber, "end number", c.EndBlockNumber, "error", err) + log.Error("Failed to fetch blocks", "start number", c.StartBlockNumber, "end number", c.EndBlockNumber, "error", err) return nil, err } - chunks[i] = &types.Chunk{ - Blocks: wrappedBlocks, + chunks[i] = &encoding.Chunk{ + Blocks: blocks, } } return chunks, nil diff --git a/rollup/internal/controller/watcher/batch_proposer_test.go b/rollup/internal/controller/watcher/batch_proposer_test.go index ccbbb69ffd..f780e8ec69 100644 --- a/rollup/internal/controller/watcher/batch_proposer_test.go +++ b/rollup/internal/controller/watcher/batch_proposer_test.go @@ -10,6 +10,7 @@ import ( "scroll-tech/common/database" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" "scroll-tech/rollup/internal/config" "scroll-tech/rollup/internal/orm" @@ -20,7 +21,7 @@ func testBatchProposerLimits(t *testing.T) { name string maxChunkNum uint64 maxL1CommitGas uint64 - maxL1CommitCalldataSize uint32 + maxL1CommitCalldataSize uint64 batchTimeoutSec uint64 forkBlock *big.Int expectedBatchesLen int @@ -104,7 +105,7 @@ func testBatchProposerLimits(t *testing.T) { defer database.CloseDB(db) l2BlockOrm := orm.NewL2Block(db) - err := l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ @@ -125,9 +126,9 @@ func testBatchProposerLimits(t *testing.T) { chunks, err := chunkOrm.GetChunksInRange(context.Background(), 0, 1) assert.NoError(t, err) assert.Equal(t, uint64(6042), chunks[0].TotalL1CommitGas) - assert.Equal(t, uint32(298), chunks[0].TotalL1CommitCalldataSize) - assert.Equal(t, uint64(94586), chunks[1].TotalL1CommitGas) - assert.Equal(t, uint32(5735), chunks[1].TotalL1CommitCalldataSize) + assert.Equal(t, uint64(298), chunks[0].TotalL1CommitCalldataSize) + assert.Equal(t, uint64(94618), chunks[1].TotalL1CommitGas) + assert.Equal(t, uint64(5737), chunks[1].TotalL1CommitCalldataSize) bp := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ MaxChunkNumPerBatch: tt.maxChunkNum, @@ -167,7 +168,7 @@ func testBatchCommitGasAndCalldataSizeEstimation(t *testing.T) { defer database.CloseDB(db) l2BlockOrm := orm.NewL2Block(db) - err := l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ @@ -186,9 +187,9 @@ func testBatchCommitGasAndCalldataSizeEstimation(t *testing.T) { chunks, err := chunkOrm.GetChunksInRange(context.Background(), 0, 1) assert.NoError(t, err) assert.Equal(t, uint64(6042), chunks[0].TotalL1CommitGas) - assert.Equal(t, uint32(298), chunks[0].TotalL1CommitCalldataSize) - assert.Equal(t, uint64(94586), chunks[1].TotalL1CommitGas) - assert.Equal(t, uint32(5735), chunks[1].TotalL1CommitCalldataSize) + assert.Equal(t, uint64(298), chunks[0].TotalL1CommitCalldataSize) + assert.Equal(t, uint64(94618), chunks[1].TotalL1CommitGas) + assert.Equal(t, uint64(5737), chunks[1].TotalL1CommitCalldataSize) bp := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ MaxChunkNumPerBatch: 10, @@ -216,6 +217,6 @@ func testBatchCommitGasAndCalldataSizeEstimation(t *testing.T) { assert.Equal(t, types.ProvingTaskUnassigned, types.ProvingStatus(chunk.ProvingStatus)) } - assert.Equal(t, uint64(254562), batches[0].TotalL1CommitGas) - assert.Equal(t, uint32(6033), batches[0].TotalL1CommitCalldataSize) + assert.Equal(t, uint64(258383), batches[0].TotalL1CommitGas) + assert.Equal(t, uint64(6035), batches[0].TotalL1CommitCalldataSize) } diff --git a/rollup/internal/controller/watcher/chunk_proposer.go b/rollup/internal/controller/watcher/chunk_proposer.go index dd47bb75c6..a51ebb6870 100644 --- a/rollup/internal/controller/watcher/chunk_proposer.go +++ b/rollup/internal/controller/watcher/chunk_proposer.go @@ -2,49 +2,23 @@ package watcher import ( "context" - "errors" "fmt" "time" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - gethTypes "github.com/scroll-tech/go-ethereum/core/types" "github.com/scroll-tech/go-ethereum/log" "github.com/scroll-tech/go-ethereum/params" "gorm.io/gorm" "scroll-tech/common/forks" - "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/rollup/internal/config" "scroll-tech/rollup/internal/orm" ) -// chunkRowConsumption is map(sub-circuit name => sub-circuit row count) -type chunkRowConsumption map[string]uint64 - -// add accumulates row consumption per sub-circuit -func (crc *chunkRowConsumption) add(rowConsumption *gethTypes.RowConsumption) error { - if rowConsumption == nil { - return errors.New("rowConsumption is ") - } - for _, subCircuit := range *rowConsumption { - (*crc)[subCircuit.Name] += subCircuit.RowNumber - } - return nil -} - -// max finds the maximum row consumption among all sub-circuits -func (crc *chunkRowConsumption) max() uint64 { - var max uint64 - for _, value := range *crc { - if value > max { - max = value - } - } - return max -} - // ChunkProposer proposes chunks based on available unchunked blocks. type ChunkProposer struct { ctx context.Context @@ -69,7 +43,6 @@ type ChunkProposer struct { chunkTxNum prometheus.Gauge chunkEstimateL1CommitGas prometheus.Gauge totalL1CommitCalldataSize prometheus.Gauge - totalTxGasUsed prometheus.Gauge maxTxConsumption prometheus.Gauge chunkBlocksNum prometheus.Gauge chunkFirstBlockTimeoutReached prometheus.Counter @@ -130,10 +103,6 @@ func NewChunkProposer(ctx context.Context, cfg *config.ChunkProposerConfig, chai Name: "rollup_propose_chunk_total_l1_commit_call_data_size", Help: "The total l1 commit call data size", }), - totalTxGasUsed: promauto.With(reg).NewGauge(prometheus.GaugeOpts{ - Name: "rollup_propose_chunk_total_tx_gas_used", - Help: "The total tx gas used", - }), maxTxConsumption: promauto.With(reg).NewGauge(prometheus.GaugeOpts{ Name: "rollup_propose_chunk_max_tx_consumption", Help: "The max tx consumption", @@ -169,7 +138,7 @@ func (p *ChunkProposer) TryProposeChunk() { } } -func (p *ChunkProposer) updateChunkInfoInDB(chunk *types.Chunk) error { +func (p *ChunkProposer) updateChunkInfoInDB(chunk *encoding.Chunk) error { if chunk == nil { return nil } @@ -178,11 +147,11 @@ func (p *ChunkProposer) updateChunkInfoInDB(chunk *types.Chunk) error { err := p.db.Transaction(func(dbTX *gorm.DB) error { dbChunk, err := p.chunkOrm.InsertChunk(p.ctx, chunk, dbTX) if err != nil { - log.Warn("ChunkProposer.InsertChunk failed", "chunk hash", chunk.Hash) + log.Warn("ChunkProposer.InsertChunk failed", "err", err) return err } if err := p.l2BlockOrm.UpdateChunkHashInRange(p.ctx, dbChunk.StartBlockNumber, dbChunk.EndBlockNumber, dbChunk.Hash, dbTX); err != nil { - log.Error("failed to update chunk_hash for l2_blocks", "chunk hash", chunk.Hash, "start block", 0, "end block", 0, "err", err) + log.Error("failed to update chunk_hash for l2_blocks", "chunk hash", dbChunk.Hash, "start block", dbChunk.StartBlockNumber, "end block", dbChunk.EndBlockNumber, "err", err) return err } return nil @@ -190,7 +159,7 @@ func (p *ChunkProposer) updateChunkInfoInDB(chunk *types.Chunk) error { return err } -func (p *ChunkProposer) proposeChunk() (*types.Chunk, error) { +func (p *ChunkProposer) proposeChunk() (*encoding.Chunk, error) { unchunkedBlockHeight, err := p.chunkOrm.GetUnchunkedBlockHeight(p.ctx) if err != nil { return nil, err @@ -203,7 +172,7 @@ func (p *ChunkProposer) proposeChunk() (*types.Chunk, error) { } // select at most maxBlocksThisChunk blocks - blocks, err := p.l2BlockOrm.GetL2WrappedBlocksGEHeight(p.ctx, unchunkedBlockHeight, int(maxBlocksThisChunk)) + blocks, err := p.l2BlockOrm.GetL2BlocksGEHeight(p.ctx, unchunkedBlockHeight, int(maxBlocksThisChunk)) if err != nil { return nil, err } @@ -212,30 +181,28 @@ func (p *ChunkProposer) proposeChunk() (*types.Chunk, error) { return nil, nil } - var chunk types.Chunk - var totalTxGasUsed uint64 - var totalTxNum uint64 - var totalL1CommitCalldataSize uint64 - var totalL1CommitGas uint64 - crc := chunkRowConsumption{} - + var chunk encoding.Chunk for i, block := range blocks { - // metric values - lastTotalTxNum := totalTxNum - lastTotalL1CommitGas := totalL1CommitGas - lastCrcMax := crc.max() - lastTotalL1CommitCalldataSize := totalL1CommitCalldataSize - lastTotalTxGasUsed := totalTxGasUsed - - totalTxGasUsed += block.Header.GasUsed - totalTxNum += uint64(len(block.Transactions)) - totalL1CommitCalldataSize += block.EstimateL1CommitCalldataSize() - totalL1CommitGas = chunk.EstimateL1CommitGas() - totalOverEstimateL1CommitGas := uint64(p.gasCostIncreaseMultiplier * float64(totalL1CommitGas)) - if err := crc.add(block.RowConsumption); err != nil { - return nil, fmt.Errorf("chunk-proposer failed to update chunk row consumption: %v", err) + chunk.Blocks = append(chunk.Blocks, block) + + crcMax, err := chunk.CrcMax() + if err != nil { + return nil, fmt.Errorf("failed to get crc max: %w", err) + } + + totalTxNum := chunk.NumTransactions() + + totalL1CommitCalldataSize, err := codecv0.EstimateChunkL1CommitCalldataSize(&chunk) + if err != nil { + return nil, fmt.Errorf("failed to estimate chunk L1 commit calldata size: %w", err) } - crcMax := crc.max() + + totalL1CommitGas, err := codecv0.EstimateChunkL1CommitGas(&chunk) + if err != nil { + return nil, fmt.Errorf("failed to estimate chunk L1 commit gas: %w", err) + } + + totalOverEstimateL1CommitGas := uint64(p.gasCostIncreaseMultiplier * float64(totalL1CommitGas)) if totalTxNum > p.maxTxNumPerChunk || totalL1CommitCalldataSize > p.maxL1CommitCalldataSizePerChunk || @@ -273,9 +240,8 @@ func (p *ChunkProposer) proposeChunk() (*types.Chunk, error) { if crcMax > p.maxRowConsumptionPerChunk { return nil, fmt.Errorf( - "the first block exceeds row consumption limit; block number: %v, row consumption: %v, max: %v, limit: %v", + "the first block exceeds row consumption limit; block number: %v, crc max: %v, limit: %v", block.Header.Number, - crc, crcMax, p.maxRowConsumptionPerChunk, ) @@ -290,18 +256,32 @@ func (p *ChunkProposer) proposeChunk() (*types.Chunk, error) { "currentOverEstimateL1CommitGas", totalOverEstimateL1CommitGas, "maxL1CommitGasPerChunk", p.maxL1CommitGasPerChunk, "chunkRowConsumptionMax", crcMax, - "chunkRowConsumption", crc, "p.maxRowConsumptionPerChunk", p.maxRowConsumptionPerChunk) - p.chunkTxNum.Set(float64(lastTotalTxNum)) - p.chunkEstimateL1CommitGas.Set(float64(lastTotalL1CommitGas)) - p.totalL1CommitCalldataSize.Set(float64(lastTotalL1CommitCalldataSize)) - p.maxTxConsumption.Set(float64(lastCrcMax)) - p.totalTxGasUsed.Set(float64(lastTotalTxGasUsed)) + chunk.Blocks = chunk.Blocks[:len(chunk.Blocks)-1] + + crcMax, err := chunk.CrcMax() + if err != nil { + return nil, fmt.Errorf("failed to get crc max: %w", err) + } + + totalL1CommitCalldataSize, err := codecv0.EstimateChunkL1CommitCalldataSize(&chunk) + if err != nil { + return nil, fmt.Errorf("failed to estimate chunk L1 commit calldata size: %w", err) + } + + totalL1CommitGas, err := codecv0.EstimateChunkL1CommitGas(&chunk) + if err != nil { + return nil, fmt.Errorf("failed to estimate chunk L1 commit gas: %w", err) + } + + p.chunkTxNum.Set(float64(chunk.NumTransactions())) + p.chunkEstimateL1CommitGas.Set(float64(totalL1CommitCalldataSize)) + p.totalL1CommitCalldataSize.Set(float64(totalL1CommitGas)) + p.maxTxConsumption.Set(float64(crcMax)) p.chunkBlocksNum.Set(float64(len(chunk.Blocks))) return &chunk, nil } - chunk.Blocks = append(chunk.Blocks, block) } currentTimeSec := uint64(time.Now().Unix()) @@ -320,12 +300,26 @@ func (p *ChunkProposer) proposeChunk() (*types.Chunk, error) { ) } + crcMax, err := chunk.CrcMax() + if err != nil { + return nil, fmt.Errorf("failed to get crc max: %w", err) + } + + totalL1CommitCalldataSize, err := codecv0.EstimateChunkL1CommitCalldataSize(&chunk) + if err != nil { + return nil, fmt.Errorf("failed to estimate chunk L1 commit calldata size: %w", err) + } + + totalL1CommitGas, err := codecv0.EstimateChunkL1CommitGas(&chunk) + if err != nil { + return nil, fmt.Errorf("failed to estimate chunk L1 commit gas: %w", err) + } + p.chunkFirstBlockTimeoutReached.Inc() - p.chunkTxNum.Set(float64(totalTxNum)) - p.chunkEstimateL1CommitGas.Set(float64(totalL1CommitGas)) - p.totalL1CommitCalldataSize.Set(float64(totalL1CommitCalldataSize)) - p.maxTxConsumption.Set(float64(crc.max())) - p.totalTxGasUsed.Set(float64(totalTxGasUsed)) + p.chunkTxNum.Set(float64(chunk.NumTransactions())) + p.chunkEstimateL1CommitGas.Set(float64(totalL1CommitCalldataSize)) + p.totalL1CommitCalldataSize.Set(float64(totalL1CommitGas)) + p.maxTxConsumption.Set(float64(crcMax)) p.chunkBlocksNum.Set(float64(len(chunk.Blocks))) return &chunk, nil } diff --git a/rollup/internal/controller/watcher/chunk_proposer_test.go b/rollup/internal/controller/watcher/chunk_proposer_test.go index c2417afd43..6bf8d0d4ca 100644 --- a/rollup/internal/controller/watcher/chunk_proposer_test.go +++ b/rollup/internal/controller/watcher/chunk_proposer_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "scroll-tech/common/database" - "scroll-tech/common/types" + "scroll-tech/common/types/encoding" "scroll-tech/rollup/internal/config" "scroll-tech/rollup/internal/orm" @@ -115,7 +115,7 @@ func testChunkProposerLimits(t *testing.T) { name: "MaxL1CommitGasPerChunkIsFirstBlock", maxBlockNum: 10, maxTxNum: 10000, - maxL1CommitGas: 60, + maxL1CommitGas: 7250, maxL1CommitCalldataSize: 1000000, maxRowConsumption: 1000000, chunkTimeoutSec: 1000000000000, @@ -164,7 +164,7 @@ func testChunkProposerLimits(t *testing.T) { defer database.CloseDB(db) l2BlockOrm := orm.NewL2Block(db) - err := l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err := l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ @@ -187,11 +187,12 @@ func testChunkProposerLimits(t *testing.T) { if len(chunks) > 0 { blockOrm := orm.NewL2Block(db) - blocks, err := blockOrm.GetL2Blocks(context.Background(), map[string]interface{}{}, []string{"number ASC"}, tt.expectedBlocksInFirstChunk) + chunkHashes, err := blockOrm.GetChunkHashes(context.Background(), tt.expectedBlocksInFirstChunk) assert.NoError(t, err) - assert.Len(t, blocks, tt.expectedBlocksInFirstChunk) - for _, block := range blocks { - assert.Equal(t, chunks[0].Hash, block.ChunkHash) + assert.Len(t, chunkHashes, tt.expectedBlocksInFirstChunk) + firstChunkHash := chunks[0].Hash + for _, chunkHash := range chunkHashes { + assert.Equal(t, firstChunkHash, chunkHash) } } }) diff --git a/rollup/internal/controller/watcher/l2_watcher.go b/rollup/internal/controller/watcher/l2_watcher.go index 3a6a832aae..01c3447b1f 100644 --- a/rollup/internal/controller/watcher/l2_watcher.go +++ b/rollup/internal/controller/watcher/l2_watcher.go @@ -16,7 +16,8 @@ import ( "github.com/scroll-tech/go-ethereum/rpc" "gorm.io/gorm" - "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" bridgeAbi "scroll-tech/rollup/abi" "scroll-tech/rollup/internal/orm" @@ -77,7 +78,7 @@ func (w *L2WatcherClient) TryFetchRunningMissingBlocks(blockHeight uint64) { to = blockHeight } - if err = w.getAndStoreBlockTraces(w.ctx, from, to); err != nil { + if err = w.getAndStoreBlocks(w.ctx, from, to); err != nil { log.Error("fail to getAndStoreBlockTraces", "from", from, "to", to, "err", err) return } @@ -101,26 +102,29 @@ func txsToTxsData(txs gethTypes.Transactions) []*gethTypes.TransactionData { } txsData[i] = &gethTypes.TransactionData{ - Type: tx.Type(), - TxHash: tx.Hash().String(), - Nonce: nonce, - ChainId: (*hexutil.Big)(tx.ChainId()), - Gas: tx.Gas(), - GasPrice: (*hexutil.Big)(tx.GasPrice()), - To: tx.To(), - Value: (*hexutil.Big)(tx.Value()), - Data: hexutil.Encode(tx.Data()), - IsCreate: tx.To() == nil, - V: (*hexutil.Big)(v), - R: (*hexutil.Big)(r), - S: (*hexutil.Big)(s), + Type: tx.Type(), + TxHash: tx.Hash().String(), + Nonce: nonce, + ChainId: (*hexutil.Big)(tx.ChainId()), + Gas: tx.Gas(), + GasPrice: (*hexutil.Big)(tx.GasPrice()), + GasTipCap: (*hexutil.Big)(tx.GasTipCap()), + GasFeeCap: (*hexutil.Big)(tx.GasFeeCap()), + To: tx.To(), + Value: (*hexutil.Big)(tx.Value()), + Data: hexutil.Encode(tx.Data()), + IsCreate: tx.To() == nil, + AccessList: tx.AccessList(), + V: (*hexutil.Big)(v), + R: (*hexutil.Big)(r), + S: (*hexutil.Big)(s), } } return txsData } -func (w *L2WatcherClient) getAndStoreBlockTraces(ctx context.Context, from, to uint64) error { - var blocks []*types.WrappedBlock +func (w *L2WatcherClient) getAndStoreBlocks(ctx context.Context, from, to uint64) error { + var blocks []*encoding.Block for number := from; number <= to; number++ { log.Debug("retrieving block", "height", number) block, err := w.GetBlockByNumberOrHash(ctx, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(number))) @@ -137,7 +141,7 @@ func (w *L2WatcherClient) getAndStoreBlockTraces(ctx context.Context, from, to u if err3 != nil { return fmt.Errorf("failed to get withdrawRoot: %v. number: %v", err3, number) } - blocks = append(blocks, &types.WrappedBlock{ + blocks = append(blocks, &encoding.Block{ Header: block.Header(), Transactions: txsToTxsData(block.Transactions()), WithdrawRoot: common.BytesToHash(withdrawRoot), @@ -147,7 +151,11 @@ func (w *L2WatcherClient) getAndStoreBlockTraces(ctx context.Context, from, to u if len(blocks) > 0 { for _, block := range blocks { - w.metrics.rollupL2BlockL1CommitCalldataSize.Set(float64(block.EstimateL1CommitCalldataSize())) + blockL1CommitCalldataSize, err := codecv0.EstimateBlockL1CommitCalldataSize(block) + if err != nil { + return fmt.Errorf("failed to estimate block L1 commit calldata size: %v", err) + } + w.metrics.rollupL2BlockL1CommitCalldataSize.Set(float64(blockL1CommitCalldataSize)) } if err := w.l2BlockOrm.InsertL2Blocks(w.ctx, blocks); err != nil { return fmt.Errorf("failed to batch insert BlockTraces: %v", err) diff --git a/rollup/internal/controller/watcher/watcher_test.go b/rollup/internal/controller/watcher/watcher_test.go index 68af7c3fba..0e73bad703 100644 --- a/rollup/internal/controller/watcher/watcher_test.go +++ b/rollup/internal/controller/watcher/watcher_test.go @@ -12,7 +12,7 @@ import ( "scroll-tech/common/database" "scroll-tech/common/docker" - "scroll-tech/common/types" + "scroll-tech/common/types/encoding" "scroll-tech/database/migrate" @@ -29,8 +29,8 @@ var ( l2Cli *ethclient.Client // block trace - wrappedBlock1 *types.WrappedBlock - wrappedBlock2 *types.WrappedBlock + block1 *encoding.Block + block2 *encoding.Block ) func setupEnv(t *testing.T) (err error) { @@ -62,8 +62,8 @@ func setupEnv(t *testing.T) (err error) { return err } // unmarshal blockTrace - wrappedBlock1 = &types.WrappedBlock{} - if err = json.Unmarshal(templateBlockTrace1, wrappedBlock1); err != nil { + block1 = &encoding.Block{} + if err = json.Unmarshal(templateBlockTrace1, block1); err != nil { return err } @@ -72,8 +72,8 @@ func setupEnv(t *testing.T) (err error) { return err } // unmarshal blockTrace - wrappedBlock2 = &types.WrappedBlock{} - if err = json.Unmarshal(templateBlockTrace2, wrappedBlock2); err != nil { + block2 = &encoding.Block{} + if err = json.Unmarshal(templateBlockTrace2, block2); err != nil { return err } return err diff --git a/rollup/internal/orm/batch.go b/rollup/internal/orm/batch.go index ccd5873b8e..bfc5bb197a 100644 --- a/rollup/internal/orm/batch.go +++ b/rollup/internal/orm/batch.go @@ -8,16 +8,15 @@ import ( "time" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/common/types/message" "scroll-tech/common/utils" - "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/log" "gorm.io/gorm" ) -const defaultBatchHeaderVersion = 0 - // Batch represents a batch of chunks. type Batch struct { db *gorm.DB `gorm:"column:-"` @@ -55,7 +54,7 @@ type Batch struct { // metadata TotalL1CommitGas uint64 `json:"total_l1_commit_gas" gorm:"column:total_l1_commit_gas;default:0"` - TotalL1CommitCalldataSize uint32 `json:"total_l1_commit_calldata_size" gorm:"column:total_l1_commit_calldata_size;default:0"` + TotalL1CommitCalldataSize uint64 `json:"total_l1_commit_calldata_size" gorm:"column:total_l1_commit_calldata_size;default:0"` CreatedAt time.Time `json:"created_at" gorm:"column:created_at"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"column:deleted_at;default:NULL"` @@ -227,68 +226,52 @@ func (o *Batch) GetBatchByIndex(ctx context.Context, index uint64) (*Batch, erro } // InsertBatch inserts a new batch into the database. -func (o *Batch) InsertBatch(ctx context.Context, chunks []*types.Chunk, batchMeta *types.BatchMeta, dbTX ...*gorm.DB) (*Batch, error) { - if len(chunks) == 0 { - return nil, errors.New("invalid args") +func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, dbTX ...*gorm.DB) (*Batch, error) { + if batch == nil { + return nil, errors.New("invalid args: batch is nil") } - parentBatch, err := o.GetLatestBatch(ctx) + daBatch, err := codecv0.NewDABatch(batch) if err != nil { - log.Error("failed to get the latest batch", "err", err) + log.Error("failed to create new DA batch", + "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore, + "parent hash", batch.ParentBatchHash, "number of chunks", len(batch.Chunks), "err", err) return nil, err } - var batchIndex uint64 - var parentBatchHash common.Hash - var totalL1MessagePoppedBefore uint64 - var version uint8 = defaultBatchHeaderVersion - - // if parentBatch==nil then err==gorm.ErrRecordNotFound, which means there's - // not batch record in the db, we then use default empty values for the creating batch; - // if parentBatch!=nil then err=nil, then we fill the parentBatch-related data into the creating batch - if parentBatch != nil { - batchIndex = parentBatch.Index + 1 - parentBatchHash = common.HexToHash(parentBatch.Hash) - - var parentBatchHeader *types.BatchHeader - parentBatchHeader, err = types.DecodeBatchHeader(parentBatch.BatchHeader) - if err != nil { - log.Error("failed to decode parent batch header", "index", parentBatch.Index, "hash", parentBatch.Hash, "err", err) - return nil, err - } - - totalL1MessagePoppedBefore = parentBatchHeader.TotalL1MessagePopped() - version = parentBatchHeader.Version() + totalL1CommitGas, err := codecv0.EstimateBatchL1CommitGas(batch) + if err != nil { + log.Error("failed to estimate batch L1 commit gas", + "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore, + "parent hash", batch.ParentBatchHash, "number of chunks", len(batch.Chunks), "err", err) + return nil, fmt.Errorf("Batch.InsertBatch error: %w", err) } - batchHeader, err := types.NewBatchHeader(version, batchIndex, totalL1MessagePoppedBefore, parentBatchHash, chunks) + totalL1CommitCalldataSize, err := codecv0.EstimateBatchL1CommitCalldataSize(batch) if err != nil { - log.Error("failed to create batch header", - "index", batchIndex, "total l1 message popped before", totalL1MessagePoppedBefore, - "parent hash", parentBatchHash, "number of chunks", len(chunks), "err", err) - return nil, err + log.Error("failed to estimate batch L1 commit calldata size", + "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore, + "parent hash", batch.ParentBatchHash, "number of chunks", len(batch.Chunks), "err", err) + return nil, fmt.Errorf("Batch.InsertBatch error: %w", err) } - numChunks := len(chunks) - lastChunkBlockNum := len(chunks[numChunks-1].Blocks) - newBatch := Batch{ - Index: batchIndex, - Hash: batchHeader.Hash().Hex(), - StartChunkHash: batchMeta.StartChunkHash, - StartChunkIndex: batchMeta.StartChunkIndex, - EndChunkHash: batchMeta.EndChunkHash, - EndChunkIndex: batchMeta.EndChunkIndex, - StateRoot: chunks[numChunks-1].Blocks[lastChunkBlockNum-1].Header.Root.Hex(), - WithdrawRoot: chunks[numChunks-1].Blocks[lastChunkBlockNum-1].WithdrawRoot.Hex(), - ParentBatchHash: parentBatchHash.Hex(), - BatchHeader: batchHeader.Encode(), + Index: batch.Index, + Hash: daBatch.Hash().Hex(), + StartChunkHash: batch.StartChunkHash.Hex(), + StartChunkIndex: batch.StartChunkIndex, + EndChunkHash: batch.EndChunkHash.Hex(), + EndChunkIndex: batch.EndChunkIndex, + StateRoot: batch.StateRoot().Hex(), + WithdrawRoot: batch.WithdrawRoot().Hex(), + ParentBatchHash: batch.ParentBatchHash.Hex(), + BatchHeader: daBatch.Encode(), ChunkProofsStatus: int16(types.ChunkProofsStatusPending), ProvingStatus: int16(types.ProvingTaskUnassigned), RollupStatus: int16(types.RollupPending), OracleStatus: int16(types.GasOraclePending), - TotalL1CommitGas: batchMeta.TotalL1CommitGas, - TotalL1CommitCalldataSize: batchMeta.TotalL1CommitCalldataSize, + TotalL1CommitGas: totalL1CommitGas, + TotalL1CommitCalldataSize: totalL1CommitCalldataSize, } db := o.db diff --git a/rollup/internal/orm/chunk.go b/rollup/internal/orm/chunk.go index 49778fdf1c..b38f2b1361 100644 --- a/rollup/internal/orm/chunk.go +++ b/rollup/internal/orm/chunk.go @@ -7,6 +7,8 @@ import ( "time" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "github.com/scroll-tech/go-ethereum/log" "gorm.io/gorm" @@ -25,7 +27,7 @@ type Chunk struct { EndBlockHash string `json:"end_block_hash" gorm:"column:end_block_hash"` StartBlockTime uint64 `json:"start_block_time" gorm:"column:start_block_time"` TotalL1MessagesPoppedBefore uint64 `json:"total_l1_messages_popped_before" gorm:"column:total_l1_messages_popped_before"` - TotalL1MessagesPoppedInChunk uint32 `json:"total_l1_messages_popped_in_chunk" gorm:"column:total_l1_messages_popped_in_chunk"` + TotalL1MessagesPoppedInChunk uint64 `json:"total_l1_messages_popped_in_chunk" gorm:"column:total_l1_messages_popped_in_chunk"` ParentChunkHash string `json:"parent_chunk_hash" gorm:"column:parent_chunk_hash"` StateRoot string `json:"state_root" gorm:"column:state_root"` ParentChunkStateRoot string `json:"parent_chunk_state_root" gorm:"column:parent_chunk_state_root"` @@ -43,8 +45,8 @@ type Chunk struct { // metadata TotalL2TxGas uint64 `json:"total_l2_tx_gas" gorm:"column:total_l2_tx_gas"` - TotalL2TxNum uint32 `json:"total_l2_tx_num" gorm:"column:total_l2_tx_num"` - TotalL1CommitCalldataSize uint32 `json:"total_l1_commit_calldata_size" gorm:"column:total_l1_commit_calldata_size"` + TotalL2TxNum uint64 `json:"total_l2_tx_num" gorm:"column:total_l2_tx_num"` + TotalL1CommitCalldataSize uint64 `json:"total_l1_commit_calldata_size" gorm:"column:total_l1_commit_calldata_size"` TotalL1CommitGas uint64 `json:"total_l1_commit_gas" gorm:"column:total_l1_commit_gas"` CreatedAt time.Time `json:"created_at" gorm:"column:created_at"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` @@ -135,7 +137,7 @@ func (o *Chunk) GetChunksGEIndex(ctx context.Context, index uint64, limit int) ( } // InsertChunk inserts a new chunk into the database. -func (o *Chunk) InsertChunk(ctx context.Context, chunk *types.Chunk, dbTX ...*gorm.DB) (*Chunk, error) { +func (o *Chunk) InsertChunk(ctx context.Context, chunk *encoding.Chunk, dbTX ...*gorm.DB) (*Chunk, error) { if chunk == nil || len(chunk.Blocks) == 0 { return nil, errors.New("invalid args") } @@ -155,41 +157,50 @@ func (o *Chunk) InsertChunk(ctx context.Context, chunk *types.Chunk, dbTX ...*go // if parentChunk!=nil then err=nil, then we fill the parentChunk-related data into the creating chunk if parentChunk != nil { chunkIndex = parentChunk.Index + 1 - totalL1MessagePoppedBefore = parentChunk.TotalL1MessagesPoppedBefore + uint64(parentChunk.TotalL1MessagesPoppedInChunk) + totalL1MessagePoppedBefore = parentChunk.TotalL1MessagesPoppedBefore + parentChunk.TotalL1MessagesPoppedInChunk parentChunkHash = parentChunk.Hash parentChunkStateRoot = parentChunk.StateRoot } - hash, err := chunk.Hash(totalL1MessagePoppedBefore) + daChunk, err := codecv0.NewDAChunk(chunk, totalL1MessagePoppedBefore) if err != nil { - log.Error("failed to get chunk hash", "err", err) + log.Error("failed to initialize new DA chunk", "err", err) return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) } - var totalL2TxGas uint64 - var totalL2TxNum uint64 - var totalL1CommitCalldataSize uint64 - for _, block := range chunk.Blocks { - totalL2TxGas += block.Header.GasUsed - totalL2TxNum += block.NumL2Transactions() - totalL1CommitCalldataSize += block.EstimateL1CommitCalldataSize() + daChunkHash, err := daChunk.Hash() + if err != nil { + log.Error("failed to get DA chunk hash", "err", err) + return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) + } + + totalL1CommitCalldataSize, err := codecv0.EstimateChunkL1CommitCalldataSize(chunk) + if err != nil { + log.Error("failed to estimate chunk L1 commit calldata size", "err", err) + return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) + } + + totalL1CommitGas, err := codecv0.EstimateChunkL1CommitGas(chunk) + if err != nil { + log.Error("failed to estimate chunk L1 commit gas", "err", err) + return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) } numBlocks := len(chunk.Blocks) newChunk := Chunk{ Index: chunkIndex, - Hash: hash.Hex(), + Hash: daChunkHash.Hex(), StartBlockNumber: chunk.Blocks[0].Header.Number.Uint64(), StartBlockHash: chunk.Blocks[0].Header.Hash().Hex(), EndBlockNumber: chunk.Blocks[numBlocks-1].Header.Number.Uint64(), EndBlockHash: chunk.Blocks[numBlocks-1].Header.Hash().Hex(), - TotalL2TxGas: totalL2TxGas, - TotalL2TxNum: uint32(totalL2TxNum), - TotalL1CommitCalldataSize: uint32(totalL1CommitCalldataSize), - TotalL1CommitGas: chunk.EstimateL1CommitGas(), + TotalL2TxGas: chunk.L2GasUsed(), + TotalL2TxNum: chunk.NumL2Transactions(), + TotalL1CommitCalldataSize: totalL1CommitCalldataSize, + TotalL1CommitGas: totalL1CommitGas, StartBlockTime: chunk.Blocks[0].Header.Time, TotalL1MessagesPoppedBefore: totalL1MessagePoppedBefore, - TotalL1MessagesPoppedInChunk: uint32(chunk.NumL1Messages(totalL1MessagePoppedBefore)), + TotalL1MessagesPoppedInChunk: chunk.NumL1Messages(totalL1MessagePoppedBefore), ParentChunkHash: parentChunkHash, StateRoot: chunk.Blocks[numBlocks-1].Header.Root.Hex(), ParentChunkStateRoot: parentChunkStateRoot, diff --git a/rollup/internal/orm/l2_block.go b/rollup/internal/orm/l2_block.go index 6f1e019e3a..1fa8bd2203 100644 --- a/rollup/internal/orm/l2_block.go +++ b/rollup/internal/orm/l2_block.go @@ -11,7 +11,7 @@ import ( "github.com/scroll-tech/go-ethereum/log" "gorm.io/gorm" - "scroll-tech/common/types" + "scroll-tech/common/types/encoding" ) // L2Block represents a l2 block in the database. @@ -64,10 +64,10 @@ func (o *L2Block) GetL2BlocksLatestHeight(ctx context.Context) (uint64, error) { return maxNumber, nil } -// GetL2WrappedBlocksGEHeight retrieves L2 blocks that have a block number greater than or equal to the given height. -// The blocks are converted into WrappedBlock format for output. +// GetL2BlocksGEHeight retrieves L2 blocks that have a block number greater than or equal to the given height. +// The blocks are converted into encoding.Block format for output. // The returned blocks are sorted in ascending order by their block number. -func (o *L2Block) GetL2WrappedBlocksGEHeight(ctx context.Context, height uint64, limit int) ([]*types.WrappedBlock, error) { +func (o *L2Block) GetL2BlocksGEHeight(ctx context.Context, height uint64, limit int) ([]*encoding.Block, error) { db := o.db.WithContext(ctx) db = db.Model(&L2Block{}) db = db.Select("header, transactions, withdraw_root, row_consumption") @@ -80,65 +80,64 @@ func (o *L2Block) GetL2WrappedBlocksGEHeight(ctx context.Context, height uint64, var l2Blocks []L2Block if err := db.Find(&l2Blocks).Error; err != nil { - return nil, fmt.Errorf("L2Block.GetL2WrappedBlocksGEHeight error: %w", err) + return nil, fmt.Errorf("L2Block.GetL2BlocksGEHeight error: %w", err) } - var wrappedBlocks []*types.WrappedBlock + var blocks []*encoding.Block for _, v := range l2Blocks { - var wrappedBlock types.WrappedBlock + var block encoding.Block - if err := json.Unmarshal([]byte(v.Transactions), &wrappedBlock.Transactions); err != nil { - return nil, fmt.Errorf("L2Block.GetL2WrappedBlocksGEHeight error: %w", err) + if err := json.Unmarshal([]byte(v.Transactions), &block.Transactions); err != nil { + return nil, fmt.Errorf("L2Block.GetL2BlocksGEHeight error: %w", err) } - wrappedBlock.Header = &gethTypes.Header{} - if err := json.Unmarshal([]byte(v.Header), wrappedBlock.Header); err != nil { - return nil, fmt.Errorf("L2Block.GetL2WrappedBlocksGEHeight error: %w", err) + block.Header = &gethTypes.Header{} + if err := json.Unmarshal([]byte(v.Header), block.Header); err != nil { + return nil, fmt.Errorf("L2Block.GetL2BlocksGEHeight error: %w", err) } - wrappedBlock.WithdrawRoot = common.HexToHash(v.WithdrawRoot) + block.WithdrawRoot = common.HexToHash(v.WithdrawRoot) - if err := json.Unmarshal([]byte(v.RowConsumption), &wrappedBlock.RowConsumption); err != nil { - return nil, fmt.Errorf("L2Block.GetL2WrappedBlocksGEHeight error: %w", err) + if err := json.Unmarshal([]byte(v.RowConsumption), &block.RowConsumption); err != nil { + return nil, fmt.Errorf("L2Block.GetL2BlocksGEHeight error: %w", err) } - wrappedBlocks = append(wrappedBlocks, &wrappedBlock) + blocks = append(blocks, &block) } - return wrappedBlocks, nil + return blocks, nil } -// GetL2Blocks retrieves selected L2Blocks from the database. -// The returned L2Blocks are sorted in ascending order by their block number. -func (o *L2Block) GetL2Blocks(ctx context.Context, fields map[string]interface{}, orderByList []string, limit int) ([]*L2Block, error) { +// GetChunkHashes retrieves selected chunk hashes from the database. +// The returned chunk hashes are sorted in ascending order by their block number. +// For unit test +func (o *L2Block) GetChunkHashes(ctx context.Context, limit int) ([]string, error) { db := o.db.WithContext(ctx) db = db.Model(&L2Block{}) - - for key, value := range fields { - db = db.Where(key, value) - } - - for _, orderBy := range orderByList { - db = db.Order(orderBy) - } + db = db.Select("chunk_hash") + db = db.Order("number ASC") if limit > 0 { db = db.Limit(limit) } - db = db.Order("number ASC") - - var l2Blocks []*L2Block + var l2Blocks []L2Block if err := db.Find(&l2Blocks).Error; err != nil { - return nil, fmt.Errorf("L2Block.GetL2Blocks error: %w, fields: %v, orderByList: %v", err, fields, orderByList) + return nil, fmt.Errorf("L2Block.GetChunkHashes error: %w, limit: %v", err, limit) } - return l2Blocks, nil + + chunkHashes := make([]string, len(l2Blocks)) + for i, block := range l2Blocks { + chunkHashes[i] = block.ChunkHash + } + + return chunkHashes, nil } // GetL2BlocksInRange retrieves the L2 blocks within the specified range (inclusive). // The range is closed, i.e., it includes both start and end block numbers. // The returned blocks are sorted in ascending order by their block number. -func (o *L2Block) GetL2BlocksInRange(ctx context.Context, startBlockNumber uint64, endBlockNumber uint64) ([]*types.WrappedBlock, error) { +func (o *L2Block) GetL2BlocksInRange(ctx context.Context, startBlockNumber uint64, endBlockNumber uint64) ([]*encoding.Block, error) { if startBlockNumber > endBlockNumber { return nil, fmt.Errorf("L2Block.GetL2BlocksInRange: start block number should be less than or equal to end block number, start block: %v, end block: %v", startBlockNumber, endBlockNumber) } @@ -159,33 +158,33 @@ func (o *L2Block) GetL2BlocksInRange(ctx context.Context, startBlockNumber uint6 return nil, fmt.Errorf("L2Block.GetL2BlocksInRange: unexpected number of results, expected: %v, got: %v", endBlockNumber-startBlockNumber+1, len(l2Blocks)) } - var wrappedBlocks []*types.WrappedBlock + var blocks []*encoding.Block for _, v := range l2Blocks { - var wrappedBlock types.WrappedBlock + var block encoding.Block - if err := json.Unmarshal([]byte(v.Transactions), &wrappedBlock.Transactions); err != nil { + if err := json.Unmarshal([]byte(v.Transactions), &block.Transactions); err != nil { return nil, fmt.Errorf("L2Block.GetL2BlocksInRange error: %w, start block: %v, end block: %v", err, startBlockNumber, endBlockNumber) } - wrappedBlock.Header = &gethTypes.Header{} - if err := json.Unmarshal([]byte(v.Header), wrappedBlock.Header); err != nil { + block.Header = &gethTypes.Header{} + if err := json.Unmarshal([]byte(v.Header), block.Header); err != nil { return nil, fmt.Errorf("L2Block.GetL2BlocksInRange error: %w, start block: %v, end block: %v", err, startBlockNumber, endBlockNumber) } - wrappedBlock.WithdrawRoot = common.HexToHash(v.WithdrawRoot) + block.WithdrawRoot = common.HexToHash(v.WithdrawRoot) - if err := json.Unmarshal([]byte(v.RowConsumption), &wrappedBlock.RowConsumption); err != nil { + if err := json.Unmarshal([]byte(v.RowConsumption), &block.RowConsumption); err != nil { return nil, fmt.Errorf("L2Block.GetL2BlocksInRange error: %w, start block: %v, end block: %v", err, startBlockNumber, endBlockNumber) } - wrappedBlocks = append(wrappedBlocks, &wrappedBlock) + blocks = append(blocks, &block) } - return wrappedBlocks, nil + return blocks, nil } // InsertL2Blocks inserts l2 blocks into the "l2_block" table. -func (o *L2Block) InsertL2Blocks(ctx context.Context, blocks []*types.WrappedBlock) error { +func (o *L2Block) InsertL2Blocks(ctx context.Context, blocks []*encoding.Block) error { var l2Blocks []L2Block for _, block := range blocks { header, err := json.Marshal(block.Header) diff --git a/rollup/internal/orm/orm_test.go b/rollup/internal/orm/orm_test.go index 12ae84cba8..58391e2e51 100644 --- a/rollup/internal/orm/orm_test.go +++ b/rollup/internal/orm/orm_test.go @@ -15,6 +15,8 @@ import ( "scroll-tech/common/database" "scroll-tech/common/docker" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/database/migrate" ) @@ -27,12 +29,12 @@ var ( batchOrm *Batch pendingTransactionOrm *PendingTransaction - wrappedBlock1 *types.WrappedBlock - wrappedBlock2 *types.WrappedBlock - chunk1 *types.Chunk - chunk2 *types.Chunk - chunkHash1 common.Hash - chunkHash2 common.Hash + block1 *encoding.Block + block2 *encoding.Block + chunk1 *encoding.Chunk + chunk2 *encoding.Chunk + chunkHash1 common.Hash + chunkHash2 common.Hash ) func TestMain(m *testing.M) { @@ -66,22 +68,26 @@ func setupEnv(t *testing.T) { templateBlockTrace, err := os.ReadFile("../../../common/testdata/blockTrace_02.json") assert.NoError(t, err) - wrappedBlock1 = &types.WrappedBlock{} - err = json.Unmarshal(templateBlockTrace, wrappedBlock1) + block1 = &encoding.Block{} + err = json.Unmarshal(templateBlockTrace, block1) assert.NoError(t, err) templateBlockTrace, err = os.ReadFile("../../../common/testdata/blockTrace_03.json") assert.NoError(t, err) - wrappedBlock2 = &types.WrappedBlock{} - err = json.Unmarshal(templateBlockTrace, wrappedBlock2) + block2 = &encoding.Block{} + err = json.Unmarshal(templateBlockTrace, block2) assert.NoError(t, err) - chunk1 = &types.Chunk{Blocks: []*types.WrappedBlock{wrappedBlock1}} - chunkHash1, err = chunk1.Hash(0) + chunk1 = &encoding.Chunk{Blocks: []*encoding.Block{block1}} + daChunk1, err := codecv0.NewDAChunk(chunk1, 0) + assert.NoError(t, err) + chunkHash1, err = daChunk1.Hash() assert.NoError(t, err) - chunk2 = &types.Chunk{Blocks: []*types.WrappedBlock{wrappedBlock2}} - chunkHash2, err = chunk2.Hash(chunk1.NumL1Messages(0)) + chunk2 = &encoding.Chunk{Blocks: []*encoding.Block{block2}} + daChunk2, err := codecv0.NewDAChunk(chunk2, chunk1.NumL1Messages(0)) + assert.NoError(t, err) + chunkHash2, err = daChunk2.Hash() assert.NoError(t, err) } @@ -144,33 +150,33 @@ func TestL2BlockOrm(t *testing.T) { assert.NoError(t, err) assert.NoError(t, migrate.ResetDB(sqlDB)) - err = l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock1, wrappedBlock2}) + err = l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block1, block2}) assert.NoError(t, err) height, err := l2BlockOrm.GetL2BlocksLatestHeight(context.Background()) assert.NoError(t, err) assert.Equal(t, uint64(3), height) - blocks, err := l2BlockOrm.GetL2Blocks(context.Background(), map[string]interface{}{}, []string{}, 0) + chunkHashes, err := l2BlockOrm.GetChunkHashes(context.Background(), 0) assert.NoError(t, err) - assert.Len(t, blocks, 2) - assert.Equal(t, "", blocks[0].ChunkHash) - assert.Equal(t, "", blocks[1].ChunkHash) + assert.Len(t, chunkHashes, 2) + assert.Equal(t, "", chunkHashes[0]) + assert.Equal(t, "", chunkHashes[1]) - wrappedBlocks, err := l2BlockOrm.GetL2BlocksInRange(context.Background(), 2, 3) + blocks, err := l2BlockOrm.GetL2BlocksInRange(context.Background(), 2, 3) assert.NoError(t, err) assert.Len(t, blocks, 2) - assert.Equal(t, wrappedBlock1, wrappedBlocks[0]) - assert.Equal(t, wrappedBlock2, wrappedBlocks[1]) + assert.Equal(t, block1, blocks[0]) + assert.Equal(t, block2, blocks[1]) err = l2BlockOrm.UpdateChunkHashInRange(context.Background(), 2, 2, "test hash") assert.NoError(t, err) - blocks, err = l2BlockOrm.GetL2Blocks(context.Background(), map[string]interface{}{}, []string{}, 0) + chunkHashes, err = l2BlockOrm.GetChunkHashes(context.Background(), 0) assert.NoError(t, err) - assert.Len(t, blocks, 2) - assert.Equal(t, "test hash", blocks[0].ChunkHash) - assert.Equal(t, "", blocks[1].ChunkHash) + assert.Len(t, chunkHashes, 2) + assert.Equal(t, "test hash", chunkHashes[0]) + assert.Equal(t, "", chunkHashes[1]) } func TestChunkOrm(t *testing.T) { @@ -223,38 +229,46 @@ func TestBatchOrm(t *testing.T) { assert.NoError(t, err) assert.NoError(t, migrate.ResetDB(sqlDB)) - batchMeta1 := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: chunkHash1.Hex(), - EndChunkIndex: 0, - EndChunkHash: chunkHash1.Hex(), + batch := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk1}, + StartChunkIndex: 0, + StartChunkHash: chunkHash1, + EndChunkIndex: 0, + EndChunkHash: chunkHash1, } - batch1, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk1}, batchMeta1) + batch1, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) hash1 := batch1.Hash batch1, err = batchOrm.GetBatchByIndex(context.Background(), 0) assert.NoError(t, err) - batchHeader1, err := types.DecodeBatchHeader(batch1.BatchHeader) + daBatch1, err := codecv0.NewDABatchFromBytes(batch1.BatchHeader) assert.NoError(t, err) - batchHash1 := batchHeader1.Hash().Hex() + batchHash1 := daBatch1.Hash().Hex() assert.Equal(t, hash1, batchHash1) - batchMeta2 := &types.BatchMeta{ - StartChunkIndex: 1, - StartChunkHash: chunkHash2.Hex(), - EndChunkIndex: 1, - EndChunkHash: chunkHash2.Hex(), + batch = &encoding.Batch{ + Index: 1, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk1}, + StartChunkIndex: 1, + StartChunkHash: chunkHash2, + EndChunkIndex: 1, + EndChunkHash: chunkHash2, } - batch2, err := batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk2}, batchMeta2) + batch2, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) hash2 := batch2.Hash batch2, err = batchOrm.GetBatchByIndex(context.Background(), 1) assert.NoError(t, err) - batchHeader2, err := types.DecodeBatchHeader(batch2.BatchHeader) + daBatch2, err := codecv0.NewDABatchFromBytes(batch2.BatchHeader) assert.NoError(t, err) - batchHash2 := batchHeader2.Hash().Hex() + batchHash2 := daBatch2.Hash().Hex() assert.Equal(t, hash2, batchHash2) count, err := batchOrm.GetBatchCount(context.Background()) diff --git a/rollup/tests/gas_oracle_test.go b/rollup/tests/gas_oracle_test.go index ad49d0fbc5..2442ee775c 100644 --- a/rollup/tests/gas_oracle_test.go +++ b/rollup/tests/gas_oracle_test.go @@ -11,6 +11,8 @@ import ( "scroll-tech/common/database" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/rollup/internal/controller/relayer" "scroll-tech/rollup/internal/controller/watcher" @@ -71,8 +73,8 @@ func testImportL2GasPrice(t *testing.T) { assert.NoError(t, err) // add fake chunk - chunk := &types.Chunk{ - Blocks: []*types.WrappedBlock{ + chunk := &encoding.Chunk{ + Blocks: []*encoding.Block{ { Header: &gethTypes.Header{ Number: big.NewInt(1), @@ -86,31 +88,38 @@ func testImportL2GasPrice(t *testing.T) { }, }, } - chunkHash, err := chunk.Hash(0) + daChunk, err := codecv0.NewDAChunk(chunk, 0) + assert.NoError(t, err) + chunkHash, err := daChunk.Hash() assert.NoError(t, err) - batchMeta := &types.BatchMeta{ - StartChunkIndex: 0, - StartChunkHash: chunkHash.Hex(), - EndChunkIndex: 0, - EndChunkHash: chunkHash.Hex(), + batch := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + StartChunkHash: chunkHash, + EndChunkIndex: 0, + EndChunkHash: chunkHash, } + batchOrm := orm.NewBatch(db) - _, err = batchOrm.InsertBatch(context.Background(), []*types.Chunk{chunk}, batchMeta) + _, err = batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) // check db status - batch, err := batchOrm.GetLatestBatch(context.Background()) + dbBatch, err := batchOrm.GetLatestBatch(context.Background()) assert.NoError(t, err) assert.NotNil(t, batch) - assert.Empty(t, batch.OracleTxHash) - assert.Equal(t, types.GasOracleStatus(batch.OracleStatus), types.GasOraclePending) + assert.Empty(t, dbBatch.OracleTxHash) + assert.Equal(t, types.GasOracleStatus(dbBatch.OracleStatus), types.GasOraclePending) // relay gas price l2Relayer.ProcessGasPriceOracle() - batch, err = batchOrm.GetLatestBatch(context.Background()) + dbBatch, err = batchOrm.GetLatestBatch(context.Background()) assert.NoError(t, err) assert.NotNil(t, batch) - assert.NotEmpty(t, batch.OracleTxHash) - assert.Equal(t, types.GasOracleStatus(batch.OracleStatus), types.GasOracleImporting) + assert.NotEmpty(t, dbBatch.OracleTxHash) + assert.Equal(t, types.GasOracleStatus(dbBatch.OracleStatus), types.GasOracleImporting) } diff --git a/rollup/tests/rollup_test.go b/rollup/tests/rollup_test.go index 92ddffd3dc..0fb45f9989 100644 --- a/rollup/tests/rollup_test.go +++ b/rollup/tests/rollup_test.go @@ -12,6 +12,7 @@ import ( "scroll-tech/common/database" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" "scroll-tech/common/types/message" "scroll-tech/common/utils" @@ -65,7 +66,7 @@ func testCommitBatchAndFinalizeBatch(t *testing.T) { l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, 0, l1Cfg.Confirmations, l1Cfg.L1MessageQueueAddress, l1Cfg.ScrollChainContractAddress, db, nil) // add some blocks to db - var wrappedBlocks []*types.WrappedBlock + var blocks []*encoding.Block for i := 0; i < 10; i++ { header := gethTypes.Header{ Number: big.NewInt(int64(i)), @@ -73,7 +74,7 @@ func testCommitBatchAndFinalizeBatch(t *testing.T) { Difficulty: big.NewInt(0), BaseFee: big.NewInt(0), } - wrappedBlocks = append(wrappedBlocks, &types.WrappedBlock{ + blocks = append(blocks, &encoding.Block{ Header: &header, Transactions: nil, WithdrawRoot: common.Hash{}, @@ -82,7 +83,7 @@ func testCommitBatchAndFinalizeBatch(t *testing.T) { } l2BlockOrm := orm.NewL2Block(db) - err = l2BlockOrm.InsertL2Blocks(context.Background(), wrappedBlocks) + err = l2BlockOrm.InsertL2Blocks(context.Background(), blocks) assert.NoError(t, err) cp := watcher.NewChunkProposer(context.Background(), &config.ChunkProposerConfig{ diff --git a/tests/integration-test/go.mod b/tests/integration-test/go.mod index 16042cbd77..778864474c 100644 --- a/tests/integration-test/go.mod +++ b/tests/integration-test/go.mod @@ -3,7 +3,7 @@ module scroll-tech/integration-test go 1.20 require ( - github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 + github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 github.com/stretchr/testify v1.8.4 gorm.io/gorm v1.25.5 ) diff --git a/tests/integration-test/go.sum b/tests/integration-test/go.sum index 10080531db..3daf523671 100644 --- a/tests/integration-test/go.sum +++ b/tests/integration-test/go.sum @@ -85,8 +85,8 @@ github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeC github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9 h1:EDnM5yoGAeUHEu1v3RUPTrHzInm3au2QWXpl+q3XnUo= -github.com/scroll-tech/go-ethereum v1.10.14-0.20240305121210-a807a41fd1e9/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8 h1:H7LzbJMrmkFkyPAl+F0NMMg0Wiq/qQv/iKKmuo/7/Yc= +github.com/scroll-tech/go-ethereum v1.10.14-0.20240311135752-ccec84ce63c8/go.mod h1:7Rz2bh9pn42rGuxjh51CG7HL9SKMG3ZugJkL3emdZx8= github.com/scroll-tech/zktrie v0.7.1 h1:NrmZNjuBzsbrKePqdHDG+t2cXnimbtezPAFS0+L9ElE= github.com/scroll-tech/zktrie v0.7.1/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= diff --git a/tests/integration-test/integration_test.go b/tests/integration-test/integration_test.go index e15a5cccba..f36ea73701 100644 --- a/tests/integration-test/integration_test.go +++ b/tests/integration-test/integration_test.go @@ -21,7 +21,8 @@ import ( "scroll-tech/common/database" "scroll-tech/common/docker" - "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" "scroll-tech/common/utils" "scroll-tech/common/version" @@ -85,23 +86,40 @@ func TestCoordinatorProverInteraction(t *testing.T) { log.Fatalf("Failed to retrieve L2 genesis header after multiple attempts: %v", err) } - wrappedBlock := &types.WrappedBlock{ + block := &encoding.Block{ Header: header, Transactions: nil, WithdrawRoot: common.Hash{}, RowConsumption: &gethTypes.RowConsumption{}, } - chunk := &types.Chunk{Blocks: []*types.WrappedBlock{wrappedBlock}} + chunk := &encoding.Chunk{Blocks: []*encoding.Block{block}} - err = l2BlockOrm.InsertL2Blocks(context.Background(), []*types.WrappedBlock{wrappedBlock}) + daChunk, err := codecv0.NewDAChunk(chunk, 0) + assert.NoError(t, err) + + daChunkHash, err := daChunk.Hash() + assert.NoError(t, err) + + batch := &encoding.Batch{ + Index: 0, + TotalL1MessagePoppedBefore: 0, + ParentBatchHash: common.Hash{}, + Chunks: []*encoding.Chunk{chunk}, + StartChunkIndex: 0, + EndChunkIndex: 0, + StartChunkHash: daChunkHash, + EndChunkHash: daChunkHash, + } + + err = l2BlockOrm.InsertL2Blocks(context.Background(), []*encoding.Block{block}) assert.NoError(t, err) dbChunk, err := chunkOrm.InsertChunk(context.Background(), chunk) assert.NoError(t, err) err = l2BlockOrm.UpdateChunkHashInRange(context.Background(), 0, 100, dbChunk.Hash) assert.NoError(t, err) - batch, err := batchOrm.InsertBatch(context.Background(), 0, 0, dbChunk.Hash, dbChunk.Hash, []*types.Chunk{chunk}) + dbBatch, err := batchOrm.InsertBatch(context.Background(), batch) assert.NoError(t, err) - err = chunkOrm.UpdateBatchHashInRange(context.Background(), 0, 0, batch.Hash) + err = chunkOrm.UpdateBatchHashInRange(context.Background(), 0, 0, dbBatch.Hash) assert.NoError(t, err) t.Log(version.Version) diff --git a/tests/integration-test/orm/batch.go b/tests/integration-test/orm/batch.go index 5bc6175dff..3abe064da3 100644 --- a/tests/integration-test/orm/batch.go +++ b/tests/integration-test/orm/batch.go @@ -6,15 +6,14 @@ import ( "fmt" "time" - "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/log" "gorm.io/gorm" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" ) -const defaultBatchHeaderVersion = 0 - // Batch represents a batch of chunks. type Batch struct { db *gorm.DB `gorm:"column:-"` @@ -80,63 +79,31 @@ func (o *Batch) GetLatestBatch(ctx context.Context) (*Batch, error) { } // InsertBatch inserts a new batch into the database. -// for init data -func (o *Batch) InsertBatch(ctx context.Context, startChunkIndex, endChunkIndex uint64, startChunkHash, endChunkHash string, chunks []*types.Chunk, dbTX ...*gorm.DB) (*Batch, error) { - if len(chunks) == 0 { - return nil, errors.New("invalid args") - } - - parentBatch, err := o.GetLatestBatch(ctx) - if err != nil && !errors.Is(errors.Unwrap(err), gorm.ErrRecordNotFound) { - log.Error("failed to get the latest batch", "err", err) - return nil, err +// for unit test +func (o *Batch) InsertBatch(ctx context.Context, batch *encoding.Batch, dbTX ...*gorm.DB) (*Batch, error) { + if batch == nil { + return nil, errors.New("invalid args: batch is nil") } - var batchIndex uint64 - var parentBatchHash common.Hash - var totalL1MessagePoppedBefore uint64 - var version uint8 = defaultBatchHeaderVersion - - // if parentBatch==nil then err==gorm.ErrRecordNotFound, which means there's - // not batch record in the db, we then use default empty values for the creating batch; - // if parentBatch!=nil then err=nil, then we fill the parentBatch-related data into the creating batch - if parentBatch != nil { - batchIndex = parentBatch.Index + 1 - parentBatchHash = common.HexToHash(parentBatch.Hash) - - var parentBatchHeader *types.BatchHeader - parentBatchHeader, err = types.DecodeBatchHeader(parentBatch.BatchHeader) - if err != nil { - log.Error("failed to decode parent batch header", "index", parentBatch.Index, "hash", parentBatch.Hash, "err", err) - return nil, err - } - - totalL1MessagePoppedBefore = parentBatchHeader.TotalL1MessagePopped() - version = parentBatchHeader.Version() - } - - batchHeader, err := types.NewBatchHeader(version, batchIndex, totalL1MessagePoppedBefore, parentBatchHash, chunks) + daBatch, err := codecv0.NewDABatch(batch) if err != nil { - log.Error("failed to create batch header", - "index", batchIndex, "total l1 message popped before", totalL1MessagePoppedBefore, - "parent hash", parentBatchHash, "number of chunks", len(chunks), "err", err) + log.Error("failed to create new DA batch", + "index", batch.Index, "total l1 message popped before", batch.TotalL1MessagePoppedBefore, + "parent hash", batch.ParentBatchHash, "number of chunks", len(batch.Chunks), "err", err) return nil, err } - numChunks := len(chunks) - lastChunkBlockNum := len(chunks[numChunks-1].Blocks) - newBatch := Batch{ - Index: batchIndex, - Hash: batchHeader.Hash().Hex(), - StartChunkHash: startChunkHash, - StartChunkIndex: startChunkIndex, - EndChunkHash: endChunkHash, - EndChunkIndex: endChunkIndex, - StateRoot: chunks[numChunks-1].Blocks[lastChunkBlockNum-1].Header.Root.Hex(), - WithdrawRoot: chunks[numChunks-1].Blocks[lastChunkBlockNum-1].WithdrawRoot.Hex(), - ParentBatchHash: parentBatchHash.Hex(), - BatchHeader: batchHeader.Encode(), + Index: batch.Index, + Hash: daBatch.Hash().Hex(), + StartChunkHash: batch.StartChunkHash.Hex(), + StartChunkIndex: batch.StartChunkIndex, + EndChunkHash: batch.EndChunkHash.Hex(), + EndChunkIndex: batch.EndChunkIndex, + StateRoot: batch.StateRoot().Hex(), + WithdrawRoot: batch.WithdrawRoot().Hex(), + ParentBatchHash: batch.ParentBatchHash.Hex(), + BatchHeader: daBatch.Encode(), ChunkProofsStatus: int16(types.ChunkProofsStatusPending), ProvingStatus: int16(types.ProvingTaskUnassigned), RollupStatus: int16(types.RollupPending), diff --git a/tests/integration-test/orm/chunk.go b/tests/integration-test/orm/chunk.go index da65774d6a..69158d59c3 100644 --- a/tests/integration-test/orm/chunk.go +++ b/tests/integration-test/orm/chunk.go @@ -10,6 +10,8 @@ import ( "gorm.io/gorm" "scroll-tech/common/types" + "scroll-tech/common/types/encoding" + "scroll-tech/common/types/encoding/codecv0" ) // Chunk represents a chunk of blocks in the database. @@ -25,7 +27,7 @@ type Chunk struct { EndBlockHash string `json:"end_block_hash" gorm:"column:end_block_hash"` StartBlockTime uint64 `json:"start_block_time" gorm:"column:start_block_time"` TotalL1MessagesPoppedBefore uint64 `json:"total_l1_messages_popped_before" gorm:"column:total_l1_messages_popped_before"` - TotalL1MessagesPoppedInChunk uint32 `json:"total_l1_messages_popped_in_chunk" gorm:"column:total_l1_messages_popped_in_chunk"` + TotalL1MessagesPoppedInChunk uint64 `json:"total_l1_messages_popped_in_chunk" gorm:"column:total_l1_messages_popped_in_chunk"` ParentChunkHash string `json:"parent_chunk_hash" gorm:"column:parent_chunk_hash"` StateRoot string `json:"state_root" gorm:"column:state_root"` ParentChunkStateRoot string `json:"parent_chunk_state_root" gorm:"column:parent_chunk_state_root"` @@ -43,8 +45,8 @@ type Chunk struct { // metadata TotalL2TxGas uint64 `json:"total_l2_tx_gas" gorm:"column:total_l2_tx_gas"` - TotalL2TxNum uint32 `json:"total_l2_tx_num" gorm:"column:total_l2_tx_num"` - TotalL1CommitCalldataSize uint32 `json:"total_l1_commit_calldata_size" gorm:"column:total_l1_commit_calldata_size"` + TotalL2TxNum uint64 `json:"total_l2_tx_num" gorm:"column:total_l2_tx_num"` + TotalL1CommitCalldataSize uint64 `json:"total_l1_commit_calldata_size" gorm:"column:total_l1_commit_calldata_size"` TotalL1CommitGas uint64 `json:"total_l1_commit_gas" gorm:"column:total_l1_commit_gas"` CreatedAt time.Time `json:"created_at" gorm:"column:created_at"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` @@ -75,8 +77,8 @@ func (o *Chunk) GetLatestChunk(ctx context.Context) (*Chunk, error) { } // InsertChunk inserts a new chunk into the database. -// for init data -func (o *Chunk) InsertChunk(ctx context.Context, chunk *types.Chunk, dbTX ...*gorm.DB) (*Chunk, error) { +// for unit test +func (o *Chunk) InsertChunk(ctx context.Context, chunk *encoding.Chunk, dbTX ...*gorm.DB) (*Chunk, error) { if chunk == nil || len(chunk.Blocks) == 0 { return nil, errors.New("invalid args") } @@ -96,43 +98,50 @@ func (o *Chunk) InsertChunk(ctx context.Context, chunk *types.Chunk, dbTX ...*go // if parentChunk!=nil then err=nil, then we fill the parentChunk-related data into the creating chunk if parentChunk != nil { chunkIndex = parentChunk.Index + 1 - totalL1MessagePoppedBefore = parentChunk.TotalL1MessagesPoppedBefore + uint64(parentChunk.TotalL1MessagesPoppedInChunk) + totalL1MessagePoppedBefore = parentChunk.TotalL1MessagesPoppedBefore + parentChunk.TotalL1MessagesPoppedInChunk parentChunkHash = parentChunk.Hash parentChunkStateRoot = parentChunk.StateRoot } - hash, err := chunk.Hash(totalL1MessagePoppedBefore) + daChunk, err := codecv0.NewDAChunk(chunk, totalL1MessagePoppedBefore) + if err != nil { + log.Error("failed to initialize new DA chunk", "err", err) + return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) + } + + daChunkHash, err := daChunk.Hash() if err != nil { - log.Error("failed to get chunk hash", "err", err) + log.Error("failed to get DA chunk hash", "err", err) return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) } - var totalL2TxGas uint64 - var totalL2TxNum uint64 - var totalL1CommitCalldataSize uint64 - var totalL1CommitGas uint64 - for _, block := range chunk.Blocks { - totalL2TxGas += block.Header.GasUsed - totalL2TxNum += block.NumL2Transactions() - totalL1CommitCalldataSize += block.EstimateL1CommitCalldataSize() - totalL1CommitGas += block.EstimateL1CommitGas() + totalL1CommitCalldataSize, err := codecv0.EstimateChunkL1CommitCalldataSize(chunk) + if err != nil { + log.Error("failed to estimate chunk L1 commit calldata size", "err", err) + return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) + } + + totalL1CommitGas, err := codecv0.EstimateChunkL1CommitGas(chunk) + if err != nil { + log.Error("failed to estimate chunk L1 commit gas", "err", err) + return nil, fmt.Errorf("Chunk.InsertChunk error: %w", err) } numBlocks := len(chunk.Blocks) newChunk := Chunk{ Index: chunkIndex, - Hash: hash.Hex(), + Hash: daChunkHash.Hex(), StartBlockNumber: chunk.Blocks[0].Header.Number.Uint64(), StartBlockHash: chunk.Blocks[0].Header.Hash().Hex(), EndBlockNumber: chunk.Blocks[numBlocks-1].Header.Number.Uint64(), EndBlockHash: chunk.Blocks[numBlocks-1].Header.Hash().Hex(), - TotalL2TxGas: totalL2TxGas, - TotalL2TxNum: uint32(totalL2TxNum), - TotalL1CommitCalldataSize: uint32(totalL1CommitCalldataSize), + TotalL2TxGas: chunk.L2GasUsed(), + TotalL2TxNum: chunk.NumL2Transactions(), + TotalL1CommitCalldataSize: totalL1CommitCalldataSize, TotalL1CommitGas: totalL1CommitGas, StartBlockTime: chunk.Blocks[0].Header.Time, TotalL1MessagesPoppedBefore: totalL1MessagePoppedBefore, - TotalL1MessagesPoppedInChunk: uint32(chunk.NumL1Messages(totalL1MessagePoppedBefore)), + TotalL1MessagesPoppedInChunk: chunk.NumL1Messages(totalL1MessagePoppedBefore), ParentChunkHash: parentChunkHash, StateRoot: chunk.Blocks[numBlocks-1].Header.Root.Hex(), ParentChunkStateRoot: parentChunkStateRoot, diff --git a/tests/integration-test/orm/l2_block.go b/tests/integration-test/orm/l2_block.go index e29d4df76c..254f095f0e 100644 --- a/tests/integration-test/orm/l2_block.go +++ b/tests/integration-test/orm/l2_block.go @@ -4,12 +4,11 @@ import ( "context" "encoding/json" "fmt" + "scroll-tech/common/types/encoding" "time" "github.com/scroll-tech/go-ethereum/log" "gorm.io/gorm" - - "scroll-tech/common/types" ) // L2Block represents a l2 block in the database. @@ -50,7 +49,7 @@ func (*L2Block) TableName() string { // InsertL2Blocks inserts l2 blocks into the "l2_block" table. // for unit test -func (o *L2Block) InsertL2Blocks(ctx context.Context, blocks []*types.WrappedBlock) error { +func (o *L2Block) InsertL2Blocks(ctx context.Context, blocks []*encoding.Block) error { var l2Blocks []L2Block for _, block := range blocks { header, err := json.Marshal(block.Header)