From 47f4aba7d9eba19a86646f56dc5d4e6de9fc9c31 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 21 Oct 2024 14:15:43 +0800 Subject: [PATCH 01/71] feat(taiko-client): preconfirmation driver APIs --- go.mod | 4 + go.sum | 7 ++ packages/taiko-client/bindings/.githead | 2 +- .../taiko-client/driver/preconf_server/api.go | 48 ++++++++++++ .../driver/preconf_server/server.go | 75 +++++++++++++++++++ 5 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 packages/taiko-client/driver/preconf_server/api.go create mode 100644 packages/taiko-client/driver/preconf_server/server.go diff --git a/go.mod b/go.mod index 4c5ee52f395..896c5c7039c 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,9 @@ require ( github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47 github.com/google/uuid v1.6.0 github.com/joho/godotenv v1.5.1 + github.com/labstack/echo v3.3.10+incompatible github.com/labstack/echo-contrib v0.17.1 + github.com/labstack/echo-jwt/v4 v4.2.0 github.com/labstack/echo/v4 v4.12.0 github.com/labstack/gommon v0.4.2 github.com/modern-go/reflect2 v1.0.2 @@ -82,6 +84,7 @@ require ( github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect + github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/distribution/reference v0.5.0 // indirect github.com/docker/docker v25.0.6+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect @@ -113,6 +116,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/golang-jwt/jwt/v5 v5.0.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/go-cmp v0.6.0 // indirect diff --git a/go.sum b/go.sum index 9ddee77dab9..a97c39aaf56 100644 --- a/go.sum +++ b/go.sum @@ -150,6 +150,7 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= @@ -253,6 +254,8 @@ github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzq github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= @@ -386,8 +389,12 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg= +github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= github.com/labstack/echo-contrib v0.17.1 h1:7I/he7ylVKsDUieaGRZ9XxxTYOjfQwVzHzUYrNykfCU= github.com/labstack/echo-contrib v0.17.1/go.mod h1:SnsCZtwHBAZm5uBSAtQtXQHI3wqEA73hvTn0bYMKnZA= +github.com/labstack/echo-jwt/v4 v4.2.0 h1:odSISV9JgcSCuhgQSV/6Io3i7nUmfM/QkBeR5GVJj5c= +github.com/labstack/echo-jwt/v4 v4.2.0/go.mod h1:MA2RqdXdEn4/uEglx0HcUOgQSyBaTh5JcaHIan3biwU= github.com/labstack/echo/v4 v4.0.0/go.mod h1:tZv7nai5buKSg5h/8E6zz4LsD/Dqh9/91Mvs7Z5Zyno= github.com/labstack/echo/v4 v4.1.15/go.mod h1:GWO5IBVzI371K8XJe50CSvHjQCafK6cw8R/moLhEU6o= github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0= diff --git a/packages/taiko-client/bindings/.githead b/packages/taiko-client/bindings/.githead index c43bce274c9..9206c9de7bb 100644 --- a/packages/taiko-client/bindings/.githead +++ b/packages/taiko-client/bindings/.githead @@ -1 +1 @@ -b93d056479adfc4a1f557578d8b66eda48b104a9 +eeeb4afeff8572115c2cf82db149cee7a723f30c diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go new file mode 100644 index 00000000000..57761fbf8df --- /dev/null +++ b/packages/taiko-client/driver/preconf_server/api.go @@ -0,0 +1,48 @@ +package preconf_server + +import ( + "net/http" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/labstack/echo/v4" +) + +// PreconfBlockGroup represents a preconfirmation block group. +type PreconfBlockGroup struct { + BlockID uint64 `json:"blockId"` + ID uint64 `json:"groupId"` + TransactionsList types.Transactions `json:"transactions"` + IsFinalGroup bool `json:"isFinalGroup"` + Signature string `json:"signature"` +} + +// CreateBlocksByGroupsRequestBody represents a request body when handling preconfirmation blocks creation requests. +type CreateBlocksByGroupsRequestBody struct { + Groups []PreconfBlockGroup `json:"block_groups"` +} + +// CreateBlocksByGroups handles a preconfirmation blocks creation request, +// if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation +// blocks to the backend L2 execution engine and return a success response +// +// @Summary Insert preconfirmation blocks by the given groups to the backend L2 execution engine. +// @Param body body preconf_server.CreateBlocksByGroupsRequestBody true "preconf blocks creation request body" +// @Accept json +// @Produce json +// @Success 200 {object} ProposeBlockResponse +// @Router /perconfBlocks [post] +func (s *PreconfAPIServer) CreateBlocksByGroups(c echo.Context) error { + return c.NoContent(http.StatusOK) +} + +// HealthCheck is the endpoints for probes. +// +// @Summary Get current server health status +// @ID health-check +// @Accept json +// @Produce json +// @Success 200 {object} Status +// @Router /healthz [get] +func (s *PreconfAPIServer) HealthCheck(c echo.Context) error { + return c.NoContent(http.StatusOK) +} diff --git a/packages/taiko-client/driver/preconf_server/server.go b/packages/taiko-client/driver/preconf_server/server.go new file mode 100644 index 00000000000..4e6cf0c7efe --- /dev/null +++ b/packages/taiko-client/driver/preconf_server/server.go @@ -0,0 +1,75 @@ +package preconf_server + +import ( + "os" + + "github.com/labstack/echo-jwt/v4" + "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4/middleware" +) + +// @title Taiko Preconfirmation Server API +// @version 1.0 +// @termsOfService http://swagger.io/terms/ + +// @contact.name API Support +// @contact.url https://community.taiko.xyz/ +// @contact.email info@taiko.xyz + +// @license.name MIT +// @license.url https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md +// PreconfAPIServer represents a preconfirmation server instance. +type PreconfAPIServer struct { + echo *echo.Echo +} + +// New creates a new preconfirmation server instance. +func New() (*PreconfAPIServer, error) { + server := &PreconfAPIServer{ + echo: echo.New(), + } + + server.echo.HideBanner = true + server.configureMiddleware([]string{"*"}) // TODO: add flags + server.configureRoutes() + server.echo.Use(echojwt.JWT([]byte("secret"))) // TODO: add flags + + return server, nil +} + +// LogSkipper implements the `middleware.Skipper` interface. +func LogSkipper(c echo.Context) bool { + switch c.Request().URL.Path { + case "/healthz": + return true + default: + return true + } +} + +// configureMiddleware configures the server middlewares. +func (s *PreconfAPIServer) configureMiddleware(corsOrigins []string) { + s.echo.Use(middleware.RequestID()) + + s.echo.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{ + Skipper: LogSkipper, + Format: `{"time":"${time_rfc3339_nano}","level":"INFO","message":{"id":"${id}","remote_ip":"${remote_ip}",` + + `"host":"${host}","method":"${method}","uri":"${uri}","user_agent":"${user_agent}",` + + `"response_status":${status},"error":"${error}","latency":${latency},"latency_human":"${latency_human}",` + + `"bytes_in":${bytes_in},"bytes_out":${bytes_out}}}` + "\n", + Output: os.Stdout, + })) + + // Add CORS middleware + s.echo.Use(middleware.CORSWithConfig(middleware.CORSConfig{ + AllowOrigins: corsOrigins, + AllowCredentials: true, + })) +} + +// configureRoutes contains all routes which will be used by prover server. +func (s *PreconfAPIServer) configureRoutes() { + s.echo.GET("/", s.HealthCheck) + s.echo.GET("/healthz", s.HealthCheck) + s.echo.POST("/perconfBlocks", s.CreateBlocksByGroups) +} From 90541bd95ebe1d351072b758952be4df8bc4a1fc Mon Sep 17 00:00:00 2001 From: David Date: Mon, 21 Oct 2024 15:40:32 +0800 Subject: [PATCH 02/71] feat: update APIs --- go.mod | 26 ++++--- go.sum | 65 +++++++---------- .../taiko-client/driver/preconf_server/api.go | 69 +++++++++++++++---- .../driver/preconf_server/server.go | 3 +- 4 files changed, 95 insertions(+), 68 deletions(-) diff --git a/go.mod b/go.mod index 896c5c7039c..19cd88cc121 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,6 @@ require ( github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47 github.com/google/uuid v1.6.0 github.com/joho/godotenv v1.5.1 - github.com/labstack/echo v3.3.10+incompatible github.com/labstack/echo-contrib v0.17.1 github.com/labstack/echo-jwt/v4 v4.2.0 github.com/labstack/echo/v4 v4.12.0 @@ -35,7 +34,7 @@ require ( github.com/rabbitmq/amqp091-go v1.10.0 github.com/shopspring/decimal v1.4.0 github.com/stretchr/testify v1.9.0 - github.com/swaggo/swag v1.16.3 + github.com/swaggo/swag v1.16.4 github.com/testcontainers/testcontainers-go v0.30.0 github.com/urfave/cli/v2 v2.27.4 golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa @@ -84,7 +83,6 @@ require ( github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect - github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/distribution/reference v0.5.0 // indirect github.com/docker/docker v25.0.6+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect @@ -103,10 +101,10 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/jsonreference v0.20.0 // indirect - github.com/go-openapi/spec v0.20.4 // indirect - github.com/go-openapi/swag v0.19.15 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/spec v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.13.0 // indirect @@ -210,15 +208,15 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.27.0 // indirect - golang.org/x/mod v0.20.0 // indirect - golang.org/x/net v0.28.0 // indirect + golang.org/x/crypto v0.28.0 // indirect + golang.org/x/mod v0.21.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect diff --git a/go.sum b/go.sum index a97c39aaf56..57f9f2e0ecd 100644 --- a/go.sum +++ b/go.sum @@ -23,8 +23,6 @@ github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7 github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= -github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= @@ -150,7 +148,6 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= @@ -214,17 +211,14 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre 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-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= -github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= -github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= -github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= -github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= -github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= +github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -389,8 +383,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg= -github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= github.com/labstack/echo-contrib v0.17.1 h1:7I/he7ylVKsDUieaGRZ9XxxTYOjfQwVzHzUYrNykfCU= github.com/labstack/echo-contrib v0.17.1/go.mod h1:SnsCZtwHBAZm5uBSAtQtXQHI3wqEA73hvTn0bYMKnZA= github.com/labstack/echo-jwt/v4 v4.2.0 h1:odSISV9JgcSCuhgQSV/6Io3i7nUmfM/QkBeR5GVJj5c= @@ -414,9 +406,6 @@ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -483,7 +472,6 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/neko-neko/echo-logrus/v2 v2.0.1 h1:BX2U6uv2N3UiUY75y+SntQak5S1AJIel9j+5Y6h4Nb4= github.com/neko-neko/echo-logrus/v2 v2.0.1/go.mod h1:GDYWo9CY4VXk/vn5ac5reoutYEkZEexlFI01MzHXVG0= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= @@ -608,8 +596,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= -github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= -github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= +github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A= +github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= @@ -693,8 +681,8 @@ golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= @@ -705,8 +693,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -723,7 +711,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226101413-39120d07d75e/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -733,8 +720,8 @@ golang.org/x/net v0.0.0-20220906165146-f3363e06e74c/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= @@ -774,7 +761,6 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/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= @@ -794,16 +780,16 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= 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= @@ -813,8 +799,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -828,8 +814,8 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= 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= @@ -870,9 +856,7 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 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-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -896,7 +880,6 @@ 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= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/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= gorm.io/datatypes v1.2.1 h1:r+g0bk4LPCW2v4+Ls7aeNgGme7JYdNDQ2VtvlNUfBh0= diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go index 57761fbf8df..907a8b708e3 100644 --- a/packages/taiko-client/driver/preconf_server/api.go +++ b/packages/taiko-client/driver/preconf_server/api.go @@ -3,38 +3,83 @@ package preconf_server import ( "net/http" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/labstack/echo/v4" ) -// PreconfBlockGroup represents a preconfirmation block group. -type PreconfBlockGroup struct { - BlockID uint64 `json:"blockId"` - ID uint64 `json:"groupId"` - TransactionsList types.Transactions `json:"transactions"` - IsFinalGroup bool `json:"isFinalGroup"` - Signature string `json:"signature"` +type PreconfBlockGroupStatus string + +const ( + StatusFinalBlockGroup PreconfBlockGroupStatus = "finalBlockGroup" + StatusFinalPreconfGroup PreconfBlockGroupStatus = "finalPreconfGroup" +) + +// PreconfTransactionsGroup represents a preconfirmation block group. +type PreconfTransactionsGroup struct { + BlockID uint64 `json:"blockId"` + ID uint64 `json:"groupId"` + TransactionsList types.Transactions `json:"transactions"` + GroupStatus PreconfBlockGroupStatus `json:"groupStatus"` + Signature string `json:"signature"` + + // Block parameters + Timestamp uint64 `json:"timestamp"` + Random common.Hash `json:"prevRandao"` + SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient"` + BaseFeePerGas uint64 `json:"baseFeePerGas"` } // CreateBlocksByGroupsRequestBody represents a request body when handling preconfirmation blocks creation requests. type CreateBlocksByGroupsRequestBody struct { - Groups []PreconfBlockGroup `json:"block_groups"` + TransactionsGroups []PreconfTransactionsGroup `json:"transactionsGroups"` +} + +// CreateBlocksByGroupsResponseBody represents a response body when handling preconfirmation blocks creation requests. +type CreateBlocksByGroupsResponseBody struct { + PreconfHeaders []types.Header `json:"preconfHeaders"` } // CreateBlocksByGroups handles a preconfirmation blocks creation request, // if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation -// blocks to the backend L2 execution engine and return a success response +// blocks to the backend L2 execution engine and return a success response. // -// @Summary Insert preconfirmation blocks by the given groups to the backend L2 execution engine. -// @Param body body preconf_server.CreateBlocksByGroupsRequestBody true "preconf blocks creation request body" +// @Summary Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that +// the AVS service should sort the groups and make sure all the groups are valid at first. +// @Param body body CreateBlocksByGroupsRequestBody true "preconf blocks creation request body" // @Accept json // @Produce json -// @Success 200 {object} ProposeBlockResponse +// @Success 200 {object} CreateBlocksByGroupsResponseBody // @Router /perconfBlocks [post] func (s *PreconfAPIServer) CreateBlocksByGroups(c echo.Context) error { return c.NoContent(http.StatusOK) } +// ResetPreconfHeadRequestBody represents a request body when resetting the backend +// L2 execution engine preconfirmation head. +type ResetPreconfHeadRequestBody struct { + NewHead uint64 `json:"newHead"` +} + +// ResetPreconfHeadResponseBody represents a response body when resetting the backend +// L2 execution engine preconfirmation head. +type ResetPreconfHeadResponseBody struct { + CurrentHead types.Header `json:"currentHead"` +} + +// ResetPreconfHead resets the backend L2 execution engine preconfirmation head. +// +// @Summary Resets the backend L2 execution engine preconfirmation head, please note that +// the AVS service should make sure the new head height is from a valid preconfirmation head. +// @Param body body ResetPreconfHeadRequestBody true "preconf blocks creation request body" +// @Accept json +// @Produce json +// @Success 200 {object} ResetPreconfHeadResponseBody +// @Router /preconfHead [put] +func (s *PreconfAPIServer) ResetPreconfHead(c echo.Context) error { + return c.NoContent(http.StatusOK) +} + // HealthCheck is the endpoints for probes. // // @Summary Get current server health status diff --git a/packages/taiko-client/driver/preconf_server/server.go b/packages/taiko-client/driver/preconf_server/server.go index 4e6cf0c7efe..b68c412caa2 100644 --- a/packages/taiko-client/driver/preconf_server/server.go +++ b/packages/taiko-client/driver/preconf_server/server.go @@ -71,5 +71,6 @@ func (s *PreconfAPIServer) configureMiddleware(corsOrigins []string) { func (s *PreconfAPIServer) configureRoutes() { s.echo.GET("/", s.HealthCheck) s.echo.GET("/healthz", s.HealthCheck) - s.echo.POST("/perconfBlocks", s.CreateBlocksByGroups) + s.echo.POST("/perconfTransactions", s.CreateBlocksByGroups) + s.echo.PUT("/preconfHead", s.ResetPreconfHead) } From a69115f4cf63cdd0c0159bfe3eeb7f2262ed5ffc Mon Sep 17 00:00:00 2001 From: David Date: Mon, 21 Oct 2024 15:41:37 +0800 Subject: [PATCH 03/71] feat: more comments --- packages/taiko-client/driver/preconf_server/api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go index 907a8b708e3..e4b4d564076 100644 --- a/packages/taiko-client/driver/preconf_server/api.go +++ b/packages/taiko-client/driver/preconf_server/api.go @@ -8,8 +8,10 @@ import ( "github.com/labstack/echo/v4" ) +// PreconfBlockGroupStatus represents the status of a preconfirmation block group. type PreconfBlockGroupStatus string +// PreconfBlockGroupStatus values. const ( StatusFinalBlockGroup PreconfBlockGroupStatus = "finalBlockGroup" StatusFinalPreconfGroup PreconfBlockGroupStatus = "finalPreconfGroup" From 643802b4479b70c6044ef6d399ea36683cb0059e Mon Sep 17 00:00:00 2001 From: David Date: Mon, 21 Oct 2024 23:35:41 +0800 Subject: [PATCH 04/71] feat: update based on comments --- .../taiko-client/driver/preconf_server/api.go | 18 +++++++++--------- .../driver/preconf_server/server.go | 12 ++++++++---- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go index e4b4d564076..949a376ef4b 100644 --- a/packages/taiko-client/driver/preconf_server/api.go +++ b/packages/taiko-client/driver/preconf_server/api.go @@ -8,22 +8,22 @@ import ( "github.com/labstack/echo/v4" ) -// PreconfBlockGroupStatus represents the status of a preconfirmation block group. -type PreconfBlockGroupStatus string +// PreconfTxsGroupStatus represents the status of a preconfirmation transactions group. +type PreconfTxsGroupStatus string // PreconfBlockGroupStatus values. const ( - StatusFinalBlockGroup PreconfBlockGroupStatus = "finalBlockGroup" - StatusFinalPreconfGroup PreconfBlockGroupStatus = "finalPreconfGroup" + StatusFinalBlockGroup PreconfTxsGroupStatus = "finalBlockGroup" + StatusFinalPreconfGroup PreconfTxsGroupStatus = "finalPreconfGroup" ) // PreconfTransactionsGroup represents a preconfirmation block group. type PreconfTransactionsGroup struct { - BlockID uint64 `json:"blockId"` - ID uint64 `json:"groupId"` - TransactionsList types.Transactions `json:"transactions"` - GroupStatus PreconfBlockGroupStatus `json:"groupStatus"` - Signature string `json:"signature"` + BlockID uint64 `json:"blockId"` + ID uint64 `json:"groupId"` + TransactionsList types.Transactions `json:"transactions"` + GroupStatus PreconfTxsGroupStatus `json:"groupStatus"` + Signature string `json:"signature"` // Block parameters Timestamp uint64 `json:"timestamp"` diff --git a/packages/taiko-client/driver/preconf_server/server.go b/packages/taiko-client/driver/preconf_server/server.go index b68c412caa2..e74eccb7118 100644 --- a/packages/taiko-client/driver/preconf_server/server.go +++ b/packages/taiko-client/driver/preconf_server/server.go @@ -3,9 +3,11 @@ package preconf_server import ( "os" - "github.com/labstack/echo-jwt/v4" + echojwt "github.com/labstack/echo-jwt/v4" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" + + chainSyncer "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer" ) // @title Taiko Preconfirmation Server API @@ -20,13 +22,15 @@ import ( // @license.url https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md // PreconfAPIServer represents a preconfirmation server instance. type PreconfAPIServer struct { - echo *echo.Echo + echo *echo.Echo + chainSyncer *chainSyncer.L2ChainSyncer } // New creates a new preconfirmation server instance. -func New() (*PreconfAPIServer, error) { +func New(chainSyncer *chainSyncer.L2ChainSyncer) (*PreconfAPIServer, error) { server := &PreconfAPIServer{ - echo: echo.New(), + echo: echo.New(), + chainSyncer: chainSyncer, } server.echo.HideBanner = true From 9ab2792c6a28b6771845cbdd8ddecd29a7cf8162 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 21 Oct 2024 23:39:07 +0800 Subject: [PATCH 05/71] feat: rename a method --- .../taiko-client/driver/preconf_server/api.go | 26 ++++++++++--------- .../driver/preconf_server/server.go | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go index 949a376ef4b..08a201aeae5 100644 --- a/packages/taiko-client/driver/preconf_server/api.go +++ b/packages/taiko-client/driver/preconf_server/api.go @@ -32,28 +32,30 @@ type PreconfTransactionsGroup struct { BaseFeePerGas uint64 `json:"baseFeePerGas"` } -// CreateBlocksByGroupsRequestBody represents a request body when handling preconfirmation blocks creation requests. -type CreateBlocksByGroupsRequestBody struct { +// CreateOrUpdateBlocksFromBatchResponseBodyRequestBody represents a request body when handling +// preconfirmation blocks creation requests. +type CreateOrUpdateBlocksFromBatchResponseBodyRequestBody struct { TransactionsGroups []PreconfTransactionsGroup `json:"transactionsGroups"` } -// CreateBlocksByGroupsResponseBody represents a response body when handling preconfirmation blocks creation requests. -type CreateBlocksByGroupsResponseBody struct { +// CreateOrUpdateBlocksFromBatchResponseBody represents a response body when handling preconfirmation +// blocks creation requests. +type CreateOrUpdateBlocksFromBatchResponseBody struct { PreconfHeaders []types.Header `json:"preconfHeaders"` } -// CreateBlocksByGroups handles a preconfirmation blocks creation request, +// CreateOrUpdateBlocksFromBatch handles a preconfirmation blocks creation request, // if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation // blocks to the backend L2 execution engine and return a success response. // -// @Summary Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that +// @Summary Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that // the AVS service should sort the groups and make sure all the groups are valid at first. -// @Param body body CreateBlocksByGroupsRequestBody true "preconf blocks creation request body" -// @Accept json -// @Produce json -// @Success 200 {object} CreateBlocksByGroupsResponseBody -// @Router /perconfBlocks [post] -func (s *PreconfAPIServer) CreateBlocksByGroups(c echo.Context) error { +// @Param body body CreateOrUpdateBlocksFromBatchResponseBodyRequestBody true "preconf blocks creation request body" +// @Accept json +// @Produce json +// @Success 200 {object} CreateOrUpdateBlocksFromBatchResponseBody +// @Router /perconfBlocks [post] +func (s *PreconfAPIServer) CreateOrUpdateBlocksFromBatch(c echo.Context) error { return c.NoContent(http.StatusOK) } diff --git a/packages/taiko-client/driver/preconf_server/server.go b/packages/taiko-client/driver/preconf_server/server.go index e74eccb7118..3eb28fbba86 100644 --- a/packages/taiko-client/driver/preconf_server/server.go +++ b/packages/taiko-client/driver/preconf_server/server.go @@ -75,6 +75,6 @@ func (s *PreconfAPIServer) configureMiddleware(corsOrigins []string) { func (s *PreconfAPIServer) configureRoutes() { s.echo.GET("/", s.HealthCheck) s.echo.GET("/healthz", s.HealthCheck) - s.echo.POST("/perconfTransactions", s.CreateBlocksByGroups) + s.echo.POST("/perconfTransactions", s.CreateOrUpdateBlocksFromBatch) s.echo.PUT("/preconfHead", s.ResetPreconfHead) } From 267ec3b952b73eef5931f0ad25b705b96d541ca3 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 21 Oct 2024 23:49:32 +0800 Subject: [PATCH 06/71] feat: add anchor params --- packages/taiko-client/driver/preconf_server/api.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go index 08a201aeae5..adbcafa1ffe 100644 --- a/packages/taiko-client/driver/preconf_server/api.go +++ b/packages/taiko-client/driver/preconf_server/api.go @@ -30,6 +30,11 @@ type PreconfTransactionsGroup struct { Random common.Hash `json:"prevRandao"` SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient"` BaseFeePerGas uint64 `json:"baseFeePerGas"` + + // AnchorV2 parameters + AnchorBlockId uint64 `json:"anchorBlockId"` + AnchorStateRoot common.Hash `json:"anchorStateRoot"` + ParentGasUsed uint32 `json:"parentGasUsed"` } // CreateOrUpdateBlocksFromBatchResponseBodyRequestBody represents a request body when handling From 22346fb274e0705960135e96fa7a68e59a6aeea1 Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 14:48:13 -0700 Subject: [PATCH 07/71] feat(taiko-client): add swagger for preconf api --- packages/taiko-client/.swaggo | 2 - packages/taiko-client/docs/docs.go | 355 ++++++++++++++++++ packages/taiko-client/docs/index.html | 29 ++ packages/taiko-client/docs/swagger.json | 310 +++++++++++++++ packages/taiko-client/docs/swagger.yaml | 226 +++++++++++ .../taiko-client/driver/preconf_server/api.go | 12 +- .../driver/preconf_server/server.go | 2 +- .../taiko-client/scripts/gen_swagger_json.sh | 2 +- 8 files changed, 928 insertions(+), 10 deletions(-) create mode 100644 packages/taiko-client/docs/docs.go create mode 100644 packages/taiko-client/docs/index.html create mode 100644 packages/taiko-client/docs/swagger.json create mode 100644 packages/taiko-client/docs/swagger.yaml diff --git a/packages/taiko-client/.swaggo b/packages/taiko-client/.swaggo index 8cc34d878a4..e69de29bb2d 100644 --- a/packages/taiko-client/.swaggo +++ b/packages/taiko-client/.swaggo @@ -1,2 +0,0 @@ -replace common.Address string -replace encoding.TierFee uint64 \ No newline at end of file diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go new file mode 100644 index 00000000000..835791ad3ae --- /dev/null +++ b/packages/taiko-client/docs/docs.go @@ -0,0 +1,355 @@ +// Package docs Code generated by swaggo/swag. DO NOT EDIT +package docs + +import "github.com/swaggo/swag" + +const docTemplate = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "API Support", + "url": "https://community.taiko.xyz/", + "email": "info@taiko.xyz" + }, + "license": { + "name": "MIT", + "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/healthz": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "summary": "Get current server health status", + "operationId": "health-check", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/preconfBlocks": { + "post": { + "description": "Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that\nthe AVS service should sort the groups and make sure all the groups are valid at first.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBody" + } + } + } + } + }, + "/preconfHead": { + "put": { + "description": "Resets the backend L2 execution engine preconfirmation head, please note that\nthe AVS service should make sure the new head height is from a valid preconfirmation head.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconf_server.ResetPreconfHeadRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconf_server.ResetPreconfHeadResponseBody" + } + } + } + } + } + }, + "definitions": { + "big.Int": { + "type": "object" + }, + "preconf_server.CreateOrUpdateBlocksFromBatchResponseBody": { + "type": "object", + "properties": { + "preconfHeaders": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Header" + } + } + } + }, + "preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody": { + "type": "object", + "properties": { + "transactionsGroups": { + "type": "array", + "items": { + "$ref": "#/definitions/preconf_server.PreconfTransactionsGroup" + } + } + } + }, + "preconf_server.PreconfTransactionsGroup": { + "type": "object", + "properties": { + "anchorBlockId": { + "description": "AnchorV2 parameters", + "type": "integer" + }, + "anchorStateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "baseFeePerGas": { + "type": "integer" + }, + "blockId": { + "type": "integer" + }, + "groupId": { + "type": "integer" + }, + "groupStatus": { + "$ref": "#/definitions/preconf_server.PreconfTxsGroupStatus" + }, + "parentGasUsed": { + "type": "integer" + }, + "prevRandao": { + "type": "array", + "items": { + "type": "integer" + } + }, + "signature": { + "type": "string" + }, + "suggestedFeeRecipient": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "description": "Block parameters", + "type": "integer" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Transaction" + } + } + } + }, + "preconf_server.PreconfTxsGroupStatus": { + "type": "string", + "enum": [ + "finalBlockGroup", + "finalPreconfGroup" + ], + "x-enum-varnames": [ + "StatusFinalBlockGroup", + "StatusFinalPreconfGroup" + ] + }, + "preconf_server.ResetPreconfHeadRequestBody": { + "type": "object", + "properties": { + "newHead": { + "type": "integer" + } + } + }, + "preconf_server.ResetPreconfHeadResponseBody": { + "type": "object", + "properties": { + "currentHead": { + "$ref": "#/definitions/types.Header" + } + } + }, + "types.Header": { + "type": "object", + "properties": { + "baseFeePerGas": { + "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", + "allOf": [ + { + "$ref": "#/definitions/big.Int" + } + ] + }, + "blobGasUsed": { + "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "difficulty": { + "$ref": "#/definitions/big.Int" + }, + "excessBlobGas": { + "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "extraData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "gasLimit": { + "type": "integer" + }, + "gasUsed": { + "type": "integer" + }, + "logsBloom": { + "type": "array", + "items": { + "type": "integer" + } + }, + "miner": { + "type": "array", + "items": { + "type": "integer" + } + }, + "mixHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "nonce": { + "type": "array", + "items": { + "type": "integer" + } + }, + "number": { + "$ref": "#/definitions/big.Int" + }, + "parentBeaconBlockRoot": { + "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "parentHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "receiptsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "requestsRoot": { + "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "sha3Uncles": { + "type": "array", + "items": { + "type": "integer" + } + }, + "stateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "type": "integer" + }, + "transactionsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "withdrawalsRoot": { + "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "types.Transaction": { + "type": "object" + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "1.0", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "Taiko Preconfirmation Server API", + Description: "", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/packages/taiko-client/docs/index.html b/packages/taiko-client/docs/index.html new file mode 100644 index 00000000000..f3644eff2c1 --- /dev/null +++ b/packages/taiko-client/docs/index.html @@ -0,0 +1,29 @@ + + + + + + Preconf Serer API + + +
+ + + diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json new file mode 100644 index 00000000000..87b0955403a --- /dev/null +++ b/packages/taiko-client/docs/swagger.json @@ -0,0 +1,310 @@ +{ + "swagger": "2.0", + "info": { + "title": "Taiko Preconfirmation Server API", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "API Support", + "url": "https://community.taiko.xyz/", + "email": "info@taiko.xyz" + }, + "license": { + "name": "MIT", + "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" + }, + "version": "1.0" + }, + "paths": { + "/healthz": { + "get": { + "consumes": ["application/json"], + "produces": ["application/json"], + "summary": "Get current server health status", + "operationId": "health-check", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/preconfBlocks": { + "post": { + "description": "Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that\nthe AVS service should sort the groups and make sure all the groups are valid at first.", + "consumes": ["application/json"], + "produces": ["application/json"], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBody" + } + } + } + } + }, + "/preconfHead": { + "put": { + "description": "Resets the backend L2 execution engine preconfirmation head, please note that\nthe AVS service should make sure the new head height is from a valid preconfirmation head.", + "consumes": ["application/json"], + "produces": ["application/json"], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconf_server.ResetPreconfHeadRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconf_server.ResetPreconfHeadResponseBody" + } + } + } + } + } + }, + "definitions": { + "big.Int": { + "type": "object" + }, + "preconf_server.CreateOrUpdateBlocksFromBatchResponseBody": { + "type": "object", + "properties": { + "preconfHeaders": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Header" + } + } + } + }, + "preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody": { + "type": "object", + "properties": { + "transactionsGroups": { + "type": "array", + "items": { + "$ref": "#/definitions/preconf_server.PreconfTransactionsGroup" + } + } + } + }, + "preconf_server.PreconfTransactionsGroup": { + "type": "object", + "properties": { + "anchorBlockId": { + "description": "AnchorV2 parameters", + "type": "integer" + }, + "anchorStateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "baseFeePerGas": { + "type": "integer" + }, + "blockId": { + "type": "integer" + }, + "groupId": { + "type": "integer" + }, + "groupStatus": { + "$ref": "#/definitions/preconf_server.PreconfTxsGroupStatus" + }, + "parentGasUsed": { + "type": "integer" + }, + "prevRandao": { + "type": "array", + "items": { + "type": "integer" + } + }, + "signature": { + "type": "string" + }, + "suggestedFeeRecipient": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "description": "Block parameters", + "type": "integer" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Transaction" + } + } + } + }, + "preconf_server.PreconfTxsGroupStatus": { + "type": "string", + "enum": ["finalBlockGroup", "finalPreconfGroup"], + "x-enum-varnames": ["StatusFinalBlockGroup", "StatusFinalPreconfGroup"] + }, + "preconf_server.ResetPreconfHeadRequestBody": { + "type": "object", + "properties": { + "newHead": { + "type": "integer" + } + } + }, + "preconf_server.ResetPreconfHeadResponseBody": { + "type": "object", + "properties": { + "currentHead": { + "$ref": "#/definitions/types.Header" + } + } + }, + "types.Header": { + "type": "object", + "properties": { + "baseFeePerGas": { + "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", + "allOf": [ + { + "$ref": "#/definitions/big.Int" + } + ] + }, + "blobGasUsed": { + "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "difficulty": { + "$ref": "#/definitions/big.Int" + }, + "excessBlobGas": { + "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "extraData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "gasLimit": { + "type": "integer" + }, + "gasUsed": { + "type": "integer" + }, + "logsBloom": { + "type": "array", + "items": { + "type": "integer" + } + }, + "miner": { + "type": "array", + "items": { + "type": "integer" + } + }, + "mixHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "nonce": { + "type": "array", + "items": { + "type": "integer" + } + }, + "number": { + "$ref": "#/definitions/big.Int" + }, + "parentBeaconBlockRoot": { + "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "parentHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "receiptsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "requestsRoot": { + "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "sha3Uncles": { + "type": "array", + "items": { + "type": "integer" + } + }, + "stateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "type": "integer" + }, + "transactionsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "withdrawalsRoot": { + "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "types.Transaction": { + "type": "object" + } + } +} diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml new file mode 100644 index 00000000000..440bc9b1a1b --- /dev/null +++ b/packages/taiko-client/docs/swagger.yaml @@ -0,0 +1,226 @@ +definitions: + big.Int: + type: object + preconf_server.CreateOrUpdateBlocksFromBatchResponseBody: + properties: + preconfHeaders: + items: + $ref: "#/definitions/types.Header" + type: array + type: object + preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody: + properties: + transactionsGroups: + items: + $ref: "#/definitions/preconf_server.PreconfTransactionsGroup" + type: array + type: object + preconf_server.PreconfTransactionsGroup: + properties: + anchorBlockId: + description: AnchorV2 parameters + type: integer + anchorStateRoot: + items: + type: integer + type: array + baseFeePerGas: + type: integer + blockId: + type: integer + groupId: + type: integer + groupStatus: + $ref: "#/definitions/preconf_server.PreconfTxsGroupStatus" + parentGasUsed: + type: integer + prevRandao: + items: + type: integer + type: array + signature: + type: string + suggestedFeeRecipient: + items: + type: integer + type: array + timestamp: + description: Block parameters + type: integer + transactions: + items: + $ref: "#/definitions/types.Transaction" + type: array + type: object + preconf_server.PreconfTxsGroupStatus: + enum: + - finalBlockGroup + - finalPreconfGroup + type: string + x-enum-varnames: + - StatusFinalBlockGroup + - StatusFinalPreconfGroup + preconf_server.ResetPreconfHeadRequestBody: + properties: + newHead: + type: integer + type: object + preconf_server.ResetPreconfHeadResponseBody: + properties: + currentHead: + $ref: "#/definitions/types.Header" + type: object + types.Header: + properties: + baseFeePerGas: + allOf: + - $ref: "#/definitions/big.Int" + description: BaseFee was added by EIP-1559 and is ignored in legacy headers. + blobGasUsed: + description: BlobGasUsed was added by EIP-4844 and is ignored in legacy headers. + type: integer + difficulty: + $ref: "#/definitions/big.Int" + excessBlobGas: + description: + ExcessBlobGas was added by EIP-4844 and is ignored in legacy + headers. + type: integer + extraData: + items: + type: integer + type: array + gasLimit: + type: integer + gasUsed: + type: integer + logsBloom: + items: + type: integer + type: array + miner: + items: + type: integer + type: array + mixHash: + items: + type: integer + type: array + nonce: + items: + type: integer + type: array + number: + $ref: "#/definitions/big.Int" + parentBeaconBlockRoot: + description: + ParentBeaconRoot was added by EIP-4788 and is ignored in legacy + headers. + items: + type: integer + type: array + parentHash: + items: + type: integer + type: array + receiptsRoot: + items: + type: integer + type: array + requestsRoot: + description: RequestsHash was added by EIP-7685 and is ignored in legacy headers. + items: + type: integer + type: array + sha3Uncles: + items: + type: integer + type: array + stateRoot: + items: + type: integer + type: array + timestamp: + type: integer + transactionsRoot: + items: + type: integer + type: array + withdrawalsRoot: + description: + WithdrawalsHash was added by EIP-4895 and is ignored in legacy + headers. + items: + type: integer + type: array + type: object + types.Transaction: + type: object +info: + contact: + email: info@taiko.xyz + name: API Support + url: https://community.taiko.xyz/ + license: + name: MIT + url: https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md + termsOfService: http://swagger.io/terms/ + title: Taiko Preconfirmation Server API + version: "1.0" +paths: + /healthz: + get: + consumes: + - application/json + operationId: health-check + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + summary: Get current server health status + /preconfBlocks: + post: + consumes: + - application/json + description: |- + Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that + the AVS service should sort the groups and make sure all the groups are valid at first. + parameters: + - description: preconf blocks creation request body + in: body + name: body + required: true + schema: + $ref: "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody" + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBody" + /preconfHead: + put: + consumes: + - application/json + description: |- + Resets the backend L2 execution engine preconfirmation head, please note that + the AVS service should make sure the new head height is from a valid preconfirmation head. + parameters: + - description: preconf blocks creation request body + in: body + name: body + required: true + schema: + $ref: "#/definitions/preconf_server.ResetPreconfHeadRequestBody" + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: "#/definitions/preconf_server.ResetPreconfHeadResponseBody" +swagger: "2.0" diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go index adbcafa1ffe..69f65c4f77c 100644 --- a/packages/taiko-client/driver/preconf_server/api.go +++ b/packages/taiko-client/driver/preconf_server/api.go @@ -53,13 +53,13 @@ type CreateOrUpdateBlocksFromBatchResponseBody struct { // if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation // blocks to the backend L2 execution engine and return a success response. // -// @Summary Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that -// the AVS service should sort the groups and make sure all the groups are valid at first. +// @Description Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that +// @Description the AVS service should sort the groups and make sure all the groups are valid at first. // @Param body body CreateOrUpdateBlocksFromBatchResponseBodyRequestBody true "preconf blocks creation request body" // @Accept json // @Produce json // @Success 200 {object} CreateOrUpdateBlocksFromBatchResponseBody -// @Router /perconfBlocks [post] +// @Router /preconfBlocks [post] func (s *PreconfAPIServer) CreateOrUpdateBlocksFromBatch(c echo.Context) error { return c.NoContent(http.StatusOK) } @@ -78,8 +78,8 @@ type ResetPreconfHeadResponseBody struct { // ResetPreconfHead resets the backend L2 execution engine preconfirmation head. // -// @Summary Resets the backend L2 execution engine preconfirmation head, please note that -// the AVS service should make sure the new head height is from a valid preconfirmation head. +// @Description Resets the backend L2 execution engine preconfirmation head, please note that +// @Description the AVS service should make sure the new head height is from a valid preconfirmation head. // @Param body body ResetPreconfHeadRequestBody true "preconf blocks creation request body" // @Accept json // @Produce json @@ -95,7 +95,7 @@ func (s *PreconfAPIServer) ResetPreconfHead(c echo.Context) error { // @ID health-check // @Accept json // @Produce json -// @Success 200 {object} Status +// @Success 200 {object} string // @Router /healthz [get] func (s *PreconfAPIServer) HealthCheck(c echo.Context) error { return c.NoContent(http.StatusOK) diff --git a/packages/taiko-client/driver/preconf_server/server.go b/packages/taiko-client/driver/preconf_server/server.go index 3eb28fbba86..51fc8edc23f 100644 --- a/packages/taiko-client/driver/preconf_server/server.go +++ b/packages/taiko-client/driver/preconf_server/server.go @@ -75,6 +75,6 @@ func (s *PreconfAPIServer) configureMiddleware(corsOrigins []string) { func (s *PreconfAPIServer) configureRoutes() { s.echo.GET("/", s.HealthCheck) s.echo.GET("/healthz", s.HealthCheck) - s.echo.POST("/perconfTransactions", s.CreateOrUpdateBlocksFromBatch) + s.echo.POST("/preconfTransactions", s.CreateOrUpdateBlocksFromBatch) s.echo.PUT("/preconfHead", s.ResetPreconfHead) } diff --git a/packages/taiko-client/scripts/gen_swagger_json.sh b/packages/taiko-client/scripts/gen_swagger_json.sh index 59dce311dbd..ac8f7a91849 100755 --- a/packages/taiko-client/scripts/gen_swagger_json.sh +++ b/packages/taiko-client/scripts/gen_swagger_json.sh @@ -1,3 +1,3 @@ #/bin/sh -swag init -g api.go -d prover/server --pd +swag init -g server.go -d driver/preconf_server --pd From 3c41aa70a1fe6c60dff939ccf0686ad8afb2f254 Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 15:03:31 -0700 Subject: [PATCH 08/71] Revert "feat(taiko-client): add swagger for preconf api" This reverts commit 22346fb274e0705960135e96fa7a68e59a6aeea1. --- packages/taiko-client/.swaggo | 2 + packages/taiko-client/docs/docs.go | 355 ------------------ packages/taiko-client/docs/index.html | 29 -- packages/taiko-client/docs/swagger.json | 310 --------------- packages/taiko-client/docs/swagger.yaml | 226 ----------- .../taiko-client/driver/preconf_server/api.go | 12 +- .../driver/preconf_server/server.go | 2 +- .../taiko-client/scripts/gen_swagger_json.sh | 2 +- 8 files changed, 10 insertions(+), 928 deletions(-) delete mode 100644 packages/taiko-client/docs/docs.go delete mode 100644 packages/taiko-client/docs/index.html delete mode 100644 packages/taiko-client/docs/swagger.json delete mode 100644 packages/taiko-client/docs/swagger.yaml diff --git a/packages/taiko-client/.swaggo b/packages/taiko-client/.swaggo index e69de29bb2d..8cc34d878a4 100644 --- a/packages/taiko-client/.swaggo +++ b/packages/taiko-client/.swaggo @@ -0,0 +1,2 @@ +replace common.Address string +replace encoding.TierFee uint64 \ No newline at end of file diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go deleted file mode 100644 index 835791ad3ae..00000000000 --- a/packages/taiko-client/docs/docs.go +++ /dev/null @@ -1,355 +0,0 @@ -// Package docs Code generated by swaggo/swag. DO NOT EDIT -package docs - -import "github.com/swaggo/swag" - -const docTemplate = `{ - "schemes": {{ marshal .Schemes }}, - "swagger": "2.0", - "info": { - "description": "{{escape .Description}}", - "title": "{{.Title}}", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "API Support", - "url": "https://community.taiko.xyz/", - "email": "info@taiko.xyz" - }, - "license": { - "name": "MIT", - "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" - }, - "version": "{{.Version}}" - }, - "host": "{{.Host}}", - "basePath": "{{.BasePath}}", - "paths": { - "/healthz": { - "get": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "summary": "Get current server health status", - "operationId": "health-check", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } - }, - "/preconfBlocks": { - "post": { - "description": "Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that\nthe AVS service should sort the groups and make sure all the groups are valid at first.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "description": "preconf blocks creation request body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBody" - } - } - } - } - }, - "/preconfHead": { - "put": { - "description": "Resets the backend L2 execution engine preconfirmation head, please note that\nthe AVS service should make sure the new head height is from a valid preconfirmation head.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "description": "preconf blocks creation request body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/preconf_server.ResetPreconfHeadRequestBody" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/preconf_server.ResetPreconfHeadResponseBody" - } - } - } - } - } - }, - "definitions": { - "big.Int": { - "type": "object" - }, - "preconf_server.CreateOrUpdateBlocksFromBatchResponseBody": { - "type": "object", - "properties": { - "preconfHeaders": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Header" - } - } - } - }, - "preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody": { - "type": "object", - "properties": { - "transactionsGroups": { - "type": "array", - "items": { - "$ref": "#/definitions/preconf_server.PreconfTransactionsGroup" - } - } - } - }, - "preconf_server.PreconfTransactionsGroup": { - "type": "object", - "properties": { - "anchorBlockId": { - "description": "AnchorV2 parameters", - "type": "integer" - }, - "anchorStateRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "baseFeePerGas": { - "type": "integer" - }, - "blockId": { - "type": "integer" - }, - "groupId": { - "type": "integer" - }, - "groupStatus": { - "$ref": "#/definitions/preconf_server.PreconfTxsGroupStatus" - }, - "parentGasUsed": { - "type": "integer" - }, - "prevRandao": { - "type": "array", - "items": { - "type": "integer" - } - }, - "signature": { - "type": "string" - }, - "suggestedFeeRecipient": { - "type": "array", - "items": { - "type": "integer" - } - }, - "timestamp": { - "description": "Block parameters", - "type": "integer" - }, - "transactions": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Transaction" - } - } - } - }, - "preconf_server.PreconfTxsGroupStatus": { - "type": "string", - "enum": [ - "finalBlockGroup", - "finalPreconfGroup" - ], - "x-enum-varnames": [ - "StatusFinalBlockGroup", - "StatusFinalPreconfGroup" - ] - }, - "preconf_server.ResetPreconfHeadRequestBody": { - "type": "object", - "properties": { - "newHead": { - "type": "integer" - } - } - }, - "preconf_server.ResetPreconfHeadResponseBody": { - "type": "object", - "properties": { - "currentHead": { - "$ref": "#/definitions/types.Header" - } - } - }, - "types.Header": { - "type": "object", - "properties": { - "baseFeePerGas": { - "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", - "allOf": [ - { - "$ref": "#/definitions/big.Int" - } - ] - }, - "blobGasUsed": { - "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", - "type": "integer" - }, - "difficulty": { - "$ref": "#/definitions/big.Int" - }, - "excessBlobGas": { - "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", - "type": "integer" - }, - "extraData": { - "type": "array", - "items": { - "type": "integer" - } - }, - "gasLimit": { - "type": "integer" - }, - "gasUsed": { - "type": "integer" - }, - "logsBloom": { - "type": "array", - "items": { - "type": "integer" - } - }, - "miner": { - "type": "array", - "items": { - "type": "integer" - } - }, - "mixHash": { - "type": "array", - "items": { - "type": "integer" - } - }, - "nonce": { - "type": "array", - "items": { - "type": "integer" - } - }, - "number": { - "$ref": "#/definitions/big.Int" - }, - "parentBeaconBlockRoot": { - "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - }, - "parentHash": { - "type": "array", - "items": { - "type": "integer" - } - }, - "receiptsRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "requestsRoot": { - "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - }, - "sha3Uncles": { - "type": "array", - "items": { - "type": "integer" - } - }, - "stateRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "timestamp": { - "type": "integer" - }, - "transactionsRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "withdrawalsRoot": { - "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - } - } - }, - "types.Transaction": { - "type": "object" - } - } -}` - -// SwaggerInfo holds exported Swagger Info so clients can modify it -var SwaggerInfo = &swag.Spec{ - Version: "1.0", - Host: "", - BasePath: "", - Schemes: []string{}, - Title: "Taiko Preconfirmation Server API", - Description: "", - InfoInstanceName: "swagger", - SwaggerTemplate: docTemplate, - LeftDelim: "{{", - RightDelim: "}}", -} - -func init() { - swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) -} diff --git a/packages/taiko-client/docs/index.html b/packages/taiko-client/docs/index.html deleted file mode 100644 index f3644eff2c1..00000000000 --- a/packages/taiko-client/docs/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - Preconf Serer API - - -
- - - diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json deleted file mode 100644 index 87b0955403a..00000000000 --- a/packages/taiko-client/docs/swagger.json +++ /dev/null @@ -1,310 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Taiko Preconfirmation Server API", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "API Support", - "url": "https://community.taiko.xyz/", - "email": "info@taiko.xyz" - }, - "license": { - "name": "MIT", - "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" - }, - "version": "1.0" - }, - "paths": { - "/healthz": { - "get": { - "consumes": ["application/json"], - "produces": ["application/json"], - "summary": "Get current server health status", - "operationId": "health-check", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } - }, - "/preconfBlocks": { - "post": { - "description": "Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that\nthe AVS service should sort the groups and make sure all the groups are valid at first.", - "consumes": ["application/json"], - "produces": ["application/json"], - "parameters": [ - { - "description": "preconf blocks creation request body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBody" - } - } - } - } - }, - "/preconfHead": { - "put": { - "description": "Resets the backend L2 execution engine preconfirmation head, please note that\nthe AVS service should make sure the new head height is from a valid preconfirmation head.", - "consumes": ["application/json"], - "produces": ["application/json"], - "parameters": [ - { - "description": "preconf blocks creation request body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/preconf_server.ResetPreconfHeadRequestBody" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/preconf_server.ResetPreconfHeadResponseBody" - } - } - } - } - } - }, - "definitions": { - "big.Int": { - "type": "object" - }, - "preconf_server.CreateOrUpdateBlocksFromBatchResponseBody": { - "type": "object", - "properties": { - "preconfHeaders": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Header" - } - } - } - }, - "preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody": { - "type": "object", - "properties": { - "transactionsGroups": { - "type": "array", - "items": { - "$ref": "#/definitions/preconf_server.PreconfTransactionsGroup" - } - } - } - }, - "preconf_server.PreconfTransactionsGroup": { - "type": "object", - "properties": { - "anchorBlockId": { - "description": "AnchorV2 parameters", - "type": "integer" - }, - "anchorStateRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "baseFeePerGas": { - "type": "integer" - }, - "blockId": { - "type": "integer" - }, - "groupId": { - "type": "integer" - }, - "groupStatus": { - "$ref": "#/definitions/preconf_server.PreconfTxsGroupStatus" - }, - "parentGasUsed": { - "type": "integer" - }, - "prevRandao": { - "type": "array", - "items": { - "type": "integer" - } - }, - "signature": { - "type": "string" - }, - "suggestedFeeRecipient": { - "type": "array", - "items": { - "type": "integer" - } - }, - "timestamp": { - "description": "Block parameters", - "type": "integer" - }, - "transactions": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Transaction" - } - } - } - }, - "preconf_server.PreconfTxsGroupStatus": { - "type": "string", - "enum": ["finalBlockGroup", "finalPreconfGroup"], - "x-enum-varnames": ["StatusFinalBlockGroup", "StatusFinalPreconfGroup"] - }, - "preconf_server.ResetPreconfHeadRequestBody": { - "type": "object", - "properties": { - "newHead": { - "type": "integer" - } - } - }, - "preconf_server.ResetPreconfHeadResponseBody": { - "type": "object", - "properties": { - "currentHead": { - "$ref": "#/definitions/types.Header" - } - } - }, - "types.Header": { - "type": "object", - "properties": { - "baseFeePerGas": { - "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", - "allOf": [ - { - "$ref": "#/definitions/big.Int" - } - ] - }, - "blobGasUsed": { - "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", - "type": "integer" - }, - "difficulty": { - "$ref": "#/definitions/big.Int" - }, - "excessBlobGas": { - "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", - "type": "integer" - }, - "extraData": { - "type": "array", - "items": { - "type": "integer" - } - }, - "gasLimit": { - "type": "integer" - }, - "gasUsed": { - "type": "integer" - }, - "logsBloom": { - "type": "array", - "items": { - "type": "integer" - } - }, - "miner": { - "type": "array", - "items": { - "type": "integer" - } - }, - "mixHash": { - "type": "array", - "items": { - "type": "integer" - } - }, - "nonce": { - "type": "array", - "items": { - "type": "integer" - } - }, - "number": { - "$ref": "#/definitions/big.Int" - }, - "parentBeaconBlockRoot": { - "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - }, - "parentHash": { - "type": "array", - "items": { - "type": "integer" - } - }, - "receiptsRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "requestsRoot": { - "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - }, - "sha3Uncles": { - "type": "array", - "items": { - "type": "integer" - } - }, - "stateRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "timestamp": { - "type": "integer" - }, - "transactionsRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "withdrawalsRoot": { - "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - } - } - }, - "types.Transaction": { - "type": "object" - } - } -} diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml deleted file mode 100644 index 440bc9b1a1b..00000000000 --- a/packages/taiko-client/docs/swagger.yaml +++ /dev/null @@ -1,226 +0,0 @@ -definitions: - big.Int: - type: object - preconf_server.CreateOrUpdateBlocksFromBatchResponseBody: - properties: - preconfHeaders: - items: - $ref: "#/definitions/types.Header" - type: array - type: object - preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody: - properties: - transactionsGroups: - items: - $ref: "#/definitions/preconf_server.PreconfTransactionsGroup" - type: array - type: object - preconf_server.PreconfTransactionsGroup: - properties: - anchorBlockId: - description: AnchorV2 parameters - type: integer - anchorStateRoot: - items: - type: integer - type: array - baseFeePerGas: - type: integer - blockId: - type: integer - groupId: - type: integer - groupStatus: - $ref: "#/definitions/preconf_server.PreconfTxsGroupStatus" - parentGasUsed: - type: integer - prevRandao: - items: - type: integer - type: array - signature: - type: string - suggestedFeeRecipient: - items: - type: integer - type: array - timestamp: - description: Block parameters - type: integer - transactions: - items: - $ref: "#/definitions/types.Transaction" - type: array - type: object - preconf_server.PreconfTxsGroupStatus: - enum: - - finalBlockGroup - - finalPreconfGroup - type: string - x-enum-varnames: - - StatusFinalBlockGroup - - StatusFinalPreconfGroup - preconf_server.ResetPreconfHeadRequestBody: - properties: - newHead: - type: integer - type: object - preconf_server.ResetPreconfHeadResponseBody: - properties: - currentHead: - $ref: "#/definitions/types.Header" - type: object - types.Header: - properties: - baseFeePerGas: - allOf: - - $ref: "#/definitions/big.Int" - description: BaseFee was added by EIP-1559 and is ignored in legacy headers. - blobGasUsed: - description: BlobGasUsed was added by EIP-4844 and is ignored in legacy headers. - type: integer - difficulty: - $ref: "#/definitions/big.Int" - excessBlobGas: - description: - ExcessBlobGas was added by EIP-4844 and is ignored in legacy - headers. - type: integer - extraData: - items: - type: integer - type: array - gasLimit: - type: integer - gasUsed: - type: integer - logsBloom: - items: - type: integer - type: array - miner: - items: - type: integer - type: array - mixHash: - items: - type: integer - type: array - nonce: - items: - type: integer - type: array - number: - $ref: "#/definitions/big.Int" - parentBeaconBlockRoot: - description: - ParentBeaconRoot was added by EIP-4788 and is ignored in legacy - headers. - items: - type: integer - type: array - parentHash: - items: - type: integer - type: array - receiptsRoot: - items: - type: integer - type: array - requestsRoot: - description: RequestsHash was added by EIP-7685 and is ignored in legacy headers. - items: - type: integer - type: array - sha3Uncles: - items: - type: integer - type: array - stateRoot: - items: - type: integer - type: array - timestamp: - type: integer - transactionsRoot: - items: - type: integer - type: array - withdrawalsRoot: - description: - WithdrawalsHash was added by EIP-4895 and is ignored in legacy - headers. - items: - type: integer - type: array - type: object - types.Transaction: - type: object -info: - contact: - email: info@taiko.xyz - name: API Support - url: https://community.taiko.xyz/ - license: - name: MIT - url: https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md - termsOfService: http://swagger.io/terms/ - title: Taiko Preconfirmation Server API - version: "1.0" -paths: - /healthz: - get: - consumes: - - application/json - operationId: health-check - produces: - - application/json - responses: - "200": - description: OK - schema: - type: string - summary: Get current server health status - /preconfBlocks: - post: - consumes: - - application/json - description: |- - Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that - the AVS service should sort the groups and make sure all the groups are valid at first. - parameters: - - description: preconf blocks creation request body - in: body - name: body - required: true - schema: - $ref: "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBodyRequestBody" - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: "#/definitions/preconf_server.CreateOrUpdateBlocksFromBatchResponseBody" - /preconfHead: - put: - consumes: - - application/json - description: |- - Resets the backend L2 execution engine preconfirmation head, please note that - the AVS service should make sure the new head height is from a valid preconfirmation head. - parameters: - - description: preconf blocks creation request body - in: body - name: body - required: true - schema: - $ref: "#/definitions/preconf_server.ResetPreconfHeadRequestBody" - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: "#/definitions/preconf_server.ResetPreconfHeadResponseBody" -swagger: "2.0" diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go index 69f65c4f77c..adbcafa1ffe 100644 --- a/packages/taiko-client/driver/preconf_server/api.go +++ b/packages/taiko-client/driver/preconf_server/api.go @@ -53,13 +53,13 @@ type CreateOrUpdateBlocksFromBatchResponseBody struct { // if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation // blocks to the backend L2 execution engine and return a success response. // -// @Description Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that -// @Description the AVS service should sort the groups and make sure all the groups are valid at first. +// @Summary Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that +// the AVS service should sort the groups and make sure all the groups are valid at first. // @Param body body CreateOrUpdateBlocksFromBatchResponseBodyRequestBody true "preconf blocks creation request body" // @Accept json // @Produce json // @Success 200 {object} CreateOrUpdateBlocksFromBatchResponseBody -// @Router /preconfBlocks [post] +// @Router /perconfBlocks [post] func (s *PreconfAPIServer) CreateOrUpdateBlocksFromBatch(c echo.Context) error { return c.NoContent(http.StatusOK) } @@ -78,8 +78,8 @@ type ResetPreconfHeadResponseBody struct { // ResetPreconfHead resets the backend L2 execution engine preconfirmation head. // -// @Description Resets the backend L2 execution engine preconfirmation head, please note that -// @Description the AVS service should make sure the new head height is from a valid preconfirmation head. +// @Summary Resets the backend L2 execution engine preconfirmation head, please note that +// the AVS service should make sure the new head height is from a valid preconfirmation head. // @Param body body ResetPreconfHeadRequestBody true "preconf blocks creation request body" // @Accept json // @Produce json @@ -95,7 +95,7 @@ func (s *PreconfAPIServer) ResetPreconfHead(c echo.Context) error { // @ID health-check // @Accept json // @Produce json -// @Success 200 {object} string +// @Success 200 {object} Status // @Router /healthz [get] func (s *PreconfAPIServer) HealthCheck(c echo.Context) error { return c.NoContent(http.StatusOK) diff --git a/packages/taiko-client/driver/preconf_server/server.go b/packages/taiko-client/driver/preconf_server/server.go index 51fc8edc23f..3eb28fbba86 100644 --- a/packages/taiko-client/driver/preconf_server/server.go +++ b/packages/taiko-client/driver/preconf_server/server.go @@ -75,6 +75,6 @@ func (s *PreconfAPIServer) configureMiddleware(corsOrigins []string) { func (s *PreconfAPIServer) configureRoutes() { s.echo.GET("/", s.HealthCheck) s.echo.GET("/healthz", s.HealthCheck) - s.echo.POST("/preconfTransactions", s.CreateOrUpdateBlocksFromBatch) + s.echo.POST("/perconfTransactions", s.CreateOrUpdateBlocksFromBatch) s.echo.PUT("/preconfHead", s.ResetPreconfHead) } diff --git a/packages/taiko-client/scripts/gen_swagger_json.sh b/packages/taiko-client/scripts/gen_swagger_json.sh index ac8f7a91849..59dce311dbd 100755 --- a/packages/taiko-client/scripts/gen_swagger_json.sh +++ b/packages/taiko-client/scripts/gen_swagger_json.sh @@ -1,3 +1,3 @@ #/bin/sh -swag init -g server.go -d driver/preconf_server --pd +swag init -g api.go -d prover/server --pd From b89158898358930e53ee9edd9af2162bdb8890a2 Mon Sep 17 00:00:00 2001 From: Roger <50648015+RogerLamTd@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:09:24 -0700 Subject: [PATCH 09/71] feat(taiko-client): add swagger api for preconf server (#18274) Co-authored-by: David --- packages/taiko-client/.swaggo | 2 - packages/taiko-client/docs/docs.go | 353 ++++++++++++++++++ packages/taiko-client/docs/swagger.json | 308 +++++++++++++++ packages/taiko-client/docs/swagger.yaml | 233 ++++++++++++ .../taiko-client/driver/preconf_server/api.go | 66 ++-- .../driver/preconf_server/server.go | 6 +- .../taiko-client/scripts/gen_swagger_json.sh | 2 +- 7 files changed, 935 insertions(+), 35 deletions(-) create mode 100644 packages/taiko-client/docs/docs.go create mode 100644 packages/taiko-client/docs/swagger.json create mode 100644 packages/taiko-client/docs/swagger.yaml diff --git a/packages/taiko-client/.swaggo b/packages/taiko-client/.swaggo index 8cc34d878a4..e69de29bb2d 100644 --- a/packages/taiko-client/.swaggo +++ b/packages/taiko-client/.swaggo @@ -1,2 +0,0 @@ -replace common.Address string -replace encoding.TierFee uint64 \ No newline at end of file diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go new file mode 100644 index 00000000000..2b8c139d168 --- /dev/null +++ b/packages/taiko-client/docs/docs.go @@ -0,0 +1,353 @@ +// Package docs Code generated by swaggo/swag. DO NOT EDIT +package docs + +import "github.com/swaggo/swag" + +const docTemplate = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "API Support", + "url": "https://community.taiko.xyz/", + "email": "info@taiko.xyz" + }, + "license": { + "name": "MIT", + "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/healthz": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "summary": "Get current server health status", + "operationId": "health-check", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/tentativeBlocks": { + "post": { + "description": "Insert a group of transactions into a tentative block for preconfirmation. If the group is the\nfirst for a block, a new tentative block will be created. Otherwise, the transactions will\nbe appended to the existing tentative block. The API will fail if:\n1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current tentative block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconfserver.BuildTentativeBlocksRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconfserver.BuildTentativeBlocksResponseBody" + } + } + } + }, + "delete": { + "description": "Remove all tentative blocks from the blockchain beyond the specified block height,\nensuring the latest block ID does not exceed the given height. This method will fail if\nthe block with an ID one greater than the specified height is not a tentative block. If the\nspecified block height is greater than the latest tentative block ID, the method will succeed\nwithout modifying the blockchain.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksResponseBody" + } + } + } + } + } + }, + "definitions": { + "big.Int": { + "type": "object" + }, + "preconfserver.BuildTentativeBlocksRequestBody": { + "type": "object", + "properties": { + "transactionsGroups": { + "type": "array", + "items": { + "$ref": "#/definitions/preconfserver.PreconfTransactionsGroup" + } + } + } + }, + "preconfserver.BuildTentativeBlocksResponseBody": { + "type": "object", + "properties": { + "tentativeHeaders": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Header" + } + } + } + }, + "preconfserver.PreconfTransactionsGroup": { + "type": "object", + "properties": { + "anchorBlockID": { + "description": "AnchorV2 parameters", + "type": "integer" + }, + "anchorStateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "baseFeePerGas": { + "type": "integer" + }, + "blockId": { + "type": "integer" + }, + "groupId": { + "type": "integer" + }, + "groupStatus": { + "$ref": "#/definitions/preconfserver.PreconfTxsGroupStatus" + }, + "parentGasUsed": { + "type": "integer" + }, + "prevRandao": { + "type": "array", + "items": { + "type": "integer" + } + }, + "signature": { + "type": "string" + }, + "suggestedFeeRecipient": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "description": "Block parameters", + "type": "integer" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Transaction" + } + } + } + }, + "preconfserver.PreconfTxsGroupStatus": { + "type": "string", + "enum": [ + "finalBlockGroup", + "finalPreconfGroup" + ], + "x-enum-varnames": [ + "StatusFinalBlockGroup", + "StatusFinalPreconfGroup" + ] + }, + "preconfserver.RemoveTentativeBlocksRequestBody": { + "type": "object", + "properties": { + "newHead": { + "type": "integer" + } + } + }, + "preconfserver.RemoveTentativeBlocksResponseBody": { + "type": "object", + "properties": { + "currentHead": { + "$ref": "#/definitions/types.Header" + } + } + }, + "types.Header": { + "type": "object", + "properties": { + "baseFeePerGas": { + "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", + "allOf": [ + { + "$ref": "#/definitions/big.Int" + } + ] + }, + "blobGasUsed": { + "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "difficulty": { + "$ref": "#/definitions/big.Int" + }, + "excessBlobGas": { + "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "extraData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "gasLimit": { + "type": "integer" + }, + "gasUsed": { + "type": "integer" + }, + "logsBloom": { + "type": "array", + "items": { + "type": "integer" + } + }, + "miner": { + "type": "array", + "items": { + "type": "integer" + } + }, + "mixHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "nonce": { + "type": "array", + "items": { + "type": "integer" + } + }, + "number": { + "$ref": "#/definitions/big.Int" + }, + "parentBeaconBlockRoot": { + "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "parentHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "receiptsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "requestsRoot": { + "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "sha3Uncles": { + "type": "array", + "items": { + "type": "integer" + } + }, + "stateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "type": "integer" + }, + "transactionsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "withdrawalsRoot": { + "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "types.Transaction": { + "type": "object" + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "1.0", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "Taiko Preconfirmation Server API", + Description: "", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json new file mode 100644 index 00000000000..61c81a0fc04 --- /dev/null +++ b/packages/taiko-client/docs/swagger.json @@ -0,0 +1,308 @@ +{ + "swagger": "2.0", + "info": { + "title": "Taiko Preconfirmation Server API", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "API Support", + "url": "https://community.taiko.xyz/", + "email": "info@taiko.xyz" + }, + "license": { + "name": "MIT", + "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" + }, + "version": "1.0" + }, + "paths": { + "/healthz": { + "get": { + "consumes": ["application/json"], + "produces": ["application/json"], + "summary": "Get current server health status", + "operationId": "health-check", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/tentativeBlocks": { + "post": { + "description": "Insert a group of transactions into a tentative block for preconfirmation. If the group is the\nfirst for a block, a new tentative block will be created. Otherwise, the transactions will\nbe appended to the existing tentative block. The API will fail if:\n1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current tentative block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", + "consumes": ["application/json"], + "produces": ["application/json"], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconfserver.BuildTentativeBlocksRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconfserver.BuildTentativeBlocksResponseBody" + } + } + } + }, + "delete": { + "description": "Remove all tentative blocks from the blockchain beyond the specified block height,\nensuring the latest block ID does not exceed the given height. This method will fail if\nthe block with an ID one greater than the specified height is not a tentative block. If the\nspecified block height is greater than the latest tentative block ID, the method will succeed\nwithout modifying the blockchain.", + "consumes": ["application/json"], + "produces": ["application/json"], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksResponseBody" + } + } + } + } + } + }, + "definitions": { + "big.Int": { + "type": "object" + }, + "preconfserver.BuildTentativeBlocksRequestBody": { + "type": "object", + "properties": { + "transactionsGroups": { + "type": "array", + "items": { + "$ref": "#/definitions/preconfserver.PreconfTransactionsGroup" + } + } + } + }, + "preconfserver.BuildTentativeBlocksResponseBody": { + "type": "object", + "properties": { + "tentativeHeaders": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Header" + } + } + } + }, + "preconfserver.PreconfTransactionsGroup": { + "type": "object", + "properties": { + "anchorBlockID": { + "description": "AnchorV2 parameters", + "type": "integer" + }, + "anchorStateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "baseFeePerGas": { + "type": "integer" + }, + "blockId": { + "type": "integer" + }, + "groupId": { + "type": "integer" + }, + "groupStatus": { + "$ref": "#/definitions/preconfserver.PreconfTxsGroupStatus" + }, + "parentGasUsed": { + "type": "integer" + }, + "prevRandao": { + "type": "array", + "items": { + "type": "integer" + } + }, + "signature": { + "type": "string" + }, + "suggestedFeeRecipient": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "description": "Block parameters", + "type": "integer" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Transaction" + } + } + } + }, + "preconfserver.PreconfTxsGroupStatus": { + "type": "string", + "enum": ["finalBlockGroup", "finalPreconfGroup"], + "x-enum-varnames": ["StatusFinalBlockGroup", "StatusFinalPreconfGroup"] + }, + "preconfserver.RemoveTentativeBlocksRequestBody": { + "type": "object", + "properties": { + "newHead": { + "type": "integer" + } + } + }, + "preconfserver.RemoveTentativeBlocksResponseBody": { + "type": "object", + "properties": { + "currentHead": { + "$ref": "#/definitions/types.Header" + } + } + }, + "types.Header": { + "type": "object", + "properties": { + "baseFeePerGas": { + "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", + "allOf": [ + { + "$ref": "#/definitions/big.Int" + } + ] + }, + "blobGasUsed": { + "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "difficulty": { + "$ref": "#/definitions/big.Int" + }, + "excessBlobGas": { + "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "extraData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "gasLimit": { + "type": "integer" + }, + "gasUsed": { + "type": "integer" + }, + "logsBloom": { + "type": "array", + "items": { + "type": "integer" + } + }, + "miner": { + "type": "array", + "items": { + "type": "integer" + } + }, + "mixHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "nonce": { + "type": "array", + "items": { + "type": "integer" + } + }, + "number": { + "$ref": "#/definitions/big.Int" + }, + "parentBeaconBlockRoot": { + "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "parentHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "receiptsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "requestsRoot": { + "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "sha3Uncles": { + "type": "array", + "items": { + "type": "integer" + } + }, + "stateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "type": "integer" + }, + "transactionsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "withdrawalsRoot": { + "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "types.Transaction": { + "type": "object" + } + } +} diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml new file mode 100644 index 00000000000..fe3da6b5fda --- /dev/null +++ b/packages/taiko-client/docs/swagger.yaml @@ -0,0 +1,233 @@ +definitions: + big.Int: + type: object + preconfserver.BuildTentativeBlocksRequestBody: + properties: + transactionsGroups: + items: + $ref: "#/definitions/preconfserver.PreconfTransactionsGroup" + type: array + type: object + preconfserver.BuildTentativeBlocksResponseBody: + properties: + tentativeHeaders: + items: + $ref: "#/definitions/types.Header" + type: array + type: object + preconfserver.PreconfTransactionsGroup: + properties: + anchorBlockID: + description: AnchorV2 parameters + type: integer + anchorStateRoot: + items: + type: integer + type: array + baseFeePerGas: + type: integer + blockId: + type: integer + groupId: + type: integer + groupStatus: + $ref: "#/definitions/preconfserver.PreconfTxsGroupStatus" + parentGasUsed: + type: integer + prevRandao: + items: + type: integer + type: array + signature: + type: string + suggestedFeeRecipient: + items: + type: integer + type: array + timestamp: + description: Block parameters + type: integer + transactions: + items: + $ref: "#/definitions/types.Transaction" + type: array + type: object + preconfserver.PreconfTxsGroupStatus: + enum: + - finalBlockGroup + - finalPreconfGroup + type: string + x-enum-varnames: + - StatusFinalBlockGroup + - StatusFinalPreconfGroup + preconfserver.RemoveTentativeBlocksRequestBody: + properties: + newHead: + type: integer + type: object + preconfserver.RemoveTentativeBlocksResponseBody: + properties: + currentHead: + $ref: "#/definitions/types.Header" + type: object + types.Header: + properties: + baseFeePerGas: + allOf: + - $ref: "#/definitions/big.Int" + description: BaseFee was added by EIP-1559 and is ignored in legacy headers. + blobGasUsed: + description: BlobGasUsed was added by EIP-4844 and is ignored in legacy headers. + type: integer + difficulty: + $ref: "#/definitions/big.Int" + excessBlobGas: + description: + ExcessBlobGas was added by EIP-4844 and is ignored in legacy + headers. + type: integer + extraData: + items: + type: integer + type: array + gasLimit: + type: integer + gasUsed: + type: integer + logsBloom: + items: + type: integer + type: array + miner: + items: + type: integer + type: array + mixHash: + items: + type: integer + type: array + nonce: + items: + type: integer + type: array + number: + $ref: "#/definitions/big.Int" + parentBeaconBlockRoot: + description: + ParentBeaconRoot was added by EIP-4788 and is ignored in legacy + headers. + items: + type: integer + type: array + parentHash: + items: + type: integer + type: array + receiptsRoot: + items: + type: integer + type: array + requestsRoot: + description: RequestsHash was added by EIP-7685 and is ignored in legacy headers. + items: + type: integer + type: array + sha3Uncles: + items: + type: integer + type: array + stateRoot: + items: + type: integer + type: array + timestamp: + type: integer + transactionsRoot: + items: + type: integer + type: array + withdrawalsRoot: + description: + WithdrawalsHash was added by EIP-4895 and is ignored in legacy + headers. + items: + type: integer + type: array + type: object + types.Transaction: + type: object +info: + contact: + email: info@taiko.xyz + name: API Support + url: https://community.taiko.xyz/ + license: + name: MIT + url: https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md + termsOfService: http://swagger.io/terms/ + title: Taiko Preconfirmation Server API + version: "1.0" +paths: + /healthz: + get: + consumes: + - application/json + operationId: health-check + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + summary: Get current server health status + /tentativeBlocks: + delete: + consumes: + - application/json + description: |- + Remove all tentative blocks from the blockchain beyond the specified block height, + ensuring the latest block ID does not exceed the given height. This method will fail if + the block with an ID one greater than the specified height is not a tentative block. If the + specified block height is greater than the latest tentative block ID, the method will succeed + without modifying the blockchain. + parameters: + - description: preconf blocks creation request body + in: body + name: body + required: true + schema: + $ref: "#/definitions/preconfserver.RemoveTentativeBlocksRequestBody" + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: "#/definitions/preconfserver.RemoveTentativeBlocksResponseBody" + post: + consumes: + - application/json + description: |- + Insert a group of transactions into a tentative block for preconfirmation. If the group is the + first for a block, a new tentative block will be created. Otherwise, the transactions will + be appended to the existing tentative block. The API will fail if: + 1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3) + block-level parameters are invalid or do not match the current tentative block’s parameters, + 4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of + the block indicates no further transactions are allowed. + parameters: + - description: preconf blocks creation request body + in: body + name: body + required: true + schema: + $ref: "#/definitions/preconfserver.BuildTentativeBlocksRequestBody" + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: "#/definitions/preconfserver.BuildTentativeBlocksResponseBody" +swagger: "2.0" diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go index adbcafa1ffe..e8dd557c9fe 100644 --- a/packages/taiko-client/driver/preconf_server/api.go +++ b/packages/taiko-client/driver/preconf_server/api.go @@ -1,4 +1,4 @@ -package preconf_server +package preconfserver import ( "net/http" @@ -32,60 +32,68 @@ type PreconfTransactionsGroup struct { BaseFeePerGas uint64 `json:"baseFeePerGas"` // AnchorV2 parameters - AnchorBlockId uint64 `json:"anchorBlockId"` + AnchorBlockID uint64 `json:"anchorBlockID"` AnchorStateRoot common.Hash `json:"anchorStateRoot"` ParentGasUsed uint32 `json:"parentGasUsed"` } -// CreateOrUpdateBlocksFromBatchResponseBodyRequestBody represents a request body when handling +// buildTentativeBlocksRequestBody represents a request body when handling // preconfirmation blocks creation requests. -type CreateOrUpdateBlocksFromBatchResponseBodyRequestBody struct { +type BuildTentativeBlocksRequestBody struct { TransactionsGroups []PreconfTransactionsGroup `json:"transactionsGroups"` } // CreateOrUpdateBlocksFromBatchResponseBody represents a response body when handling preconfirmation // blocks creation requests. -type CreateOrUpdateBlocksFromBatchResponseBody struct { - PreconfHeaders []types.Header `json:"preconfHeaders"` +type BuildTentativeBlocksResponseBody struct { + PreconfHeaders []types.Header `json:"tentativeHeaders"` } -// CreateOrUpdateBlocksFromBatch handles a preconfirmation blocks creation request, +// BuildTentativeBlocks handles a preconfirmation blocks creation request, // if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation // blocks to the backend L2 execution engine and return a success response. // -// @Summary Insert preconfirmation blocks by the given groups to the backend L2 execution engine, please note that -// the AVS service should sort the groups and make sure all the groups are valid at first. -// @Param body body CreateOrUpdateBlocksFromBatchResponseBodyRequestBody true "preconf blocks creation request body" -// @Accept json -// @Produce json -// @Success 200 {object} CreateOrUpdateBlocksFromBatchResponseBody -// @Router /perconfBlocks [post] -func (s *PreconfAPIServer) CreateOrUpdateBlocksFromBatch(c echo.Context) error { +// @Description Insert a group of transactions into a tentative block for preconfirmation. If the group is the +// @Description first for a block, a new tentative block will be created. Otherwise, the transactions will +// @Description be appended to the existing tentative block. The API will fail if: +// @Description 1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3) +// @Description block-level parameters are invalid or do not match the current tentative block’s parameters, +// @Description 4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of +// @Description the block indicates no further transactions are allowed. +// @Param body body BuildTentativeBlocksRequestBody true "preconf blocks creation request body" +// @Accept json +// @Produce json +// @Success 200 {object} BuildTentativeBlocksResponseBody +// @Router /tentativeBlocks [post] +func (s *PreconfAPIServer) BuildTentativeBlocks(c echo.Context) error { return c.NoContent(http.StatusOK) } -// ResetPreconfHeadRequestBody represents a request body when resetting the backend +// RemoveTentativeBlocksRequestBody represents a request body when resetting the backend // L2 execution engine preconfirmation head. -type ResetPreconfHeadRequestBody struct { +type RemoveTentativeBlocksRequestBody struct { NewHead uint64 `json:"newHead"` } -// ResetPreconfHeadResponseBody represents a response body when resetting the backend +// RemoveTentativeBlocksResponseBody represents a response body when resetting the backend // L2 execution engine preconfirmation head. -type ResetPreconfHeadResponseBody struct { +type RemoveTentativeBlocksResponseBody struct { CurrentHead types.Header `json:"currentHead"` } -// ResetPreconfHead resets the backend L2 execution engine preconfirmation head. +// RemoveTentativeBlocks removes the backend L2 execution engine preconfirmation head. // -// @Summary Resets the backend L2 execution engine preconfirmation head, please note that -// the AVS service should make sure the new head height is from a valid preconfirmation head. -// @Param body body ResetPreconfHeadRequestBody true "preconf blocks creation request body" -// @Accept json -// @Produce json -// @Success 200 {object} ResetPreconfHeadResponseBody -// @Router /preconfHead [put] -func (s *PreconfAPIServer) ResetPreconfHead(c echo.Context) error { +// @Description Remove all tentative blocks from the blockchain beyond the specified block height, +// @Description ensuring the latest block ID does not exceed the given height. This method will fail if +// @Description the block with an ID one greater than the specified height is not a tentative block. If the +// @Description specified block height is greater than the latest tentative block ID, the method will succeed +// @Description without modifying the blockchain. +// @Param body body RemoveTentativeBlocksRequestBody true "preconf blocks creation request body" +// @Accept json +// @Produce json +// @Success 200 {object} RemoveTentativeBlocksResponseBody +// @Router /tentativeBlocks [delete] +func (s *PreconfAPIServer) RemoveTentativeBlocks(c echo.Context) error { return c.NoContent(http.StatusOK) } @@ -95,7 +103,7 @@ func (s *PreconfAPIServer) ResetPreconfHead(c echo.Context) error { // @ID health-check // @Accept json // @Produce json -// @Success 200 {object} Status +// @Success 200 {object} string // @Router /healthz [get] func (s *PreconfAPIServer) HealthCheck(c echo.Context) error { return c.NoContent(http.StatusOK) diff --git a/packages/taiko-client/driver/preconf_server/server.go b/packages/taiko-client/driver/preconf_server/server.go index 3eb28fbba86..90f2a1cc6fe 100644 --- a/packages/taiko-client/driver/preconf_server/server.go +++ b/packages/taiko-client/driver/preconf_server/server.go @@ -1,4 +1,4 @@ -package preconf_server +package preconfserver import ( "os" @@ -75,6 +75,6 @@ func (s *PreconfAPIServer) configureMiddleware(corsOrigins []string) { func (s *PreconfAPIServer) configureRoutes() { s.echo.GET("/", s.HealthCheck) s.echo.GET("/healthz", s.HealthCheck) - s.echo.POST("/perconfTransactions", s.CreateOrUpdateBlocksFromBatch) - s.echo.PUT("/preconfHead", s.ResetPreconfHead) + s.echo.POST("/tentativeBlocks", s.BuildTentativeBlocks) + s.echo.DELETE("/tentativeBlocks", s.RemoveTentativeBlocks) } diff --git a/packages/taiko-client/scripts/gen_swagger_json.sh b/packages/taiko-client/scripts/gen_swagger_json.sh index 59dce311dbd..ac8f7a91849 100755 --- a/packages/taiko-client/scripts/gen_swagger_json.sh +++ b/packages/taiko-client/scripts/gen_swagger_json.sh @@ -1,3 +1,3 @@ #/bin/sh -swag init -g api.go -d prover/server --pd +swag init -g server.go -d driver/preconf_server --pd From 42d0288f2460905e057632648baed5a6e5fe58c2 Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 22:20:33 -0700 Subject: [PATCH 10/71] add page --- packages/taiko-client/docs/index.html | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/taiko-client/docs/index.html diff --git a/packages/taiko-client/docs/index.html b/packages/taiko-client/docs/index.html new file mode 100644 index 00000000000..63e2d943d3d --- /dev/null +++ b/packages/taiko-client/docs/index.html @@ -0,0 +1,29 @@ + + + + + + Taiko Preconfirmation Server API + + +
+ + + From d9fa67d7f37c45f2b38f6d27d6652052a446ea25 Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 22:34:12 -0700 Subject: [PATCH 11/71] pages workflow --- .github/workflows/taiko-client--pages.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/taiko-client--pages.yml diff --git a/.github/workflows/taiko-client--pages.yml b/.github/workflows/taiko-client--pages.yml new file mode 100644 index 00000000000..5dfee680dc3 --- /dev/null +++ b/.github/workflows/taiko-client--pages.yml @@ -0,0 +1,22 @@ +name: GitHub Pages + +on: + push: + branches: + - preconf-driver-apis + +jobs: + deploy: + runs-on: [arc-runner-set] + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./packages/taiko-client/docs/ # Set this to where your `index.html` is located + publish_branch: gh-pages From bcd5fad5bd804041bc45964e2823ef72b67e550f Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 22:51:47 -0700 Subject: [PATCH 12/71] fix --- .github/workflows/taiko-client--pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taiko-client--pages.yml b/.github/workflows/taiko-client--pages.yml index 5dfee680dc3..2742f760a61 100644 --- a/.github/workflows/taiko-client--pages.yml +++ b/.github/workflows/taiko-client--pages.yml @@ -18,5 +18,5 @@ jobs: uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./packages/taiko-client/docs/ # Set this to where your `index.html` is located + publish_dir: ./packages/taiko-client/docs # Set this to where your `index.html` is located publish_branch: gh-pages From 37cd672a92a8795d37836b8ed8348983879d2aa6 Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 22:57:47 -0700 Subject: [PATCH 13/71] . --- .github/workflows/taiko-client--pages.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/taiko-client--pages.yml b/.github/workflows/taiko-client--pages.yml index 2742f760a61..9ba07793b5f 100644 --- a/.github/workflows/taiko-client--pages.yml +++ b/.github/workflows/taiko-client--pages.yml @@ -13,10 +13,11 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - + - name: List contents of docs directory + run: ls -la packages/taiko-client/docs - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./packages/taiko-client/docs # Set this to where your `index.html` is located + publish_dir: /packages/taiko-client/docs # Set this to where your `index.html` is located publish_branch: gh-pages From a5b12ad2fe89347a142ce071f257413aeaa8f95e Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 23:20:27 -0700 Subject: [PATCH 14/71] add swagger gen step and fix path --- .github/workflows/taiko-client--pages.yml | 33 ++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/taiko-client--pages.yml b/.github/workflows/taiko-client--pages.yml index 9ba07793b5f..e92085a3195 100644 --- a/.github/workflows/taiko-client--pages.yml +++ b/.github/workflows/taiko-client--pages.yml @@ -6,8 +6,39 @@ on: - preconf-driver-apis jobs: + swagger-gen: + if: ${{ !contains(github.event.head_commit.message, 'Update Swagger documentation') }} + runs-on: [arc-runner-set] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.23" + + - name: Install swaggo + run: go install github.com/swaggo/swag/cmd/swag@latest + + - name: Generate Swagger documentation + run: | + cd packages/taiko-client + ./scripts/gen_swagger_json.sh + + - name: Commit Swagger docs + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Update Swagger documentation" + git push origin HEAD:${{ github.ref_name }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} deploy: + if: ${{ !contains(github.event.head_commit.message, 'Update Swagger documentation') }} runs-on: [arc-runner-set] + needs: swagger-gen permissions: contents: write steps: @@ -19,5 +50,5 @@ jobs: uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: /packages/taiko-client/docs # Set this to where your `index.html` is located + publish_dir: packages/taiko-client/docs # Set this to where your `index.html` is located publish_branch: gh-pages From 7cd0c3a0b196ce65eaf5d57379f742566f5e4d1a Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 23:24:54 -0700 Subject: [PATCH 15/71] use branch ref --- .github/workflows/taiko-client--pages.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/taiko-client--pages.yml b/.github/workflows/taiko-client--pages.yml index e92085a3195..75e7958ee77 100644 --- a/.github/workflows/taiko-client--pages.yml +++ b/.github/workflows/taiko-client--pages.yml @@ -11,7 +11,9 @@ jobs: runs-on: [arc-runner-set] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + ref: preconf-driver-apis - name: Set up Go uses: actions/setup-go@v4 @@ -44,8 +46,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: List contents of docs directory - run: ls -la packages/taiko-client/docs + with: + ref: preconf-driver-apis + - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: From 1183f1da856cb622afe7a62de40ec4c57b5cf7af Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 22 Oct 2024 06:26:57 +0000 Subject: [PATCH 16/71] Update Swagger documentation --- packages/taiko-client/docs/swagger.json | 600 ++++++++++++------------ packages/taiko-client/docs/swagger.yaml | 73 ++- 2 files changed, 344 insertions(+), 329 deletions(-) diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json index 61c81a0fc04..f1b6ac7ce7e 100644 --- a/packages/taiko-client/docs/swagger.json +++ b/packages/taiko-client/docs/swagger.json @@ -1,308 +1,326 @@ { - "swagger": "2.0", - "info": { - "title": "Taiko Preconfirmation Server API", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "API Support", - "url": "https://community.taiko.xyz/", - "email": "info@taiko.xyz" - }, - "license": { - "name": "MIT", - "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" - }, - "version": "1.0" - }, - "paths": { - "/healthz": { - "get": { - "consumes": ["application/json"], - "produces": ["application/json"], - "summary": "Get current server health status", - "operationId": "health-check", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } + "swagger": "2.0", + "info": { + "title": "Taiko Preconfirmation Server API", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "API Support", + "url": "https://community.taiko.xyz/", + "email": "info@taiko.xyz" + }, + "license": { + "name": "MIT", + "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" + }, + "version": "1.0" }, - "/tentativeBlocks": { - "post": { - "description": "Insert a group of transactions into a tentative block for preconfirmation. If the group is the\nfirst for a block, a new tentative block will be created. Otherwise, the transactions will\nbe appended to the existing tentative block. The API will fail if:\n1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current tentative block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", - "consumes": ["application/json"], - "produces": ["application/json"], - "parameters": [ - { - "description": "preconf blocks creation request body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/preconfserver.BuildTentativeBlocksRequestBody" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/preconfserver.BuildTentativeBlocksResponseBody" + "paths": { + "/healthz": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "summary": "Get current server health status", + "operationId": "health-check", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } } - } - } - }, - "delete": { - "description": "Remove all tentative blocks from the blockchain beyond the specified block height,\nensuring the latest block ID does not exceed the given height. This method will fail if\nthe block with an ID one greater than the specified height is not a tentative block. If the\nspecified block height is greater than the latest tentative block ID, the method will succeed\nwithout modifying the blockchain.", - "consumes": ["application/json"], - "produces": ["application/json"], - "parameters": [ - { - "description": "preconf blocks creation request body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksRequestBody" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksResponseBody" + }, + "/tentativeBlocks": { + "post": { + "description": "Insert a group of transactions into a tentative block for preconfirmation. If the group is the\nfirst for a block, a new tentative block will be created. Otherwise, the transactions will\nbe appended to the existing tentative block. The API will fail if:\n1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current tentative block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconfserver.BuildTentativeBlocksRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconfserver.BuildTentativeBlocksResponseBody" + } + } + } + }, + "delete": { + "description": "Remove all tentative blocks from the blockchain beyond the specified block height,\nensuring the latest block ID does not exceed the given height. This method will fail if\nthe block with an ID one greater than the specified height is not a tentative block. If the\nspecified block height is greater than the latest tentative block ID, the method will succeed\nwithout modifying the blockchain.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksResponseBody" + } + } + } } - } - } - } - } - }, - "definitions": { - "big.Int": { - "type": "object" - }, - "preconfserver.BuildTentativeBlocksRequestBody": { - "type": "object", - "properties": { - "transactionsGroups": { - "type": "array", - "items": { - "$ref": "#/definitions/preconfserver.PreconfTransactionsGroup" - } } - } }, - "preconfserver.BuildTentativeBlocksResponseBody": { - "type": "object", - "properties": { - "tentativeHeaders": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Header" - } - } - } - }, - "preconfserver.PreconfTransactionsGroup": { - "type": "object", - "properties": { - "anchorBlockID": { - "description": "AnchorV2 parameters", - "type": "integer" - }, - "anchorStateRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "baseFeePerGas": { - "type": "integer" - }, - "blockId": { - "type": "integer" - }, - "groupId": { - "type": "integer" - }, - "groupStatus": { - "$ref": "#/definitions/preconfserver.PreconfTxsGroupStatus" + "definitions": { + "big.Int": { + "type": "object" }, - "parentGasUsed": { - "type": "integer" - }, - "prevRandao": { - "type": "array", - "items": { - "type": "integer" - } - }, - "signature": { - "type": "string" - }, - "suggestedFeeRecipient": { - "type": "array", - "items": { - "type": "integer" - } - }, - "timestamp": { - "description": "Block parameters", - "type": "integer" - }, - "transactions": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Transaction" - } - } - } - }, - "preconfserver.PreconfTxsGroupStatus": { - "type": "string", - "enum": ["finalBlockGroup", "finalPreconfGroup"], - "x-enum-varnames": ["StatusFinalBlockGroup", "StatusFinalPreconfGroup"] - }, - "preconfserver.RemoveTentativeBlocksRequestBody": { - "type": "object", - "properties": { - "newHead": { - "type": "integer" - } - } - }, - "preconfserver.RemoveTentativeBlocksResponseBody": { - "type": "object", - "properties": { - "currentHead": { - "$ref": "#/definitions/types.Header" - } - } - }, - "types.Header": { - "type": "object", - "properties": { - "baseFeePerGas": { - "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", - "allOf": [ - { - "$ref": "#/definitions/big.Int" + "preconfserver.BuildTentativeBlocksRequestBody": { + "type": "object", + "properties": { + "transactionsGroups": { + "type": "array", + "items": { + "$ref": "#/definitions/preconfserver.PreconfTransactionsGroup" + } + } } - ] - }, - "blobGasUsed": { - "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", - "type": "integer" - }, - "difficulty": { - "$ref": "#/definitions/big.Int" - }, - "excessBlobGas": { - "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", - "type": "integer" - }, - "extraData": { - "type": "array", - "items": { - "type": "integer" - } - }, - "gasLimit": { - "type": "integer" - }, - "gasUsed": { - "type": "integer" - }, - "logsBloom": { - "type": "array", - "items": { - "type": "integer" - } }, - "miner": { - "type": "array", - "items": { - "type": "integer" - } - }, - "mixHash": { - "type": "array", - "items": { - "type": "integer" - } - }, - "nonce": { - "type": "array", - "items": { - "type": "integer" - } - }, - "number": { - "$ref": "#/definitions/big.Int" - }, - "parentBeaconBlockRoot": { - "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - }, - "parentHash": { - "type": "array", - "items": { - "type": "integer" - } - }, - "receiptsRoot": { - "type": "array", - "items": { - "type": "integer" - } + "preconfserver.BuildTentativeBlocksResponseBody": { + "type": "object", + "properties": { + "tentativeHeaders": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Header" + } + } + } }, - "requestsRoot": { - "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } + "preconfserver.PreconfTransactionsGroup": { + "type": "object", + "properties": { + "anchorBlockID": { + "description": "AnchorV2 parameters", + "type": "integer" + }, + "anchorStateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "baseFeePerGas": { + "type": "integer" + }, + "blockId": { + "type": "integer" + }, + "groupId": { + "type": "integer" + }, + "groupStatus": { + "$ref": "#/definitions/preconfserver.PreconfTxsGroupStatus" + }, + "parentGasUsed": { + "type": "integer" + }, + "prevRandao": { + "type": "array", + "items": { + "type": "integer" + } + }, + "signature": { + "type": "string" + }, + "suggestedFeeRecipient": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "description": "Block parameters", + "type": "integer" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Transaction" + } + } + } }, - "sha3Uncles": { - "type": "array", - "items": { - "type": "integer" - } + "preconfserver.PreconfTxsGroupStatus": { + "type": "string", + "enum": [ + "finalBlockGroup", + "finalPreconfGroup" + ], + "x-enum-varnames": [ + "StatusFinalBlockGroup", + "StatusFinalPreconfGroup" + ] }, - "stateRoot": { - "type": "array", - "items": { - "type": "integer" - } + "preconfserver.RemoveTentativeBlocksRequestBody": { + "type": "object", + "properties": { + "newHead": { + "type": "integer" + } + } }, - "timestamp": { - "type": "integer" + "preconfserver.RemoveTentativeBlocksResponseBody": { + "type": "object", + "properties": { + "currentHead": { + "$ref": "#/definitions/types.Header" + } + } }, - "transactionsRoot": { - "type": "array", - "items": { - "type": "integer" - } + "types.Header": { + "type": "object", + "properties": { + "baseFeePerGas": { + "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", + "allOf": [ + { + "$ref": "#/definitions/big.Int" + } + ] + }, + "blobGasUsed": { + "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "difficulty": { + "$ref": "#/definitions/big.Int" + }, + "excessBlobGas": { + "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "extraData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "gasLimit": { + "type": "integer" + }, + "gasUsed": { + "type": "integer" + }, + "logsBloom": { + "type": "array", + "items": { + "type": "integer" + } + }, + "miner": { + "type": "array", + "items": { + "type": "integer" + } + }, + "mixHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "nonce": { + "type": "array", + "items": { + "type": "integer" + } + }, + "number": { + "$ref": "#/definitions/big.Int" + }, + "parentBeaconBlockRoot": { + "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "parentHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "receiptsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "requestsRoot": { + "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "sha3Uncles": { + "type": "array", + "items": { + "type": "integer" + } + }, + "stateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "type": "integer" + }, + "transactionsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "withdrawalsRoot": { + "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + } + } }, - "withdrawalsRoot": { - "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } + "types.Transaction": { + "type": "object" } - } - }, - "types.Transaction": { - "type": "object" } - } -} +} \ No newline at end of file diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml index fe3da6b5fda..bc229078ff9 100644 --- a/packages/taiko-client/docs/swagger.yaml +++ b/packages/taiko-client/docs/swagger.yaml @@ -5,14 +5,14 @@ definitions: properties: transactionsGroups: items: - $ref: "#/definitions/preconfserver.PreconfTransactionsGroup" + $ref: '#/definitions/preconfserver.PreconfTransactionsGroup' type: array type: object preconfserver.BuildTentativeBlocksResponseBody: properties: tentativeHeaders: items: - $ref: "#/definitions/types.Header" + $ref: '#/definitions/types.Header' type: array type: object preconfserver.PreconfTransactionsGroup: @@ -31,7 +31,7 @@ definitions: groupId: type: integer groupStatus: - $ref: "#/definitions/preconfserver.PreconfTxsGroupStatus" + $ref: '#/definitions/preconfserver.PreconfTxsGroupStatus' parentGasUsed: type: integer prevRandao: @@ -49,17 +49,17 @@ definitions: type: integer transactions: items: - $ref: "#/definitions/types.Transaction" + $ref: '#/definitions/types.Transaction' type: array type: object preconfserver.PreconfTxsGroupStatus: enum: - - finalBlockGroup - - finalPreconfGroup + - finalBlockGroup + - finalPreconfGroup type: string x-enum-varnames: - - StatusFinalBlockGroup - - StatusFinalPreconfGroup + - StatusFinalBlockGroup + - StatusFinalPreconfGroup preconfserver.RemoveTentativeBlocksRequestBody: properties: newHead: @@ -68,22 +68,21 @@ definitions: preconfserver.RemoveTentativeBlocksResponseBody: properties: currentHead: - $ref: "#/definitions/types.Header" + $ref: '#/definitions/types.Header' type: object types.Header: properties: baseFeePerGas: allOf: - - $ref: "#/definitions/big.Int" + - $ref: '#/definitions/big.Int' description: BaseFee was added by EIP-1559 and is ignored in legacy headers. blobGasUsed: description: BlobGasUsed was added by EIP-4844 and is ignored in legacy headers. type: integer difficulty: - $ref: "#/definitions/big.Int" + $ref: '#/definitions/big.Int' excessBlobGas: - description: - ExcessBlobGas was added by EIP-4844 and is ignored in legacy + description: ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers. type: integer extraData: @@ -111,10 +110,9 @@ definitions: type: integer type: array number: - $ref: "#/definitions/big.Int" + $ref: '#/definitions/big.Int' parentBeaconBlockRoot: - description: - ParentBeaconRoot was added by EIP-4788 and is ignored in legacy + description: ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers. items: type: integer @@ -147,8 +145,7 @@ definitions: type: integer type: array withdrawalsRoot: - description: - WithdrawalsHash was added by EIP-4895 and is ignored in legacy + description: WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers. items: type: integer @@ -171,10 +168,10 @@ paths: /healthz: get: consumes: - - application/json + - application/json operationId: health-check produces: - - application/json + - application/json responses: "200": description: OK @@ -184,7 +181,7 @@ paths: /tentativeBlocks: delete: consumes: - - application/json + - application/json description: |- Remove all tentative blocks from the blockchain beyond the specified block height, ensuring the latest block ID does not exceed the given height. This method will fail if @@ -192,22 +189,22 @@ paths: specified block height is greater than the latest tentative block ID, the method will succeed without modifying the blockchain. parameters: - - description: preconf blocks creation request body - in: body - name: body - required: true - schema: - $ref: "#/definitions/preconfserver.RemoveTentativeBlocksRequestBody" + - description: preconf blocks creation request body + in: body + name: body + required: true + schema: + $ref: '#/definitions/preconfserver.RemoveTentativeBlocksRequestBody' produces: - - application/json + - application/json responses: "200": description: OK schema: - $ref: "#/definitions/preconfserver.RemoveTentativeBlocksResponseBody" + $ref: '#/definitions/preconfserver.RemoveTentativeBlocksResponseBody' post: consumes: - - application/json + - application/json description: |- Insert a group of transactions into a tentative block for preconfirmation. If the group is the first for a block, a new tentative block will be created. Otherwise, the transactions will @@ -217,17 +214,17 @@ paths: 4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of the block indicates no further transactions are allowed. parameters: - - description: preconf blocks creation request body - in: body - name: body - required: true - schema: - $ref: "#/definitions/preconfserver.BuildTentativeBlocksRequestBody" + - description: preconf blocks creation request body + in: body + name: body + required: true + schema: + $ref: '#/definitions/preconfserver.BuildTentativeBlocksRequestBody' produces: - - application/json + - application/json responses: "200": description: OK schema: - $ref: "#/definitions/preconfserver.BuildTentativeBlocksResponseBody" + $ref: '#/definitions/preconfserver.BuildTentativeBlocksResponseBody' swagger: "2.0" From 365d896c32160e8133444e5f4779473c3ac2428f Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 23:45:14 -0700 Subject: [PATCH 17/71] fix workflow and index.html --- .github/workflows/taiko-client--pages.yml | 3 ++- packages/taiko-client/docs/index.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/taiko-client--pages.yml b/.github/workflows/taiko-client--pages.yml index 75e7958ee77..286070a85f7 100644 --- a/.github/workflows/taiko-client--pages.yml +++ b/.github/workflows/taiko-client--pages.yml @@ -21,7 +21,8 @@ jobs: go-version: "1.23" - name: Install swaggo - run: go install github.com/swaggo/swag/cmd/swag@latest + run: export CGO_ENABLED=0 + go install github.com/swaggo/swag/cmd/swag@latest - name: Generate Swagger documentation run: | diff --git a/packages/taiko-client/docs/index.html b/packages/taiko-client/docs/index.html index 63e2d943d3d..fd6da6d8abf 100644 --- a/packages/taiko-client/docs/index.html +++ b/packages/taiko-client/docs/index.html @@ -11,7 +11,7 @@ window.onload = function () { // Begin Swagger UI call region const ui = SwaggerUIBundle({ - url: "/swagger.json", //Location of Open API spec in the repo + url: "swagger.json", //Location of Open API spec in the repo dom_id: '#swagger-ui', deepLinking: true, presets: [ From f132607fc462ffd7c795158d25b2e727c13696f0 Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 23:48:20 -0700 Subject: [PATCH 18/71] fix again --- .github/workflows/taiko-client--pages.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/taiko-client--pages.yml b/.github/workflows/taiko-client--pages.yml index 286070a85f7..32a4e4660a4 100644 --- a/.github/workflows/taiko-client--pages.yml +++ b/.github/workflows/taiko-client--pages.yml @@ -21,11 +21,13 @@ jobs: go-version: "1.23" - name: Install swaggo - run: export CGO_ENABLED=0 + run: | + export CGO_ENABLED=0 go install github.com/swaggo/swag/cmd/swag@latest - name: Generate Swagger documentation run: | + export CGO_ENABLED=0 cd packages/taiko-client ./scripts/gen_swagger_json.sh From 89f956e711b26bbf3baae70b01dc73266caf3aad Mon Sep 17 00:00:00 2001 From: RogerLamTd Date: Mon, 21 Oct 2024 23:56:11 -0700 Subject: [PATCH 19/71] make commit safe --- .github/workflows/taiko-client--pages.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/taiko-client--pages.yml b/.github/workflows/taiko-client--pages.yml index 32a4e4660a4..11ac1ddbb81 100644 --- a/.github/workflows/taiko-client--pages.yml +++ b/.github/workflows/taiko-client--pages.yml @@ -36,8 +36,12 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" git add . - git commit -m "Update Swagger documentation" - git push origin HEAD:${{ github.ref_name }} + if ! git diff --quiet; then + git commit -m "Update Swagger documentation" + git push origin HEAD:${{ github.ref_name }} + else + echo "No changes to commit" + fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} deploy: From 11a9381d4b64eb4edc7d907da77575dbec6576b7 Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:54:11 +0800 Subject: [PATCH 20/71] suggested changes (#18281) Co-authored-by: David --- packages/taiko-client/docs/docs.go | 32 +- packages/taiko-client/docs/swagger.json | 600 +++++++++--------- packages/taiko-client/docs/swagger.yaml | 103 +-- .../taiko-client/driver/preconf_server/api.go | 110 ---- .../taiko-client/driver/soft_blocks/api.go | 108 ++++ .../{preconf_server => soft_blocks}/server.go | 16 +- 6 files changed, 476 insertions(+), 493 deletions(-) delete mode 100644 packages/taiko-client/driver/preconf_server/api.go create mode 100644 packages/taiko-client/driver/soft_blocks/api.go rename packages/taiko-client/driver/{preconf_server => soft_blocks}/server.go (82%) diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go index 2b8c139d168..6c49afc0041 100644 --- a/packages/taiko-client/docs/docs.go +++ b/packages/taiko-client/docs/docs.go @@ -44,9 +44,9 @@ const docTemplate = `{ } } }, - "/tentativeBlocks": { + "/softBlocks": { "post": { - "description": "Insert a group of transactions into a tentative block for preconfirmation. If the group is the\nfirst for a block, a new tentative block will be created. Otherwise, the transactions will\nbe appended to the existing tentative block. The API will fail if:\n1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current tentative block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", + "description": "Insert a group of transactions into a soft block for preconfirmation. If the group is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current soft block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", "consumes": [ "application/json" ], @@ -60,7 +60,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/preconfserver.BuildTentativeBlocksRequestBody" + "$ref": "#/definitions/preconfserver.BuildSoftBlocksRequestBody" } } ], @@ -68,13 +68,13 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/preconfserver.BuildTentativeBlocksResponseBody" + "$ref": "#/definitions/preconfserver.BuildSoftBlocksResponseBody" } } } }, "delete": { - "description": "Remove all tentative blocks from the blockchain beyond the specified block height,\nensuring the latest block ID does not exceed the given height. This method will fail if\nthe block with an ID one greater than the specified height is not a tentative block. If the\nspecified block height is greater than the latest tentative block ID, the method will succeed\nwithout modifying the blockchain.", + "description": "Remove all soft blocks from the blockchain beyond the specified block height,\nensuring the latest block ID does not exceed the given height. This method will fail if\nthe block with an ID one greater than the specified height is not a soft block. If the\nspecified block height is greater than the latest soft block ID, the method will succeed\nwithout modifying the blockchain.", "consumes": [ "application/json" ], @@ -88,7 +88,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksRequestBody" + "$ref": "#/definitions/preconfserver.RemoveSoftBlocksRequestBody" } } ], @@ -96,7 +96,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksResponseBody" + "$ref": "#/definitions/preconfserver.RemoveSoftBlocksResponseBody" } } } @@ -107,21 +107,21 @@ const docTemplate = `{ "big.Int": { "type": "object" }, - "preconfserver.BuildTentativeBlocksRequestBody": { + "preconfserver.BuildSoftBlocksRequestBody": { "type": "object", "properties": { "transactionsGroups": { "type": "array", "items": { - "$ref": "#/definitions/preconfserver.PreconfTransactionsGroup" + "$ref": "#/definitions/preconfserver.TransactionBatch" } } } }, - "preconfserver.BuildTentativeBlocksResponseBody": { + "preconfserver.BuildSoftBlocksResponseBody": { "type": "object", "properties": { - "tentativeHeaders": { + "softHeaders": { "type": "array", "items": { "$ref": "#/definitions/types.Header" @@ -129,7 +129,7 @@ const docTemplate = `{ } } }, - "preconfserver.PreconfTransactionsGroup": { + "preconfserver.TransactionBatch": { "type": "object", "properties": { "anchorBlockID": { @@ -191,11 +191,11 @@ const docTemplate = `{ "finalPreconfGroup" ], "x-enum-varnames": [ - "StatusFinalBlockGroup", - "StatusFinalPreconfGroup" + "BatchMarkerEOB", + "BatchMarkerEOP" ] }, - "preconfserver.RemoveTentativeBlocksRequestBody": { + "preconfserver.RemoveSoftBlocksRequestBody": { "type": "object", "properties": { "newHead": { @@ -203,7 +203,7 @@ const docTemplate = `{ } } }, - "preconfserver.RemoveTentativeBlocksResponseBody": { + "preconfserver.RemoveSoftBlocksResponseBody": { "type": "object", "properties": { "currentHead": { diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json index f1b6ac7ce7e..faa34a2e708 100644 --- a/packages/taiko-client/docs/swagger.json +++ b/packages/taiko-client/docs/swagger.json @@ -1,326 +1,308 @@ { - "swagger": "2.0", - "info": { - "title": "Taiko Preconfirmation Server API", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "API Support", - "url": "https://community.taiko.xyz/", - "email": "info@taiko.xyz" - }, - "license": { - "name": "MIT", - "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" - }, - "version": "1.0" + "swagger": "2.0", + "info": { + "title": "Taiko Preconfirmation Server API", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "API Support", + "url": "https://community.taiko.xyz/", + "email": "info@taiko.xyz" }, - "paths": { - "/healthz": { - "get": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "summary": "Get current server health status", - "operationId": "health-check", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } + "license": { + "name": "MIT", + "url": "https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md" + }, + "version": "1.0" + }, + "paths": { + "/healthz": { + "get": { + "consumes": ["application/json"], + "produces": ["application/json"], + "summary": "Get current server health status", + "operationId": "health-check", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" } - }, - "/tentativeBlocks": { - "post": { - "description": "Insert a group of transactions into a tentative block for preconfirmation. If the group is the\nfirst for a block, a new tentative block will be created. Otherwise, the transactions will\nbe appended to the existing tentative block. The API will fail if:\n1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current tentative block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "description": "preconf blocks creation request body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/preconfserver.BuildTentativeBlocksRequestBody" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/preconfserver.BuildTentativeBlocksResponseBody" - } - } - } - }, - "delete": { - "description": "Remove all tentative blocks from the blockchain beyond the specified block height,\nensuring the latest block ID does not exceed the given height. This method will fail if\nthe block with an ID one greater than the specified height is not a tentative block. If the\nspecified block height is greater than the latest tentative block ID, the method will succeed\nwithout modifying the blockchain.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "description": "preconf blocks creation request body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksRequestBody" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/preconfserver.RemoveTentativeBlocksResponseBody" - } - } - } + } + } + } + }, + "/softBlocks": { + "post": { + "description": "Insert a group of transactions into a soft block for preconfirmation. If the group is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current soft block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", + "consumes": ["application/json"], + "produces": ["application/json"], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconfserver.BuildSoftBlocksRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconfserver.BuildSoftBlocksResponseBody" } + } + } + }, + "delete": { + "description": "Remove all soft blocks from the blockchain beyond the specified block height,\nensuring the latest block ID does not exceed the given height. This method will fail if\nthe block with an ID one greater than the specified height is not a soft block. If the\nspecified block height is greater than the latest soft block ID, the method will succeed\nwithout modifying the blockchain.", + "consumes": ["application/json"], + "produces": ["application/json"], + "parameters": [ + { + "description": "preconf blocks creation request body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/preconfserver.RemoveSoftBlocksRequestBody" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/preconfserver.RemoveSoftBlocksResponseBody" + } + } + } + } + } + }, + "definitions": { + "big.Int": { + "type": "object" + }, + "preconfserver.BuildSoftBlocksRequestBody": { + "type": "object", + "properties": { + "transactionsGroups": { + "type": "array", + "items": { + "$ref": "#/definitions/preconfserver.TransactionBatch" + } } + } }, - "definitions": { - "big.Int": { - "type": "object" + "preconfserver.BuildSoftBlocksResponseBody": { + "type": "object", + "properties": { + "softHeaders": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Header" + } + } + } + }, + "preconfserver.TransactionBatch": { + "type": "object", + "properties": { + "anchorBlockID": { + "description": "AnchorV2 parameters", + "type": "integer" }, - "preconfserver.BuildTentativeBlocksRequestBody": { - "type": "object", - "properties": { - "transactionsGroups": { - "type": "array", - "items": { - "$ref": "#/definitions/preconfserver.PreconfTransactionsGroup" - } - } - } + "anchorStateRoot": { + "type": "array", + "items": { + "type": "integer" + } }, - "preconfserver.BuildTentativeBlocksResponseBody": { - "type": "object", - "properties": { - "tentativeHeaders": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Header" - } - } - } + "baseFeePerGas": { + "type": "integer" }, - "preconfserver.PreconfTransactionsGroup": { - "type": "object", - "properties": { - "anchorBlockID": { - "description": "AnchorV2 parameters", - "type": "integer" - }, - "anchorStateRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "baseFeePerGas": { - "type": "integer" - }, - "blockId": { - "type": "integer" - }, - "groupId": { - "type": "integer" - }, - "groupStatus": { - "$ref": "#/definitions/preconfserver.PreconfTxsGroupStatus" - }, - "parentGasUsed": { - "type": "integer" - }, - "prevRandao": { - "type": "array", - "items": { - "type": "integer" - } - }, - "signature": { - "type": "string" - }, - "suggestedFeeRecipient": { - "type": "array", - "items": { - "type": "integer" - } - }, - "timestamp": { - "description": "Block parameters", - "type": "integer" - }, - "transactions": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Transaction" - } - } - } + "blockId": { + "type": "integer" }, - "preconfserver.PreconfTxsGroupStatus": { - "type": "string", - "enum": [ - "finalBlockGroup", - "finalPreconfGroup" - ], - "x-enum-varnames": [ - "StatusFinalBlockGroup", - "StatusFinalPreconfGroup" - ] + "groupId": { + "type": "integer" }, - "preconfserver.RemoveTentativeBlocksRequestBody": { - "type": "object", - "properties": { - "newHead": { - "type": "integer" - } - } + "groupStatus": { + "$ref": "#/definitions/preconfserver.PreconfTxsGroupStatus" }, - "preconfserver.RemoveTentativeBlocksResponseBody": { - "type": "object", - "properties": { - "currentHead": { - "$ref": "#/definitions/types.Header" - } - } + "parentGasUsed": { + "type": "integer" }, - "types.Header": { - "type": "object", - "properties": { - "baseFeePerGas": { - "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", - "allOf": [ - { - "$ref": "#/definitions/big.Int" - } - ] - }, - "blobGasUsed": { - "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", - "type": "integer" - }, - "difficulty": { - "$ref": "#/definitions/big.Int" - }, - "excessBlobGas": { - "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", - "type": "integer" - }, - "extraData": { - "type": "array", - "items": { - "type": "integer" - } - }, - "gasLimit": { - "type": "integer" - }, - "gasUsed": { - "type": "integer" - }, - "logsBloom": { - "type": "array", - "items": { - "type": "integer" - } - }, - "miner": { - "type": "array", - "items": { - "type": "integer" - } - }, - "mixHash": { - "type": "array", - "items": { - "type": "integer" - } - }, - "nonce": { - "type": "array", - "items": { - "type": "integer" - } - }, - "number": { - "$ref": "#/definitions/big.Int" - }, - "parentBeaconBlockRoot": { - "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - }, - "parentHash": { - "type": "array", - "items": { - "type": "integer" - } - }, - "receiptsRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "requestsRoot": { - "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - }, - "sha3Uncles": { - "type": "array", - "items": { - "type": "integer" - } - }, - "stateRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "timestamp": { - "type": "integer" - }, - "transactionsRoot": { - "type": "array", - "items": { - "type": "integer" - } - }, - "withdrawalsRoot": { - "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", - "type": "array", - "items": { - "type": "integer" - } - } + "prevRandao": { + "type": "array", + "items": { + "type": "integer" + } + }, + "signature": { + "type": "string" + }, + "suggestedFeeRecipient": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "description": "Block parameters", + "type": "integer" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Transaction" + } + } + } + }, + "preconfserver.PreconfTxsGroupStatus": { + "type": "string", + "enum": ["finalBlockGroup", "finalPreconfGroup"], + "x-enum-varnames": ["BatchMarkerEOB", "BatchMarkerEOP"] + }, + "preconfserver.RemoveSoftBlocksRequestBody": { + "type": "object", + "properties": { + "newHead": { + "type": "integer" + } + } + }, + "preconfserver.RemoveSoftBlocksResponseBody": { + "type": "object", + "properties": { + "currentHead": { + "$ref": "#/definitions/types.Header" + } + } + }, + "types.Header": { + "type": "object", + "properties": { + "baseFeePerGas": { + "description": "BaseFee was added by EIP-1559 and is ignored in legacy headers.", + "allOf": [ + { + "$ref": "#/definitions/big.Int" } + ] + }, + "blobGasUsed": { + "description": "BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "difficulty": { + "$ref": "#/definitions/big.Int" + }, + "excessBlobGas": { + "description": "ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.", + "type": "integer" + }, + "extraData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "gasLimit": { + "type": "integer" + }, + "gasUsed": { + "type": "integer" + }, + "logsBloom": { + "type": "array", + "items": { + "type": "integer" + } + }, + "miner": { + "type": "array", + "items": { + "type": "integer" + } }, - "types.Transaction": { - "type": "object" + "mixHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "nonce": { + "type": "array", + "items": { + "type": "integer" + } + }, + "number": { + "$ref": "#/definitions/big.Int" + }, + "parentBeaconBlockRoot": { + "description": "ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "parentHash": { + "type": "array", + "items": { + "type": "integer" + } + }, + "receiptsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "requestsRoot": { + "description": "RequestsHash was added by EIP-7685 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } + }, + "sha3Uncles": { + "type": "array", + "items": { + "type": "integer" + } + }, + "stateRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "timestamp": { + "type": "integer" + }, + "transactionsRoot": { + "type": "array", + "items": { + "type": "integer" + } + }, + "withdrawalsRoot": { + "description": "WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.", + "type": "array", + "items": { + "type": "integer" + } } + } + }, + "types.Transaction": { + "type": "object" } -} \ No newline at end of file + } +} diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml index bc229078ff9..081fb8b4f59 100644 --- a/packages/taiko-client/docs/swagger.yaml +++ b/packages/taiko-client/docs/swagger.yaml @@ -1,21 +1,21 @@ definitions: big.Int: type: object - preconfserver.BuildTentativeBlocksRequestBody: + preconfserver.BuildSoftBlocksRequestBody: properties: transactionsGroups: items: - $ref: '#/definitions/preconfserver.PreconfTransactionsGroup' + $ref: "#/definitions/preconfserver.TransactionBatch" type: array type: object - preconfserver.BuildTentativeBlocksResponseBody: + preconfserver.BuildSoftBlocksResponseBody: properties: - tentativeHeaders: + softHeaders: items: - $ref: '#/definitions/types.Header' + $ref: "#/definitions/types.Header" type: array type: object - preconfserver.PreconfTransactionsGroup: + preconfserver.TransactionBatch: properties: anchorBlockID: description: AnchorV2 parameters @@ -31,7 +31,7 @@ definitions: groupId: type: integer groupStatus: - $ref: '#/definitions/preconfserver.PreconfTxsGroupStatus' + $ref: "#/definitions/preconfserver.PreconfTxsGroupStatus" parentGasUsed: type: integer prevRandao: @@ -49,40 +49,41 @@ definitions: type: integer transactions: items: - $ref: '#/definitions/types.Transaction' + $ref: "#/definitions/types.Transaction" type: array type: object preconfserver.PreconfTxsGroupStatus: enum: - - finalBlockGroup - - finalPreconfGroup + - finalBlockGroup + - finalPreconfGroup type: string x-enum-varnames: - - StatusFinalBlockGroup - - StatusFinalPreconfGroup - preconfserver.RemoveTentativeBlocksRequestBody: + - BatchMarkerEOB + - BatchMarkerEOP + preconfserver.RemoveSoftBlocksRequestBody: properties: newHead: type: integer type: object - preconfserver.RemoveTentativeBlocksResponseBody: + preconfserver.RemoveSoftBlocksResponseBody: properties: currentHead: - $ref: '#/definitions/types.Header' + $ref: "#/definitions/types.Header" type: object types.Header: properties: baseFeePerGas: allOf: - - $ref: '#/definitions/big.Int' + - $ref: "#/definitions/big.Int" description: BaseFee was added by EIP-1559 and is ignored in legacy headers. blobGasUsed: description: BlobGasUsed was added by EIP-4844 and is ignored in legacy headers. type: integer difficulty: - $ref: '#/definitions/big.Int' + $ref: "#/definitions/big.Int" excessBlobGas: - description: ExcessBlobGas was added by EIP-4844 and is ignored in legacy + description: + ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers. type: integer extraData: @@ -110,9 +111,10 @@ definitions: type: integer type: array number: - $ref: '#/definitions/big.Int' + $ref: "#/definitions/big.Int" parentBeaconBlockRoot: - description: ParentBeaconRoot was added by EIP-4788 and is ignored in legacy + description: + ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers. items: type: integer @@ -145,7 +147,8 @@ definitions: type: integer type: array withdrawalsRoot: - description: WithdrawalsHash was added by EIP-4895 and is ignored in legacy + description: + WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers. items: type: integer @@ -168,63 +171,63 @@ paths: /healthz: get: consumes: - - application/json + - application/json operationId: health-check produces: - - application/json + - application/json responses: "200": description: OK schema: type: string summary: Get current server health status - /tentativeBlocks: + /softBlocks: delete: consumes: - - application/json + - application/json description: |- - Remove all tentative blocks from the blockchain beyond the specified block height, + Remove all soft blocks from the blockchain beyond the specified block height, ensuring the latest block ID does not exceed the given height. This method will fail if - the block with an ID one greater than the specified height is not a tentative block. If the - specified block height is greater than the latest tentative block ID, the method will succeed + the block with an ID one greater than the specified height is not a soft block. If the + specified block height is greater than the latest soft block ID, the method will succeed without modifying the blockchain. parameters: - - description: preconf blocks creation request body - in: body - name: body - required: true - schema: - $ref: '#/definitions/preconfserver.RemoveTentativeBlocksRequestBody' + - description: preconf blocks creation request body + in: body + name: body + required: true + schema: + $ref: "#/definitions/preconfserver.RemoveSoftBlocksRequestBody" produces: - - application/json + - application/json responses: "200": description: OK schema: - $ref: '#/definitions/preconfserver.RemoveTentativeBlocksResponseBody' + $ref: "#/definitions/preconfserver.RemoveSoftBlocksResponseBody" post: consumes: - - application/json + - application/json description: |- - Insert a group of transactions into a tentative block for preconfirmation. If the group is the - first for a block, a new tentative block will be created. Otherwise, the transactions will - be appended to the existing tentative block. The API will fail if: - 1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3) - block-level parameters are invalid or do not match the current tentative block’s parameters, + Insert a group of transactions into a soft block for preconfirmation. If the group is the + first for a block, a new soft block will be created. Otherwise, the transactions will + be appended to the existing soft block. The API will fail if: + 1) the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3) + block-level parameters are invalid or do not match the current soft block’s parameters, 4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of the block indicates no further transactions are allowed. parameters: - - description: preconf blocks creation request body - in: body - name: body - required: true - schema: - $ref: '#/definitions/preconfserver.BuildTentativeBlocksRequestBody' + - description: preconf blocks creation request body + in: body + name: body + required: true + schema: + $ref: "#/definitions/preconfserver.BuildSoftBlocksRequestBody" produces: - - application/json + - application/json responses: "200": description: OK schema: - $ref: '#/definitions/preconfserver.BuildTentativeBlocksResponseBody' + $ref: "#/definitions/preconfserver.BuildSoftBlocksResponseBody" swagger: "2.0" diff --git a/packages/taiko-client/driver/preconf_server/api.go b/packages/taiko-client/driver/preconf_server/api.go deleted file mode 100644 index e8dd557c9fe..00000000000 --- a/packages/taiko-client/driver/preconf_server/api.go +++ /dev/null @@ -1,110 +0,0 @@ -package preconfserver - -import ( - "net/http" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/labstack/echo/v4" -) - -// PreconfTxsGroupStatus represents the status of a preconfirmation transactions group. -type PreconfTxsGroupStatus string - -// PreconfBlockGroupStatus values. -const ( - StatusFinalBlockGroup PreconfTxsGroupStatus = "finalBlockGroup" - StatusFinalPreconfGroup PreconfTxsGroupStatus = "finalPreconfGroup" -) - -// PreconfTransactionsGroup represents a preconfirmation block group. -type PreconfTransactionsGroup struct { - BlockID uint64 `json:"blockId"` - ID uint64 `json:"groupId"` - TransactionsList types.Transactions `json:"transactions"` - GroupStatus PreconfTxsGroupStatus `json:"groupStatus"` - Signature string `json:"signature"` - - // Block parameters - Timestamp uint64 `json:"timestamp"` - Random common.Hash `json:"prevRandao"` - SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient"` - BaseFeePerGas uint64 `json:"baseFeePerGas"` - - // AnchorV2 parameters - AnchorBlockID uint64 `json:"anchorBlockID"` - AnchorStateRoot common.Hash `json:"anchorStateRoot"` - ParentGasUsed uint32 `json:"parentGasUsed"` -} - -// buildTentativeBlocksRequestBody represents a request body when handling -// preconfirmation blocks creation requests. -type BuildTentativeBlocksRequestBody struct { - TransactionsGroups []PreconfTransactionsGroup `json:"transactionsGroups"` -} - -// CreateOrUpdateBlocksFromBatchResponseBody represents a response body when handling preconfirmation -// blocks creation requests. -type BuildTentativeBlocksResponseBody struct { - PreconfHeaders []types.Header `json:"tentativeHeaders"` -} - -// BuildTentativeBlocks handles a preconfirmation blocks creation request, -// if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation -// blocks to the backend L2 execution engine and return a success response. -// -// @Description Insert a group of transactions into a tentative block for preconfirmation. If the group is the -// @Description first for a block, a new tentative block will be created. Otherwise, the transactions will -// @Description be appended to the existing tentative block. The API will fail if: -// @Description 1) the block is not tentative, 2) any transaction in the group is invalid or a duplicate, 3) -// @Description block-level parameters are invalid or do not match the current tentative block’s parameters, -// @Description 4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of -// @Description the block indicates no further transactions are allowed. -// @Param body body BuildTentativeBlocksRequestBody true "preconf blocks creation request body" -// @Accept json -// @Produce json -// @Success 200 {object} BuildTentativeBlocksResponseBody -// @Router /tentativeBlocks [post] -func (s *PreconfAPIServer) BuildTentativeBlocks(c echo.Context) error { - return c.NoContent(http.StatusOK) -} - -// RemoveTentativeBlocksRequestBody represents a request body when resetting the backend -// L2 execution engine preconfirmation head. -type RemoveTentativeBlocksRequestBody struct { - NewHead uint64 `json:"newHead"` -} - -// RemoveTentativeBlocksResponseBody represents a response body when resetting the backend -// L2 execution engine preconfirmation head. -type RemoveTentativeBlocksResponseBody struct { - CurrentHead types.Header `json:"currentHead"` -} - -// RemoveTentativeBlocks removes the backend L2 execution engine preconfirmation head. -// -// @Description Remove all tentative blocks from the blockchain beyond the specified block height, -// @Description ensuring the latest block ID does not exceed the given height. This method will fail if -// @Description the block with an ID one greater than the specified height is not a tentative block. If the -// @Description specified block height is greater than the latest tentative block ID, the method will succeed -// @Description without modifying the blockchain. -// @Param body body RemoveTentativeBlocksRequestBody true "preconf blocks creation request body" -// @Accept json -// @Produce json -// @Success 200 {object} RemoveTentativeBlocksResponseBody -// @Router /tentativeBlocks [delete] -func (s *PreconfAPIServer) RemoveTentativeBlocks(c echo.Context) error { - return c.NoContent(http.StatusOK) -} - -// HealthCheck is the endpoints for probes. -// -// @Summary Get current server health status -// @ID health-check -// @Accept json -// @Produce json -// @Success 200 {object} string -// @Router /healthz [get] -func (s *PreconfAPIServer) HealthCheck(c echo.Context) error { - return c.NoContent(http.StatusOK) -} diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go new file mode 100644 index 00000000000..2a1b1baa0fb --- /dev/null +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -0,0 +1,108 @@ +package preconfserver + +import ( + "net/http" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/labstack/echo/v4" +) + +// TransactionBatchMarker represents the status of a preconfirmation transactions group. +type TransactionBatchMarker string + +// PreconfBlockBatchMarker values. +const ( + BatchMarkerEOB TransactionBatchMarker = "end_of_block" + BatchMarkerEOP TransactionBatchMarker = "end_of_preconf" +) + +// TransactionBatch represents a preconfirmation block group. +type TransactionBatch struct { + BlockID uint64 `json:"blockId"` + ID uint64 `json:"batchId"` + TransactionsList types.Transactions `json:"transactions"` + BatchMarker TransactionBatchMarker `json:"batchType"` + Signature string `json:"signature"` + + // Block parameters + Timestamp uint64 `json:"timestamp"` + Coinbase common.Address `json:"coinbase"` + + // AnchorV2 parameters + AnchorBlockID uint64 `json:"anchorBlockID"` + AnchorStateRoot common.Hash `json:"anchorStateRoot"` +} + +// buildSoftBlocksRequestBody represents a request body when handling +// preconfirmation blocks creation requests. +type BuildSoftBlockRequestBody struct { + TransactionBatch TransactionBatch `json:"transactionBatch"` +} + +// CreateOrUpdateBlocksFromBatchResponseBody represents a response body when handling preconfirmation +// blocks creation requests. +type BuildSoftBlockResponseBody struct { + BlockHeader types.Header `json:"blockHeader"` +} + +// BuildSoftBlock handles a preconfirmation block creation request, +// if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation +// block to the backend L2 execution engine and return a success response. +// +// @Description Insert a group of transactions into a soft block for preconfirmation. If the group is the +// @Description first for a block, a new soft block will be created. Otherwise, the transactions will +// @Description be appended to the existing soft block. The API will fail if: +// @Description 1) the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3) +// @Description block-level parameters are invalid or do not match the current soft block’s parameters, +// @Description 4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of +// @Description the block indicates no further transactions are allowed. +// @Param body body BuildSoftBlocksRequestBody true "preconf blocks creation request body" +// @Accept json +// @Produce json +// @Success 200 {object} BuildSoftBlocksResponseBody +// @Router /softBlocks [post] +func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { + return c.NoContent(http.StatusOK) +} + +// RemoveSoftBlocksRequestBody represents a request body when resetting the backend +// L2 execution engine preconfirmation head. +type RemoveSoftBlocksRequestBody struct { + NewHead uint64 `json:"newHead"` +} + +// RemoveSoftBlocksResponseBody represents a response body when resetting the backend +// L2 execution engine preconfirmation head. +type RemoveSoftBlocksResponseBody struct { + CurrentHead types.Header `json:"currentHead"` + HeadRemoved uint64 `json:"headRemoved"` +} + +// RemoveSoftBlocks removes the backend L2 execution engine preconfirmation head. +// +// @Description Remove all soft blocks from the blockchain beyond the specified block height, +// @Description ensuring the latest block ID does not exceed the given height. This method will fail if +// @Description the block with an ID one greater than the specified height is not a soft block. If the +// @Description specified block height is greater than the latest soft block ID, the method will succeed +// @Description without modifying the blockchain. +// @Param body body RemoveSoftBlocksRequestBody true "preconf blocks creation request body" +// @Accept json +// @Produce json +// @Success 200 {object} RemoveSoftBlocksResponseBody +// @Router /softBlocks [delete] +func (s *SoftBlockAPIServer) RemoveSoftBlocks(c echo.Context) error { + return c.NoContent(http.StatusOK) +} + +// HealthCheck is the endpoints for probes. +// +// @Summary Get current server health status +// @ID health-check +// @Accept json +// @Produce json +// @Success 200 {object} string +// @Router /healthz [get] +func (s *SoftBlockAPIServer) HealthCheck(c echo.Context) error { + return c.NoContent(http.StatusOK) +} diff --git a/packages/taiko-client/driver/preconf_server/server.go b/packages/taiko-client/driver/soft_blocks/server.go similarity index 82% rename from packages/taiko-client/driver/preconf_server/server.go rename to packages/taiko-client/driver/soft_blocks/server.go index 90f2a1cc6fe..abc56939509 100644 --- a/packages/taiko-client/driver/preconf_server/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -20,15 +20,15 @@ import ( // @license.name MIT // @license.url https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md -// PreconfAPIServer represents a preconfirmation server instance. -type PreconfAPIServer struct { +// SoftBlockAPIServer represents a preconfirmation server instance. +type SoftBlockAPIServer struct { echo *echo.Echo chainSyncer *chainSyncer.L2ChainSyncer } // New creates a new preconfirmation server instance. -func New(chainSyncer *chainSyncer.L2ChainSyncer) (*PreconfAPIServer, error) { - server := &PreconfAPIServer{ +func New(chainSyncer *chainSyncer.L2ChainSyncer) (*SoftBlockAPIServer, error) { + server := &SoftBlockAPIServer{ echo: echo.New(), chainSyncer: chainSyncer, } @@ -52,7 +52,7 @@ func LogSkipper(c echo.Context) bool { } // configureMiddleware configures the server middlewares. -func (s *PreconfAPIServer) configureMiddleware(corsOrigins []string) { +func (s *SoftBlockAPIServer) configureMiddleware(corsOrigins []string) { s.echo.Use(middleware.RequestID()) s.echo.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{ @@ -72,9 +72,9 @@ func (s *PreconfAPIServer) configureMiddleware(corsOrigins []string) { } // configureRoutes contains all routes which will be used by prover server. -func (s *PreconfAPIServer) configureRoutes() { +func (s *SoftBlockAPIServer) configureRoutes() { s.echo.GET("/", s.HealthCheck) s.echo.GET("/healthz", s.HealthCheck) - s.echo.POST("/tentativeBlocks", s.BuildTentativeBlocks) - s.echo.DELETE("/tentativeBlocks", s.RemoveTentativeBlocks) + s.echo.POST("/softBlocks", s.BuildSoftBlock) + s.echo.DELETE("/softBlocks", s.RemoveSoftBlocks) } From b6150e6c4908fc0470c0fcfb688287b9c52b738b Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 14:36:17 +0800 Subject: [PATCH 21/71] feat: update ci --- packages/taiko-client/driver/soft_blocks/api.go | 2 +- packages/taiko-client/scripts/gen_swagger_json.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 2a1b1baa0fb..29cdd5cdfb1 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -21,7 +21,7 @@ const ( type TransactionBatch struct { BlockID uint64 `json:"blockId"` ID uint64 `json:"batchId"` - TransactionsList types.Transactions `json:"transactions"` + TransactionsList []byte `json:"transactions"` BatchMarker TransactionBatchMarker `json:"batchType"` Signature string `json:"signature"` diff --git a/packages/taiko-client/scripts/gen_swagger_json.sh b/packages/taiko-client/scripts/gen_swagger_json.sh index ac8f7a91849..6d3a297c984 100755 --- a/packages/taiko-client/scripts/gen_swagger_json.sh +++ b/packages/taiko-client/scripts/gen_swagger_json.sh @@ -1,3 +1,3 @@ #/bin/sh -swag init -g server.go -d driver/preconf_server --pd +swag init -g server.go -d driver/soft_blocks --pd From c4c0fec6769ac90d434ec0d90caaf4647f533c92 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 14:41:46 +0800 Subject: [PATCH 22/71] feat: rename packages --- packages/taiko-client/driver/soft_blocks/api.go | 2 +- packages/taiko-client/driver/soft_blocks/server.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 29cdd5cdfb1..c7b0754a4b1 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -1,4 +1,4 @@ -package preconfserver +package softblocks import ( "net/http" diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index abc56939509..76d30a7c2fd 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -1,4 +1,4 @@ -package preconfserver +package softblocks import ( "os" From 5b4b57e1fd964fe1b66f8a840749d4a70a533f08 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 14:44:28 +0800 Subject: [PATCH 23/71] fix: fix swagger build --- packages/taiko-client/docs/docs.go | 96 ++++++++----------- packages/taiko-client/docs/swagger.json | 94 ++++++++---------- packages/taiko-client/docs/swagger.yaml | 74 ++++++-------- .../taiko-client/driver/soft_blocks/api.go | 6 +- 4 files changed, 111 insertions(+), 159 deletions(-) diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go index 6c49afc0041..e2b4fd1475f 100644 --- a/packages/taiko-client/docs/docs.go +++ b/packages/taiko-client/docs/docs.go @@ -60,7 +60,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/preconfserver.BuildSoftBlocksRequestBody" + "$ref": "#/definitions/softblocks.BuildSoftBlockRequestBody" } } ], @@ -68,7 +68,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/preconfserver.BuildSoftBlocksResponseBody" + "$ref": "#/definitions/softblocks.BuildSoftBlockResponseBody" } } } @@ -88,7 +88,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/preconfserver.RemoveSoftBlocksRequestBody" + "$ref": "#/definitions/softblocks.RemoveSoftBlocksRequestBody" } } ], @@ -96,7 +96,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/preconfserver.RemoveSoftBlocksResponseBody" + "$ref": "#/definitions/softblocks.RemoveSoftBlocksResponseBody" } } } @@ -107,29 +107,42 @@ const docTemplate = `{ "big.Int": { "type": "object" }, - "preconfserver.BuildSoftBlocksRequestBody": { + "softblocks.BuildSoftBlockRequestBody": { "type": "object", "properties": { - "transactionsGroups": { - "type": "array", - "items": { - "$ref": "#/definitions/preconfserver.TransactionBatch" - } + "transactionBatch": { + "$ref": "#/definitions/softblocks.TransactionBatch" } } }, - "preconfserver.BuildSoftBlocksResponseBody": { + "softblocks.BuildSoftBlockResponseBody": { "type": "object", "properties": { - "softHeaders": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Header" - } + "blockHeader": { + "$ref": "#/definitions/types.Header" + } + } + }, + "softblocks.RemoveSoftBlocksRequestBody": { + "type": "object", + "properties": { + "newHead": { + "type": "integer" } } }, - "preconfserver.TransactionBatch": { + "softblocks.RemoveSoftBlocksResponseBody": { + "type": "object", + "properties": { + "currentHead": { + "$ref": "#/definitions/types.Header" + }, + "headRemoved": { + "type": "integer" + } + } + }, + "softblocks.TransactionBatch": { "type": "object", "properties": { "anchorBlockID": { @@ -142,22 +155,16 @@ const docTemplate = `{ "type": "integer" } }, - "baseFeePerGas": { - "type": "integer" - }, - "blockId": { - "type": "integer" - }, - "groupId": { + "batchId": { "type": "integer" }, - "groupStatus": { - "$ref": "#/definitions/preconfserver.PreconfTxsGroupStatus" + "batchType": { + "$ref": "#/definitions/softblocks.TransactionBatchMarker" }, - "parentGasUsed": { + "blockId": { "type": "integer" }, - "prevRandao": { + "coinbase": { "type": "array", "items": { "type": "integer" @@ -166,12 +173,6 @@ const docTemplate = `{ "signature": { "type": "string" }, - "suggestedFeeRecipient": { - "type": "array", - "items": { - "type": "integer" - } - }, "timestamp": { "description": "Block parameters", "type": "integer" @@ -179,38 +180,22 @@ const docTemplate = `{ "transactions": { "type": "array", "items": { - "$ref": "#/definitions/types.Transaction" + "type": "integer" } } } }, - "preconfserver.PreconfTxsGroupStatus": { + "softblocks.TransactionBatchMarker": { "type": "string", "enum": [ - "finalBlockGroup", - "finalPreconfGroup" + "end_of_block", + "end_of_preconf" ], "x-enum-varnames": [ "BatchMarkerEOB", "BatchMarkerEOP" ] }, - "preconfserver.RemoveSoftBlocksRequestBody": { - "type": "object", - "properties": { - "newHead": { - "type": "integer" - } - } - }, - "preconfserver.RemoveSoftBlocksResponseBody": { - "type": "object", - "properties": { - "currentHead": { - "$ref": "#/definitions/types.Header" - } - } - }, "types.Header": { "type": "object", "properties": { @@ -327,9 +312,6 @@ const docTemplate = `{ } } } - }, - "types.Transaction": { - "type": "object" } } }` diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json index faa34a2e708..d24c495f865 100644 --- a/packages/taiko-client/docs/swagger.json +++ b/packages/taiko-client/docs/swagger.json @@ -43,7 +43,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/preconfserver.BuildSoftBlocksRequestBody" + "$ref": "#/definitions/softblocks.BuildSoftBlockRequestBody" } } ], @@ -51,7 +51,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/preconfserver.BuildSoftBlocksResponseBody" + "$ref": "#/definitions/softblocks.BuildSoftBlockResponseBody" } } } @@ -67,7 +67,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/preconfserver.RemoveSoftBlocksRequestBody" + "$ref": "#/definitions/softblocks.RemoveSoftBlocksRequestBody" } } ], @@ -75,7 +75,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/preconfserver.RemoveSoftBlocksResponseBody" + "$ref": "#/definitions/softblocks.RemoveSoftBlocksResponseBody" } } } @@ -86,29 +86,42 @@ "big.Int": { "type": "object" }, - "preconfserver.BuildSoftBlocksRequestBody": { + "softblocks.BuildSoftBlockRequestBody": { "type": "object", "properties": { - "transactionsGroups": { - "type": "array", - "items": { - "$ref": "#/definitions/preconfserver.TransactionBatch" - } + "transactionBatch": { + "$ref": "#/definitions/softblocks.TransactionBatch" } } }, - "preconfserver.BuildSoftBlocksResponseBody": { + "softblocks.BuildSoftBlockResponseBody": { "type": "object", "properties": { - "softHeaders": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Header" - } + "blockHeader": { + "$ref": "#/definitions/types.Header" + } + } + }, + "softblocks.RemoveSoftBlocksRequestBody": { + "type": "object", + "properties": { + "newHead": { + "type": "integer" } } }, - "preconfserver.TransactionBatch": { + "softblocks.RemoveSoftBlocksResponseBody": { + "type": "object", + "properties": { + "currentHead": { + "$ref": "#/definitions/types.Header" + }, + "headRemoved": { + "type": "integer" + } + } + }, + "softblocks.TransactionBatch": { "type": "object", "properties": { "anchorBlockID": { @@ -121,22 +134,16 @@ "type": "integer" } }, - "baseFeePerGas": { - "type": "integer" - }, - "blockId": { - "type": "integer" - }, - "groupId": { + "batchId": { "type": "integer" }, - "groupStatus": { - "$ref": "#/definitions/preconfserver.PreconfTxsGroupStatus" + "batchType": { + "$ref": "#/definitions/softblocks.TransactionBatchMarker" }, - "parentGasUsed": { + "blockId": { "type": "integer" }, - "prevRandao": { + "coinbase": { "type": "array", "items": { "type": "integer" @@ -145,12 +152,6 @@ "signature": { "type": "string" }, - "suggestedFeeRecipient": { - "type": "array", - "items": { - "type": "integer" - } - }, "timestamp": { "description": "Block parameters", "type": "integer" @@ -158,32 +159,16 @@ "transactions": { "type": "array", "items": { - "$ref": "#/definitions/types.Transaction" + "type": "integer" } } } }, - "preconfserver.PreconfTxsGroupStatus": { + "softblocks.TransactionBatchMarker": { "type": "string", - "enum": ["finalBlockGroup", "finalPreconfGroup"], + "enum": ["end_of_block", "end_of_preconf"], "x-enum-varnames": ["BatchMarkerEOB", "BatchMarkerEOP"] }, - "preconfserver.RemoveSoftBlocksRequestBody": { - "type": "object", - "properties": { - "newHead": { - "type": "integer" - } - } - }, - "preconfserver.RemoveSoftBlocksResponseBody": { - "type": "object", - "properties": { - "currentHead": { - "$ref": "#/definitions/types.Header" - } - } - }, "types.Header": { "type": "object", "properties": { @@ -300,9 +285,6 @@ } } } - }, - "types.Transaction": { - "type": "object" } } } diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml index 081fb8b4f59..dd6476d372f 100644 --- a/packages/taiko-client/docs/swagger.yaml +++ b/packages/taiko-client/docs/swagger.yaml @@ -1,21 +1,29 @@ definitions: big.Int: type: object - preconfserver.BuildSoftBlocksRequestBody: + softblocks.BuildSoftBlockRequestBody: properties: - transactionsGroups: - items: - $ref: "#/definitions/preconfserver.TransactionBatch" - type: array + transactionBatch: + $ref: "#/definitions/softblocks.TransactionBatch" type: object - preconfserver.BuildSoftBlocksResponseBody: + softblocks.BuildSoftBlockResponseBody: properties: - softHeaders: - items: - $ref: "#/definitions/types.Header" - type: array + blockHeader: + $ref: "#/definitions/types.Header" type: object - preconfserver.TransactionBatch: + softblocks.RemoveSoftBlocksRequestBody: + properties: + newHead: + type: integer + type: object + softblocks.RemoveSoftBlocksResponseBody: + properties: + currentHead: + $ref: "#/definitions/types.Header" + headRemoved: + type: integer + type: object + softblocks.TransactionBatch: properties: anchorBlockID: description: AnchorV2 parameters @@ -24,52 +32,34 @@ definitions: items: type: integer type: array - baseFeePerGas: + batchId: type: integer + batchType: + $ref: "#/definitions/softblocks.TransactionBatchMarker" blockId: type: integer - groupId: - type: integer - groupStatus: - $ref: "#/definitions/preconfserver.PreconfTxsGroupStatus" - parentGasUsed: - type: integer - prevRandao: + coinbase: items: type: integer type: array signature: type: string - suggestedFeeRecipient: - items: - type: integer - type: array timestamp: description: Block parameters type: integer transactions: items: - $ref: "#/definitions/types.Transaction" + type: integer type: array type: object - preconfserver.PreconfTxsGroupStatus: + softblocks.TransactionBatchMarker: enum: - - finalBlockGroup - - finalPreconfGroup + - end_of_block + - end_of_preconf type: string x-enum-varnames: - BatchMarkerEOB - BatchMarkerEOP - preconfserver.RemoveSoftBlocksRequestBody: - properties: - newHead: - type: integer - type: object - preconfserver.RemoveSoftBlocksResponseBody: - properties: - currentHead: - $ref: "#/definitions/types.Header" - type: object types.Header: properties: baseFeePerGas: @@ -154,8 +144,6 @@ definitions: type: integer type: array type: object - types.Transaction: - type: object info: contact: email: info@taiko.xyz @@ -197,14 +185,14 @@ paths: name: body required: true schema: - $ref: "#/definitions/preconfserver.RemoveSoftBlocksRequestBody" + $ref: "#/definitions/softblocks.RemoveSoftBlocksRequestBody" produces: - application/json responses: "200": description: OK schema: - $ref: "#/definitions/preconfserver.RemoveSoftBlocksResponseBody" + $ref: "#/definitions/softblocks.RemoveSoftBlocksResponseBody" post: consumes: - application/json @@ -222,12 +210,12 @@ paths: name: body required: true schema: - $ref: "#/definitions/preconfserver.BuildSoftBlocksRequestBody" + $ref: "#/definitions/softblocks.BuildSoftBlockRequestBody" produces: - application/json responses: "200": description: OK schema: - $ref: "#/definitions/preconfserver.BuildSoftBlocksResponseBody" + $ref: "#/definitions/softblocks.BuildSoftBlockResponseBody" swagger: "2.0" diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index c7b0754a4b1..ad4c0b0f2f0 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -34,7 +34,7 @@ type TransactionBatch struct { AnchorStateRoot common.Hash `json:"anchorStateRoot"` } -// buildSoftBlocksRequestBody represents a request body when handling +// BuildSoftBlockRequestBody represents a request body when handling // preconfirmation blocks creation requests. type BuildSoftBlockRequestBody struct { TransactionBatch TransactionBatch `json:"transactionBatch"` @@ -57,10 +57,10 @@ type BuildSoftBlockResponseBody struct { // @Description block-level parameters are invalid or do not match the current soft block’s parameters, // @Description 4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of // @Description the block indicates no further transactions are allowed. -// @Param body body BuildSoftBlocksRequestBody true "preconf blocks creation request body" +// @Param body body BuildSoftBlockRequestBody true "preconf blocks creation request body" // @Accept json // @Produce json -// @Success 200 {object} BuildSoftBlocksResponseBody +// @Success 200 {object} BuildSoftBlockResponseBody // @Router /softBlocks [post] func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { return c.NoContent(http.StatusOK) From 8193b5e5e75579d1a7b53a5eda1b6c9f2edd5881 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 14:51:15 +0800 Subject: [PATCH 24/71] feat: update api --- packages/taiko-client/driver/soft_blocks/api.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index ad4c0b0f2f0..2b900519546 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -3,7 +3,6 @@ package softblocks import ( "net/http" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/labstack/echo/v4" ) @@ -21,17 +20,17 @@ const ( type TransactionBatch struct { BlockID uint64 `json:"blockId"` ID uint64 `json:"batchId"` - TransactionsList []byte `json:"transactions"` + TransactionsList string `json:"transactions"` BatchMarker TransactionBatchMarker `json:"batchType"` Signature string `json:"signature"` // Block parameters - Timestamp uint64 `json:"timestamp"` - Coinbase common.Address `json:"coinbase"` + Timestamp uint64 `json:"timestamp"` + Coinbase string `json:"coinbase"` // AnchorV2 parameters - AnchorBlockID uint64 `json:"anchorBlockID"` - AnchorStateRoot common.Hash `json:"anchorStateRoot"` + AnchorBlockID uint64 `json:"anchorBlockID"` + AnchorStateRoot string `json:"anchorStateRoot"` } // BuildSoftBlockRequestBody represents a request body when handling From 239b4a31e82c54c62b30b8523115be9b6deabac2 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 14:54:07 +0800 Subject: [PATCH 25/71] feat: update api --- packages/taiko-client/driver/soft_blocks/api.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 2b900519546..6370dbd507c 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -51,10 +51,10 @@ type BuildSoftBlockResponseBody struct { // // @Description Insert a group of transactions into a soft block for preconfirmation. If the group is the // @Description first for a block, a new soft block will be created. Otherwise, the transactions will -// @Description be appended to the existing soft block. The API will fail if: -// @Description 1) the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3) -// @Description block-level parameters are invalid or do not match the current soft block’s parameters, -// @Description 4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of +// @Description be appended to the existing soft block. The API will fail if: 1) +// @Description the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3) +// @Description block-level parameters are invalid or do not match the current soft block’s parameters, 4) +// @Description the group ID is not exactly 1 greater than the previous one, or 5) the last group of // @Description the block indicates no further transactions are allowed. // @Param body body BuildSoftBlockRequestBody true "preconf blocks creation request body" // @Accept json From fa155bdf441b4125d5b865d243fcceddbe44205e Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 14:55:39 +0800 Subject: [PATCH 26/71] feat: update api --- .../taiko-client/driver/soft_blocks/api.go | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 6370dbd507c..02b1ea0f154 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -49,18 +49,19 @@ type BuildSoftBlockResponseBody struct { // if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation // block to the backend L2 execution engine and return a success response. // -// @Description Insert a group of transactions into a soft block for preconfirmation. If the group is the -// @Description first for a block, a new soft block will be created. Otherwise, the transactions will -// @Description be appended to the existing soft block. The API will fail if: 1) -// @Description the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3) -// @Description block-level parameters are invalid or do not match the current soft block’s parameters, 4) -// @Description the group ID is not exactly 1 greater than the previous one, or 5) the last group of -// @Description the block indicates no further transactions are allowed. -// @Param body body BuildSoftBlockRequestBody true "preconf blocks creation request body" -// @Accept json -// @Produce json -// @Success 200 {object} BuildSoftBlockResponseBody -// @Router /softBlocks [post] +// @Description Insert a group of transactions into a soft block for preconfirmation. If the group is the +// @Description first for a block, a new soft block will be created. Otherwise, the transactions will +// @Description be appended to the existing soft block. The API will fail if: +// @Description 1) the block is not soft +// @Description 2) any transaction in the group is invalid or a duplicate +// @Description 3) block-level parameters are invalid or do not match the current soft block’s parameters +// @Description 4) the group ID is not exactly 1 greater than the previous one +// @Description 5) the last group ofthe block indicates no further transactions are allowed +// @Param body body BuildSoftBlockRequestBody true "preconf blocks creation request body" +// @Accept json +// @Produce json +// @Success 200 {object} BuildSoftBlockResponseBody +// @Router /softBlocks [post] func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { return c.NoContent(http.StatusOK) } From 928a72c9e6cf74f2c0d9681bd23c44d28e5e8d22 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 14:56:30 +0800 Subject: [PATCH 27/71] feat: update api --- packages/taiko-client/driver/soft_blocks/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 02b1ea0f154..3670967dde0 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -75,8 +75,8 @@ type RemoveSoftBlocksRequestBody struct { // RemoveSoftBlocksResponseBody represents a response body when resetting the backend // L2 execution engine preconfirmation head. type RemoveSoftBlocksResponseBody struct { - CurrentHead types.Header `json:"currentHead"` - HeadRemoved uint64 `json:"headRemoved"` + CurrentHead types.Header `json:"currentHead"` + HeadsRemoved uint64 `json:"headsRemoved"` } // RemoveSoftBlocks removes the backend L2 execution engine preconfirmation head. From e94c531fbf47bd76231d3d4631b8965f0166b2a2 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 14:57:33 +0800 Subject: [PATCH 28/71] feat: update api --- .../taiko-client/driver/soft_blocks/api.go | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 3670967dde0..9dea9385597 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -49,19 +49,18 @@ type BuildSoftBlockResponseBody struct { // if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation // block to the backend L2 execution engine and return a success response. // -// @Description Insert a group of transactions into a soft block for preconfirmation. If the group is the -// @Description first for a block, a new soft block will be created. Otherwise, the transactions will -// @Description be appended to the existing soft block. The API will fail if: -// @Description 1) the block is not soft -// @Description 2) any transaction in the group is invalid or a duplicate -// @Description 3) block-level parameters are invalid or do not match the current soft block’s parameters -// @Description 4) the group ID is not exactly 1 greater than the previous one -// @Description 5) the last group ofthe block indicates no further transactions are allowed -// @Param body body BuildSoftBlockRequestBody true "preconf blocks creation request body" -// @Accept json -// @Produce json -// @Success 200 {object} BuildSoftBlockResponseBody -// @Router /softBlocks [post] +// @Description Insert a group of transactions into a soft block for preconfirmation. If the group is the +// @Description first for a block, a new soft block will be created. Otherwise, the transactions will +// @Description be appended to the existing soft block. The API will fail if: +// @Description 1) the block is not soft +// @Description 2) block-level parameters are invalid or do not match the current soft block’s parameters +// @Description 3) the group ID is not exactly 1 greater than the previous one +// @Description 4) the last group of the block indicates no further transactions are allowed +// @Param body body BuildSoftBlockRequestBody true "preconf blocks creation request body" +// @Accept json +// @Produce json +// @Success 200 {object} BuildSoftBlockResponseBody +// @Router /softBlocks [post] func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { return c.NoContent(http.StatusOK) } From 870b013dab36ae659f208a48d04236126ac81042 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 15:21:39 +0800 Subject: [PATCH 29/71] chore: update comments --- packages/taiko-client/driver/soft_blocks/api.go | 16 ++++++++-------- .../taiko-client/driver/soft_blocks/server.go | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 9dea9385597..2d38b66836e 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -16,7 +16,7 @@ const ( BatchMarkerEOP TransactionBatchMarker = "end_of_preconf" ) -// TransactionBatch represents a preconfirmation block group. +// TransactionBatch represents a soft block group. type TransactionBatch struct { BlockID uint64 `json:"blockId"` ID uint64 `json:"batchId"` @@ -34,19 +34,19 @@ type TransactionBatch struct { } // BuildSoftBlockRequestBody represents a request body when handling -// preconfirmation blocks creation requests. +// soft blocks creation requests. type BuildSoftBlockRequestBody struct { TransactionBatch TransactionBatch `json:"transactionBatch"` } -// CreateOrUpdateBlocksFromBatchResponseBody represents a response body when handling preconfirmation +// CreateOrUpdateBlocksFromBatchResponseBody represents a response body when handling soft // blocks creation requests. type BuildSoftBlockResponseBody struct { BlockHeader types.Header `json:"blockHeader"` } -// BuildSoftBlock handles a preconfirmation block creation request, -// if the preconfirmation block groups in request are valid, it will insert the correspoinding new preconfirmation +// BuildSoftBlock handles a soft block creation request, +// if the soft block group in request are valid, it will insert the correspoinding new preconfirmation // block to the backend L2 execution engine and return a success response. // // @Description Insert a group of transactions into a soft block for preconfirmation. If the group is the @@ -66,19 +66,19 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { } // RemoveSoftBlocksRequestBody represents a request body when resetting the backend -// L2 execution engine preconfirmation head. +// L2 execution engine soft head. type RemoveSoftBlocksRequestBody struct { NewHead uint64 `json:"newHead"` } // RemoveSoftBlocksResponseBody represents a response body when resetting the backend -// L2 execution engine preconfirmation head. +// L2 execution engine soft head. type RemoveSoftBlocksResponseBody struct { CurrentHead types.Header `json:"currentHead"` HeadsRemoved uint64 `json:"headsRemoved"` } -// RemoveSoftBlocks removes the backend L2 execution engine preconfirmation head. +// RemoveSoftBlocks removes the backend L2 execution engine soft head. // // @Description Remove all soft blocks from the blockchain beyond the specified block height, // @Description ensuring the latest block ID does not exceed the given height. This method will fail if diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index 76d30a7c2fd..e8aebfbf367 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -10,7 +10,7 @@ import ( chainSyncer "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer" ) -// @title Taiko Preconfirmation Server API +// @title Taiko Soft Block Server API // @version 1.0 // @termsOfService http://swagger.io/terms/ @@ -20,13 +20,13 @@ import ( // @license.name MIT // @license.url https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md -// SoftBlockAPIServer represents a preconfirmation server instance. +// SoftBlockAPIServer represents a soft blcok server instance. type SoftBlockAPIServer struct { echo *echo.Echo chainSyncer *chainSyncer.L2ChainSyncer } -// New creates a new preconfirmation server instance. +// New creates a new soft blcok server instance. func New(chainSyncer *chainSyncer.L2ChainSyncer) (*SoftBlockAPIServer, error) { server := &SoftBlockAPIServer{ echo: echo.New(), From 03950657a89f067aea5bb72e6f5f09b9e813e133 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 15:29:59 +0800 Subject: [PATCH 30/71] chore: update swagger json --- packages/taiko-client/docs/docs.go | 21 ++++++--------------- packages/taiko-client/docs/swagger.json | 21 ++++++--------------- packages/taiko-client/docs/swagger.yaml | 24 +++++++++--------------- 3 files changed, 21 insertions(+), 45 deletions(-) diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go index e2b4fd1475f..b852991072a 100644 --- a/packages/taiko-client/docs/docs.go +++ b/packages/taiko-client/docs/docs.go @@ -46,7 +46,7 @@ const docTemplate = `{ }, "/softBlocks": { "post": { - "description": "Insert a group of transactions into a soft block for preconfirmation. If the group is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current soft block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", + "description": "Insert a group of transactions into a soft block for preconfirmation. If the group is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft\n2) block-level parameters are invalid or do not match the current soft block’s parameters\n3) the group ID is not exactly 1 greater than the previous one\n4) the last group of the block indicates no further transactions are allowed", "consumes": [ "application/json" ], @@ -137,7 +137,7 @@ const docTemplate = `{ "currentHead": { "$ref": "#/definitions/types.Header" }, - "headRemoved": { + "headsRemoved": { "type": "integer" } } @@ -150,10 +150,7 @@ const docTemplate = `{ "type": "integer" }, "anchorStateRoot": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "batchId": { "type": "integer" @@ -165,10 +162,7 @@ const docTemplate = `{ "type": "integer" }, "coinbase": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "signature": { "type": "string" @@ -178,10 +172,7 @@ const docTemplate = `{ "type": "integer" }, "transactions": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" } } }, @@ -322,7 +313,7 @@ var SwaggerInfo = &swag.Spec{ Host: "", BasePath: "", Schemes: []string{}, - Title: "Taiko Preconfirmation Server API", + Title: "Taiko Soft Block Server API", Description: "", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json index d24c495f865..51704dbfee9 100644 --- a/packages/taiko-client/docs/swagger.json +++ b/packages/taiko-client/docs/swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "Taiko Preconfirmation Server API", + "title": "Taiko Soft Block Server API", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", @@ -33,7 +33,7 @@ }, "/softBlocks": { "post": { - "description": "Insert a group of transactions into a soft block for preconfirmation. If the group is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3)\nblock-level parameters are invalid or do not match the current soft block’s parameters,\n4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of\nthe block indicates no further transactions are allowed.", + "description": "Insert a group of transactions into a soft block for preconfirmation. If the group is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft\n2) block-level parameters are invalid or do not match the current soft block’s parameters\n3) the group ID is not exactly 1 greater than the previous one\n4) the last group of the block indicates no further transactions are allowed", "consumes": ["application/json"], "produces": ["application/json"], "parameters": [ @@ -116,7 +116,7 @@ "currentHead": { "$ref": "#/definitions/types.Header" }, - "headRemoved": { + "headsRemoved": { "type": "integer" } } @@ -129,10 +129,7 @@ "type": "integer" }, "anchorStateRoot": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "batchId": { "type": "integer" @@ -144,10 +141,7 @@ "type": "integer" }, "coinbase": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" }, "signature": { "type": "string" @@ -157,10 +151,7 @@ "type": "integer" }, "transactions": { - "type": "array", - "items": { - "type": "integer" - } + "type": "string" } } }, diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml index dd6476d372f..af442e3266c 100644 --- a/packages/taiko-client/docs/swagger.yaml +++ b/packages/taiko-client/docs/swagger.yaml @@ -20,7 +20,7 @@ definitions: properties: currentHead: $ref: "#/definitions/types.Header" - headRemoved: + headsRemoved: type: integer type: object softblocks.TransactionBatch: @@ -29,9 +29,7 @@ definitions: description: AnchorV2 parameters type: integer anchorStateRoot: - items: - type: integer - type: array + type: string batchId: type: integer batchType: @@ -39,18 +37,14 @@ definitions: blockId: type: integer coinbase: - items: - type: integer - type: array + type: string signature: type: string timestamp: description: Block parameters type: integer transactions: - items: - type: integer - type: array + type: string type: object softblocks.TransactionBatchMarker: enum: @@ -153,7 +147,7 @@ info: name: MIT url: https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md termsOfService: http://swagger.io/terms/ - title: Taiko Preconfirmation Server API + title: Taiko Soft Block Server API version: "1.0" paths: /healthz: @@ -200,10 +194,10 @@ paths: Insert a group of transactions into a soft block for preconfirmation. If the group is the first for a block, a new soft block will be created. Otherwise, the transactions will be appended to the existing soft block. The API will fail if: - 1) the block is not soft, 2) any transaction in the group is invalid or a duplicate, 3) - block-level parameters are invalid or do not match the current soft block’s parameters, - 4) the group ID is not exactly 1 greater than the previous one, or 5) the last group of - the block indicates no further transactions are allowed. + 1) the block is not soft + 2) block-level parameters are invalid or do not match the current soft block’s parameters + 3) the group ID is not exactly 1 greater than the previous one + 4) the last group of the block indicates no further transactions are allowed parameters: - description: preconf blocks creation request body in: body From 719eabd39be6a4653a68eb16a5bcef3148379e19 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 16:10:02 +0800 Subject: [PATCH 31/71] chore: update some comments --- packages/taiko-client/docs/docs.go | 4 ++-- packages/taiko-client/docs/swagger.json | 4 ++-- packages/taiko-client/docs/swagger.yaml | 4 ++-- packages/taiko-client/driver/soft_blocks/api.go | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go index b852991072a..cfd903a02c6 100644 --- a/packages/taiko-client/docs/docs.go +++ b/packages/taiko-client/docs/docs.go @@ -55,7 +55,7 @@ const docTemplate = `{ ], "parameters": [ { - "description": "preconf blocks creation request body", + "description": "soft block creation request body", "name": "body", "in": "body", "required": true, @@ -83,7 +83,7 @@ const docTemplate = `{ ], "parameters": [ { - "description": "preconf blocks creation request body", + "description": "soft blocks removing request body", "name": "body", "in": "body", "required": true, diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json index 51704dbfee9..26053064871 100644 --- a/packages/taiko-client/docs/swagger.json +++ b/packages/taiko-client/docs/swagger.json @@ -38,7 +38,7 @@ "produces": ["application/json"], "parameters": [ { - "description": "preconf blocks creation request body", + "description": "soft block creation request body", "name": "body", "in": "body", "required": true, @@ -62,7 +62,7 @@ "produces": ["application/json"], "parameters": [ { - "description": "preconf blocks creation request body", + "description": "soft blocks removing request body", "name": "body", "in": "body", "required": true, diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml index af442e3266c..43dc7a40134 100644 --- a/packages/taiko-client/docs/swagger.yaml +++ b/packages/taiko-client/docs/swagger.yaml @@ -174,7 +174,7 @@ paths: specified block height is greater than the latest soft block ID, the method will succeed without modifying the blockchain. parameters: - - description: preconf blocks creation request body + - description: soft blocks removing request body in: body name: body required: true @@ -199,7 +199,7 @@ paths: 3) the group ID is not exactly 1 greater than the previous one 4) the last group of the block indicates no further transactions are allowed parameters: - - description: preconf blocks creation request body + - description: soft block creation request body in: body name: body required: true diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 2d38b66836e..77666ea92b7 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -7,10 +7,10 @@ import ( "github.com/labstack/echo/v4" ) -// TransactionBatchMarker represents the status of a preconfirmation transactions group. +// TransactionBatchMarker represents the status of a soft block transactions group. type TransactionBatchMarker string -// PreconfBlockBatchMarker values. +// BatchMarker values. const ( BatchMarkerEOB TransactionBatchMarker = "end_of_block" BatchMarkerEOP TransactionBatchMarker = "end_of_preconf" @@ -46,7 +46,7 @@ type BuildSoftBlockResponseBody struct { } // BuildSoftBlock handles a soft block creation request, -// if the soft block group in request are valid, it will insert the correspoinding new preconfirmation +// if the soft block group in request are valid, it will insert the correspoinding new soft // block to the backend L2 execution engine and return a success response. // // @Description Insert a group of transactions into a soft block for preconfirmation. If the group is the @@ -56,7 +56,7 @@ type BuildSoftBlockResponseBody struct { // @Description 2) block-level parameters are invalid or do not match the current soft block’s parameters // @Description 3) the group ID is not exactly 1 greater than the previous one // @Description 4) the last group of the block indicates no further transactions are allowed -// @Param body body BuildSoftBlockRequestBody true "preconf blocks creation request body" +// @Param body body BuildSoftBlockRequestBody true "soft block creation request body" // @Accept json // @Produce json // @Success 200 {object} BuildSoftBlockResponseBody @@ -85,7 +85,7 @@ type RemoveSoftBlocksResponseBody struct { // @Description the block with an ID one greater than the specified height is not a soft block. If the // @Description specified block height is greater than the latest soft block ID, the method will succeed // @Description without modifying the blockchain. -// @Param body body RemoveSoftBlocksRequestBody true "preconf blocks creation request body" +// @Param body body RemoveSoftBlocksRequestBody true "soft blocks removing request body" // @Accept json // @Produce json // @Success 200 {object} RemoveSoftBlocksResponseBody From 3015dcb15036c67dd392d22572454e7fa668c958 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 16:15:40 +0800 Subject: [PATCH 32/71] chore: update some comments --- packages/taiko-client/docs/docs.go | 22 +++++++++++++------ packages/taiko-client/docs/swagger.json | 22 +++++++++++++------ packages/taiko-client/docs/swagger.yaml | 17 +++++++++----- .../taiko-client/driver/soft_blocks/api.go | 20 ++++++++++------- 4 files changed, 53 insertions(+), 28 deletions(-) diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go index cfd903a02c6..c8eb9a905fa 100644 --- a/packages/taiko-client/docs/docs.go +++ b/packages/taiko-client/docs/docs.go @@ -142,7 +142,7 @@ const docTemplate = `{ } } }, - "softblocks.TransactionBatch": { + "softblocks.SoftBlockParams": { "type": "object", "properties": { "anchorBlockID": { @@ -152,6 +152,18 @@ const docTemplate = `{ "anchorStateRoot": { "type": "string" }, + "coinbase": { + "type": "string" + }, + "timestamp": { + "description": "Block parameters", + "type": "integer" + } + } + }, + "softblocks.TransactionBatch": { + "type": "object", + "properties": { "batchId": { "type": "integer" }, @@ -161,16 +173,12 @@ const docTemplate = `{ "blockId": { "type": "integer" }, - "coinbase": { - "type": "string" + "blockParams": { + "$ref": "#/definitions/softblocks.SoftBlockParams" }, "signature": { "type": "string" }, - "timestamp": { - "description": "Block parameters", - "type": "integer" - }, "transactions": { "type": "string" } diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json index 26053064871..4ea04c2eebd 100644 --- a/packages/taiko-client/docs/swagger.json +++ b/packages/taiko-client/docs/swagger.json @@ -121,7 +121,7 @@ } } }, - "softblocks.TransactionBatch": { + "softblocks.SoftBlockParams": { "type": "object", "properties": { "anchorBlockID": { @@ -131,6 +131,18 @@ "anchorStateRoot": { "type": "string" }, + "coinbase": { + "type": "string" + }, + "timestamp": { + "description": "Block parameters", + "type": "integer" + } + } + }, + "softblocks.TransactionBatch": { + "type": "object", + "properties": { "batchId": { "type": "integer" }, @@ -140,16 +152,12 @@ "blockId": { "type": "integer" }, - "coinbase": { - "type": "string" + "blockParams": { + "$ref": "#/definitions/softblocks.SoftBlockParams" }, "signature": { "type": "string" }, - "timestamp": { - "description": "Block parameters", - "type": "integer" - }, "transactions": { "type": "string" } diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml index 43dc7a40134..b3bd92defcc 100644 --- a/packages/taiko-client/docs/swagger.yaml +++ b/packages/taiko-client/docs/swagger.yaml @@ -23,26 +23,31 @@ definitions: headsRemoved: type: integer type: object - softblocks.TransactionBatch: + softblocks.SoftBlockParams: properties: anchorBlockID: description: AnchorV2 parameters type: integer anchorStateRoot: type: string + coinbase: + type: string + timestamp: + description: Block parameters + type: integer + type: object + softblocks.TransactionBatch: + properties: batchId: type: integer batchType: $ref: "#/definitions/softblocks.TransactionBatchMarker" blockId: type: integer - coinbase: - type: string + blockParams: + $ref: "#/definitions/softblocks.SoftBlockParams" signature: type: string - timestamp: - description: Block parameters - type: integer transactions: type: string type: object diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 77666ea92b7..7a912c4f848 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -16,14 +16,8 @@ const ( BatchMarkerEOP TransactionBatchMarker = "end_of_preconf" ) -// TransactionBatch represents a soft block group. -type TransactionBatch struct { - BlockID uint64 `json:"blockId"` - ID uint64 `json:"batchId"` - TransactionsList string `json:"transactions"` - BatchMarker TransactionBatchMarker `json:"batchType"` - Signature string `json:"signature"` - +// SoftBlockParams represents the parameters for building a soft block. +type SoftBlockParams struct { // Block parameters Timestamp uint64 `json:"timestamp"` Coinbase string `json:"coinbase"` @@ -33,6 +27,16 @@ type TransactionBatch struct { AnchorStateRoot string `json:"anchorStateRoot"` } +// TransactionBatch represents a soft block group. +type TransactionBatch struct { + BlockID uint64 `json:"blockId"` + ID uint64 `json:"batchId"` + TransactionsList string `json:"transactions"` + BatchMarker TransactionBatchMarker `json:"batchType"` + Signature string `json:"signature"` + BlockParams *SoftBlockParams `json:"blockParams"` +} + // BuildSoftBlockRequestBody represents a request body when handling // soft blocks creation requests. type BuildSoftBlockRequestBody struct { From 9b5afccd783e667a0f20bca99b5ea46567daba9f Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 16:21:52 +0800 Subject: [PATCH 33/71] chore: update some comments --- packages/taiko-client/docs/docs.go | 11 +++++++---- packages/taiko-client/docs/swagger.json | 11 +++++++---- packages/taiko-client/docs/swagger.yaml | 8 +++++--- packages/taiko-client/driver/soft_blocks/api.go | 7 ++++--- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go index c8eb9a905fa..bbefe6bfe55 100644 --- a/packages/taiko-client/docs/docs.go +++ b/packages/taiko-client/docs/docs.go @@ -126,7 +126,7 @@ const docTemplate = `{ "softblocks.RemoveSoftBlocksRequestBody": { "type": "object", "properties": { - "newHead": { + "newLastBlockId": { "type": "integer" } } @@ -134,11 +134,14 @@ const docTemplate = `{ "softblocks.RemoveSoftBlocksResponseBody": { "type": "object", "properties": { - "currentHead": { - "$ref": "#/definitions/types.Header" - }, "headsRemoved": { "type": "integer" + }, + "lastBlockId": { + "type": "integer" + }, + "lastProposedBlockID": { + "type": "integer" } } }, diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json index 4ea04c2eebd..d898f301d0c 100644 --- a/packages/taiko-client/docs/swagger.json +++ b/packages/taiko-client/docs/swagger.json @@ -105,7 +105,7 @@ "softblocks.RemoveSoftBlocksRequestBody": { "type": "object", "properties": { - "newHead": { + "newLastBlockId": { "type": "integer" } } @@ -113,11 +113,14 @@ "softblocks.RemoveSoftBlocksResponseBody": { "type": "object", "properties": { - "currentHead": { - "$ref": "#/definitions/types.Header" - }, "headsRemoved": { "type": "integer" + }, + "lastBlockId": { + "type": "integer" + }, + "lastProposedBlockID": { + "type": "integer" } } }, diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml index b3bd92defcc..47be427728e 100644 --- a/packages/taiko-client/docs/swagger.yaml +++ b/packages/taiko-client/docs/swagger.yaml @@ -13,15 +13,17 @@ definitions: type: object softblocks.RemoveSoftBlocksRequestBody: properties: - newHead: + newLastBlockId: type: integer type: object softblocks.RemoveSoftBlocksResponseBody: properties: - currentHead: - $ref: "#/definitions/types.Header" headsRemoved: type: integer + lastBlockId: + type: integer + lastProposedBlockID: + type: integer type: object softblocks.SoftBlockParams: properties: diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 7a912c4f848..733d3efd7da 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -72,14 +72,15 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { // RemoveSoftBlocksRequestBody represents a request body when resetting the backend // L2 execution engine soft head. type RemoveSoftBlocksRequestBody struct { - NewHead uint64 `json:"newHead"` + NewLastBlockID uint64 `json:"newLastBlockId"` } // RemoveSoftBlocksResponseBody represents a response body when resetting the backend // L2 execution engine soft head. type RemoveSoftBlocksResponseBody struct { - CurrentHead types.Header `json:"currentHead"` - HeadsRemoved uint64 `json:"headsRemoved"` + LastBlockID uint64 `json:"lastBlockId"` + LastProposedBlockID uint64 `json:"lastProposedBlockID"` + HeadsRemoved uint64 `json:"headsRemoved"` } // RemoveSoftBlocks removes the backend L2 execution engine soft head. From 3890e5793eae6b9800e31541479e7d162566e051 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 23 Oct 2024 16:32:49 +0800 Subject: [PATCH 34/71] feat: update json From 5c58198f00802cec23f8a6a1f925c05ef5963982 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 25 Oct 2024 15:38:28 +0800 Subject: [PATCH 35/71] chore: update some comments --- packages/taiko-client/docs/docs.go | 52 +++++++++++++--- packages/taiko-client/docs/swagger.json | 52 +++++++++++++--- packages/taiko-client/docs/swagger.yaml | 56 ++++++++++++++--- .../driver/chain_syncer/blob/syncer.go | 5 ++ .../taiko-client/driver/soft_blocks/api.go | 60 ++++++++++++++----- .../taiko-client/driver/soft_blocks/server.go | 2 + packages/taiko-client/pkg/rpc/methods.go | 6 +- 7 files changed, 192 insertions(+), 41 deletions(-) diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go index bbefe6bfe55..716fc382652 100644 --- a/packages/taiko-client/docs/docs.go +++ b/packages/taiko-client/docs/docs.go @@ -111,7 +111,12 @@ const docTemplate = `{ "type": "object", "properties": { "transactionBatch": { - "$ref": "#/definitions/softblocks.TransactionBatch" + "description": "@param transactionBatch TransactionBatch Transaction batch to be inserted into the soft block", + "allOf": [ + { + "$ref": "#/definitions/softblocks.TransactionBatch" + } + ] } } }, @@ -119,7 +124,12 @@ const docTemplate = `{ "type": "object", "properties": { "blockHeader": { - "$ref": "#/definitions/types.Header" + "description": "@param blockHeader types.Header Header of the soft block", + "allOf": [ + { + "$ref": "#/definitions/types.Header" + } + ] } } }, @@ -127,6 +137,7 @@ const docTemplate = `{ "type": "object", "properties": { "newLastBlockId": { + "description": "@param newLastBlockID uint64 New last block ID of the blockchain, it should\n@param not smaller than the canonical chain's highest block ID.", "type": "integer" } } @@ -135,12 +146,15 @@ const docTemplate = `{ "type": "object", "properties": { "headsRemoved": { + "description": "@param headsRemoved uint64 Number of soft heads removed", "type": "integer" }, "lastBlockId": { + "description": "@param lastBlockID uint64 Current highest block ID of the blockchain (including soft blocks)", "type": "integer" }, "lastProposedBlockID": { + "description": "@param lastProposedBlockID uint64 Highest block ID of the cnonical chain", "type": "integer" } } @@ -149,17 +163,22 @@ const docTemplate = `{ "type": "object", "properties": { "anchorBlockID": { - "description": "AnchorV2 parameters", + "description": "@param anchorBlockID uint64 ` + "`" + `_anchorBlockId` + "`" + ` parameter of the ` + "`" + `anchorV2` + "`" + ` transaction in soft block", "type": "integer" }, "anchorStateRoot": { - "type": "string" + "description": "@param anchorStateRoot string ` + "`" + `_anchorStateRoot` + "`" + ` parameter of the ` + "`" + `anchorV2` + "`" + ` transaction in soft block", + "type": "array", + "items": { + "type": "integer" + } }, "coinbase": { + "description": "@param coinbase uint64 Coinbase of the soft block", "type": "string" }, "timestamp": { - "description": "Block parameters", + "description": "@param timestamp uint64 Timestamp of the soft block", "type": "integer" } } @@ -168,22 +187,39 @@ const docTemplate = `{ "type": "object", "properties": { "batchId": { + "description": "@param batchId uint64 ID of this transaction batch", "type": "integer" }, "batchType": { - "$ref": "#/definitions/softblocks.TransactionBatchMarker" + "description": "@param batchType TransactionBatchMarker Marker of the transaction batch,\n@param either ` + "`" + `end_of_block` + "`" + `, ` + "`" + `end_of_preconf` + "`" + ` or empty", + "allOf": [ + { + "$ref": "#/definitions/softblocks.TransactionBatchMarker" + } + ] }, "blockId": { + "description": "@param blockId uint64 Block ID of the soft block", "type": "integer" }, "blockParams": { - "$ref": "#/definitions/softblocks.SoftBlockParams" + "description": "@param blockParams SoftBlockParams Block parameters of the soft block", + "allOf": [ + { + "$ref": "#/definitions/softblocks.SoftBlockParams" + } + ] }, "signature": { + "description": "@param signature string Signature of this transaction batch", "type": "string" }, "transactions": { - "type": "string" + "description": "@param transactions string zlib compressed RLP encoded bytes of a transactions list", + "type": "array", + "items": { + "type": "integer" + } } } }, diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json index d898f301d0c..078524beb0b 100644 --- a/packages/taiko-client/docs/swagger.json +++ b/packages/taiko-client/docs/swagger.json @@ -90,7 +90,12 @@ "type": "object", "properties": { "transactionBatch": { - "$ref": "#/definitions/softblocks.TransactionBatch" + "description": "@param transactionBatch TransactionBatch Transaction batch to be inserted into the soft block", + "allOf": [ + { + "$ref": "#/definitions/softblocks.TransactionBatch" + } + ] } } }, @@ -98,7 +103,12 @@ "type": "object", "properties": { "blockHeader": { - "$ref": "#/definitions/types.Header" + "description": "@param blockHeader types.Header Header of the soft block", + "allOf": [ + { + "$ref": "#/definitions/types.Header" + } + ] } } }, @@ -106,6 +116,7 @@ "type": "object", "properties": { "newLastBlockId": { + "description": "@param newLastBlockID uint64 New last block ID of the blockchain, it should\n@param not smaller than the canonical chain's highest block ID.", "type": "integer" } } @@ -114,12 +125,15 @@ "type": "object", "properties": { "headsRemoved": { + "description": "@param headsRemoved uint64 Number of soft heads removed", "type": "integer" }, "lastBlockId": { + "description": "@param lastBlockID uint64 Current highest block ID of the blockchain (including soft blocks)", "type": "integer" }, "lastProposedBlockID": { + "description": "@param lastProposedBlockID uint64 Highest block ID of the cnonical chain", "type": "integer" } } @@ -128,17 +142,22 @@ "type": "object", "properties": { "anchorBlockID": { - "description": "AnchorV2 parameters", + "description": "@param anchorBlockID uint64 `_anchorBlockId` parameter of the `anchorV2` transaction in soft block", "type": "integer" }, "anchorStateRoot": { - "type": "string" + "description": "@param anchorStateRoot string `_anchorStateRoot` parameter of the `anchorV2` transaction in soft block", + "type": "array", + "items": { + "type": "integer" + } }, "coinbase": { + "description": "@param coinbase uint64 Coinbase of the soft block", "type": "string" }, "timestamp": { - "description": "Block parameters", + "description": "@param timestamp uint64 Timestamp of the soft block", "type": "integer" } } @@ -147,22 +166,39 @@ "type": "object", "properties": { "batchId": { + "description": "@param batchId uint64 ID of this transaction batch", "type": "integer" }, "batchType": { - "$ref": "#/definitions/softblocks.TransactionBatchMarker" + "description": "@param batchType TransactionBatchMarker Marker of the transaction batch,\n@param either `end_of_block`, `end_of_preconf` or empty", + "allOf": [ + { + "$ref": "#/definitions/softblocks.TransactionBatchMarker" + } + ] }, "blockId": { + "description": "@param blockId uint64 Block ID of the soft block", "type": "integer" }, "blockParams": { - "$ref": "#/definitions/softblocks.SoftBlockParams" + "description": "@param blockParams SoftBlockParams Block parameters of the soft block", + "allOf": [ + { + "$ref": "#/definitions/softblocks.SoftBlockParams" + } + ] }, "signature": { + "description": "@param signature string Signature of this transaction batch", "type": "string" }, "transactions": { - "type": "string" + "description": "@param transactions string zlib compressed RLP encoded bytes of a transactions list", + "type": "array", + "items": { + "type": "integer" + } } } }, diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml index 47be427728e..fa62613b65a 100644 --- a/packages/taiko-client/docs/swagger.yaml +++ b/packages/taiko-client/docs/swagger.yaml @@ -4,54 +4,94 @@ definitions: softblocks.BuildSoftBlockRequestBody: properties: transactionBatch: - $ref: "#/definitions/softblocks.TransactionBatch" + allOf: + - $ref: "#/definitions/softblocks.TransactionBatch" + description: + "@param transactionBatch TransactionBatch Transaction batch to + be inserted into the soft block" type: object softblocks.BuildSoftBlockResponseBody: properties: blockHeader: - $ref: "#/definitions/types.Header" + allOf: + - $ref: "#/definitions/types.Header" + description: "@param blockHeader types.Header Header of the soft block" type: object softblocks.RemoveSoftBlocksRequestBody: properties: newLastBlockId: + description: |- + @param newLastBlockID uint64 New last block ID of the blockchain, it should + @param not smaller than the canonical chain's highest block ID. type: integer type: object softblocks.RemoveSoftBlocksResponseBody: properties: headsRemoved: + description: "@param headsRemoved uint64 Number of soft heads removed" type: integer lastBlockId: + description: + "@param lastBlockID uint64 Current highest block ID of the blockchain + (including soft blocks)" type: integer lastProposedBlockID: + description: + "@param lastProposedBlockID uint64 Highest block ID of the cnonical + chain" type: integer type: object softblocks.SoftBlockParams: properties: anchorBlockID: - description: AnchorV2 parameters + description: + "@param anchorBlockID uint64 `_anchorBlockId` parameter of the + `anchorV2` transaction in soft block" type: integer anchorStateRoot: - type: string + description: + "@param anchorStateRoot string `_anchorStateRoot` parameter of + the `anchorV2` transaction in soft block" + items: + type: integer + type: array coinbase: + description: "@param coinbase uint64 Coinbase of the soft block" type: string timestamp: - description: Block parameters + description: "@param timestamp uint64 Timestamp of the soft block" type: integer type: object softblocks.TransactionBatch: properties: batchId: + description: "@param batchId uint64 ID of this transaction batch" type: integer batchType: - $ref: "#/definitions/softblocks.TransactionBatchMarker" + allOf: + - $ref: "#/definitions/softblocks.TransactionBatchMarker" + description: |- + @param batchType TransactionBatchMarker Marker of the transaction batch, + @param either `end_of_block`, `end_of_preconf` or empty blockId: + description: "@param blockId uint64 Block ID of the soft block" type: integer blockParams: - $ref: "#/definitions/softblocks.SoftBlockParams" + allOf: + - $ref: "#/definitions/softblocks.SoftBlockParams" + description: + "@param blockParams SoftBlockParams Block parameters of the soft + block" signature: + description: "@param signature string Signature of this transaction batch" type: string transactions: - type: string + description: + "@param transactions string zlib compressed RLP encoded bytes + of a transactions list" + items: + type: integer + type: array type: object softblocks.TransactionBatchMarker: enum: diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index 53a49961a0b..4acd8e6b7fb 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -106,6 +106,11 @@ func (s *Syncer) ProcessL1Blocks(ctx context.Context) error { } } +// InsertSoftBlock inserts a soft block into the L2 execution engine's blockchain. +func (s *Syncer) InsertSoftBlock(ctx context.Context) (*types.Header, error) { + return nil, nil +} + // processL1Blocks is the inner method which responsible for processing // all new L1 blocks. func (s *Syncer) processL1Blocks(ctx context.Context) error { diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 733d3efd7da..b1ed43653a6 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -3,6 +3,7 @@ package softblocks import ( "net/http" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/labstack/echo/v4" ) @@ -18,34 +19,45 @@ const ( // SoftBlockParams represents the parameters for building a soft block. type SoftBlockParams struct { - // Block parameters + // @param timestamp uint64 Timestamp of the soft block Timestamp uint64 `json:"timestamp"` - Coinbase string `json:"coinbase"` + // @param coinbase uint64 Coinbase of the soft block + Coinbase string `json:"coinbase"` - // AnchorV2 parameters - AnchorBlockID uint64 `json:"anchorBlockID"` - AnchorStateRoot string `json:"anchorStateRoot"` + // @param anchorBlockID uint64 `_anchorBlockId` parameter of the `anchorV2` transaction in soft block + AnchorBlockID uint64 `json:"anchorBlockID"` + // @param anchorStateRoot string `_anchorStateRoot` parameter of the `anchorV2` transaction in soft block + AnchorStateRoot common.Hash `json:"anchorStateRoot"` } // TransactionBatch represents a soft block group. type TransactionBatch struct { - BlockID uint64 `json:"blockId"` - ID uint64 `json:"batchId"` - TransactionsList string `json:"transactions"` - BatchMarker TransactionBatchMarker `json:"batchType"` - Signature string `json:"signature"` - BlockParams *SoftBlockParams `json:"blockParams"` + // @param blockId uint64 Block ID of the soft block + BlockID uint64 `json:"blockId"` + // @param batchId uint64 ID of this transaction batch + ID uint64 `json:"batchId"` + // @param transactions string zlib compressed RLP encoded bytes of a transactions list + TransactionsList []byte `json:"transactions"` + // @param batchType TransactionBatchMarker Marker of the transaction batch, + // @param either `end_of_block`, `end_of_preconf` or empty + BatchMarker TransactionBatchMarker `json:"batchType"` + // @param signature string Signature of this transaction batch + Signature string `json:"signature"` + // @param blockParams SoftBlockParams Block parameters of the soft block + BlockParams *SoftBlockParams `json:"blockParams"` } // BuildSoftBlockRequestBody represents a request body when handling // soft blocks creation requests. type BuildSoftBlockRequestBody struct { + // @param transactionBatch TransactionBatch Transaction batch to be inserted into the soft block TransactionBatch TransactionBatch `json:"transactionBatch"` } // CreateOrUpdateBlocksFromBatchResponseBody represents a response body when handling soft // blocks creation requests. type BuildSoftBlockResponseBody struct { + // @param blockHeader types.Header Header of the soft block BlockHeader types.Header `json:"blockHeader"` } @@ -66,21 +78,41 @@ type BuildSoftBlockResponseBody struct { // @Success 200 {object} BuildSoftBlockResponseBody // @Router /softBlocks [post] func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { - return c.NoContent(http.StatusOK) + // Check if the L2 execution engine is syncing from L1. + progress, err := s.rpc.L2ExecutionEngineSyncProgress(c.Request().Context()) + if err != nil { + return err + } + if progress.IsSyncing() { + return c.JSON(http.StatusBadRequest, map[string]string{"error": "L2 execution engine is syncing"}) + } + + // Insert the soft block. + header, err := s.chainSyncer.BlobSyncer().InsertSoftBlock(c.Request().Context()) + if err != nil { + return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()}) + } + + return c.JSON(http.StatusOK, BuildSoftBlockResponseBody{BlockHeader: *header}) } // RemoveSoftBlocksRequestBody represents a request body when resetting the backend // L2 execution engine soft head. type RemoveSoftBlocksRequestBody struct { + // @param newLastBlockID uint64 New last block ID of the blockchain, it should + // @param not smaller than the canonical chain's highest block ID. NewLastBlockID uint64 `json:"newLastBlockId"` } // RemoveSoftBlocksResponseBody represents a response body when resetting the backend // L2 execution engine soft head. type RemoveSoftBlocksResponseBody struct { - LastBlockID uint64 `json:"lastBlockId"` + // @param lastBlockID uint64 Current highest block ID of the blockchain (including soft blocks) + LastBlockID uint64 `json:"lastBlockId"` + // @param lastProposedBlockID uint64 Highest block ID of the cnonical chain LastProposedBlockID uint64 `json:"lastProposedBlockID"` - HeadsRemoved uint64 `json:"headsRemoved"` + // @param headsRemoved uint64 Number of soft heads removed + HeadsRemoved uint64 `json:"headsRemoved"` } // RemoveSoftBlocks removes the backend L2 execution engine soft head. diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index e8aebfbf367..1cb620b0729 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -8,6 +8,7 @@ import ( "github.com/labstack/echo/v4/middleware" chainSyncer "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" ) // @title Taiko Soft Block Server API @@ -24,6 +25,7 @@ import ( type SoftBlockAPIServer struct { echo *echo.Echo chainSyncer *chainSyncer.L2ChainSyncer + rpc *rpc.Client } // New creates a new soft blcok server instance. diff --git a/packages/taiko-client/pkg/rpc/methods.go b/packages/taiko-client/pkg/rpc/methods.go index 7a747c419e6..5139735719c 100644 --- a/packages/taiko-client/pkg/rpc/methods.go +++ b/packages/taiko-client/pkg/rpc/methods.go @@ -114,7 +114,7 @@ func (c *Client) WaitTillL2ExecutionEngineSynced(ctx context.Context) error { return err } - if progress.isSyncing() { + if progress.IsSyncing() { log.Info( "L2 execution engine is syncing", "currentBlockID", progress.CurrentBlockID, @@ -430,8 +430,8 @@ type L2SyncProgress struct { HighestBlockID *big.Int } -// isSyncing returns true if the L2 execution engine is syncing with L1. -func (p *L2SyncProgress) isSyncing() bool { +// IsSyncing returns true if the L2 execution engine is syncing with L1. +func (p *L2SyncProgress) IsSyncing() bool { if p.SyncProgress == nil { return false } From 6b41652fc02b7f1fd92788982fde6d4e522a575e Mon Sep 17 00:00:00 2001 From: David Date: Mon, 28 Oct 2024 14:39:36 +0800 Subject: [PATCH 36/71] feat: draft implementation of `InsertSoftBlockFromTransactionsBatch` --- .../taiko-client/bindings/encoding/input.go | 13 ++ .../bindings/encoding/protocol_config.go | 11 ++ .../driver/chain_syncer/blob/syncer.go | 185 +++++++++++++++++- .../taiko-client/driver/soft_blocks/api.go | 107 +++++++++- .../taiko-client/driver/soft_blocks/server.go | 16 +- 5 files changed, 318 insertions(+), 14 deletions(-) diff --git a/packages/taiko-client/bindings/encoding/input.go b/packages/taiko-client/bindings/encoding/input.go index 8cfc0e8811a..809df8d537b 100644 --- a/packages/taiko-client/bindings/encoding/input.go +++ b/packages/taiko-client/bindings/encoding/input.go @@ -294,6 +294,9 @@ var ( {Name: "TaikoData.Transition", Type: transitionComponentsType}, {Name: "TaikoData.TierProof", Type: tierProofComponentsType}, } + stringType, _ = abi.NewType("string", "TAIKO_DIFFICULTY", nil) + uint64Type, _ = abi.NewType("uint64", "local.b.numBlocks", nil) + difficultyCalculationInputArgs = abi.Arguments{{Type: stringType}, {Type: uint64Type}} ) // Contract ABIs. @@ -423,6 +426,16 @@ func EncodeProveBlockInput( return b, nil } +// EncodeDifficultCalcutionParams performs the solidity `abi.encode` for the +// `block.difficulty` hash payload. +func EncodeDifficultyCalcutionParams(numBlocks uint64) ([]byte, error) { + b, err := difficultyCalculationInputArgs.Pack("TAIKO_DIFFICULTY", numBlocks) + if err != nil { + return nil, fmt.Errorf("failed to abi.encode `block.difficulty` hash payload, %w", err) + } + return b, nil +} + // UnpackTxListBytes unpacks the input data of a TaikoL1.proposeBlock transaction, and returns the txList bytes. func UnpackTxListBytes(txData []byte) ([]byte, error) { method, err := TaikoL1ABI.MethodById(txData) diff --git a/packages/taiko-client/bindings/encoding/protocol_config.go b/packages/taiko-client/bindings/encoding/protocol_config.go index 27d0c4684ba..256bd088e31 100644 --- a/packages/taiko-client/bindings/encoding/protocol_config.go +++ b/packages/taiko-client/bindings/encoding/protocol_config.go @@ -58,6 +58,7 @@ var ( OntakeForkHeight: 538_304, BaseFeeConfig: bindings.LibSharedDataBaseFeeConfig{ AdjustmentQuotient: 8, + SharingPctg: 75, GasIssuancePerSecond: 5_000_000, MinGasExcess: 1_340_000_000, MaxGasIssuancePerBlock: 600_000_000, @@ -76,3 +77,13 @@ func GetProtocolConfig(chainID uint64) *bindings.TaikoDataConfig { return InternlDevnetProtocolConfig } } + +// EncodeBaseFeeConfig encodes the block.extraData field from the given base fee config. +func EncodeBaseFeeConfig(baseFeeConfig *bindings.LibSharedDataBaseFeeConfig) [32]byte { + var ( + bytes32Value [32]byte + uintValue = new(big.Int).SetUint64(uint64(baseFeeConfig.SharingPctg)) + ) + copy(bytes32Value[32-len(uintValue.Bytes()):], uintValue.Bytes()) + return bytes32Value +} diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index 4acd8e6b7fb..f6d37dc9318 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -17,6 +17,7 @@ import ( consensus "github.com/ethereum/go-ethereum/consensus/taiko" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" @@ -106,11 +107,6 @@ func (s *Syncer) ProcessL1Blocks(ctx context.Context) error { } } -// InsertSoftBlock inserts a soft block into the L2 execution engine's blockchain. -func (s *Syncer) InsertSoftBlock(ctx context.Context) (*types.Header, error) { - return nil, nil -} - // processL1Blocks is the inner method which responsible for processing // all new L1 blocks. func (s *Syncer) processL1Blocks(ctx context.Context) error { @@ -492,7 +488,7 @@ func (s *Syncer) createExecutionPayloads( "timestamp", attributes.BlockMetadata.Timestamp, "mixHash", attributes.BlockMetadata.MixHash, "baseFee", utils.WeiToGWei(attributes.BaseFeePerGas), - "extraData", string(attributes.BlockMetadata.ExtraData), + "extraData", common.Bytes2Hex(attributes.BlockMetadata.ExtraData), "l1OriginHeight", attributes.L1Origin.L1BlockHeight, "l1OriginHash", attributes.L1Origin.L1BlockHash, ) @@ -693,3 +689,180 @@ func (s *Syncer) checkReorg( return reorgCheckResult, nil } + +// InsertSoftBlockFromTransactionsBatch inserts a soft block into the L2 execution engine's blockchain +// from the given transactions batch. +func (s *Syncer) InsertSoftBlockFromTransactionsBatch( + // Transactions batch parameters + ctx context.Context, + blockID uint64, + batchID uint64, // TODO(DavidCai): verify batch ID + txListBytes []byte, + batchMarker string, // TODO(DavidCai): handle batch marker + // Block parameters + timestamp uint64, + coinbase common.Address, + // Anchor parameters + anchorBlockID uint64, + anchorStateRoot common.Hash, +) (*types.Header, error) { + parent, err := s.rpc.L2.HeaderByNumber(ctx, new(big.Int).Sub(new(big.Int).SetUint64(blockID), common.Big1)) + if err != nil { + return nil, err + } + + if parent.Number.Uint64()+1 != blockID { + return nil, fmt.Errorf("parent block number (%d) is not equal to blockID - 1 (%d)", parent.Number.Uint64(), blockID) + } + + // Calculate the other block parameters + difficultyHashPaylaod, err := encoding.EncodeDifficultyCalcutionParams(blockID) + if err != nil { + return nil, fmt.Errorf("failed to encode `block.difficulty` calculation parameters: %w", err) + } + + var ( + txList []*types.Transaction + fc = &engine.ForkchoiceStateV1{HeadBlockHash: parent.Hash()} + difficulty = crypto.Keccak256Hash(difficultyHashPaylaod) + protocolConfig = encoding.GetProtocolConfig(s.rpc.L2.ChainID.Uint64()) + extraData = encoding.EncodeBaseFeeConfig(&protocolConfig.BaseFeeConfig) + ) + + if err := rlp.DecodeBytes(txListBytes, &txList); err != nil { + return nil, fmt.Errorf("failed to RLP decode txList bytes: %w", err) + } + + baseFee, err := s.rpc.CalculateBaseFee( + ctx, + parent, + new(big.Int).SetUint64(anchorBlockID), + true, + &protocolConfig.BaseFeeConfig, + timestamp, + ) + if err != nil { + return nil, fmt.Errorf("failed to calculate base fee: %w", err) + } + + // Insert the anchor transaction at the head of the transactions list. + if batchID == 0 { + // Assemble a TaikoL2.anchorV2 transaction. + anchorTx, err := s.anchorConstructor.AssembleAnchorV2Tx( + ctx, + new(big.Int).SetUint64(anchorBlockID), + anchorStateRoot, + parent.GasUsed, + &protocolConfig.BaseFeeConfig, + new(big.Int).SetUint64(blockID), + baseFee, + ) + if err != nil { + return nil, fmt.Errorf("failed to create TaikoL2.anchorV2 transaction: %w", err) + } + + txList = append([]*types.Transaction{anchorTx}, txList...) + if txListBytes, err = rlp.EncodeToBytes(txList); err != nil { + log.Error("Encode txList error", "blockID", blockID, "error", err) + return nil, err + } + } else { + prevSoftBlock, err := s.rpc.L2.BlockByNumber(ctx, new(big.Int).SetUint64(blockID-1)) + if err != nil { + return nil, fmt.Errorf("failed to fetch previous soft block (%d): %w", blockID, err) + } + txList = append(prevSoftBlock.Transactions(), txList...) + } + + attributes := &engine.PayloadAttributes{ + Timestamp: timestamp, + Random: difficulty, + SuggestedFeeRecipient: coinbase, + Withdrawals: []*types.Withdrawal{}, + BlockMetadata: &engine.BlockMetadata{ + Beneficiary: coinbase, + GasLimit: uint64(protocolConfig.BlockMaxGasLimit) + consensus.AnchorGasLimit, + Timestamp: timestamp, + TxList: txListBytes, + MixHash: difficulty, + ExtraData: extraData[:], + }, + BaseFeePerGas: baseFee, + L1Origin: nil, // TODO(DavidCai): check L1 origin + } + + log.Info( + "Soft block payloadAttributes", + "blockID", blockID, + "timestamp", attributes.Timestamp, + "random", attributes.Random, + "suggestedFeeRecipient", attributes.SuggestedFeeRecipient, + "withdrawals", len(attributes.Withdrawals), + "gasLimit", attributes.BlockMetadata.GasLimit, + "timestamp", attributes.BlockMetadata.Timestamp, + "mixHash", attributes.BlockMetadata.MixHash, + "baseFee", utils.WeiToGWei(attributes.BaseFeePerGas), + "extraData", common.Bytes2Hex(attributes.BlockMetadata.ExtraData), + ) + + // Step 1, prepare a payload + fcRes, err := s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, attributes) + if err != nil { + return nil, fmt.Errorf("failed to update fork choice: %w", err) + } + if fcRes.PayloadStatus.Status != engine.VALID { + return nil, fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) + } + if fcRes.PayloadID == nil { + return nil, errors.New("empty payload ID") + } + + // Step 2, get the payload + payload, err := s.rpc.L2Engine.GetPayload(ctx, fcRes.PayloadID) + if err != nil { + return nil, fmt.Errorf("failed to get payload: %w", err) + } + + log.Info( + "Soft block payload", + "blockID", blockID, + "baseFee", utils.WeiToGWei(payload.BaseFeePerGas), + "number", payload.Number, + "hash", payload.BlockHash, + "gasLimit", payload.GasLimit, + "gasUsed", payload.GasUsed, + "timestamp", payload.Timestamp, + "withdrawalsHash", payload.WithdrawalsHash, + ) + + // Step 3, execute the payload + execStatus, err := s.rpc.L2Engine.NewPayload(ctx, payload) + if err != nil { + return nil, fmt.Errorf("failed to create a new payload: %w", err) + } + if execStatus.Status != engine.VALID { + return nil, fmt.Errorf("unexpected NewPayload response status: %s", execStatus.Status) + } + + lastVerifiedBlockHash, err := s.rpc.GetLastVerifiedBlockHash(ctx) + if err != nil { + return nil, fmt.Errorf("failed to fetch last verified block hash: %w", err) + } + + fc = &engine.ForkchoiceStateV1{ + HeadBlockHash: payload.BlockHash, + SafeBlockHash: payload.BlockHash, // TODO(DavidCai): use last canonical block hash. + FinalizedBlockHash: lastVerifiedBlockHash, + } + + // Update the fork choice + fcRes, err = s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, nil) + if err != nil { + return nil, err + } + if fcRes.PayloadStatus.Status != engine.VALID { + return nil, fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) + } + + return s.rpc.L2.HeaderByHash(ctx, payload.BlockHash) +} diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index b1ed43653a6..f4fc4bfa270 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -1,10 +1,15 @@ package softblocks import ( + "math/big" "net/http" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rlp" "github.com/labstack/echo/v4" ) @@ -21,8 +26,8 @@ const ( type SoftBlockParams struct { // @param timestamp uint64 Timestamp of the soft block Timestamp uint64 `json:"timestamp"` - // @param coinbase uint64 Coinbase of the soft block - Coinbase string `json:"coinbase"` + // @param coinbase string Coinbase of the soft block + Coinbase common.Address `json:"coinbase"` // @param anchorBlockID uint64 `_anchorBlockId` parameter of the `anchorV2` transaction in soft block AnchorBlockID uint64 `json:"anchorBlockID"` @@ -47,6 +52,26 @@ type TransactionBatch struct { BlockParams *SoftBlockParams `json:"blockParams"` } +// ValidateSignature validates the signature of the transaction batch. +func (b *TransactionBatch) ValidateSignature() (bool, error) { + batchWithoutSig := *b + batchWithoutSig.Signature = "" + + payload, err := rlp.EncodeToBytes(batchWithoutSig) + if err != nil { + return false, err + } + + log.Debug("Validating signature", "payload", payload, "signature", b.Signature) + + pubKey, err := crypto.SigToPub(payload, common.FromHex(b.Signature)) + if err != nil { + return false, err + } + + return crypto.PubkeyToAddress(*pubKey).Hex() == b.BlockParams.Coinbase.Hex(), nil +} + // BuildSoftBlockRequestBody represents a request body when handling // soft blocks creation requests. type BuildSoftBlockRequestBody struct { @@ -78,17 +103,91 @@ type BuildSoftBlockResponseBody struct { // @Success 200 {object} BuildSoftBlockResponseBody // @Router /softBlocks [post] func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { + // Parse the request body. + reqBody := new(BuildSoftBlockRequestBody) + if err := c.Bind(reqBody); err != nil { + return c.JSON(http.StatusUnprocessableEntity, map[string]string{"error": err.Error()}) + } + + log.Info( + "New soft block building request", + "blockID", reqBody.TransactionBatch.BlockID, + "batchID", reqBody.TransactionBatch.ID, + "batchMarker", reqBody.TransactionBatch.BatchMarker, + "transactionsListBytes", len(reqBody.TransactionBatch.TransactionsList), + "signature", reqBody.TransactionBatch.Signature, + "timestamp", reqBody.TransactionBatch.BlockParams.Timestamp, + "coinbase", reqBody.TransactionBatch.BlockParams.Coinbase, + "anchorBlockID", reqBody.TransactionBatch.BlockParams.AnchorBlockID, + "anchorStateRoot", reqBody.TransactionBatch.BlockParams.AnchorStateRoot, + ) + + // Request body validation. + if reqBody.TransactionBatch.BlockParams == nil { + return c.JSON(http.StatusBadRequest, map[string]string{"error": "blockParams is required"}) + } + if reqBody.TransactionBatch.BlockParams.AnchorBlockID == 0 { + return c.JSON(http.StatusBadRequest, map[string]string{"error": "non-zero anchorBlockID is required"}) + } + if reqBody.TransactionBatch.BlockParams.AnchorStateRoot == (common.Hash{}) { + return c.JSON(http.StatusBadRequest, map[string]string{"error": "empty anchorStateRoot"}) + } + if reqBody.TransactionBatch.BlockParams.Timestamp == 0 { + return c.JSON(http.StatusBadRequest, map[string]string{"error": "non-zero timestamp is required"}) + } + if reqBody.TransactionBatch.BlockParams.Coinbase == (common.Address{}) { + return c.JSON(http.StatusBadRequest, map[string]string{"error": "empty coinbase"}) + } + + ok, err := reqBody.TransactionBatch.ValidateSignature() + if err != nil { + return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + } + if !ok { + log.Warn( + "Invalid signature", + "signature", reqBody.TransactionBatch.Signature, + "coinbase", reqBody.TransactionBatch.BlockParams.Coinbase.Hex(), + ) + return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid signature"}) + } + // Check if the L2 execution engine is syncing from L1. progress, err := s.rpc.L2ExecutionEngineSyncProgress(c.Request().Context()) if err != nil { - return err + return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) } if progress.IsSyncing() { return c.JSON(http.StatusBadRequest, map[string]string{"error": "L2 execution engine is syncing"}) } + var txListBytes []byte + if s.rpc.L2.ChainID.Cmp(params.HeklaNetworkID) == 0 { + txListBytes = s.txListDecompressor.TryDecompressHekla( + new(big.Int).SetUint64(reqBody.TransactionBatch.BlockID), + reqBody.TransactionBatch.TransactionsList, + true, + ) + } else { + txListBytes = s.txListDecompressor.TryDecompress( + new(big.Int).SetUint64(reqBody.TransactionBatch.BlockID), + reqBody.TransactionBatch.TransactionsList, + true, + ) + } + // Insert the soft block. - header, err := s.chainSyncer.BlobSyncer().InsertSoftBlock(c.Request().Context()) + header, err := s.chainSyncer.BlobSyncer().InsertSoftBlockFromTransactionsBatch( + c.Request().Context(), + reqBody.TransactionBatch.BlockID, + reqBody.TransactionBatch.ID, + txListBytes, + string(reqBody.TransactionBatch.BatchMarker), + reqBody.TransactionBatch.BlockParams.Timestamp, + reqBody.TransactionBatch.BlockParams.Coinbase, + reqBody.TransactionBatch.BlockParams.AnchorBlockID, + reqBody.TransactionBatch.BlockParams.AnchorStateRoot, + ) if err != nil { return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()}) } diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index 1cb620b0729..f4211604daa 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -7,7 +7,9 @@ import ( "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" chainSyncer "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer" + txListDecompressor "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/txlist_decompressor" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" ) @@ -23,16 +25,22 @@ import ( // @license.url https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md // SoftBlockAPIServer represents a soft blcok server instance. type SoftBlockAPIServer struct { - echo *echo.Echo - chainSyncer *chainSyncer.L2ChainSyncer - rpc *rpc.Client + echo *echo.Echo + chainSyncer *chainSyncer.L2ChainSyncer + rpc *rpc.Client + txListDecompressor *txListDecompressor.TxListDecompressor } // New creates a new soft blcok server instance. -func New(chainSyncer *chainSyncer.L2ChainSyncer) (*SoftBlockAPIServer, error) { +func New(chainSyncer *chainSyncer.L2ChainSyncer, cli *rpc.Client) (*SoftBlockAPIServer, error) { server := &SoftBlockAPIServer{ echo: echo.New(), chainSyncer: chainSyncer, + txListDecompressor: txListDecompressor.NewTxListDecompressor( + uint64(encoding.GetProtocolConfig(cli.L2.ChainID.Uint64()).BlockMaxGasLimit), + rpc.BlockMaxTxListBytes, + cli.L2.ChainID, + ), } server.echo.HideBanner = true From 8e02ca868a147bdaeae86914af55766aefb2b519 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 28 Oct 2024 14:44:58 +0800 Subject: [PATCH 37/71] feat: use `canonicalHead` as safe head --- packages/taiko-client/driver/chain_syncer/blob/syncer.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index f6d37dc9318..1a02f993a98 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -432,7 +432,7 @@ func (s *Syncer) insertNewHead( fc := &engine.ForkchoiceStateV1{ HeadBlockHash: payload.BlockHash, - SafeBlockHash: lastVerifiedBlockHash, + SafeBlockHash: payload.BlockHash, FinalizedBlockHash: lastVerifiedBlockHash, } @@ -849,9 +849,14 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( return nil, fmt.Errorf("failed to fetch last verified block hash: %w", err) } + canonicalHead, err := s.rpc.L2.HeadL1Origin(ctx) + if err != nil { + return nil, fmt.Errorf("failed to fetch canonical head: %w", err) + } + fc = &engine.ForkchoiceStateV1{ HeadBlockHash: payload.BlockHash, - SafeBlockHash: payload.BlockHash, // TODO(DavidCai): use last canonical block hash. + SafeBlockHash: canonicalHead.L2BlockHash, FinalizedBlockHash: lastVerifiedBlockHash, } From e90e200e328774b7d176ab0e1d2058a82adbc6ff Mon Sep 17 00:00:00 2001 From: David Date: Mon, 28 Oct 2024 15:31:05 +0800 Subject: [PATCH 38/71] chore: update go.mod --- go.mod | 2 +- go.sum | 4 ++-- packages/taiko-client/driver/chain_syncer/blob/syncer.go | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 18278b0178d..08e6477b378 100644 --- a/go.mod +++ b/go.mod @@ -237,7 +237,7 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -replace github.com/ethereum/go-ethereum v1.14.11 => github.com/taikoxyz/taiko-geth v1.11.1 +replace github.com/ethereum/go-ethereum v1.14.11 => github.com/taikoxyz/taiko-geth v1.11.2-0.20241028072634-028fdd21d620 replace github.com/ethereum-optimism/optimism v1.7.4 => github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39 diff --git a/go.sum b/go.sum index 1f9735aaf31..c9d5798cf58 100644 --- a/go.sum +++ b/go.sum @@ -605,8 +605,8 @@ github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082 h1:ymZR+Y88LOnA8i3Ke github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082/go.mod h1:RHnIu3EFehrWX3JhFAMQSXD5uz7l0xaNroTzXrap7EQ= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39 h1:JssMxaDmORjQ9RPZNulVJhAD8zSPd6LZFq5wsr6Nwz8= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39/go.mod h1:ym7scR7ZHvEmwx1DLGVDzFlAdR+uhP1+Z4XCiFuSD5s= -github.com/taikoxyz/taiko-geth v1.11.1 h1:pur1WP6YJkwKhLVeN3Zf7dOwbPq6tS88gYod6QKlJc4= -github.com/taikoxyz/taiko-geth v1.11.1/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241028072634-028fdd21d620 h1:kLba9l42fc0q3ofwnkcFJv0nNKMc5Cy6i1Oa7jIGK+I= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241028072634-028fdd21d620/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= github.com/testcontainers/testcontainers-go v0.30.0 h1:jmn/XS22q4YRrcMwWg0pAwlClzs/abopbsBzrepyc4E= github.com/testcontainers/testcontainers-go v0.30.0/go.mod h1:K+kHNGiM5zjklKjgTtcrEetF3uhWbMUyqAQoyoh8Pf0= github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e h1:cR8/SYRgyQCt5cNCMniB/ZScMkhI9nk8U5C7SbISXjo= diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index 1a02f993a98..146affdf63d 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -854,13 +854,12 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( return nil, fmt.Errorf("failed to fetch canonical head: %w", err) } + // Step 4, update the fork choice fc = &engine.ForkchoiceStateV1{ HeadBlockHash: payload.BlockHash, SafeBlockHash: canonicalHead.L2BlockHash, FinalizedBlockHash: lastVerifiedBlockHash, } - - // Update the fork choice fcRes, err = s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, nil) if err != nil { return nil, err From 7b51a3b09b8958e3cd896db31a5e173233561990 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 28 Oct 2024 16:01:38 +0800 Subject: [PATCH 39/71] feat: upload new L1Origin --- .../driver/chain_syncer/blob/syncer.go | 63 ++++++++++++------- .../taiko-client/driver/soft_blocks/api.go | 14 ++--- .../taiko-client/driver/soft_blocks/server.go | 20 +++++- 3 files changed, 65 insertions(+), 32 deletions(-) diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index 146affdf63d..b1511af299d 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -25,6 +25,7 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/metadata" "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer/beaconsync" + softblocks "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/soft_blocks" "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/state" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/metrics" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/utils" @@ -696,15 +697,10 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( // Transactions batch parameters ctx context.Context, blockID uint64, - batchID uint64, // TODO(DavidCai): verify batch ID + batchID uint64, txListBytes []byte, - batchMarker string, // TODO(DavidCai): handle batch marker - // Block parameters - timestamp uint64, - coinbase common.Address, - // Anchor parameters - anchorBlockID uint64, - anchorStateRoot common.Hash, + batchMarker softblocks.TransactionBatchMarker, + blockParams softblocks.SoftBlockParams, ) (*types.Header, error) { parent, err := s.rpc.L2.HeaderByNumber(ctx, new(big.Int).Sub(new(big.Int).SetUint64(blockID), common.Big1)) if err != nil { @@ -736,10 +732,10 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( baseFee, err := s.rpc.CalculateBaseFee( ctx, parent, - new(big.Int).SetUint64(anchorBlockID), + new(big.Int).SetUint64(blockParams.AnchorBlockID), true, &protocolConfig.BaseFeeConfig, - timestamp, + blockParams.Timestamp, ) if err != nil { return nil, fmt.Errorf("failed to calculate base fee: %w", err) @@ -750,8 +746,8 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( // Assemble a TaikoL2.anchorV2 transaction. anchorTx, err := s.anchorConstructor.AssembleAnchorV2Tx( ctx, - new(big.Int).SetUint64(anchorBlockID), - anchorStateRoot, + new(big.Int).SetUint64(blockParams.AnchorBlockID), + blockParams.AnchorStateRoot, parent.GasUsed, &protocolConfig.BaseFeeConfig, new(big.Int).SetUint64(blockID), @@ -762,33 +758,58 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( } txList = append([]*types.Transaction{anchorTx}, txList...) - if txListBytes, err = rlp.EncodeToBytes(txList); err != nil { - log.Error("Encode txList error", "blockID", blockID, "error", err) - return nil, err - } } else { prevSoftBlock, err := s.rpc.L2.BlockByNumber(ctx, new(big.Int).SetUint64(blockID-1)) if err != nil { return nil, fmt.Errorf("failed to fetch previous soft block (%d): %w", blockID, err) } + + // Check the previous soft block status. + l1Origin, err := s.rpc.L2.L1OriginByID(ctx, prevSoftBlock.Number()) + if err != nil { + return nil, fmt.Errorf("failed to fetch L1 origin for block %d: %w", blockID, err) + } + if l1Origin.BatchID.Uint64()+1 != batchID { + return nil, fmt.Errorf("batch ID mismatch: expected %d, got %d", l1Origin.BatchID.Uint64()+1, batchID) + } + if l1Origin.EndOfBlock { + return nil, fmt.Errorf("soft block %d has already been marked as ended", blockID) + } + if l1Origin.EndOfPreconf { + return nil, fmt.Errorf("preconfirmation from %s has already been marked as ended", blockParams.Coinbase) + } + txList = append(prevSoftBlock.Transactions(), txList...) } + if txListBytes, err = rlp.EncodeToBytes(txList); err != nil { + log.Error("Encode txList error", "blockID", blockID, "error", err) + return nil, err + } + attributes := &engine.PayloadAttributes{ - Timestamp: timestamp, + Timestamp: blockParams.Timestamp, Random: difficulty, - SuggestedFeeRecipient: coinbase, + SuggestedFeeRecipient: blockParams.Coinbase, Withdrawals: []*types.Withdrawal{}, BlockMetadata: &engine.BlockMetadata{ - Beneficiary: coinbase, + Beneficiary: blockParams.Coinbase, GasLimit: uint64(protocolConfig.BlockMaxGasLimit) + consensus.AnchorGasLimit, - Timestamp: timestamp, + Timestamp: blockParams.Timestamp, TxList: txListBytes, MixHash: difficulty, ExtraData: extraData[:], }, BaseFeePerGas: baseFee, - L1Origin: nil, // TODO(DavidCai): check L1 origin + L1Origin: &rawdb.L1Origin{ + BlockID: new(big.Int).SetUint64(blockID), + L2BlockHash: common.Hash{}, // Will be set by taiko-geth. + L1BlockHeight: nil, // No L1 block height for soft blocks. + BatchID: new(big.Int).SetUint64(batchID), + EndOfBlock: batchMarker == softblocks.BatchMarkerEOB, + EndOfPreconf: batchMarker == softblocks.BatchMarkerEOP, + Preconfer: blockParams.Coinbase, + }, } log.Info( diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index f4fc4bfa270..1c06972abe8 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -16,10 +16,11 @@ import ( // TransactionBatchMarker represents the status of a soft block transactions group. type TransactionBatchMarker string -// BatchMarker values. +// BatchMarker valid values. const ( - BatchMarkerEOB TransactionBatchMarker = "end_of_block" - BatchMarkerEOP TransactionBatchMarker = "end_of_preconf" + BatchMarkerEmpty TransactionBatchMarker = "" + BatchMarkerEOB TransactionBatchMarker = "endOfBlock" + BatchMarkerEOP TransactionBatchMarker = "endOfPreconf" ) // SoftBlockParams represents the parameters for building a soft block. @@ -177,16 +178,13 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { } // Insert the soft block. - header, err := s.chainSyncer.BlobSyncer().InsertSoftBlockFromTransactionsBatch( + header, err := s.chainSyncer.InsertSoftBlockFromTransactionsBatch( c.Request().Context(), reqBody.TransactionBatch.BlockID, reqBody.TransactionBatch.ID, txListBytes, string(reqBody.TransactionBatch.BatchMarker), - reqBody.TransactionBatch.BlockParams.Timestamp, - reqBody.TransactionBatch.BlockParams.Coinbase, - reqBody.TransactionBatch.BlockParams.AnchorBlockID, - reqBody.TransactionBatch.BlockParams.AnchorStateRoot, + reqBody.TransactionBatch.BlockParams, ) if err != nil { return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()}) diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index f4211604daa..81cf5e60f1c 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -1,18 +1,32 @@ package softblocks import ( + "context" "os" + "github.com/ethereum/go-ethereum/core/types" echojwt "github.com/labstack/echo-jwt/v4" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" - chainSyncer "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer" txListDecompressor "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/txlist_decompressor" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" ) +// softBlockChainSyncer is an interface for soft block chain syncer. +type softBlockChainSyncer interface { + InsertSoftBlockFromTransactionsBatch( + // Transactions batch parameters + ctx context.Context, + blockID uint64, + batchID uint64, + txListBytes []byte, + batchMarker string, + softBlockParams *SoftBlockParams, + ) (*types.Header, error) +} + // @title Taiko Soft Block Server API // @version 1.0 // @termsOfService http://swagger.io/terms/ @@ -26,13 +40,13 @@ import ( // SoftBlockAPIServer represents a soft blcok server instance. type SoftBlockAPIServer struct { echo *echo.Echo - chainSyncer *chainSyncer.L2ChainSyncer + chainSyncer softBlockChainSyncer rpc *rpc.Client txListDecompressor *txListDecompressor.TxListDecompressor } // New creates a new soft blcok server instance. -func New(chainSyncer *chainSyncer.L2ChainSyncer, cli *rpc.Client) (*SoftBlockAPIServer, error) { +func New(chainSyncer softBlockChainSyncer, cli *rpc.Client) (*SoftBlockAPIServer, error) { server := &SoftBlockAPIServer{ echo: echo.New(), chainSyncer: chainSyncer, From b8887ba7d583ede3ed1537506bb61bddad6ccc55 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 28 Oct 2024 16:26:28 +0800 Subject: [PATCH 40/71] feat: add soft block server flags --- packages/taiko-client/cmd/flags/driver.go | 23 +++++++++++ .../driver/chain_syncer/blob/syncer.go | 2 +- packages/taiko-client/driver/config.go | 39 +++++++++++++------ packages/taiko-client/driver/driver.go | 30 ++++++++++++-- .../taiko-client/driver/soft_blocks/api.go | 2 +- .../taiko-client/driver/soft_blocks/server.go | 26 ++++++++++--- 6 files changed, 100 insertions(+), 22 deletions(-) diff --git a/packages/taiko-client/cmd/flags/driver.go b/packages/taiko-client/cmd/flags/driver.go index 3c28dc7571a..221d8394115 100644 --- a/packages/taiko-client/cmd/flags/driver.go +++ b/packages/taiko-client/cmd/flags/driver.go @@ -52,6 +52,26 @@ var ( Category: driverCategory, EnvVars: []string{"BLOB_SOCIAL_SCAN_ENDPOINT"}, } + // soft block server + SoftBlockServerPort = &cli.Uint64Flag{ + Name: "softBlock.port", + Usage: "HTTP port of the soft block server, 0 means disabled", + Category: driverCategory, + EnvVars: []string{"SOFT_BLOCK_SERVER_PORT"}, + } + SoftBlockServerJWTSecret = &cli.StringFlag{ + Name: "softBlock.jwtSecret", + Usage: "Path to a JWT secret to use for the soft block server", + Category: driverCategory, + EnvVars: []string{"SOFT_BLOCK_SERVER_JWT_SECRET"}, + } + SoftBlockServerCORSOrigins = &cli.StringFlag{ + Name: "softBlock.corsOrigins", + Usage: "CORS Origins settings for the soft block server", + Category: driverCategory, + Value: "*", + EnvVars: []string{"SOFT_BLOCK_SERVER_CORS_ORIGINS"}, + } ) // DriverFlags All driver flags. @@ -66,4 +86,7 @@ var DriverFlags = MergeFlags(CommonFlags, []cli.Flag{ MaxExponent, BlobServerEndpoint, SocialScanEndpoint, + SoftBlockServerPort, + SoftBlockServerJWTSecret, + SoftBlockServerCORSOrigins, }) diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index b1511af299d..e334e4bb771 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -700,7 +700,7 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( batchID uint64, txListBytes []byte, batchMarker softblocks.TransactionBatchMarker, - blockParams softblocks.SoftBlockParams, + blockParams *softblocks.SoftBlockParams, ) (*types.Header, error) { parent, err := s.rpc.L2.HeaderByNumber(ctx, new(big.Int).Sub(new(big.Int).SetUint64(blockID), common.Big1)) if err != nil { diff --git a/packages/taiko-client/driver/config.go b/packages/taiko-client/driver/config.go index 3eb3b95e236..ad7f867a451 100644 --- a/packages/taiko-client/driver/config.go +++ b/packages/taiko-client/driver/config.go @@ -17,12 +17,15 @@ import ( // Config contains the configurations to initialize a Taiko driver. type Config struct { *rpc.ClientConfig - P2PSync bool - P2PSyncTimeout time.Duration - RetryInterval time.Duration - MaxExponent uint64 - BlobServerEndpoint *url.URL - SocialScanEndpoint *url.URL + P2PSync bool + P2PSyncTimeout time.Duration + RetryInterval time.Duration + MaxExponent uint64 + BlobServerEndpoint *url.URL + SocialScanEndpoint *url.URL + SoftBlockServerPort uint64 + SoftBlockServerJWTSecret []byte + SoftBlockServerCORSOrigins string } // NewConfigFromCliContext creates a new config instance from @@ -69,6 +72,15 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { return nil, errors.New("empty L1 beacon endpoint, blob server and Social Scan endpoint") } + var softBlockServerJWTSecret []byte + if c.String(flags.SoftBlockServerJWTSecret.Name) != "" { + if softBlockServerJWTSecret, err = jwt.ParseSecretFromFile( + c.String(flags.SoftBlockServerJWTSecret.Name), + ); err != nil { + return nil, fmt.Errorf("invalid JWT secret file: %w", err) + } + } + var timeout = c.Duration(flags.RPCTimeout.Name) return &Config{ ClientConfig: &rpc.ClientConfig{ @@ -82,11 +94,14 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { JwtSecret: string(jwtSecret), Timeout: timeout, }, - RetryInterval: c.Duration(flags.BackOffRetryInterval.Name), - P2PSync: p2pSync, - P2PSyncTimeout: c.Duration(flags.P2PSyncTimeout.Name), - MaxExponent: c.Uint64(flags.MaxExponent.Name), - BlobServerEndpoint: blobServerEndpoint, - SocialScanEndpoint: socialScanEndpoint, + RetryInterval: c.Duration(flags.BackOffRetryInterval.Name), + P2PSync: p2pSync, + P2PSyncTimeout: c.Duration(flags.P2PSyncTimeout.Name), + MaxExponent: c.Uint64(flags.MaxExponent.Name), + BlobServerEndpoint: blobServerEndpoint, + SocialScanEndpoint: socialScanEndpoint, + SoftBlockServerPort: c.Uint64(flags.SoftBlockServerPort.Name), + SoftBlockServerJWTSecret: softBlockServerJWTSecret, + SoftBlockServerCORSOrigins: c.String(flags.SoftBlockServerCORSOrigins.Name), }, nil } diff --git a/packages/taiko-client/driver/driver.go b/packages/taiko-client/driver/driver.go index 51967df1d93..74cb4086855 100644 --- a/packages/taiko-client/driver/driver.go +++ b/packages/taiko-client/driver/driver.go @@ -17,6 +17,7 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" chainSyncer "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer" + softblocks "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/soft_blocks" "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/state" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" ) @@ -30,9 +31,10 @@ const ( // contract. type Driver struct { *Config - rpc *rpc.Client - l2ChainSyncer *chainSyncer.L2ChainSyncer - state *state.State + rpc *rpc.Client + l2ChainSyncer *chainSyncer.L2ChainSyncer + softblockServer *softblocks.SoftBlockAPIServer + state *state.State l1HeadCh chan *types.Header l1HeadSub event.Subscription @@ -89,6 +91,17 @@ func (d *Driver) InitFromConfig(ctx context.Context, cfg *Config) (err error) { d.l1HeadSub = d.state.SubL1HeadsFeed(d.l1HeadCh) + if d.SoftBlockServerPort > 0 { + if d.softblockServer, err = softblocks.Start( + d.SoftBlockServerCORSOrigins, + d.SoftBlockServerJWTSecret, + d.l2ChainSyncer.BlobSyncer(), + d.rpc, + ); err != nil { + return err + } + } + return nil } @@ -98,6 +111,13 @@ func (d *Driver) Start() error { go d.reportProtocolStatus() go d.exchangeTransitionConfigLoop() + // Start the soft block server if it is enabled. + if d.softblockServer != nil { + if err := d.softblockServer.Start(d.SoftBlockServerPort); err != nil { + return err + } + } + return nil } @@ -105,6 +125,10 @@ func (d *Driver) Start() error { func (d *Driver) Close(_ context.Context) { d.l1HeadSub.Unsubscribe() d.state.Close() + // Close the soft block server if it is enabled. + if d.softblockServer != nil { + d.softblockServer.Shutdown(d.ctx) + } d.wg.Wait() } diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 1c06972abe8..f2eab6bd065 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -183,7 +183,7 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { reqBody.TransactionBatch.BlockID, reqBody.TransactionBatch.ID, txListBytes, - string(reqBody.TransactionBatch.BatchMarker), + reqBody.TransactionBatch.BatchMarker, reqBody.TransactionBatch.BlockParams, ) if err != nil { diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index 81cf5e60f1c..d43fc07b937 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -2,6 +2,7 @@ package softblocks import ( "context" + "fmt" "os" "github.com/ethereum/go-ethereum/core/types" @@ -22,7 +23,7 @@ type softBlockChainSyncer interface { blockID uint64, batchID uint64, txListBytes []byte, - batchMarker string, + batchMarker TransactionBatchMarker, softBlockParams *SoftBlockParams, ) (*types.Header, error) } @@ -45,8 +46,13 @@ type SoftBlockAPIServer struct { txListDecompressor *txListDecompressor.TxListDecompressor } -// New creates a new soft blcok server instance. -func New(chainSyncer softBlockChainSyncer, cli *rpc.Client) (*SoftBlockAPIServer, error) { +// Start creates a new soft blcok server instance, and starts the server. +func Start( + cors string, + jwtSecret []byte, + chainSyncer softBlockChainSyncer, + cli *rpc.Client, +) (*SoftBlockAPIServer, error) { server := &SoftBlockAPIServer{ echo: echo.New(), chainSyncer: chainSyncer, @@ -58,9 +64,9 @@ func New(chainSyncer softBlockChainSyncer, cli *rpc.Client) (*SoftBlockAPIServer } server.echo.HideBanner = true - server.configureMiddleware([]string{"*"}) // TODO: add flags + server.configureMiddleware([]string{cors}) server.configureRoutes() - server.echo.Use(echojwt.JWT([]byte("secret"))) // TODO: add flags + server.echo.Use(echojwt.JWT(jwtSecret)) return server, nil } @@ -95,6 +101,16 @@ func (s *SoftBlockAPIServer) configureMiddleware(corsOrigins []string) { })) } +// Start starts the HTTP server. +func (s *SoftBlockAPIServer) Start(port uint64) error { + return s.echo.Start(fmt.Sprintf(":%v", port)) +} + +// Shutdown shuts down the HTTP server. +func (s *SoftBlockAPIServer) Shutdown(ctx context.Context) error { + return s.echo.Shutdown(ctx) +} + // configureRoutes contains all routes which will be used by prover server. func (s *SoftBlockAPIServer) configureRoutes() { s.echo.GET("/", s.HealthCheck) From 16d2645582eaaf3afc7780a3f3f3d37d72c21c6b Mon Sep 17 00:00:00 2001 From: David Date: Mon, 28 Oct 2024 16:48:48 +0800 Subject: [PATCH 41/71] test: introduce uint tests --- packages/taiko-client/driver/driver.go | 14 +++++----- packages/taiko-client/driver/driver_test.go | 22 +++++++++++++++ .../taiko-client/driver/soft_blocks/server.go | 12 ++++---- .../driver/soft_blocks/server_test.go | 28 +++++++++++++++++++ 4 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 packages/taiko-client/driver/soft_blocks/server_test.go diff --git a/packages/taiko-client/driver/driver.go b/packages/taiko-client/driver/driver.go index 74cb4086855..83ac220b2e5 100644 --- a/packages/taiko-client/driver/driver.go +++ b/packages/taiko-client/driver/driver.go @@ -92,14 +92,12 @@ func (d *Driver) InitFromConfig(ctx context.Context, cfg *Config) (err error) { d.l1HeadSub = d.state.SubL1HeadsFeed(d.l1HeadCh) if d.SoftBlockServerPort > 0 { - if d.softblockServer, err = softblocks.Start( + d.softblockServer = softblocks.New( d.SoftBlockServerCORSOrigins, d.SoftBlockServerJWTSecret, d.l2ChainSyncer.BlobSyncer(), d.rpc, - ); err != nil { - return err - } + ) } return nil @@ -113,9 +111,11 @@ func (d *Driver) Start() error { // Start the soft block server if it is enabled. if d.softblockServer != nil { - if err := d.softblockServer.Start(d.SoftBlockServerPort); err != nil { - return err - } + go func() { + if err := d.softblockServer.Start(d.SoftBlockServerPort); err != nil { + log.Crit("Failed to start soft block server", "error", err) + } + }() } return nil diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index b0a97cc4818..5ebc52ecc16 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -45,6 +45,9 @@ func (s *DriverTestSuite) SetupTest() { TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2")), JwtSecret: string(jwtSecret), }, + SoftBlockServerPort: testutils.RandomHash().Big().Uint64(), + SoftBlockServerJWTSecret: nil, + SoftBlockServerCORSOrigins: "*", })) s.d = d s.cancel = cancel @@ -344,6 +347,25 @@ func (s *DriverTestSuite) InitProposer() { s.p = p } +func (s *DriverTestSuite) TestInsertSoftBlocks() { + // Start the soft block server. + go func() { s.Nil(s.d.softblockServer.Start(s.d.SoftBlockServerPort)) }() + defer s.d.softblockServer.Shutdown(s.d.ctx) + + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + + // Propose a valid L2 block + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) +} + func TestDriverTestSuite(t *testing.T) { suite.Run(t, new(DriverTestSuite)) } diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index d43fc07b937..4b69632cb27 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -46,13 +46,13 @@ type SoftBlockAPIServer struct { txListDecompressor *txListDecompressor.TxListDecompressor } -// Start creates a new soft blcok server instance, and starts the server. -func Start( +// New creates a new soft blcok server instance, and starts the server. +func New( cors string, jwtSecret []byte, chainSyncer softBlockChainSyncer, cli *rpc.Client, -) (*SoftBlockAPIServer, error) { +) *SoftBlockAPIServer { server := &SoftBlockAPIServer{ echo: echo.New(), chainSyncer: chainSyncer, @@ -66,9 +66,11 @@ func Start( server.echo.HideBanner = true server.configureMiddleware([]string{cors}) server.configureRoutes() - server.echo.Use(echojwt.JWT(jwtSecret)) + if jwtSecret != nil { + server.echo.Use(echojwt.JWT(jwtSecret)) + } - return server, nil + return server } // LogSkipper implements the `middleware.Skipper` interface. diff --git a/packages/taiko-client/driver/soft_blocks/server_test.go b/packages/taiko-client/driver/soft_blocks/server_test.go new file mode 100644 index 00000000000..ade0eb89959 --- /dev/null +++ b/packages/taiko-client/driver/soft_blocks/server_test.go @@ -0,0 +1,28 @@ +package softblocks + +import ( + "context" + "testing" + + "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" +) + +type SoftBlockAPIServerTestSuite struct { + testutils.ClientTestSuite + s *SoftBlockAPIServer +} + +func (s *SoftBlockAPIServerTestSuite) SetupTest() { + s.ClientTestSuite.SetupTest() + s.s = New("*", nil, nil, s.RPCClient) + go s.s.Start(uint64(testutils.RandomPort())) +} + +func (s *SoftBlockAPIServerTestSuite) TestShutdown() { + s.Nil(s.s.Shutdown(context.Background())) +} + +func TestSoftBlockAPIServerTestSuite(t *testing.T) { + suite.Run(t, new(SoftBlockAPIServerTestSuite)) +} From 5baa565b6cd7e92f2bcadea446ce8191c0710b40 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 30 Oct 2024 11:27:15 +0800 Subject: [PATCH 42/71] test: more tests --- go.mod | 2 +- go.sum | 4 +- packages/taiko-client/bindings/.githead | 2 +- .../driver/chain_syncer/blob/soft_block.go | 222 +++++++ .../driver/chain_syncer/blob/syncer.go | 203 ------- packages/taiko-client/driver/driver_test.go | 573 +++++++++++------- .../taiko-client/driver/soft_blocks/api.go | 4 +- .../taiko-client/driver/soft_blocks/server.go | 1 + .../internal/docker/nodes/docker-compose.yml | 2 +- 9 files changed, 568 insertions(+), 445 deletions(-) create mode 100644 packages/taiko-client/driver/chain_syncer/blob/soft_block.go diff --git a/go.mod b/go.mod index 08e6477b378..bd2dbac0a2a 100644 --- a/go.mod +++ b/go.mod @@ -237,7 +237,7 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -replace github.com/ethereum/go-ethereum v1.14.11 => github.com/taikoxyz/taiko-geth v1.11.2-0.20241028072634-028fdd21d620 +replace github.com/ethereum/go-ethereum v1.14.11 => github.com/taikoxyz/taiko-geth v1.11.2-0.20241029080652-47538d588fc1 replace github.com/ethereum-optimism/optimism v1.7.4 => github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39 diff --git a/go.sum b/go.sum index c9d5798cf58..b5219c2422b 100644 --- a/go.sum +++ b/go.sum @@ -605,8 +605,8 @@ github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082 h1:ymZR+Y88LOnA8i3Ke github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082/go.mod h1:RHnIu3EFehrWX3JhFAMQSXD5uz7l0xaNroTzXrap7EQ= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39 h1:JssMxaDmORjQ9RPZNulVJhAD8zSPd6LZFq5wsr6Nwz8= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39/go.mod h1:ym7scR7ZHvEmwx1DLGVDzFlAdR+uhP1+Z4XCiFuSD5s= -github.com/taikoxyz/taiko-geth v1.11.2-0.20241028072634-028fdd21d620 h1:kLba9l42fc0q3ofwnkcFJv0nNKMc5Cy6i1Oa7jIGK+I= -github.com/taikoxyz/taiko-geth v1.11.2-0.20241028072634-028fdd21d620/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241029080652-47538d588fc1 h1:OJh/OzKpAq1dSpc1PxnnrGC2bsprjJMIo6syu6mFdt4= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241029080652-47538d588fc1/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= github.com/testcontainers/testcontainers-go v0.30.0 h1:jmn/XS22q4YRrcMwWg0pAwlClzs/abopbsBzrepyc4E= github.com/testcontainers/testcontainers-go v0.30.0/go.mod h1:K+kHNGiM5zjklKjgTtcrEetF3uhWbMUyqAQoyoh8Pf0= github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e h1:cR8/SYRgyQCt5cNCMniB/ZScMkhI9nk8U5C7SbISXjo= diff --git a/packages/taiko-client/bindings/.githead b/packages/taiko-client/bindings/.githead index d214b1e728d..657afd7e9af 100644 --- a/packages/taiko-client/bindings/.githead +++ b/packages/taiko-client/bindings/.githead @@ -1 +1 @@ -13cc0074a2295c5939cf83e23f531cb25c43bd64 +1faa04b17989ba22eec875cf71e4d9bf39d1050c diff --git a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go new file mode 100644 index 00000000000..7d53265b46b --- /dev/null +++ b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go @@ -0,0 +1,222 @@ +package blob + +import ( + "context" + "errors" + "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/beacon/engine" + "github.com/ethereum/go-ethereum/common" + consensus "github.com/ethereum/go-ethereum/consensus/taiko" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/rlp" + + "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" + softblocks "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/soft_blocks" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/utils" +) + +// InsertSoftBlockFromTransactionsBatch inserts a soft block into the L2 execution engine's blockchain +// from the given transactions batch. +func (s *Syncer) InsertSoftBlockFromTransactionsBatch( + // Transactions batch parameters + ctx context.Context, + blockID uint64, + batchID uint64, + txListBytes []byte, + batchMarker softblocks.TransactionBatchMarker, + blockParams *softblocks.SoftBlockParams, +) (*types.Header, error) { + parent, err := s.rpc.L2.HeaderByNumber(ctx, new(big.Int).Sub(new(big.Int).SetUint64(blockID), common.Big1)) + if err != nil { + return nil, err + } + + if parent.Number.Uint64()+1 != blockID { + return nil, fmt.Errorf("parent block number (%d) is not equal to blockID - 1 (%d)", parent.Number.Uint64(), blockID) + } + + // Calculate the other block parameters + difficultyHashPaylaod, err := encoding.EncodeDifficultyCalcutionParams(blockID) + if err != nil { + return nil, fmt.Errorf("failed to encode `block.difficulty` calculation parameters: %w", err) + } + + var ( + txList []*types.Transaction + fc = &engine.ForkchoiceStateV1{HeadBlockHash: parent.Hash()} + difficulty = crypto.Keccak256Hash(difficultyHashPaylaod) + protocolConfig = encoding.GetProtocolConfig(s.rpc.L2.ChainID.Uint64()) + extraData = encoding.EncodeBaseFeeConfig(&protocolConfig.BaseFeeConfig) + ) + + if err := rlp.DecodeBytes(txListBytes, &txList); err != nil { + return nil, fmt.Errorf("failed to RLP decode txList bytes: %w", err) + } + + baseFee, err := s.rpc.CalculateBaseFee( + ctx, + parent, + new(big.Int).SetUint64(blockParams.AnchorBlockID), + true, + &protocolConfig.BaseFeeConfig, + blockParams.Timestamp, + ) + if err != nil { + return nil, fmt.Errorf("failed to calculate base fee: %w", err) + } + + // Insert the anchor transaction at the head of the transactions list. + if batchID == 0 { + // Assemble a TaikoL2.anchorV2 transaction. + anchorTx, err := s.anchorConstructor.AssembleAnchorV2Tx( + ctx, + new(big.Int).SetUint64(blockParams.AnchorBlockID), + blockParams.AnchorStateRoot, + parent.GasUsed, + &protocolConfig.BaseFeeConfig, + new(big.Int).SetUint64(blockID), + baseFee, + ) + if err != nil { + return nil, fmt.Errorf("failed to create TaikoL2.anchorV2 transaction: %w", err) + } + + txList = append([]*types.Transaction{anchorTx}, txList...) + } else { + prevSoftBlock, err := s.rpc.L2.BlockByNumber(ctx, new(big.Int).SetUint64(blockID-1)) + if err != nil { + return nil, fmt.Errorf("failed to fetch previous soft block (%d): %w", blockID, err) + } + + // Check the previous soft block status. + l1Origin, err := s.rpc.L2.L1OriginByID(ctx, prevSoftBlock.Number()) + if err != nil { + return nil, fmt.Errorf("failed to fetch L1 origin for block %d: %w", blockID, err) + } + if l1Origin.BatchID.Uint64()+1 != batchID { + return nil, fmt.Errorf("batch ID mismatch: expected %d, got %d", l1Origin.BatchID.Uint64()+1, batchID) + } + if l1Origin.EndOfBlock { + return nil, fmt.Errorf("soft block %d has already been marked as ended", blockID) + } + if l1Origin.EndOfPreconf { + return nil, fmt.Errorf("preconfirmation from %s has already been marked as ended", blockParams.Coinbase) + } + + txList = append(prevSoftBlock.Transactions(), txList...) + } + + if txListBytes, err = rlp.EncodeToBytes(txList); err != nil { + log.Error("Encode txList error", "blockID", blockID, "error", err) + return nil, err + } + + attributes := &engine.PayloadAttributes{ + Timestamp: blockParams.Timestamp, + Random: difficulty, + SuggestedFeeRecipient: blockParams.Coinbase, + Withdrawals: []*types.Withdrawal{}, + BlockMetadata: &engine.BlockMetadata{ + Beneficiary: blockParams.Coinbase, + GasLimit: uint64(protocolConfig.BlockMaxGasLimit) + consensus.AnchorGasLimit, + Timestamp: blockParams.Timestamp, + TxList: txListBytes, + MixHash: difficulty, + ExtraData: extraData[:], + }, + BaseFeePerGas: baseFee, + L1Origin: &rawdb.L1Origin{ + BlockID: new(big.Int).SetUint64(blockID), + L2BlockHash: common.Hash{}, // Will be set by taiko-geth. + L1BlockHeight: nil, // No L1 block height for soft blocks. + BatchID: new(big.Int).SetUint64(batchID), + EndOfBlock: batchMarker == softblocks.BatchMarkerEOB, + EndOfPreconf: batchMarker == softblocks.BatchMarkerEOP, + Preconfer: blockParams.Coinbase, + }, + } + + log.Info( + "Soft block payloadAttributes", + "blockID", blockID, + "timestamp", attributes.Timestamp, + "random", attributes.Random, + "suggestedFeeRecipient", attributes.SuggestedFeeRecipient, + "withdrawals", len(attributes.Withdrawals), + "gasLimit", attributes.BlockMetadata.GasLimit, + "timestamp", attributes.BlockMetadata.Timestamp, + "mixHash", attributes.BlockMetadata.MixHash, + "baseFee", utils.WeiToGWei(attributes.BaseFeePerGas), + "extraData", common.Bytes2Hex(attributes.BlockMetadata.ExtraData), + ) + + // Step 1, prepare a payload + fcRes, err := s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, attributes) + if err != nil { + return nil, fmt.Errorf("failed to update fork choice: %w", err) + } + if fcRes.PayloadStatus.Status != engine.VALID { + return nil, fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) + } + if fcRes.PayloadID == nil { + return nil, errors.New("empty payload ID") + } + + // Step 2, get the payload + payload, err := s.rpc.L2Engine.GetPayload(ctx, fcRes.PayloadID) + if err != nil { + return nil, fmt.Errorf("failed to get payload: %w", err) + } + + log.Info( + "Soft block payload", + "blockID", blockID, + "baseFee", utils.WeiToGWei(payload.BaseFeePerGas), + "number", payload.Number, + "hash", payload.BlockHash, + "gasLimit", payload.GasLimit, + "gasUsed", payload.GasUsed, + "timestamp", payload.Timestamp, + "withdrawalsHash", payload.WithdrawalsHash, + ) + + // Step 3, execute the payload + execStatus, err := s.rpc.L2Engine.NewPayload(ctx, payload) + if err != nil { + return nil, fmt.Errorf("failed to create a new payload: %w", err) + } + if execStatus.Status != engine.VALID { + return nil, fmt.Errorf("unexpected NewPayload response status: %s", execStatus.Status) + } + + lastVerifiedBlockHash, err := s.rpc.GetLastVerifiedBlockHash(ctx) + if err != nil { + return nil, fmt.Errorf("failed to fetch last verified block hash: %w", err) + } + + canonicalHead, err := s.rpc.L2.HeadL1Origin(ctx) + if err != nil { + return nil, fmt.Errorf("failed to fetch canonical head: %w", err) + } + + // Step 4, update the fork choice + fc = &engine.ForkchoiceStateV1{ + HeadBlockHash: payload.BlockHash, + SafeBlockHash: canonicalHead.L2BlockHash, + FinalizedBlockHash: lastVerifiedBlockHash, + } + fcRes, err = s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, nil) + if err != nil { + return nil, err + } + if fcRes.PayloadStatus.Status != engine.VALID { + return nil, fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) + } + + return s.rpc.L2.HeaderByHash(ctx, payload.BlockHash) +} diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index e334e4bb771..eb055ce9f1b 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -17,7 +17,6 @@ import ( consensus "github.com/ethereum/go-ethereum/consensus/taiko" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" @@ -25,7 +24,6 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/metadata" "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer/beaconsync" - softblocks "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/soft_blocks" "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/state" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/metrics" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/utils" @@ -690,204 +688,3 @@ func (s *Syncer) checkReorg( return reorgCheckResult, nil } - -// InsertSoftBlockFromTransactionsBatch inserts a soft block into the L2 execution engine's blockchain -// from the given transactions batch. -func (s *Syncer) InsertSoftBlockFromTransactionsBatch( - // Transactions batch parameters - ctx context.Context, - blockID uint64, - batchID uint64, - txListBytes []byte, - batchMarker softblocks.TransactionBatchMarker, - blockParams *softblocks.SoftBlockParams, -) (*types.Header, error) { - parent, err := s.rpc.L2.HeaderByNumber(ctx, new(big.Int).Sub(new(big.Int).SetUint64(blockID), common.Big1)) - if err != nil { - return nil, err - } - - if parent.Number.Uint64()+1 != blockID { - return nil, fmt.Errorf("parent block number (%d) is not equal to blockID - 1 (%d)", parent.Number.Uint64(), blockID) - } - - // Calculate the other block parameters - difficultyHashPaylaod, err := encoding.EncodeDifficultyCalcutionParams(blockID) - if err != nil { - return nil, fmt.Errorf("failed to encode `block.difficulty` calculation parameters: %w", err) - } - - var ( - txList []*types.Transaction - fc = &engine.ForkchoiceStateV1{HeadBlockHash: parent.Hash()} - difficulty = crypto.Keccak256Hash(difficultyHashPaylaod) - protocolConfig = encoding.GetProtocolConfig(s.rpc.L2.ChainID.Uint64()) - extraData = encoding.EncodeBaseFeeConfig(&protocolConfig.BaseFeeConfig) - ) - - if err := rlp.DecodeBytes(txListBytes, &txList); err != nil { - return nil, fmt.Errorf("failed to RLP decode txList bytes: %w", err) - } - - baseFee, err := s.rpc.CalculateBaseFee( - ctx, - parent, - new(big.Int).SetUint64(blockParams.AnchorBlockID), - true, - &protocolConfig.BaseFeeConfig, - blockParams.Timestamp, - ) - if err != nil { - return nil, fmt.Errorf("failed to calculate base fee: %w", err) - } - - // Insert the anchor transaction at the head of the transactions list. - if batchID == 0 { - // Assemble a TaikoL2.anchorV2 transaction. - anchorTx, err := s.anchorConstructor.AssembleAnchorV2Tx( - ctx, - new(big.Int).SetUint64(blockParams.AnchorBlockID), - blockParams.AnchorStateRoot, - parent.GasUsed, - &protocolConfig.BaseFeeConfig, - new(big.Int).SetUint64(blockID), - baseFee, - ) - if err != nil { - return nil, fmt.Errorf("failed to create TaikoL2.anchorV2 transaction: %w", err) - } - - txList = append([]*types.Transaction{anchorTx}, txList...) - } else { - prevSoftBlock, err := s.rpc.L2.BlockByNumber(ctx, new(big.Int).SetUint64(blockID-1)) - if err != nil { - return nil, fmt.Errorf("failed to fetch previous soft block (%d): %w", blockID, err) - } - - // Check the previous soft block status. - l1Origin, err := s.rpc.L2.L1OriginByID(ctx, prevSoftBlock.Number()) - if err != nil { - return nil, fmt.Errorf("failed to fetch L1 origin for block %d: %w", blockID, err) - } - if l1Origin.BatchID.Uint64()+1 != batchID { - return nil, fmt.Errorf("batch ID mismatch: expected %d, got %d", l1Origin.BatchID.Uint64()+1, batchID) - } - if l1Origin.EndOfBlock { - return nil, fmt.Errorf("soft block %d has already been marked as ended", blockID) - } - if l1Origin.EndOfPreconf { - return nil, fmt.Errorf("preconfirmation from %s has already been marked as ended", blockParams.Coinbase) - } - - txList = append(prevSoftBlock.Transactions(), txList...) - } - - if txListBytes, err = rlp.EncodeToBytes(txList); err != nil { - log.Error("Encode txList error", "blockID", blockID, "error", err) - return nil, err - } - - attributes := &engine.PayloadAttributes{ - Timestamp: blockParams.Timestamp, - Random: difficulty, - SuggestedFeeRecipient: blockParams.Coinbase, - Withdrawals: []*types.Withdrawal{}, - BlockMetadata: &engine.BlockMetadata{ - Beneficiary: blockParams.Coinbase, - GasLimit: uint64(protocolConfig.BlockMaxGasLimit) + consensus.AnchorGasLimit, - Timestamp: blockParams.Timestamp, - TxList: txListBytes, - MixHash: difficulty, - ExtraData: extraData[:], - }, - BaseFeePerGas: baseFee, - L1Origin: &rawdb.L1Origin{ - BlockID: new(big.Int).SetUint64(blockID), - L2BlockHash: common.Hash{}, // Will be set by taiko-geth. - L1BlockHeight: nil, // No L1 block height for soft blocks. - BatchID: new(big.Int).SetUint64(batchID), - EndOfBlock: batchMarker == softblocks.BatchMarkerEOB, - EndOfPreconf: batchMarker == softblocks.BatchMarkerEOP, - Preconfer: blockParams.Coinbase, - }, - } - - log.Info( - "Soft block payloadAttributes", - "blockID", blockID, - "timestamp", attributes.Timestamp, - "random", attributes.Random, - "suggestedFeeRecipient", attributes.SuggestedFeeRecipient, - "withdrawals", len(attributes.Withdrawals), - "gasLimit", attributes.BlockMetadata.GasLimit, - "timestamp", attributes.BlockMetadata.Timestamp, - "mixHash", attributes.BlockMetadata.MixHash, - "baseFee", utils.WeiToGWei(attributes.BaseFeePerGas), - "extraData", common.Bytes2Hex(attributes.BlockMetadata.ExtraData), - ) - - // Step 1, prepare a payload - fcRes, err := s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, attributes) - if err != nil { - return nil, fmt.Errorf("failed to update fork choice: %w", err) - } - if fcRes.PayloadStatus.Status != engine.VALID { - return nil, fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) - } - if fcRes.PayloadID == nil { - return nil, errors.New("empty payload ID") - } - - // Step 2, get the payload - payload, err := s.rpc.L2Engine.GetPayload(ctx, fcRes.PayloadID) - if err != nil { - return nil, fmt.Errorf("failed to get payload: %w", err) - } - - log.Info( - "Soft block payload", - "blockID", blockID, - "baseFee", utils.WeiToGWei(payload.BaseFeePerGas), - "number", payload.Number, - "hash", payload.BlockHash, - "gasLimit", payload.GasLimit, - "gasUsed", payload.GasUsed, - "timestamp", payload.Timestamp, - "withdrawalsHash", payload.WithdrawalsHash, - ) - - // Step 3, execute the payload - execStatus, err := s.rpc.L2Engine.NewPayload(ctx, payload) - if err != nil { - return nil, fmt.Errorf("failed to create a new payload: %w", err) - } - if execStatus.Status != engine.VALID { - return nil, fmt.Errorf("unexpected NewPayload response status: %s", execStatus.Status) - } - - lastVerifiedBlockHash, err := s.rpc.GetLastVerifiedBlockHash(ctx) - if err != nil { - return nil, fmt.Errorf("failed to fetch last verified block hash: %w", err) - } - - canonicalHead, err := s.rpc.L2.HeadL1Origin(ctx) - if err != nil { - return nil, fmt.Errorf("failed to fetch canonical head: %w", err) - } - - // Step 4, update the fork choice - fc = &engine.ForkchoiceStateV1{ - HeadBlockHash: payload.BlockHash, - SafeBlockHash: canonicalHead.L2BlockHash, - FinalizedBlockHash: lastVerifiedBlockHash, - } - fcRes, err = s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, nil) - if err != nil { - return nil, err - } - if fcRes.PayloadStatus.Status != engine.VALID { - return nil, fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) - } - - return s.rpc.L2.HeaderByHash(ctx, payload.BlockHash) -} diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 5ebc52ecc16..e03babc7f43 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -1,18 +1,27 @@ package driver import ( + "bytes" + "compress/zlib" "context" + "fmt" "math/big" + "net/url" "os" "testing" "time" "github.com/ethereum-optimism/optimism/op-service/txmgr" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rlp" + "github.com/go-resty/resty/v2" "github.com/stretchr/testify/suite" - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" + softblocks "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/soft_blocks" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/jwt" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" @@ -45,9 +54,6 @@ func (s *DriverTestSuite) SetupTest() { TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2")), JwtSecret: string(jwtSecret), }, - SoftBlockServerPort: testutils.RandomHash().Big().Uint64(), - SoftBlockServerJWTSecret: nil, - SoftBlockServerCORSOrigins: "*", })) s.d = d s.cancel = cancel @@ -60,234 +66,234 @@ func (s *DriverTestSuite) TestName() { s.Equal("driver", s.d.Name()) } -func (s *DriverTestSuite) TestProcessL1Blocks() { - l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - - // Propose a valid L2 block - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - - // Empty blocks - s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) - s.Nil(err) - - l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) - - for _, height := range []uint64{l2Head3.Number.Uint64(), l2Head3.Number.Uint64() - 1} { - header, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(height)) - s.Nil(err) - - txCount, err := s.d.rpc.L2.TransactionCount(context.Background(), header.Hash()) - s.Nil(err) - s.GreaterOrEqual(txCount, uint(1)) - - anchorTx, err := s.d.rpc.L2.TransactionInBlock(context.Background(), header.Hash(), 0) - s.Nil(err) - - method, err := encoding.TaikoL2ABI.MethodById(anchorTx.Data()) - s.Nil(err) - s.Contains(method.Name, "anchor") - } -} - -func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { - // TODO: Temporarily skip this test case when use l2_reth node. - if os.Getenv("L2_NODE") == "l2_reth" { - s.T().Skip() - } - var ( - testnetL1SnapshotID = s.SetL1Snapshot() - ) - l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - // Propose two L2 blocks - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - - res, err := s.RPCClient.CheckL1Reorg( - context.Background(), - l2Head2.Number, - ) - s.Nil(err) - s.False(res.IsReorged) - - // Reorg back to l2Head1 - s.RevertL1Snapshot(testnetL1SnapshotID) - s.InitProposer() - - // Because of evm_revert operation, the nonce of the proposer need to be adjusted. - // Propose ten blocks on another fork - for i := 0; i < 10; i++ { - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - } - - l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) - - l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Equal(l2Head1.Number.Uint64()+10, l2Head3.Number.Uint64()) - - parent, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(l2Head1.Number.Uint64()+1)) - s.Nil(err) - s.Equal(parent.ParentHash, l2Head1.Hash()) - s.NotEqual(parent.Hash(), l2Head2.ParentHash) -} - -func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() { - var ( - testnetL1SnapshotID = s.SetL1Snapshot() - ) - l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - // Propose two L2 blocks - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - time.Sleep(3 * time.Second) - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - - res, err := s.RPCClient.CheckL1Reorg( - context.Background(), - l2Head2.Number, - ) - s.Nil(err) - s.False(res.IsReorged) - - // Reorg back to l2Head1 - s.RevertL1Snapshot(testnetL1SnapshotID) - s.InitProposer() - - l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) - - // Propose one blocks on another fork - s.ProposeValidBlock(s.p) - - l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) - s.Less(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) - - s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - - l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) - s.Nil(err) - s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()-1) - s.Equal(parent.Hash(), l2Head1.Hash()) -} - -func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() { - var ( - testnetL1SnapshotID = s.SetL1Snapshot() - ) - l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - // Propose two L2 blocks - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - time.Sleep(3 * time.Second) - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - - res, err := s.RPCClient.CheckL1Reorg( - context.Background(), - l2Head2.Number, - ) - s.Nil(err) - s.False(res.IsReorged) - - // Reorg back to l2Head1 - s.RevertL1Snapshot(testnetL1SnapshotID) - s.InitProposer() - - l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) - - // Propose two blocks on another fork - s.ProposeValidBlock(s.p) - time.Sleep(3 * time.Second) - s.ProposeValidBlock(s.p) - - l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) - - s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - - l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) - s.Nil(err) - s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) - s.NotEqual(l2Head3.Hash(), l2Head2.Hash()) - s.Equal(parent.ParentHash, l2Head1.Hash()) -} - -func (s *DriverTestSuite) TestDoSyncNoNewL2Blocks() { - s.Nil(s.d.l2ChainSyncer.Sync()) -} - -func (s *DriverTestSuite) TestStartClose() { - s.Nil(s.d.Start()) - s.cancel() - s.d.Close(s.d.ctx) -} - -func (s *DriverTestSuite) TestL1Current() { - // propose and insert a block - s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) - // reset L1 current with increased height - s.Nil(s.d.state.ResetL1Current(s.d.ctx, common.Big1)) -} +// func (s *DriverTestSuite) TestProcessL1Blocks() { +// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + +// // Propose a valid L2 block +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + +// // Empty blocks +// s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) +// s.Nil(err) + +// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) + +// for _, height := range []uint64{l2Head3.Number.Uint64(), l2Head3.Number.Uint64() - 1} { +// header, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(height)) +// s.Nil(err) + +// txCount, err := s.d.rpc.L2.TransactionCount(context.Background(), header.Hash()) +// s.Nil(err) +// s.GreaterOrEqual(txCount, uint(1)) + +// anchorTx, err := s.d.rpc.L2.TransactionInBlock(context.Background(), header.Hash(), 0) +// s.Nil(err) + +// method, err := encoding.TaikoL2ABI.MethodById(anchorTx.Data()) +// s.Nil(err) +// s.Contains(method.Name, "anchor") +// } +// } + +// func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { +// // TODO: Temporarily skip this test case when use l2_reth node. +// if os.Getenv("L2_NODE") == "l2_reth" { +// s.T().Skip() +// } +// var ( +// testnetL1SnapshotID = s.SetL1Snapshot() +// ) +// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// // Propose two L2 blocks +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) +// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + +// res, err := s.RPCClient.CheckL1Reorg( +// context.Background(), +// l2Head2.Number, +// ) +// s.Nil(err) +// s.False(res.IsReorged) + +// // Reorg back to l2Head1 +// s.RevertL1Snapshot(testnetL1SnapshotID) +// s.InitProposer() + +// // Because of evm_revert operation, the nonce of the proposer need to be adjusted. +// // Propose ten blocks on another fork +// for i := 0; i < 10; i++ { +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) +// } + +// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) + +// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Equal(l2Head1.Number.Uint64()+10, l2Head3.Number.Uint64()) + +// parent, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(l2Head1.Number.Uint64()+1)) +// s.Nil(err) +// s.Equal(parent.ParentHash, l2Head1.Hash()) +// s.NotEqual(parent.Hash(), l2Head2.ParentHash) +// } + +// func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() { +// var ( +// testnetL1SnapshotID = s.SetL1Snapshot() +// ) +// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// // Propose two L2 blocks +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) +// time.Sleep(3 * time.Second) +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) +// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + +// res, err := s.RPCClient.CheckL1Reorg( +// context.Background(), +// l2Head2.Number, +// ) +// s.Nil(err) +// s.False(res.IsReorged) + +// // Reorg back to l2Head1 +// s.RevertL1Snapshot(testnetL1SnapshotID) +// s.InitProposer() + +// l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) + +// // Propose one blocks on another fork +// s.ProposeValidBlock(s.p) + +// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) +// s.Less(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) + +// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + +// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) +// s.Nil(err) +// s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()-1) +// s.Equal(parent.Hash(), l2Head1.Hash()) +// } + +// func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() { +// var ( +// testnetL1SnapshotID = s.SetL1Snapshot() +// ) +// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// // Propose two L2 blocks +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) +// time.Sleep(3 * time.Second) +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) +// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + +// res, err := s.RPCClient.CheckL1Reorg( +// context.Background(), +// l2Head2.Number, +// ) +// s.Nil(err) +// s.False(res.IsReorged) + +// // Reorg back to l2Head1 +// s.RevertL1Snapshot(testnetL1SnapshotID) +// s.InitProposer() + +// l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) + +// // Propose two blocks on another fork +// s.ProposeValidBlock(s.p) +// time.Sleep(3 * time.Second) +// s.ProposeValidBlock(s.p) + +// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) + +// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + +// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) +// s.Nil(err) +// s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) +// s.NotEqual(l2Head3.Hash(), l2Head2.Hash()) +// s.Equal(parent.ParentHash, l2Head1.Hash()) +// } + +// func (s *DriverTestSuite) TestDoSyncNoNewL2Blocks() { +// s.Nil(s.d.l2ChainSyncer.Sync()) +// } + +// func (s *DriverTestSuite) TestStartClose() { +// s.Nil(s.d.Start()) +// s.cancel() +// s.d.Close(s.d.ctx) +// } + +// func (s *DriverTestSuite) TestL1Current() { +// // propose and insert a block +// s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) +// // reset L1 current with increased height +// s.Nil(s.d.state.ResetL1Current(s.d.ctx, common.Big1)) +// } func (s *DriverTestSuite) InitProposer() { p := new(proposer.Proposer) @@ -348,10 +354,19 @@ func (s *DriverTestSuite) InitProposer() { } func (s *DriverTestSuite) TestInsertSoftBlocks() { - // Start the soft block server. - go func() { s.Nil(s.d.softblockServer.Start(s.d.SoftBlockServerPort)) }() + port := uint64(testutils.RandomPort()) + s.d.softblockServer = softblocks.New( + "*", + nil, + s.d.ChainSyncer().BlobSyncer(), + s.RPCClient, + ) + go func() { s.d.softblockServer.Start(port) }() defer s.d.softblockServer.Shutdown(s.d.ctx) + url, err := url.Parse(fmt.Sprintf("http://localhost:%v", port)) + s.Nil(err) + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) s.Nil(err) @@ -363,9 +378,99 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) s.Nil(err) + l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + + res, err := resty.New().R().Get(url.String() + "/healthz") + s.Nil(err) + s.True(res.IsSuccess()) + + preconferPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROPOSER_PRIVATE_KEY"))) + s.Nil(err) + + preconferAddress := crypto.PubkeyToAddress(preconferPrivKey.PublicKey) + + nonce, err := s.RPCClient.L2.PendingNonceAt(context.Background(), s.TestAddr) + s.Nil(err) + + tx := types.NewTransaction( + nonce, + common.BytesToAddress(testutils.RandomBytes(32)), + common.Big0, + 100_000, + new(big.Int).SetUint64(uint64(10*params.GWei)), + []byte{}, + ) + signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(s.RPCClient.L2.ChainID), s.TestAddrPrivKey) + s.Nil(err) + s.Nil(s.RPCClient.L2.SendTransaction(context.Background(), signedTx)) + + b, err := encodeAndCompressTxList([]*types.Transaction{signedTx}) + s.Nil(err) + + txBatch := softblocks.TransactionBatch{ + BlockID: l2Head2.Number.Uint64() + 1, + ID: 0, + TransactionsList: b, + BatchMarker: softblocks.BatchMarkerEmpty, + Signature: "", + BlockParams: &softblocks.SoftBlockParams{ + AnchorBlockID: l1Head1.Number.Uint64(), + AnchorStateRoot: l1Head1.Root, + Timestamp: l1Head1.Time + 12, + Coinbase: preconferAddress, + }, + } + + payload, err := rlp.EncodeToBytes(txBatch) + s.Nil(err) + s.NotEmpty(payload) + + sig, err := crypto.Sign(crypto.Keccak256(payload), preconferPrivKey) + s.Nil(err) + txBatch.Signature = common.Bytes2Hex(sig) + + // Try to propose a soft block + res, err = resty.New(). + R(). + SetBody(&softblocks.BuildSoftBlockRequestBody{ + TransactionBatch: txBatch, + }). + Post(url.String() + "/softBlocks") + s.Nil(err) + log.Info("Response", "res", res.String()) + s.True(res.IsSuccess()) } func TestDriverTestSuite(t *testing.T) { suite.Run(t, new(DriverTestSuite)) } + +// encodeAndCompressTxList encodes and compresses the given transactions list. +func encodeAndCompressTxList(txs types.Transactions) ([]byte, error) { + b, err := rlp.EncodeToBytes(txs) + if err != nil { + return nil, err + } + + return compress(b) +} + +// compress compresses the given txList bytes using zlib. +func compress(txListBytes []byte) ([]byte, error) { + var b bytes.Buffer + w := zlib.NewWriter(&b) + defer w.Close() + + if _, err := w.Write(txListBytes); err != nil { + return nil, err + } + + if err := w.Flush(); err != nil { + return nil, err + } + + return b.Bytes(), nil +} diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index f2eab6bd065..b18fc60ce79 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -63,9 +63,7 @@ func (b *TransactionBatch) ValidateSignature() (bool, error) { return false, err } - log.Debug("Validating signature", "payload", payload, "signature", b.Signature) - - pubKey, err := crypto.SigToPub(payload, common.FromHex(b.Signature)) + pubKey, err := crypto.SigToPub(crypto.Keccak256(payload), common.FromHex(b.Signature)) if err != nil { return false, err } diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index 4b69632cb27..e4c34f87f54 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -61,6 +61,7 @@ func New( rpc.BlockMaxTxListBytes, cli.L2.ChainID, ), + rpc: cli, } server.echo.HideBanner = true diff --git a/packages/taiko-client/internal/docker/nodes/docker-compose.yml b/packages/taiko-client/internal/docker/nodes/docker-compose.yml index 1c81f01f92c..ff7f73ace51 100644 --- a/packages/taiko-client/internal/docker/nodes/docker-compose.yml +++ b/packages/taiko-client/internal/docker/nodes/docker-compose.yml @@ -18,7 +18,7 @@ services: l2_geth: container_name: l2_geth - image: us-docker.pkg.dev/evmchain/images/taiko-geth:taiko + image: us-docker.pkg.dev/evmchain/images/taiko-geth:softblock restart: unless-stopped pull_policy: always volumes: From 3bdb7a3275cd2ffd74a59b79005139209b1aae72 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 30 Oct 2024 16:07:05 +0800 Subject: [PATCH 43/71] test: update tests --- .../driver/chain_syncer/blob/soft_block.go | 16 +++++++++++++++- .../driver/chain_syncer/blob/syncer.go | 1 - packages/taiko-client/driver/driver_test.go | 2 -- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go index 7d53265b46b..01d121a3ccd 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go +++ b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go @@ -218,5 +218,19 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( return nil, fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) } - return s.rpc.L2.HeaderByHash(ctx, payload.BlockHash) + header, err := s.rpc.L2.HeaderByHash(ctx, payload.BlockHash) + if err != nil { + return nil, err + } + + log.Info( + "⏰ New soft L2 block inserted", + "blockID", blockID, + "hash", header.Hash(), + "transactions", len(payload.Transactions), + "baseFee", utils.WeiToGWei(header.BaseFee), + "withdrawals", len(payload.Withdrawals), + ) + + return header, nil } diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index eb055ce9f1b..9ad1c808d8b 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -290,7 +290,6 @@ func (s *Syncer) onBlockProposed( log.Info( "🔗 New L2 block inserted", "blockID", meta.GetBlockID(), - "height", payloadData.Number, "hash", payloadData.BlockHash, "transactions", len(payloadData.Transactions), "baseFee", utils.WeiToGWei(payloadData.BaseFeePerGas), diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index e03babc7f43..3b260a229c0 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -15,7 +15,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" "github.com/go-resty/resty/v2" @@ -440,7 +439,6 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { }). Post(url.String() + "/softBlocks") s.Nil(err) - log.Info("Response", "res", res.String()) s.True(res.IsSuccess()) } From f10d030fa2cc4b445797c2d83bb565ce4e9bf1ce Mon Sep 17 00:00:00 2001 From: David Date: Thu, 31 Oct 2024 13:17:08 +0800 Subject: [PATCH 44/71] chore: update go.mod --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index bd2dbac0a2a..ea13b320c83 100644 --- a/go.mod +++ b/go.mod @@ -237,7 +237,7 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -replace github.com/ethereum/go-ethereum v1.14.11 => github.com/taikoxyz/taiko-geth v1.11.2-0.20241029080652-47538d588fc1 +replace github.com/ethereum/go-ethereum v1.14.11 => github.com/taikoxyz/taiko-geth v1.11.2-0.20241031044538-43ab184d9ebd replace github.com/ethereum-optimism/optimism v1.7.4 => github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39 diff --git a/go.sum b/go.sum index b5219c2422b..70719dcdc5a 100644 --- a/go.sum +++ b/go.sum @@ -605,8 +605,8 @@ github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082 h1:ymZR+Y88LOnA8i3Ke github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082/go.mod h1:RHnIu3EFehrWX3JhFAMQSXD5uz7l0xaNroTzXrap7EQ= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39 h1:JssMxaDmORjQ9RPZNulVJhAD8zSPd6LZFq5wsr6Nwz8= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39/go.mod h1:ym7scR7ZHvEmwx1DLGVDzFlAdR+uhP1+Z4XCiFuSD5s= -github.com/taikoxyz/taiko-geth v1.11.2-0.20241029080652-47538d588fc1 h1:OJh/OzKpAq1dSpc1PxnnrGC2bsprjJMIo6syu6mFdt4= -github.com/taikoxyz/taiko-geth v1.11.2-0.20241029080652-47538d588fc1/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241031044538-43ab184d9ebd h1:QAdpo8oqI+X66EA5dc6cT77fEgNk2sqVKC6j14vv6uk= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241031044538-43ab184d9ebd/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= github.com/testcontainers/testcontainers-go v0.30.0 h1:jmn/XS22q4YRrcMwWg0pAwlClzs/abopbsBzrepyc4E= github.com/testcontainers/testcontainers-go v0.30.0/go.mod h1:K+kHNGiM5zjklKjgTtcrEetF3uhWbMUyqAQoyoh8Pf0= github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e h1:cR8/SYRgyQCt5cNCMniB/ZScMkhI9nk8U5C7SbISXjo= From ac8c74c1b81361f5cb52759a228894cdc62a5380 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 3 Nov 2024 16:08:19 +0800 Subject: [PATCH 45/71] chore: update go.mod --- go.mod | 8 -------- go.sum | 8 ++++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 90674df309c..ae2e13f83b5 100644 --- a/go.mod +++ b/go.mod @@ -217,18 +217,10 @@ require ( golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.6.0 // indirect -<<<<<<< HEAD - golang.org/x/tools v0.26.0 // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/grpc v1.63.2 // indirect -======= golang.org/x/tools v0.24.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/grpc v1.64.1 // indirect ->>>>>>> main google.golang.org/protobuf v1.34.2 // indirect gopkg.in/inconshreveable/log15.v2 v2.0.0-20200109203555-b30bc20e4fd1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index e3ade9a70ce..cd5a47307b5 100644 --- a/go.sum +++ b/go.sum @@ -607,8 +607,8 @@ github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082 h1:ymZR+Y88LOnA8i3Ke github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082/go.mod h1:RHnIu3EFehrWX3JhFAMQSXD5uz7l0xaNroTzXrap7EQ= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39 h1:JssMxaDmORjQ9RPZNulVJhAD8zSPd6LZFq5wsr6Nwz8= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39/go.mod h1:ym7scR7ZHvEmwx1DLGVDzFlAdR+uhP1+Z4XCiFuSD5s= -github.com/taikoxyz/taiko-geth v1.11.1 h1:pur1WP6YJkwKhLVeN3Zf7dOwbPq6tS88gYod6QKlJc4= -github.com/taikoxyz/taiko-geth v1.11.1/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241031044538-43ab184d9ebd h1:QAdpo8oqI+X66EA5dc6cT77fEgNk2sqVKC6j14vv6uk= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241031044538-43ab184d9ebd/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= github.com/testcontainers/testcontainers-go v0.34.0 h1:5fbgF0vIN5u+nD3IWabQwRybuB4GY8G2HHgCkbMzMHo= github.com/testcontainers/testcontainers-go v0.34.0/go.mod h1:6P/kMkQe8yqPHfPWNulFGdFHTD8HB2vLq/231xY2iPQ= github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e h1:cR8/SYRgyQCt5cNCMniB/ZScMkhI9nk8U5C7SbISXjo= @@ -816,8 +816,8 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= 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= From 074910fd3d5b13e44c69aa7e97c9034b8b13b7e9 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 3 Nov 2024 18:51:23 +0800 Subject: [PATCH 46/71] feat: merge upstream --- .../bindings/encoding/protocol_config.go | 89 ---- .../driver/chain_syncer/blob/soft_block.go | 22 +- packages/taiko-client/driver/driver.go | 6 +- packages/taiko-client/driver/driver_test.go | 465 +++++++++--------- .../taiko-client/driver/soft_blocks/server.go | 12 +- .../driver/soft_blocks/server_test.go | 4 +- 6 files changed, 263 insertions(+), 335 deletions(-) delete mode 100644 packages/taiko-client/bindings/encoding/protocol_config.go diff --git a/packages/taiko-client/bindings/encoding/protocol_config.go b/packages/taiko-client/bindings/encoding/protocol_config.go deleted file mode 100644 index 256bd088e31..00000000000 --- a/packages/taiko-client/bindings/encoding/protocol_config.go +++ /dev/null @@ -1,89 +0,0 @@ -package encoding - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/params" - - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings" -) - -var ( - livenessBond, _ = new(big.Int).SetString("125000000000000000000", 10) - InternlDevnetProtocolConfig = &bindings.TaikoDataConfig{ - ChainId: params.TaikoInternalL2ANetworkID.Uint64(), - BlockMaxProposals: 324_000, - BlockRingBufferSize: 360_000, - MaxBlocksToVerify: 16, - BlockMaxGasLimit: 240_000_000, - LivenessBond: livenessBond, - StateRootSyncInternal: 16, - MaxAnchorHeightOffset: 64, - OntakeForkHeight: 2, - BaseFeeConfig: bindings.LibSharedDataBaseFeeConfig{ - AdjustmentQuotient: 8, - SharingPctg: 75, - GasIssuancePerSecond: 5_000_000, - MinGasExcess: 1_340_000_000, - MaxGasIssuancePerBlock: 600_000_000, - }, - } - HeklaProtocolConfig = &bindings.TaikoDataConfig{ - ChainId: params.HeklaNetworkID.Uint64(), - BlockMaxProposals: 324_000, - BlockRingBufferSize: 324_512, - MaxBlocksToVerify: 16, - BlockMaxGasLimit: 240_000_000, - LivenessBond: livenessBond, - StateRootSyncInternal: 16, - MaxAnchorHeightOffset: 64, - OntakeForkHeight: 840_512, - BaseFeeConfig: bindings.LibSharedDataBaseFeeConfig{ - AdjustmentQuotient: 8, - SharingPctg: 75, - GasIssuancePerSecond: 5_000_000, - MinGasExcess: 1_340_000_000, - MaxGasIssuancePerBlock: 600_000_000, - }, - } - MainnetProtocolConfig = &bindings.TaikoDataConfig{ - ChainId: params.TaikoMainnetNetworkID.Uint64(), - BlockMaxProposals: 324_000, - BlockRingBufferSize: 360_000, - MaxBlocksToVerify: 16, - BlockMaxGasLimit: 240_000_000, - LivenessBond: livenessBond, - StateRootSyncInternal: 16, - MaxAnchorHeightOffset: 64, - OntakeForkHeight: 538_304, - BaseFeeConfig: bindings.LibSharedDataBaseFeeConfig{ - AdjustmentQuotient: 8, - SharingPctg: 75, - GasIssuancePerSecond: 5_000_000, - MinGasExcess: 1_340_000_000, - MaxGasIssuancePerBlock: 600_000_000, - }, - } -) - -// GetProtocolConfig returns the protocol config for the given chain ID. -func GetProtocolConfig(chainID uint64) *bindings.TaikoDataConfig { - switch chainID { - case params.HeklaNetworkID.Uint64(): - return HeklaProtocolConfig - case params.TaikoMainnetNetworkID.Uint64(): - return MainnetProtocolConfig - default: - return InternlDevnetProtocolConfig - } -} - -// EncodeBaseFeeConfig encodes the block.extraData field from the given base fee config. -func EncodeBaseFeeConfig(baseFeeConfig *bindings.LibSharedDataBaseFeeConfig) [32]byte { - var ( - bytes32Value [32]byte - uintValue = new(big.Int).SetUint64(uint64(baseFeeConfig.SharingPctg)) - ) - copy(bytes32Value[32-len(uintValue.Bytes()):], uintValue.Bytes()) - return bytes32Value -} diff --git a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go index 01d121a3ccd..169f5280700 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go +++ b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go @@ -6,6 +6,7 @@ import ( "fmt" "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/beacon/engine" "github.com/ethereum/go-ethereum/common" consensus "github.com/ethereum/go-ethereum/consensus/taiko" @@ -18,12 +19,12 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" softblocks "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/soft_blocks" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/utils" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" ) // InsertSoftBlockFromTransactionsBatch inserts a soft block into the L2 execution engine's blockchain // from the given transactions batch. func (s *Syncer) InsertSoftBlockFromTransactionsBatch( - // Transactions batch parameters ctx context.Context, blockID uint64, batchID uint64, @@ -45,13 +46,16 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( if err != nil { return nil, fmt.Errorf("failed to encode `block.difficulty` calculation parameters: %w", err) } + protocolConfigs, err := rpc.GetProtocolConfigs(s.rpc.TaikoL1, &bind.CallOpts{Context: ctx}) + if err != nil { + return nil, fmt.Errorf("failed to fetch protocol configs: %w", err) + } var ( - txList []*types.Transaction - fc = &engine.ForkchoiceStateV1{HeadBlockHash: parent.Hash()} - difficulty = crypto.Keccak256Hash(difficultyHashPaylaod) - protocolConfig = encoding.GetProtocolConfig(s.rpc.L2.ChainID.Uint64()) - extraData = encoding.EncodeBaseFeeConfig(&protocolConfig.BaseFeeConfig) + txList []*types.Transaction + fc = &engine.ForkchoiceStateV1{HeadBlockHash: parent.Hash()} + difficulty = crypto.Keccak256Hash(difficultyHashPaylaod) + extraData = encoding.EncodeBaseFeeConfig(&protocolConfigs.BaseFeeConfig) ) if err := rlp.DecodeBytes(txListBytes, &txList); err != nil { @@ -63,7 +67,7 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( parent, new(big.Int).SetUint64(blockParams.AnchorBlockID), true, - &protocolConfig.BaseFeeConfig, + &protocolConfigs.BaseFeeConfig, blockParams.Timestamp, ) if err != nil { @@ -78,7 +82,7 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( new(big.Int).SetUint64(blockParams.AnchorBlockID), blockParams.AnchorStateRoot, parent.GasUsed, - &protocolConfig.BaseFeeConfig, + &protocolConfigs.BaseFeeConfig, new(big.Int).SetUint64(blockID), baseFee, ) @@ -123,7 +127,7 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( Withdrawals: []*types.Withdrawal{}, BlockMetadata: &engine.BlockMetadata{ Beneficiary: blockParams.Coinbase, - GasLimit: uint64(protocolConfig.BlockMaxGasLimit) + consensus.AnchorGasLimit, + GasLimit: uint64(protocolConfigs.BlockMaxGasLimit) + consensus.AnchorGasLimit, Timestamp: blockParams.Timestamp, TxList: txListBytes, MixHash: difficulty, diff --git a/packages/taiko-client/driver/driver.go b/packages/taiko-client/driver/driver.go index 48190f9fe1a..79450c7202e 100644 --- a/packages/taiko-client/driver/driver.go +++ b/packages/taiko-client/driver/driver.go @@ -91,12 +91,14 @@ func (d *Driver) InitFromConfig(ctx context.Context, cfg *Config) (err error) { d.l1HeadSub = d.state.SubL1HeadsFeed(d.l1HeadCh) if d.SoftBlockServerPort > 0 { - d.softblockServer = softblocks.New( + if d.softblockServer, err = softblocks.New( d.SoftBlockServerCORSOrigins, d.SoftBlockServerJWTSecret, d.l2ChainSyncer.BlobSyncer(), d.rpc, - ) + ); err != nil { + return err + } } return nil diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 3b260a229c0..f3eaa279eca 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -20,6 +20,7 @@ import ( "github.com/go-resty/resty/v2" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" softblocks "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/soft_blocks" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/jwt" @@ -65,234 +66,234 @@ func (s *DriverTestSuite) TestName() { s.Equal("driver", s.d.Name()) } -// func (s *DriverTestSuite) TestProcessL1Blocks() { -// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - -// // Propose a valid L2 block -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - -// // Empty blocks -// s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) -// s.Nil(err) - -// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) - -// for _, height := range []uint64{l2Head3.Number.Uint64(), l2Head3.Number.Uint64() - 1} { -// header, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(height)) -// s.Nil(err) - -// txCount, err := s.d.rpc.L2.TransactionCount(context.Background(), header.Hash()) -// s.Nil(err) -// s.GreaterOrEqual(txCount, uint(1)) - -// anchorTx, err := s.d.rpc.L2.TransactionInBlock(context.Background(), header.Hash(), 0) -// s.Nil(err) - -// method, err := encoding.TaikoL2ABI.MethodById(anchorTx.Data()) -// s.Nil(err) -// s.Contains(method.Name, "anchor") -// } -// } - -// func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { -// // TODO: Temporarily skip this test case when use l2_reth node. -// if os.Getenv("L2_NODE") == "l2_reth" { -// s.T().Skip() -// } -// var ( -// testnetL1SnapshotID = s.SetL1Snapshot() -// ) -// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// // Propose two L2 blocks -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) -// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - -// res, err := s.RPCClient.CheckL1Reorg( -// context.Background(), -// l2Head2.Number, -// ) -// s.Nil(err) -// s.False(res.IsReorged) - -// // Reorg back to l2Head1 -// s.RevertL1Snapshot(testnetL1SnapshotID) -// s.InitProposer() - -// // Because of evm_revert operation, the nonce of the proposer need to be adjusted. -// // Propose ten blocks on another fork -// for i := 0; i < 10; i++ { -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) -// } - -// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) - -// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Equal(l2Head1.Number.Uint64()+10, l2Head3.Number.Uint64()) - -// parent, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(l2Head1.Number.Uint64()+1)) -// s.Nil(err) -// s.Equal(parent.ParentHash, l2Head1.Hash()) -// s.NotEqual(parent.Hash(), l2Head2.ParentHash) -// } - -// func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() { -// var ( -// testnetL1SnapshotID = s.SetL1Snapshot() -// ) -// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// // Propose two L2 blocks -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) -// time.Sleep(3 * time.Second) -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) -// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - -// res, err := s.RPCClient.CheckL1Reorg( -// context.Background(), -// l2Head2.Number, -// ) -// s.Nil(err) -// s.False(res.IsReorged) - -// // Reorg back to l2Head1 -// s.RevertL1Snapshot(testnetL1SnapshotID) -// s.InitProposer() - -// l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) - -// // Propose one blocks on another fork -// s.ProposeValidBlock(s.p) - -// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) -// s.Less(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) - -// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - -// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) -// s.Nil(err) -// s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()-1) -// s.Equal(parent.Hash(), l2Head1.Hash()) -// } - -// func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() { -// var ( -// testnetL1SnapshotID = s.SetL1Snapshot() -// ) -// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// // Propose two L2 blocks -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) -// time.Sleep(3 * time.Second) -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) -// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - -// res, err := s.RPCClient.CheckL1Reorg( -// context.Background(), -// l2Head2.Number, -// ) -// s.Nil(err) -// s.False(res.IsReorged) - -// // Reorg back to l2Head1 -// s.RevertL1Snapshot(testnetL1SnapshotID) -// s.InitProposer() - -// l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) - -// // Propose two blocks on another fork -// s.ProposeValidBlock(s.p) -// time.Sleep(3 * time.Second) -// s.ProposeValidBlock(s.p) - -// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) - -// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - -// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) -// s.Nil(err) -// s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) -// s.NotEqual(l2Head3.Hash(), l2Head2.Hash()) -// s.Equal(parent.ParentHash, l2Head1.Hash()) -// } - -// func (s *DriverTestSuite) TestDoSyncNoNewL2Blocks() { -// s.Nil(s.d.l2ChainSyncer.Sync()) -// } - -// func (s *DriverTestSuite) TestStartClose() { -// s.Nil(s.d.Start()) -// s.cancel() -// s.d.Close(s.d.ctx) -// } - -// func (s *DriverTestSuite) TestL1Current() { -// // propose and insert a block -// s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) -// // reset L1 current with increased height -// s.Nil(s.d.state.ResetL1Current(s.d.ctx, common.Big1)) -// } +func (s *DriverTestSuite) TestProcessL1Blocks() { + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + + // Propose a valid L2 block + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + + // Empty blocks + s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) + s.Nil(err) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) + + for _, height := range []uint64{l2Head3.Number.Uint64(), l2Head3.Number.Uint64() - 1} { + header, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(height)) + s.Nil(err) + + txCount, err := s.d.rpc.L2.TransactionCount(context.Background(), header.Hash()) + s.Nil(err) + s.GreaterOrEqual(txCount, uint(1)) + + anchorTx, err := s.d.rpc.L2.TransactionInBlock(context.Background(), header.Hash(), 0) + s.Nil(err) + + method, err := encoding.TaikoL2ABI.MethodById(anchorTx.Data()) + s.Nil(err) + s.Contains(method.Name, "anchor") + } +} + +func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { + // TODO: Temporarily skip this test case when use l2_reth node. + if os.Getenv("L2_NODE") == "l2_reth" { + s.T().Skip() + } + var ( + testnetL1SnapshotID = s.SetL1Snapshot() + ) + l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + // Propose two L2 blocks + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + + res, err := s.RPCClient.CheckL1Reorg( + context.Background(), + l2Head2.Number, + ) + s.Nil(err) + s.False(res.IsReorged) + + // Reorg back to l2Head1 + s.RevertL1Snapshot(testnetL1SnapshotID) + s.InitProposer() + + // Because of evm_revert operation, the nonce of the proposer need to be adjusted. + // Propose ten blocks on another fork + for i := 0; i < 10; i++ { + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + } + + l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Equal(l2Head1.Number.Uint64()+10, l2Head3.Number.Uint64()) + + parent, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(l2Head1.Number.Uint64()+1)) + s.Nil(err) + s.Equal(parent.ParentHash, l2Head1.Hash()) + s.NotEqual(parent.Hash(), l2Head2.ParentHash) +} + +func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() { + var ( + testnetL1SnapshotID = s.SetL1Snapshot() + ) + l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + // Propose two L2 blocks + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + time.Sleep(3 * time.Second) + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + + res, err := s.RPCClient.CheckL1Reorg( + context.Background(), + l2Head2.Number, + ) + s.Nil(err) + s.False(res.IsReorged) + + // Reorg back to l2Head1 + s.RevertL1Snapshot(testnetL1SnapshotID) + s.InitProposer() + + l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) + + // Propose one blocks on another fork + s.ProposeValidBlock(s.p) + + l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) + s.Less(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) + + s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) + s.Nil(err) + s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()-1) + s.Equal(parent.Hash(), l2Head1.Hash()) +} + +func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() { + var ( + testnetL1SnapshotID = s.SetL1Snapshot() + ) + l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + // Propose two L2 blocks + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + time.Sleep(3 * time.Second) + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + + res, err := s.RPCClient.CheckL1Reorg( + context.Background(), + l2Head2.Number, + ) + s.Nil(err) + s.False(res.IsReorged) + + // Reorg back to l2Head1 + s.RevertL1Snapshot(testnetL1SnapshotID) + s.InitProposer() + + l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) + + // Propose two blocks on another fork + s.ProposeValidBlock(s.p) + time.Sleep(3 * time.Second) + s.ProposeValidBlock(s.p) + + l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) + + s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) + s.Nil(err) + s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) + s.NotEqual(l2Head3.Hash(), l2Head2.Hash()) + s.Equal(parent.ParentHash, l2Head1.Hash()) +} + +func (s *DriverTestSuite) TestDoSyncNoNewL2Blocks() { + s.Nil(s.d.l2ChainSyncer.Sync()) +} + +func (s *DriverTestSuite) TestStartClose() { + s.Nil(s.d.Start()) + s.cancel() + s.d.Close(s.d.ctx) +} + +func (s *DriverTestSuite) TestL1Current() { + // propose and insert a block + s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) + // reset L1 current with increased height + s.Nil(s.d.state.ResetL1Current(s.d.ctx, common.Big1)) +} func (s *DriverTestSuite) InitProposer() { p := new(proposer.Proposer) @@ -353,13 +354,17 @@ func (s *DriverTestSuite) InitProposer() { } func (s *DriverTestSuite) TestInsertSoftBlocks() { - port := uint64(testutils.RandomPort()) - s.d.softblockServer = softblocks.New( + var ( + port = uint64(testutils.RandomPort()) + err error + ) + s.d.softblockServer, err = softblocks.New( "*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, ) + s.Nil(err) go func() { s.d.softblockServer.Start(port) }() defer s.d.softblockServer.Shutdown(s.d.ctx) diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index e4c34f87f54..058bebddf69 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -10,7 +10,6 @@ import ( "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" txListDecompressor "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/txlist_decompressor" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" ) @@ -52,12 +51,17 @@ func New( jwtSecret []byte, chainSyncer softBlockChainSyncer, cli *rpc.Client, -) *SoftBlockAPIServer { +) (*SoftBlockAPIServer, error) { + protocolConfigs, err := rpc.GetProtocolConfigs(cli.TaikoL1, nil) + if err != nil { + return nil, fmt.Errorf("failed to fetch protocol configs: %w", err) + } + server := &SoftBlockAPIServer{ echo: echo.New(), chainSyncer: chainSyncer, txListDecompressor: txListDecompressor.NewTxListDecompressor( - uint64(encoding.GetProtocolConfig(cli.L2.ChainID.Uint64()).BlockMaxGasLimit), + uint64(protocolConfigs.BlockMaxGasLimit), rpc.BlockMaxTxListBytes, cli.L2.ChainID, ), @@ -71,7 +75,7 @@ func New( server.echo.Use(echojwt.JWT(jwtSecret)) } - return server + return server, nil } // LogSkipper implements the `middleware.Skipper` interface. diff --git a/packages/taiko-client/driver/soft_blocks/server_test.go b/packages/taiko-client/driver/soft_blocks/server_test.go index ade0eb89959..99156fc90be 100644 --- a/packages/taiko-client/driver/soft_blocks/server_test.go +++ b/packages/taiko-client/driver/soft_blocks/server_test.go @@ -15,7 +15,9 @@ type SoftBlockAPIServerTestSuite struct { func (s *SoftBlockAPIServerTestSuite) SetupTest() { s.ClientTestSuite.SetupTest() - s.s = New("*", nil, nil, s.RPCClient) + server, err := New("*", nil, nil, s.RPCClient) + s.Nil(err) + s.s = server go s.s.Start(uint64(testutils.RandomPort())) } From 680c1746b3117e65b6433a46bc2ac97512c9b7e2 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 3 Nov 2024 20:44:47 +0800 Subject: [PATCH 47/71] feat: update bindings --- packages/taiko-client/bindings/.githead | 2 +- .../bindings/gen_lib_proposing.go | 294 +------ .../taiko-client/bindings/gen_lib_proving.go | 157 +++- .../bindings/gen_lib_verifying.go | 303 +------ .../taiko-client/bindings/gen_taiko_l1.go | 787 ++++++++++++------ .../bindings/gen_tier_provider.go | 50 +- 6 files changed, 746 insertions(+), 847 deletions(-) diff --git a/packages/taiko-client/bindings/.githead b/packages/taiko-client/bindings/.githead index 34b5ba1cba0..f19c7e94d41 100644 --- a/packages/taiko-client/bindings/.githead +++ b/packages/taiko-client/bindings/.githead @@ -1 +1 @@ -6b03929ae41f15c3a36b514cec3f8e91e64e8fab +074910fd3d5b13e44c69aa7e97c9034b8b13b7e9 diff --git a/packages/taiko-client/bindings/gen_lib_proposing.go b/packages/taiko-client/bindings/gen_lib_proposing.go index 182dadc0a2b..54e935c1666 100644 --- a/packages/taiko-client/bindings/gen_lib_proposing.go +++ b/packages/taiko-client/bindings/gen_lib_proposing.go @@ -29,9 +29,10 @@ var ( _ = abi.ConvertType ) + // LibProposingMetaData contains all meta data concerning the LibProposing contract. var LibProposingMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"event\",\"name\":\"BlockProposedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDebited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDeposited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CalldataTxList\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"txList\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_AVAILABLE\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_FOUND\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_FORK_HEIGHT_ERROR\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_ANCHOR_BLOCK\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_CUSTOM_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PARAMS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TIMESTAMP\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TOO_MANY_BLOCKS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_PARENT\",\"inputs\":[]}]", + ABI: "[{\"type\":\"event\",\"name\":\"BlockProposedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CalldataTxList\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"txList\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_AVAILABLE\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_FOUND\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_FORK_HEIGHT_ERROR\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_ANCHOR_BLOCK\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_CUSTOM_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PARAMS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TIMESTAMP\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TOO_MANY_BLOCKS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_PARENT\",\"inputs\":[]}]", } // LibProposingABI is the input ABI used to generate the binding from. @@ -325,297 +326,6 @@ func (_LibProposing *LibProposingFilterer) ParseBlockProposedV2(log types.Log) ( return event, nil } -// LibProposingBondDebitedIterator is returned from FilterBondDebited and is used to iterate over the raw logs and unpacked data for BondDebited events raised by the LibProposing contract. -type LibProposingBondDebitedIterator struct { - Event *LibProposingBondDebited // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *LibProposingBondDebitedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(LibProposingBondDebited) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(LibProposingBondDebited) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *LibProposingBondDebitedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *LibProposingBondDebitedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// LibProposingBondDebited represents a BondDebited event raised by the LibProposing contract. -type LibProposingBondDebited struct { - User common.Address - BlockId *big.Int - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterBondDebited is a free log retrieval operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. -// -// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) -func (_LibProposing *LibProposingFilterer) FilterBondDebited(opts *bind.FilterOpts, user []common.Address) (*LibProposingBondDebitedIterator, error) { - - var userRule []interface{} - for _, userItem := range user { - userRule = append(userRule, userItem) - } - - logs, sub, err := _LibProposing.contract.FilterLogs(opts, "BondDebited", userRule) - if err != nil { - return nil, err - } - return &LibProposingBondDebitedIterator{contract: _LibProposing.contract, event: "BondDebited", logs: logs, sub: sub}, nil -} - -// WatchBondDebited is a free log subscription operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. -// -// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) -func (_LibProposing *LibProposingFilterer) WatchBondDebited(opts *bind.WatchOpts, sink chan<- *LibProposingBondDebited, user []common.Address) (event.Subscription, error) { - - var userRule []interface{} - for _, userItem := range user { - userRule = append(userRule, userItem) - } - - logs, sub, err := _LibProposing.contract.WatchLogs(opts, "BondDebited", userRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(LibProposingBondDebited) - if err := _LibProposing.contract.UnpackLog(event, "BondDebited", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseBondDebited is a log parse operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. -// -// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) -func (_LibProposing *LibProposingFilterer) ParseBondDebited(log types.Log) (*LibProposingBondDebited, error) { - event := new(LibProposingBondDebited) - if err := _LibProposing.contract.UnpackLog(event, "BondDebited", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// LibProposingBondDepositedIterator is returned from FilterBondDeposited and is used to iterate over the raw logs and unpacked data for BondDeposited events raised by the LibProposing contract. -type LibProposingBondDepositedIterator struct { - Event *LibProposingBondDeposited // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *LibProposingBondDepositedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(LibProposingBondDeposited) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(LibProposingBondDeposited) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *LibProposingBondDepositedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *LibProposingBondDepositedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// LibProposingBondDeposited represents a BondDeposited event raised by the LibProposing contract. -type LibProposingBondDeposited struct { - User common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterBondDeposited is a free log retrieval operation binding the contract event 0x8ed8c6869618197b68315ade66e75ed3906c97b111fa3ab81e5760046825c7db. -// -// Solidity: event BondDeposited(address indexed user, uint256 amount) -func (_LibProposing *LibProposingFilterer) FilterBondDeposited(opts *bind.FilterOpts, user []common.Address) (*LibProposingBondDepositedIterator, error) { - - var userRule []interface{} - for _, userItem := range user { - userRule = append(userRule, userItem) - } - - logs, sub, err := _LibProposing.contract.FilterLogs(opts, "BondDeposited", userRule) - if err != nil { - return nil, err - } - return &LibProposingBondDepositedIterator{contract: _LibProposing.contract, event: "BondDeposited", logs: logs, sub: sub}, nil -} - -// WatchBondDeposited is a free log subscription operation binding the contract event 0x8ed8c6869618197b68315ade66e75ed3906c97b111fa3ab81e5760046825c7db. -// -// Solidity: event BondDeposited(address indexed user, uint256 amount) -func (_LibProposing *LibProposingFilterer) WatchBondDeposited(opts *bind.WatchOpts, sink chan<- *LibProposingBondDeposited, user []common.Address) (event.Subscription, error) { - - var userRule []interface{} - for _, userItem := range user { - userRule = append(userRule, userItem) - } - - logs, sub, err := _LibProposing.contract.WatchLogs(opts, "BondDeposited", userRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(LibProposingBondDeposited) - if err := _LibProposing.contract.UnpackLog(event, "BondDeposited", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseBondDeposited is a log parse operation binding the contract event 0x8ed8c6869618197b68315ade66e75ed3906c97b111fa3ab81e5760046825c7db. -// -// Solidity: event BondDeposited(address indexed user, uint256 amount) -func (_LibProposing *LibProposingFilterer) ParseBondDeposited(log types.Log) (*LibProposingBondDeposited, error) { - event := new(LibProposingBondDeposited) - if err := _LibProposing.contract.UnpackLog(event, "BondDeposited", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // LibProposingCalldataTxListIterator is returned from FilterCalldataTxList and is used to iterate over the raw logs and unpacked data for CalldataTxList events raised by the LibProposing contract. type LibProposingCalldataTxListIterator struct { Event *LibProposingCalldataTxList // Event containing the contract specifics and raw log diff --git a/packages/taiko-client/bindings/gen_lib_proving.go b/packages/taiko-client/bindings/gen_lib_proving.go index b4a31484e70..45ae50c4a40 100644 --- a/packages/taiko-client/bindings/gen_lib_proving.go +++ b/packages/taiko-client/bindings/gen_lib_proving.go @@ -31,7 +31,7 @@ var ( // LibProvingMetaData contains all meta data concerning the LibProving contract. var LibProvingMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"event\",\"name\":\"BondCredited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDebited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDeposited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ProvingPaused\",\"inputs\":[{\"name\":\"paused\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContestedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProvedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"L1_ALREADY_CONTESTED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_ALREADY_PROVED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOCK_MISMATCH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_CANNOT_CONTEST\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_DIFF_VERIFIER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_BLOCK_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PARAMS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TIER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TRANSITION\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_NOT_ASSIGNED_PROVER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_PROVING_PAUSED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"inputs\":[]}]", + ABI: "[{\"type\":\"event\",\"name\":\"BlockVerifiedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondCredited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDebited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDeposited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ProvingPaused\",\"inputs\":[{\"name\":\"paused\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContestedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProvedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"L1_ALREADY_CONTESTED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_ALREADY_PROVED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOCK_MISMATCH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOCK_MISMATCH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_CANNOT_CONTEST\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_DIFF_VERIFIER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_BLOCK_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PARAMS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TIER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TRANSITION\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_NOT_ASSIGNED_PROVER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_PROVING_PAUSED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TRANSITION_ID_ZERO\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"inputs\":[]}]", } // LibProvingABI is the input ABI used to generate the binding from. @@ -180,6 +180,161 @@ func (_LibProving *LibProvingTransactorRaw) Transact(opts *bind.TransactOpts, me return _LibProving.Contract.contract.Transact(opts, method, params...) } +// LibProvingBlockVerifiedV2Iterator is returned from FilterBlockVerifiedV2 and is used to iterate over the raw logs and unpacked data for BlockVerifiedV2 events raised by the LibProving contract. +type LibProvingBlockVerifiedV2Iterator struct { + Event *LibProvingBlockVerifiedV2 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *LibProvingBlockVerifiedV2Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(LibProvingBlockVerifiedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(LibProvingBlockVerifiedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *LibProvingBlockVerifiedV2Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *LibProvingBlockVerifiedV2Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// LibProvingBlockVerifiedV2 represents a BlockVerifiedV2 event raised by the LibProving contract. +type LibProvingBlockVerifiedV2 struct { + BlockId *big.Int + Prover common.Address + BlockHash [32]byte + Tier uint16 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockVerifiedV2 is a free log retrieval operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. +// +// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) +func (_LibProving *LibProvingFilterer) FilterBlockVerifiedV2(opts *bind.FilterOpts, blockId []*big.Int, prover []common.Address) (*LibProvingBlockVerifiedV2Iterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _LibProving.contract.FilterLogs(opts, "BlockVerifiedV2", blockIdRule, proverRule) + if err != nil { + return nil, err + } + return &LibProvingBlockVerifiedV2Iterator{contract: _LibProving.contract, event: "BlockVerifiedV2", logs: logs, sub: sub}, nil +} + +// WatchBlockVerifiedV2 is a free log subscription operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. +// +// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) +func (_LibProving *LibProvingFilterer) WatchBlockVerifiedV2(opts *bind.WatchOpts, sink chan<- *LibProvingBlockVerifiedV2, blockId []*big.Int, prover []common.Address) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _LibProving.contract.WatchLogs(opts, "BlockVerifiedV2", blockIdRule, proverRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(LibProvingBlockVerifiedV2) + if err := _LibProving.contract.UnpackLog(event, "BlockVerifiedV2", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockVerifiedV2 is a log parse operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. +// +// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) +func (_LibProving *LibProvingFilterer) ParseBlockVerifiedV2(log types.Log) (*LibProvingBlockVerifiedV2, error) { + event := new(LibProvingBlockVerifiedV2) + if err := _LibProving.contract.UnpackLog(event, "BlockVerifiedV2", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // LibProvingBondCreditedIterator is returned from FilterBondCredited and is used to iterate over the raw logs and unpacked data for BondCredited events raised by the LibProving contract. type LibProvingBondCreditedIterator struct { Event *LibProvingBondCredited // Event containing the contract specifics and raw log diff --git a/packages/taiko-client/bindings/gen_lib_verifying.go b/packages/taiko-client/bindings/gen_lib_verifying.go index 088fa79a641..92626c25e59 100644 --- a/packages/taiko-client/bindings/gen_lib_verifying.go +++ b/packages/taiko-client/bindings/gen_lib_verifying.go @@ -31,7 +31,7 @@ var ( // LibVerifyingMetaData contains all meta data concerning the LibVerifying contract. var LibVerifyingMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"event\",\"name\":\"BlockVerifiedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondCredited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"L1_BLOCK_MISMATCH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TRANSITION_ID_ZERO\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"inputs\":[]}]", + ABI: "[{\"type\":\"error\",\"name\":\"L1_BLOCK_MISMATCH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TRANSITION_ID_ZERO\",\"inputs\":[]}]", } // LibVerifyingABI is the input ABI used to generate the binding from. @@ -179,304 +179,3 @@ func (_LibVerifying *LibVerifyingTransactorRaw) Transfer(opts *bind.TransactOpts func (_LibVerifying *LibVerifyingTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { return _LibVerifying.Contract.contract.Transact(opts, method, params...) } - -// LibVerifyingBlockVerifiedV2Iterator is returned from FilterBlockVerifiedV2 and is used to iterate over the raw logs and unpacked data for BlockVerifiedV2 events raised by the LibVerifying contract. -type LibVerifyingBlockVerifiedV2Iterator struct { - Event *LibVerifyingBlockVerifiedV2 // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *LibVerifyingBlockVerifiedV2Iterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(LibVerifyingBlockVerifiedV2) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(LibVerifyingBlockVerifiedV2) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *LibVerifyingBlockVerifiedV2Iterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *LibVerifyingBlockVerifiedV2Iterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// LibVerifyingBlockVerifiedV2 represents a BlockVerifiedV2 event raised by the LibVerifying contract. -type LibVerifyingBlockVerifiedV2 struct { - BlockId *big.Int - Prover common.Address - BlockHash [32]byte - Tier uint16 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterBlockVerifiedV2 is a free log retrieval operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. -// -// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) -func (_LibVerifying *LibVerifyingFilterer) FilterBlockVerifiedV2(opts *bind.FilterOpts, blockId []*big.Int, prover []common.Address) (*LibVerifyingBlockVerifiedV2Iterator, error) { - - var blockIdRule []interface{} - for _, blockIdItem := range blockId { - blockIdRule = append(blockIdRule, blockIdItem) - } - var proverRule []interface{} - for _, proverItem := range prover { - proverRule = append(proverRule, proverItem) - } - - logs, sub, err := _LibVerifying.contract.FilterLogs(opts, "BlockVerifiedV2", blockIdRule, proverRule) - if err != nil { - return nil, err - } - return &LibVerifyingBlockVerifiedV2Iterator{contract: _LibVerifying.contract, event: "BlockVerifiedV2", logs: logs, sub: sub}, nil -} - -// WatchBlockVerifiedV2 is a free log subscription operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. -// -// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) -func (_LibVerifying *LibVerifyingFilterer) WatchBlockVerifiedV2(opts *bind.WatchOpts, sink chan<- *LibVerifyingBlockVerifiedV2, blockId []*big.Int, prover []common.Address) (event.Subscription, error) { - - var blockIdRule []interface{} - for _, blockIdItem := range blockId { - blockIdRule = append(blockIdRule, blockIdItem) - } - var proverRule []interface{} - for _, proverItem := range prover { - proverRule = append(proverRule, proverItem) - } - - logs, sub, err := _LibVerifying.contract.WatchLogs(opts, "BlockVerifiedV2", blockIdRule, proverRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(LibVerifyingBlockVerifiedV2) - if err := _LibVerifying.contract.UnpackLog(event, "BlockVerifiedV2", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseBlockVerifiedV2 is a log parse operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. -// -// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) -func (_LibVerifying *LibVerifyingFilterer) ParseBlockVerifiedV2(log types.Log) (*LibVerifyingBlockVerifiedV2, error) { - event := new(LibVerifyingBlockVerifiedV2) - if err := _LibVerifying.contract.UnpackLog(event, "BlockVerifiedV2", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// LibVerifyingBondCreditedIterator is returned from FilterBondCredited and is used to iterate over the raw logs and unpacked data for BondCredited events raised by the LibVerifying contract. -type LibVerifyingBondCreditedIterator struct { - Event *LibVerifyingBondCredited // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *LibVerifyingBondCreditedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(LibVerifyingBondCredited) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(LibVerifyingBondCredited) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *LibVerifyingBondCreditedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *LibVerifyingBondCreditedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// LibVerifyingBondCredited represents a BondCredited event raised by the LibVerifying contract. -type LibVerifyingBondCredited struct { - User common.Address - BlockId *big.Int - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterBondCredited is a free log retrieval operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. -// -// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) -func (_LibVerifying *LibVerifyingFilterer) FilterBondCredited(opts *bind.FilterOpts, user []common.Address) (*LibVerifyingBondCreditedIterator, error) { - - var userRule []interface{} - for _, userItem := range user { - userRule = append(userRule, userItem) - } - - logs, sub, err := _LibVerifying.contract.FilterLogs(opts, "BondCredited", userRule) - if err != nil { - return nil, err - } - return &LibVerifyingBondCreditedIterator{contract: _LibVerifying.contract, event: "BondCredited", logs: logs, sub: sub}, nil -} - -// WatchBondCredited is a free log subscription operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. -// -// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) -func (_LibVerifying *LibVerifyingFilterer) WatchBondCredited(opts *bind.WatchOpts, sink chan<- *LibVerifyingBondCredited, user []common.Address) (event.Subscription, error) { - - var userRule []interface{} - for _, userItem := range user { - userRule = append(userRule, userItem) - } - - logs, sub, err := _LibVerifying.contract.WatchLogs(opts, "BondCredited", userRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(LibVerifyingBondCredited) - if err := _LibVerifying.contract.UnpackLog(event, "BondCredited", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseBondCredited is a log parse operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. -// -// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) -func (_LibVerifying *LibVerifyingFilterer) ParseBondCredited(log types.Log) (*LibVerifyingBondCredited, error) { - event := new(LibVerifyingBondCredited) - if err := _LibVerifying.contract.UnpackLog(event, "BondCredited", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/packages/taiko-client/bindings/gen_taiko_l1.go b/packages/taiko-client/bindings/gen_taiko_l1.go index f916929026e..c50544445ba 100644 --- a/packages/taiko-client/bindings/gen_taiko_l1.go +++ b/packages/taiko-client/bindings/gen_taiko_l1.go @@ -169,7 +169,7 @@ type TaikoDataTransitionState struct { // TaikoL1ClientMetaData contains all meta data concerning the TaikoL1Client contract. var TaikoL1ClientMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"addressManager\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"bondBalanceOf\",\"inputs\":[{\"name\":\"_user\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"depositBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getBlock\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"blk_\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.Block\",\"components\":[{\"name\":\"metaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"assignedProver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"nextTransitionId\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"verifiedTransitionId\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getBlockV2\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"blk_\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.BlockV2\",\"components\":[{\"name\":\"metaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"assignedProver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"nextTransitionId\",\"type\":\"uint24\",\"internalType\":\"uint24\"},{\"name\":\"livenessBondReturned\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"verifiedTransitionId\",\"type\":\"uint24\",\"internalType\":\"uint24\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConfig\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.Config\",\"components\":[{\"name\":\"chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockMaxProposals\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockRingBufferSize\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxBlocksToVerify\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockMaxGasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"stateRootSyncInternal\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"maxAnchorHeightOffset\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]},{\"name\":\"ontakeForkHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getLastSyncedBlock\",\"inputs\":[],\"outputs\":[{\"name\":\"blockId_\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockHash_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"verifiedAt_\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLastVerifiedBlock\",\"inputs\":[],\"outputs\":[{\"name\":\"blockId_\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockHash_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"verifiedAt_\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStateVariables\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotA\",\"components\":[{\"name\":\"genesisHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"genesisTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSyncedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSynecdAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotB\",\"components\":[{\"name\":\"numBlocks\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"provingPaused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"__reservedB1\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"__reservedB2\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reservedB3\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"lastUnpausedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransition\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_tid\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.TransitionState\",\"components\":[{\"name\":\"key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contester\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"tier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reserved1\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransition\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.TransitionState\",\"components\":[{\"name\":\"key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contester\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"tier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reserved1\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransitions\",\"inputs\":[{\"name\":\"_blockIds\",\"type\":\"uint64[]\",\"internalType\":\"uint64[]\"},{\"name\":\"_parentHashes\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple[]\",\"internalType\":\"structTaikoData.TransitionState[]\",\"components\":[{\"name\":\"key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contester\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"tier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reserved1\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getVerifiedBlockProver\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"prover_\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"impl\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"inNonReentrant\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"init\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_rollupAddressManager\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_genesisBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_toPause\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"init2\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"init3\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"lastUnpausedAt\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"pauseProving\",\"inputs\":[{\"name\":\"_pause\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pendingOwner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposeBlockV2\",\"inputs\":[{\"name\":\"_params\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_txList\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"meta_\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proposeBlocksV2\",\"inputs\":[{\"name\":\"_paramsArr\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"_txListArr\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[{\"name\":\"metaArr_\",\"type\":\"tuple[]\",\"internalType\":\"structTaikoData.BlockMetadataV2[]\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proveBlock\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_input\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proveBlocks\",\"inputs\":[{\"name\":\"_blockIds\",\"type\":\"uint64[]\",\"internalType\":\"uint64[]\"},{\"name\":\"_inputs\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"_batchProof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"state\",\"inputs\":[],\"outputs\":[{\"name\":\"__reserve1\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"slotA\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotA\",\"components\":[{\"name\":\"genesisHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"genesisTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSyncedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSynecdAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"slotB\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotB\",\"components\":[{\"name\":\"numBlocks\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"provingPaused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"__reservedB1\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"__reservedB2\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reservedB3\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"lastUnpausedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeTo\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"verifyBlocks\",\"inputs\":[{\"name\":\"_maxBlocksToVerify\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AdminChanged\",\"inputs\":[{\"name\":\"previousAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"newAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BeaconUpgraded\",\"inputs\":[{\"name\":\"beacon\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockProposed\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"assignedProver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadata\",\"components\":[{\"name\":\"l1Hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"depositsHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"l1Height\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"name\":\"depositsProcessed\",\"type\":\"tuple[]\",\"indexed\":false,\"internalType\":\"structTaikoData.EthDeposit[]\",\"components\":[{\"name\":\"recipient\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockProposedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockVerified\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockVerifiedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockVerifiedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondCredited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDebited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDeposited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDeposited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondWithdrawn\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondWithdrawn\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CalldataTxList\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"txList\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferStarted\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ProvingPaused\",\"inputs\":[{\"name\":\"paused\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ProvingPaused\",\"inputs\":[{\"name\":\"paused\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StateVariablesUpdated\",\"inputs\":[{\"name\":\"slotB\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.SlotB\",\"components\":[{\"name\":\"numBlocks\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"provingPaused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"__reservedB1\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"__reservedB2\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reservedB3\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"lastUnpausedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContested\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContestedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProved\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProvedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"FUNC_NOT_IMPLEMENTED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_FORK_HEIGHT_ERROR\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_BLOCK_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_GENESIS_HASH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PARAMS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_PROVING_PAUSED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TRANSITION_NOT_FOUND\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"REENTRANT_CALL\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_DENIED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_INVALID_MANAGER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_UNEXPECTED_CHAINID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_ZERO_ADDR\",\"inputs\":[{\"name\":\"chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ZERO_ADDRESS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ZERO_VALUE\",\"inputs\":[]}]", + ABI: "[{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"addressManager\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"bondBalanceOf\",\"inputs\":[{\"name\":\"_user\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"depositBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getBlock\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"blk_\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.Block\",\"components\":[{\"name\":\"metaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"assignedProver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"nextTransitionId\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"verifiedTransitionId\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getBlockV2\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"blk_\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.BlockV2\",\"components\":[{\"name\":\"metaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"assignedProver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"nextTransitionId\",\"type\":\"uint24\",\"internalType\":\"uint24\"},{\"name\":\"livenessBondReturned\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"verifiedTransitionId\",\"type\":\"uint24\",\"internalType\":\"uint24\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConfig\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.Config\",\"components\":[{\"name\":\"chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockMaxProposals\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockRingBufferSize\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxBlocksToVerify\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockMaxGasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"stateRootSyncInternal\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"maxAnchorHeightOffset\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]},{\"name\":\"ontakeForkHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getLastSyncedBlock\",\"inputs\":[],\"outputs\":[{\"name\":\"blockId_\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockHash_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"verifiedAt_\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLastVerifiedBlock\",\"inputs\":[],\"outputs\":[{\"name\":\"blockId_\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockHash_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"verifiedAt_\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStateVariables\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotA\",\"components\":[{\"name\":\"genesisHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"genesisTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSyncedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSynecdAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotB\",\"components\":[{\"name\":\"numBlocks\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"provingPaused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"__reservedB1\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"__reservedB2\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reservedB3\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"lastUnpausedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransition\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_tid\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.TransitionState\",\"components\":[{\"name\":\"key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contester\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"tier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reserved1\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransition\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.TransitionState\",\"components\":[{\"name\":\"key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contester\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"tier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reserved1\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransitions\",\"inputs\":[{\"name\":\"_blockIds\",\"type\":\"uint64[]\",\"internalType\":\"uint64[]\"},{\"name\":\"_parentHashes\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple[]\",\"internalType\":\"structTaikoData.TransitionState[]\",\"components\":[{\"name\":\"key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contester\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"tier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reserved1\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getVerifiedBlockProver\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"prover_\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"impl\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"inNonReentrant\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"init\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_rollupAddressManager\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_genesisBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_toPause\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"init2\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"init3\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"lastUnpausedAt\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"pauseProving\",\"inputs\":[{\"name\":\"_pause\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pendingOwner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposeBlockV2\",\"inputs\":[{\"name\":\"_params\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_txList\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"meta_\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proposeBlocksV2\",\"inputs\":[{\"name\":\"_paramsArr\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"_txListArr\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[{\"name\":\"metaArr_\",\"type\":\"tuple[]\",\"internalType\":\"structTaikoData.BlockMetadataV2[]\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proveBlock\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_input\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proveBlocks\",\"inputs\":[{\"name\":\"_blockIds\",\"type\":\"uint64[]\",\"internalType\":\"uint64[]\"},{\"name\":\"_inputs\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"_batchProof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"state\",\"inputs\":[],\"outputs\":[{\"name\":\"__reserve1\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"slotA\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotA\",\"components\":[{\"name\":\"genesisHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"genesisTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSyncedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSynecdAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"slotB\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotB\",\"components\":[{\"name\":\"numBlocks\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"provingPaused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"__reservedB1\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"__reservedB2\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reservedB3\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"lastUnpausedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeTo\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"verifyBlocks\",\"inputs\":[{\"name\":\"_maxBlocksToVerify\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AdminChanged\",\"inputs\":[{\"name\":\"previousAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"newAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BeaconUpgraded\",\"inputs\":[{\"name\":\"beacon\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockProposed\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"assignedProver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadata\",\"components\":[{\"name\":\"l1Hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"depositsHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"l1Height\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"name\":\"depositsProcessed\",\"type\":\"tuple[]\",\"indexed\":false,\"internalType\":\"structTaikoData.EthDeposit[]\",\"components\":[{\"name\":\"recipient\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockProposedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockProposedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockVerified\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockVerifiedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockVerifiedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondCredited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondCredited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDebited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDebited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDeposited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDeposited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondWithdrawn\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CalldataTxList\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"txList\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CalldataTxList\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"txList\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferStarted\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ProvingPaused\",\"inputs\":[{\"name\":\"paused\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StateVariablesUpdated\",\"inputs\":[{\"name\":\"slotB\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.SlotB\",\"components\":[{\"name\":\"numBlocks\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"provingPaused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"__reservedB1\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"__reservedB2\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reservedB3\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"lastUnpausedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContested\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContestedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProved\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProvedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"FUNC_NOT_IMPLEMENTED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_AVAILABLE\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_FOUND\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOCK_MISMATCH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_FORK_HEIGHT_ERROR\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_FORK_HEIGHT_ERROR\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_ANCHOR_BLOCK\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_BLOCK_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_CUSTOM_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PARAMS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TIMESTAMP\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_PROVING_PAUSED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TOO_MANY_BLOCKS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TRANSITION_ID_ZERO\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TRANSITION_NOT_FOUND\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_PARENT\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"REENTRANT_CALL\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_DENIED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_INVALID_MANAGER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_UNEXPECTED_CHAINID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_ZERO_ADDR\",\"inputs\":[{\"name\":\"chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ZERO_ADDRESS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ZERO_VALUE\",\"inputs\":[]}]", } // TaikoL1ClientABI is the input ABI used to generate the binding from. @@ -2026,6 +2026,151 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBlockProposedV2(log types.Log) return event, nil } +// TaikoL1ClientBlockProposedV20Iterator is returned from FilterBlockProposedV20 and is used to iterate over the raw logs and unpacked data for BlockProposedV20 events raised by the TaikoL1Client contract. +type TaikoL1ClientBlockProposedV20Iterator struct { + Event *TaikoL1ClientBlockProposedV20 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBlockProposedV20Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockProposedV20) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockProposedV20) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBlockProposedV20Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBlockProposedV20Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBlockProposedV20 represents a BlockProposedV20 event raised by the TaikoL1Client contract. +type TaikoL1ClientBlockProposedV20 struct { + BlockId *big.Int + Meta TaikoDataBlockMetadataV2 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockProposedV20 is a free log retrieval operation binding the contract event 0xefe9c6c0b5cbd9c0eed2d1e9c00cfc1a010d6f1aff50f7facd665a639b622b26. +// +// Solidity: event BlockProposedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBlockProposedV20(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientBlockProposedV20Iterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BlockProposedV20", blockIdRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBlockProposedV20Iterator{contract: _TaikoL1Client.contract, event: "BlockProposedV20", logs: logs, sub: sub}, nil +} + +// WatchBlockProposedV20 is a free log subscription operation binding the contract event 0xefe9c6c0b5cbd9c0eed2d1e9c00cfc1a010d6f1aff50f7facd665a639b622b26. +// +// Solidity: event BlockProposedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBlockProposedV20(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBlockProposedV20, blockId []*big.Int) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BlockProposedV20", blockIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBlockProposedV20) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockProposedV20", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockProposedV20 is a log parse operation binding the contract event 0xefe9c6c0b5cbd9c0eed2d1e9c00cfc1a010d6f1aff50f7facd665a639b622b26. +// +// Solidity: event BlockProposedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBlockProposedV20(log types.Log) (*TaikoL1ClientBlockProposedV20, error) { + event := new(TaikoL1ClientBlockProposedV20) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockProposedV20", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // TaikoL1ClientBlockVerifiedIterator is returned from FilterBlockVerified and is used to iterate over the raw logs and unpacked data for BlockVerified events raised by the TaikoL1Client contract. type TaikoL1ClientBlockVerifiedIterator struct { Event *TaikoL1ClientBlockVerified // Event containing the contract specifics and raw log @@ -2492,9 +2637,301 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBlockVerifiedV20(log types.Log return event, nil } -// TaikoL1ClientBondCreditedIterator is returned from FilterBondCredited and is used to iterate over the raw logs and unpacked data for BondCredited events raised by the TaikoL1Client contract. -type TaikoL1ClientBondCreditedIterator struct { - Event *TaikoL1ClientBondCredited // Event containing the contract specifics and raw log +// TaikoL1ClientBondCreditedIterator is returned from FilterBondCredited and is used to iterate over the raw logs and unpacked data for BondCredited events raised by the TaikoL1Client contract. +type TaikoL1ClientBondCreditedIterator struct { + Event *TaikoL1ClientBondCredited // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBondCreditedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondCredited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondCredited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBondCreditedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBondCreditedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBondCredited represents a BondCredited event raised by the TaikoL1Client contract. +type TaikoL1ClientBondCredited struct { + User common.Address + BlockId *big.Int + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBondCredited is a free log retrieval operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondCredited(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondCreditedIterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondCredited", userRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBondCreditedIterator{contract: _TaikoL1Client.contract, event: "BondCredited", logs: logs, sub: sub}, nil +} + +// WatchBondCredited is a free log subscription operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondCredited(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondCredited, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondCredited", userRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBondCredited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBondCredited is a log parse operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondCredited(log types.Log) (*TaikoL1ClientBondCredited, error) { + event := new(TaikoL1ClientBondCredited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBondCredited0Iterator is returned from FilterBondCredited0 and is used to iterate over the raw logs and unpacked data for BondCredited0 events raised by the TaikoL1Client contract. +type TaikoL1ClientBondCredited0Iterator struct { + Event *TaikoL1ClientBondCredited0 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBondCredited0Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondCredited0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondCredited0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBondCredited0Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBondCredited0Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBondCredited0 represents a BondCredited0 event raised by the TaikoL1Client contract. +type TaikoL1ClientBondCredited0 struct { + User common.Address + BlockId *big.Int + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBondCredited0 is a free log retrieval operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondCredited0(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondCredited0Iterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondCredited0", userRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBondCredited0Iterator{contract: _TaikoL1Client.contract, event: "BondCredited0", logs: logs, sub: sub}, nil +} + +// WatchBondCredited0 is a free log subscription operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondCredited0(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondCredited0, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondCredited0", userRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBondCredited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited0", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBondCredited0 is a log parse operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondCredited0(log types.Log) (*TaikoL1ClientBondCredited0, error) { + event := new(TaikoL1ClientBondCredited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited0", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBondDebitedIterator is returned from FilterBondDebited and is used to iterate over the raw logs and unpacked data for BondDebited events raised by the TaikoL1Client contract. +type TaikoL1ClientBondDebitedIterator struct { + Event *TaikoL1ClientBondDebited // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2508,7 +2945,7 @@ type TaikoL1ClientBondCreditedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *TaikoL1ClientBondCreditedIterator) Next() bool { +func (it *TaikoL1ClientBondDebitedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2517,7 +2954,7 @@ func (it *TaikoL1ClientBondCreditedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(TaikoL1ClientBondCredited) + it.Event = new(TaikoL1ClientBondDebited) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2532,7 +2969,7 @@ func (it *TaikoL1ClientBondCreditedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(TaikoL1ClientBondCredited) + it.Event = new(TaikoL1ClientBondDebited) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2548,53 +2985,53 @@ func (it *TaikoL1ClientBondCreditedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *TaikoL1ClientBondCreditedIterator) Error() error { +func (it *TaikoL1ClientBondDebitedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *TaikoL1ClientBondCreditedIterator) Close() error { +func (it *TaikoL1ClientBondDebitedIterator) Close() error { it.sub.Unsubscribe() return nil } -// TaikoL1ClientBondCredited represents a BondCredited event raised by the TaikoL1Client contract. -type TaikoL1ClientBondCredited struct { +// TaikoL1ClientBondDebited represents a BondDebited event raised by the TaikoL1Client contract. +type TaikoL1ClientBondDebited struct { User common.Address BlockId *big.Int Amount *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterBondCredited is a free log retrieval operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// FilterBondDebited is a free log retrieval operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. // -// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) -func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondCredited(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondCreditedIterator, error) { +// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondDebited(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondDebitedIterator, error) { var userRule []interface{} for _, userItem := range user { userRule = append(userRule, userItem) } - logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondCredited", userRule) + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondDebited", userRule) if err != nil { return nil, err } - return &TaikoL1ClientBondCreditedIterator{contract: _TaikoL1Client.contract, event: "BondCredited", logs: logs, sub: sub}, nil + return &TaikoL1ClientBondDebitedIterator{contract: _TaikoL1Client.contract, event: "BondDebited", logs: logs, sub: sub}, nil } -// WatchBondCredited is a free log subscription operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// WatchBondDebited is a free log subscription operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. // -// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) -func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondCredited(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondCredited, user []common.Address) (event.Subscription, error) { +// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondDebited(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondDebited, user []common.Address) (event.Subscription, error) { var userRule []interface{} for _, userItem := range user { userRule = append(userRule, userItem) } - logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondCredited", userRule) + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondDebited", userRule) if err != nil { return nil, err } @@ -2604,8 +3041,8 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondCredited(opts *bind.WatchO select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(TaikoL1ClientBondCredited) - if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited", log); err != nil { + event := new(TaikoL1ClientBondDebited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited", log); err != nil { return err } event.Raw = log @@ -2626,21 +3063,21 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondCredited(opts *bind.WatchO }), nil } -// ParseBondCredited is a log parse operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// ParseBondDebited is a log parse operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. // -// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) -func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondCredited(log types.Log) (*TaikoL1ClientBondCredited, error) { - event := new(TaikoL1ClientBondCredited) - if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited", log); err != nil { +// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondDebited(log types.Log) (*TaikoL1ClientBondDebited, error) { + event := new(TaikoL1ClientBondDebited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited", log); err != nil { return nil, err } event.Raw = log return event, nil } -// TaikoL1ClientBondDebitedIterator is returned from FilterBondDebited and is used to iterate over the raw logs and unpacked data for BondDebited events raised by the TaikoL1Client contract. -type TaikoL1ClientBondDebitedIterator struct { - Event *TaikoL1ClientBondDebited // Event containing the contract specifics and raw log +// TaikoL1ClientBondDebited0Iterator is returned from FilterBondDebited0 and is used to iterate over the raw logs and unpacked data for BondDebited0 events raised by the TaikoL1Client contract. +type TaikoL1ClientBondDebited0Iterator struct { + Event *TaikoL1ClientBondDebited0 // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -2654,7 +3091,7 @@ type TaikoL1ClientBondDebitedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *TaikoL1ClientBondDebitedIterator) Next() bool { +func (it *TaikoL1ClientBondDebited0Iterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -2663,7 +3100,7 @@ func (it *TaikoL1ClientBondDebitedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(TaikoL1ClientBondDebited) + it.Event = new(TaikoL1ClientBondDebited0) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2678,7 +3115,7 @@ func (it *TaikoL1ClientBondDebitedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(TaikoL1ClientBondDebited) + it.Event = new(TaikoL1ClientBondDebited0) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -2694,53 +3131,53 @@ func (it *TaikoL1ClientBondDebitedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *TaikoL1ClientBondDebitedIterator) Error() error { +func (it *TaikoL1ClientBondDebited0Iterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *TaikoL1ClientBondDebitedIterator) Close() error { +func (it *TaikoL1ClientBondDebited0Iterator) Close() error { it.sub.Unsubscribe() return nil } -// TaikoL1ClientBondDebited represents a BondDebited event raised by the TaikoL1Client contract. -type TaikoL1ClientBondDebited struct { +// TaikoL1ClientBondDebited0 represents a BondDebited0 event raised by the TaikoL1Client contract. +type TaikoL1ClientBondDebited0 struct { User common.Address BlockId *big.Int Amount *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterBondDebited is a free log retrieval operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. +// FilterBondDebited0 is a free log retrieval operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. // // Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) -func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondDebited(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondDebitedIterator, error) { +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondDebited0(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondDebited0Iterator, error) { var userRule []interface{} for _, userItem := range user { userRule = append(userRule, userItem) } - logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondDebited", userRule) + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondDebited0", userRule) if err != nil { return nil, err } - return &TaikoL1ClientBondDebitedIterator{contract: _TaikoL1Client.contract, event: "BondDebited", logs: logs, sub: sub}, nil + return &TaikoL1ClientBondDebited0Iterator{contract: _TaikoL1Client.contract, event: "BondDebited0", logs: logs, sub: sub}, nil } -// WatchBondDebited is a free log subscription operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. +// WatchBondDebited0 is a free log subscription operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. // // Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) -func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondDebited(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondDebited, user []common.Address) (event.Subscription, error) { +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondDebited0(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondDebited0, user []common.Address) (event.Subscription, error) { var userRule []interface{} for _, userItem := range user { userRule = append(userRule, userItem) } - logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondDebited", userRule) + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondDebited0", userRule) if err != nil { return nil, err } @@ -2750,8 +3187,8 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondDebited(opts *bind.WatchOp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(TaikoL1ClientBondDebited) - if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited", log); err != nil { + event := new(TaikoL1ClientBondDebited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited0", log); err != nil { return err } event.Raw = log @@ -2772,12 +3209,12 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondDebited(opts *bind.WatchOp }), nil } -// ParseBondDebited is a log parse operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. +// ParseBondDebited0 is a log parse operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. // // Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) -func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondDebited(log types.Log) (*TaikoL1ClientBondDebited, error) { - event := new(TaikoL1ClientBondDebited) - if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited", log); err != nil { +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondDebited0(log types.Log) (*TaikoL1ClientBondDebited0, error) { + event := new(TaikoL1ClientBondDebited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited0", log); err != nil { return nil, err } event.Raw = log @@ -3219,9 +3656,9 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondWithdrawn(log types.Log) ( return event, nil } -// TaikoL1ClientBondWithdrawn0Iterator is returned from FilterBondWithdrawn0 and is used to iterate over the raw logs and unpacked data for BondWithdrawn0 events raised by the TaikoL1Client contract. -type TaikoL1ClientBondWithdrawn0Iterator struct { - Event *TaikoL1ClientBondWithdrawn0 // Event containing the contract specifics and raw log +// TaikoL1ClientCalldataTxListIterator is returned from FilterCalldataTxList and is used to iterate over the raw logs and unpacked data for CalldataTxList events raised by the TaikoL1Client contract. +type TaikoL1ClientCalldataTxListIterator struct { + Event *TaikoL1ClientCalldataTxList // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3235,7 +3672,7 @@ type TaikoL1ClientBondWithdrawn0Iterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *TaikoL1ClientBondWithdrawn0Iterator) Next() bool { +func (it *TaikoL1ClientCalldataTxListIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3244,7 +3681,7 @@ func (it *TaikoL1ClientBondWithdrawn0Iterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(TaikoL1ClientBondWithdrawn0) + it.Event = new(TaikoL1ClientCalldataTxList) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3259,7 +3696,7 @@ func (it *TaikoL1ClientBondWithdrawn0Iterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(TaikoL1ClientBondWithdrawn0) + it.Event = new(TaikoL1ClientCalldataTxList) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3275,52 +3712,52 @@ func (it *TaikoL1ClientBondWithdrawn0Iterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *TaikoL1ClientBondWithdrawn0Iterator) Error() error { +func (it *TaikoL1ClientCalldataTxListIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *TaikoL1ClientBondWithdrawn0Iterator) Close() error { +func (it *TaikoL1ClientCalldataTxListIterator) Close() error { it.sub.Unsubscribe() return nil } -// TaikoL1ClientBondWithdrawn0 represents a BondWithdrawn0 event raised by the TaikoL1Client contract. -type TaikoL1ClientBondWithdrawn0 struct { - User common.Address - Amount *big.Int - Raw types.Log // Blockchain specific contextual infos +// TaikoL1ClientCalldataTxList represents a CalldataTxList event raised by the TaikoL1Client contract. +type TaikoL1ClientCalldataTxList struct { + BlockId *big.Int + TxList []byte + Raw types.Log // Blockchain specific contextual infos } -// FilterBondWithdrawn0 is a free log retrieval operation binding the contract event 0x0d41118e36df44efb77a471fc49fb9c0be0406d802ef95520e9fbf606e65b455. +// FilterCalldataTxList is a free log retrieval operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. // -// Solidity: event BondWithdrawn(address indexed user, uint256 amount) -func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondWithdrawn0(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondWithdrawn0Iterator, error) { +// Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterCalldataTxList(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientCalldataTxListIterator, error) { - var userRule []interface{} - for _, userItem := range user { - userRule = append(userRule, userItem) + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) } - logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondWithdrawn0", userRule) + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "CalldataTxList", blockIdRule) if err != nil { return nil, err } - return &TaikoL1ClientBondWithdrawn0Iterator{contract: _TaikoL1Client.contract, event: "BondWithdrawn0", logs: logs, sub: sub}, nil + return &TaikoL1ClientCalldataTxListIterator{contract: _TaikoL1Client.contract, event: "CalldataTxList", logs: logs, sub: sub}, nil } -// WatchBondWithdrawn0 is a free log subscription operation binding the contract event 0x0d41118e36df44efb77a471fc49fb9c0be0406d802ef95520e9fbf606e65b455. +// WatchCalldataTxList is a free log subscription operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. // -// Solidity: event BondWithdrawn(address indexed user, uint256 amount) -func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondWithdrawn0(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondWithdrawn0, user []common.Address) (event.Subscription, error) { +// Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchCalldataTxList(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientCalldataTxList, blockId []*big.Int) (event.Subscription, error) { - var userRule []interface{} - for _, userItem := range user { - userRule = append(userRule, userItem) + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) } - logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondWithdrawn0", userRule) + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "CalldataTxList", blockIdRule) if err != nil { return nil, err } @@ -3330,8 +3767,8 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondWithdrawn0(opts *bind.Watc select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(TaikoL1ClientBondWithdrawn0) - if err := _TaikoL1Client.contract.UnpackLog(event, "BondWithdrawn0", log); err != nil { + event := new(TaikoL1ClientCalldataTxList) + if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList", log); err != nil { return err } event.Raw = log @@ -3352,21 +3789,21 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondWithdrawn0(opts *bind.Watc }), nil } -// ParseBondWithdrawn0 is a log parse operation binding the contract event 0x0d41118e36df44efb77a471fc49fb9c0be0406d802ef95520e9fbf606e65b455. +// ParseCalldataTxList is a log parse operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. // -// Solidity: event BondWithdrawn(address indexed user, uint256 amount) -func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondWithdrawn0(log types.Log) (*TaikoL1ClientBondWithdrawn0, error) { - event := new(TaikoL1ClientBondWithdrawn0) - if err := _TaikoL1Client.contract.UnpackLog(event, "BondWithdrawn0", log); err != nil { +// Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseCalldataTxList(log types.Log) (*TaikoL1ClientCalldataTxList, error) { + event := new(TaikoL1ClientCalldataTxList) + if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList", log); err != nil { return nil, err } event.Raw = log return event, nil } -// TaikoL1ClientCalldataTxListIterator is returned from FilterCalldataTxList and is used to iterate over the raw logs and unpacked data for CalldataTxList events raised by the TaikoL1Client contract. -type TaikoL1ClientCalldataTxListIterator struct { - Event *TaikoL1ClientCalldataTxList // Event containing the contract specifics and raw log +// TaikoL1ClientCalldataTxList0Iterator is returned from FilterCalldataTxList0 and is used to iterate over the raw logs and unpacked data for CalldataTxList0 events raised by the TaikoL1Client contract. +type TaikoL1ClientCalldataTxList0Iterator struct { + Event *TaikoL1ClientCalldataTxList0 // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -3380,7 +3817,7 @@ type TaikoL1ClientCalldataTxListIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *TaikoL1ClientCalldataTxListIterator) Next() bool { +func (it *TaikoL1ClientCalldataTxList0Iterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -3389,7 +3826,7 @@ func (it *TaikoL1ClientCalldataTxListIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(TaikoL1ClientCalldataTxList) + it.Event = new(TaikoL1ClientCalldataTxList0) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3404,7 +3841,7 @@ func (it *TaikoL1ClientCalldataTxListIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(TaikoL1ClientCalldataTxList) + it.Event = new(TaikoL1ClientCalldataTxList0) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -3420,52 +3857,52 @@ func (it *TaikoL1ClientCalldataTxListIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *TaikoL1ClientCalldataTxListIterator) Error() error { +func (it *TaikoL1ClientCalldataTxList0Iterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *TaikoL1ClientCalldataTxListIterator) Close() error { +func (it *TaikoL1ClientCalldataTxList0Iterator) Close() error { it.sub.Unsubscribe() return nil } -// TaikoL1ClientCalldataTxList represents a CalldataTxList event raised by the TaikoL1Client contract. -type TaikoL1ClientCalldataTxList struct { +// TaikoL1ClientCalldataTxList0 represents a CalldataTxList0 event raised by the TaikoL1Client contract. +type TaikoL1ClientCalldataTxList0 struct { BlockId *big.Int TxList []byte Raw types.Log // Blockchain specific contextual infos } -// FilterCalldataTxList is a free log retrieval operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. +// FilterCalldataTxList0 is a free log retrieval operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. // // Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) -func (_TaikoL1Client *TaikoL1ClientFilterer) FilterCalldataTxList(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientCalldataTxListIterator, error) { +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterCalldataTxList0(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientCalldataTxList0Iterator, error) { var blockIdRule []interface{} for _, blockIdItem := range blockId { blockIdRule = append(blockIdRule, blockIdItem) } - logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "CalldataTxList", blockIdRule) + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "CalldataTxList0", blockIdRule) if err != nil { return nil, err } - return &TaikoL1ClientCalldataTxListIterator{contract: _TaikoL1Client.contract, event: "CalldataTxList", logs: logs, sub: sub}, nil + return &TaikoL1ClientCalldataTxList0Iterator{contract: _TaikoL1Client.contract, event: "CalldataTxList0", logs: logs, sub: sub}, nil } -// WatchCalldataTxList is a free log subscription operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. +// WatchCalldataTxList0 is a free log subscription operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. // // Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) -func (_TaikoL1Client *TaikoL1ClientFilterer) WatchCalldataTxList(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientCalldataTxList, blockId []*big.Int) (event.Subscription, error) { +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchCalldataTxList0(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientCalldataTxList0, blockId []*big.Int) (event.Subscription, error) { var blockIdRule []interface{} for _, blockIdItem := range blockId { blockIdRule = append(blockIdRule, blockIdItem) } - logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "CalldataTxList", blockIdRule) + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "CalldataTxList0", blockIdRule) if err != nil { return nil, err } @@ -3475,8 +3912,8 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) WatchCalldataTxList(opts *bind.Watc select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(TaikoL1ClientCalldataTxList) - if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList", log); err != nil { + event := new(TaikoL1ClientCalldataTxList0) + if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList0", log); err != nil { return err } event.Raw = log @@ -3497,12 +3934,12 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) WatchCalldataTxList(opts *bind.Watc }), nil } -// ParseCalldataTxList is a log parse operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. +// ParseCalldataTxList0 is a log parse operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. // // Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) -func (_TaikoL1Client *TaikoL1ClientFilterer) ParseCalldataTxList(log types.Log) (*TaikoL1ClientCalldataTxList, error) { - event := new(TaikoL1ClientCalldataTxList) - if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList", log); err != nil { +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseCalldataTxList0(log types.Log) (*TaikoL1ClientCalldataTxList0, error) { + event := new(TaikoL1ClientCalldataTxList0) + if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList0", log); err != nil { return nil, err } event.Raw = log @@ -4217,140 +4654,6 @@ func (_TaikoL1Client *TaikoL1ClientFilterer) ParseProvingPaused(log types.Log) ( return event, nil } -// TaikoL1ClientProvingPaused0Iterator is returned from FilterProvingPaused0 and is used to iterate over the raw logs and unpacked data for ProvingPaused0 events raised by the TaikoL1Client contract. -type TaikoL1ClientProvingPaused0Iterator struct { - Event *TaikoL1ClientProvingPaused0 // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *TaikoL1ClientProvingPaused0Iterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(TaikoL1ClientProvingPaused0) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(TaikoL1ClientProvingPaused0) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *TaikoL1ClientProvingPaused0Iterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *TaikoL1ClientProvingPaused0Iterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// TaikoL1ClientProvingPaused0 represents a ProvingPaused0 event raised by the TaikoL1Client contract. -type TaikoL1ClientProvingPaused0 struct { - Paused bool - Raw types.Log // Blockchain specific contextual infos -} - -// FilterProvingPaused0 is a free log retrieval operation binding the contract event 0xed64db85835d07c3c990b8ebdd55e32d64e5ed53143b6ef2179e7bfaf17ddc3b. -// -// Solidity: event ProvingPaused(bool paused) -func (_TaikoL1Client *TaikoL1ClientFilterer) FilterProvingPaused0(opts *bind.FilterOpts) (*TaikoL1ClientProvingPaused0Iterator, error) { - - logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "ProvingPaused0") - if err != nil { - return nil, err - } - return &TaikoL1ClientProvingPaused0Iterator{contract: _TaikoL1Client.contract, event: "ProvingPaused0", logs: logs, sub: sub}, nil -} - -// WatchProvingPaused0 is a free log subscription operation binding the contract event 0xed64db85835d07c3c990b8ebdd55e32d64e5ed53143b6ef2179e7bfaf17ddc3b. -// -// Solidity: event ProvingPaused(bool paused) -func (_TaikoL1Client *TaikoL1ClientFilterer) WatchProvingPaused0(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientProvingPaused0) (event.Subscription, error) { - - logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "ProvingPaused0") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(TaikoL1ClientProvingPaused0) - if err := _TaikoL1Client.contract.UnpackLog(event, "ProvingPaused0", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseProvingPaused0 is a log parse operation binding the contract event 0xed64db85835d07c3c990b8ebdd55e32d64e5ed53143b6ef2179e7bfaf17ddc3b. -// -// Solidity: event ProvingPaused(bool paused) -func (_TaikoL1Client *TaikoL1ClientFilterer) ParseProvingPaused0(log types.Log) (*TaikoL1ClientProvingPaused0, error) { - event := new(TaikoL1ClientProvingPaused0) - if err := _TaikoL1Client.contract.UnpackLog(event, "ProvingPaused0", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // TaikoL1ClientStateVariablesUpdatedIterator is returned from FilterStateVariablesUpdated and is used to iterate over the raw logs and unpacked data for StateVariablesUpdated events raised by the TaikoL1Client contract. type TaikoL1ClientStateVariablesUpdatedIterator struct { Event *TaikoL1ClientStateVariablesUpdated // Event containing the contract specifics and raw log diff --git a/packages/taiko-client/bindings/gen_tier_provider.go b/packages/taiko-client/bindings/gen_tier_provider.go index a2dcc851196..70209eb847e 100644 --- a/packages/taiko-client/bindings/gen_tier_provider.go +++ b/packages/taiko-client/bindings/gen_tier_provider.go @@ -31,16 +31,17 @@ var ( // ITierProviderTier is an auto generated low-level Go binding around an user-defined struct. type ITierProviderTier struct { - VerifierName [32]byte - ValidityBond *big.Int - ContestBond *big.Int - CooldownWindow *big.Int - ProvingWindow uint16 + VerifierName [32]byte + ValidityBond *big.Int + ContestBond *big.Int + CooldownWindow *big.Int + ProvingWindow uint16 + MaxBlocksToVerifyPerProof uint8 } // TierProviderMetaData contains all meta data concerning the TierProvider contract. var TierProviderMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"function\",\"name\":\"BOND_UNIT\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"GRACE_PERIOD\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint16\",\"internalType\":\"uint16\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getMinTier\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint16\",\"internalType\":\"uint16\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getProvider\",\"inputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTier\",\"inputs\":[{\"name\":\"_tierId\",\"type\":\"uint16\",\"internalType\":\"uint16\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structITierProvider.Tier\",\"components\":[{\"name\":\"verifierName\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"cooldownWindow\",\"type\":\"uint24\",\"internalType\":\"uint24\"},{\"name\":\"provingWindow\",\"type\":\"uint16\",\"internalType\":\"uint16\"}]}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getTierIds\",\"inputs\":[],\"outputs\":[{\"name\":\"tiers_\",\"type\":\"uint16[]\",\"internalType\":\"uint16[]\"}],\"stateMutability\":\"pure\"},{\"type\":\"error\",\"name\":\"TIER_NOT_FOUND\",\"inputs\":[]}]", + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_daoFallbackProposer\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"BOND_UNIT\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"DAO_FALLBACK_PROPOSER\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"GRACE_PERIOD\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint16\",\"internalType\":\"uint16\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getMinTier\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint16\",\"internalType\":\"uint16\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getProvider\",\"inputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTier\",\"inputs\":[{\"name\":\"_tierId\",\"type\":\"uint16\",\"internalType\":\"uint16\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structITierProvider.Tier\",\"components\":[{\"name\":\"verifierName\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"cooldownWindow\",\"type\":\"uint24\",\"internalType\":\"uint24\"},{\"name\":\"provingWindow\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"maxBlocksToVerifyPerProof\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getTierIds\",\"inputs\":[],\"outputs\":[{\"name\":\"tiers_\",\"type\":\"uint16[]\",\"internalType\":\"uint16[]\"}],\"stateMutability\":\"pure\"},{\"type\":\"error\",\"name\":\"TIER_NOT_FOUND\",\"inputs\":[]}]", } // TierProviderABI is the input ABI used to generate the binding from. @@ -220,6 +221,37 @@ func (_TierProvider *TierProviderCallerSession) BONDUNIT() (*big.Int, error) { return _TierProvider.Contract.BONDUNIT(&_TierProvider.CallOpts) } +// DAOFALLBACKPROPOSER is a free data retrieval call binding the contract method 0xbf62514d. +// +// Solidity: function DAO_FALLBACK_PROPOSER() view returns(address) +func (_TierProvider *TierProviderCaller) DAOFALLBACKPROPOSER(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TierProvider.contract.Call(opts, &out, "DAO_FALLBACK_PROPOSER") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// DAOFALLBACKPROPOSER is a free data retrieval call binding the contract method 0xbf62514d. +// +// Solidity: function DAO_FALLBACK_PROPOSER() view returns(address) +func (_TierProvider *TierProviderSession) DAOFALLBACKPROPOSER() (common.Address, error) { + return _TierProvider.Contract.DAOFALLBACKPROPOSER(&_TierProvider.CallOpts) +} + +// DAOFALLBACKPROPOSER is a free data retrieval call binding the contract method 0xbf62514d. +// +// Solidity: function DAO_FALLBACK_PROPOSER() view returns(address) +func (_TierProvider *TierProviderCallerSession) DAOFALLBACKPROPOSER() (common.Address, error) { + return _TierProvider.Contract.DAOFALLBACKPROPOSER(&_TierProvider.CallOpts) +} + // GRACEPERIOD is a free data retrieval call binding the contract method 0xc1a287e2. // // Solidity: function GRACE_PERIOD() view returns(uint16) @@ -315,7 +347,7 @@ func (_TierProvider *TierProviderCallerSession) GetProvider(arg0 *big.Int) (comm // GetTier is a free data retrieval call binding the contract method 0x576c3de7. // -// Solidity: function getTier(uint16 _tierId) pure returns((bytes32,uint96,uint96,uint24,uint16)) +// Solidity: function getTier(uint16 _tierId) pure returns((bytes32,uint96,uint96,uint24,uint16,uint8)) func (_TierProvider *TierProviderCaller) GetTier(opts *bind.CallOpts, _tierId uint16) (ITierProviderTier, error) { var out []interface{} err := _TierProvider.contract.Call(opts, &out, "getTier", _tierId) @@ -332,14 +364,14 @@ func (_TierProvider *TierProviderCaller) GetTier(opts *bind.CallOpts, _tierId ui // GetTier is a free data retrieval call binding the contract method 0x576c3de7. // -// Solidity: function getTier(uint16 _tierId) pure returns((bytes32,uint96,uint96,uint24,uint16)) +// Solidity: function getTier(uint16 _tierId) pure returns((bytes32,uint96,uint96,uint24,uint16,uint8)) func (_TierProvider *TierProviderSession) GetTier(_tierId uint16) (ITierProviderTier, error) { return _TierProvider.Contract.GetTier(&_TierProvider.CallOpts, _tierId) } // GetTier is a free data retrieval call binding the contract method 0x576c3de7. // -// Solidity: function getTier(uint16 _tierId) pure returns((bytes32,uint96,uint96,uint24,uint16)) +// Solidity: function getTier(uint16 _tierId) pure returns((bytes32,uint96,uint96,uint24,uint16,uint8)) func (_TierProvider *TierProviderCallerSession) GetTier(_tierId uint16) (ITierProviderTier, error) { return _TierProvider.Contract.GetTier(&_TierProvider.CallOpts, _tierId) } From c3665b7c1991c483817b7960f1d3b878b69d3f77 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 3 Nov 2024 22:05:49 +0800 Subject: [PATCH 48/71] feat: update `GetPoolContent` --- .../driver/chain_syncer/blob/soft_block.go | 3 ++ .../driver/chain_syncer/blob/syncer.go | 5 +++ packages/taiko-client/driver/driver_test.go | 3 ++ packages/taiko-client/pkg/rpc/methods.go | 35 ++++++++++++++++--- 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go index 169f5280700..56fb1ede383 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go +++ b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go @@ -32,6 +32,9 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( batchMarker softblocks.TransactionBatchMarker, blockParams *softblocks.SoftBlockParams, ) (*types.Header, error) { + s.mutex.Lock() + defer s.mutex.Unlock() + parent, err := s.rpc.L2.HeaderByNumber(ctx, new(big.Int).Sub(new(big.Int).SetUint64(blockID), common.Big1)) if err != nil { return nil, err diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index 10fd9f14c7f..7075877ecd1 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -6,6 +6,7 @@ import ( "fmt" "math/big" "net/url" + "sync" "time" "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings" @@ -48,6 +49,7 @@ type Syncer struct { reorgDetectedFlag bool maxRetrieveExponent uint64 blobDatasource *rpc.BlobDataSource + mutex *sync.Mutex } // NewSyncer creates a new syncer instance. @@ -88,12 +90,15 @@ func NewSyncer( blobServerEndpoint, socialScanEndpoint, ), + mutex: new(sync.Mutex), }, nil } // ProcessL1Blocks fetches all `TaikoL1.BlockProposed` events between given // L1 block heights, and then tries inserting them into L2 execution engine's blockchain. func (s *Syncer) ProcessL1Blocks(ctx context.Context) error { + s.mutex.Lock() + defer s.mutex.Unlock() for { if err := s.processL1Blocks(ctx); err != nil { return err diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index f3eaa279eca..8883ca83aff 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -445,6 +445,9 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { Post(url.String() + "/softBlocks") s.Nil(err) s.True(res.IsSuccess()) + + // Propose a valid L2 block + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) } func TestDriverTestSuite(t *testing.T) { diff --git a/packages/taiko-client/pkg/rpc/methods.go b/packages/taiko-client/pkg/rpc/methods.go index c793fae5af0..3b40f6be4c9 100644 --- a/packages/taiko-client/pkg/rpc/methods.go +++ b/packages/taiko-client/pkg/rpc/methods.go @@ -374,23 +374,50 @@ func (c *Client) GetPoolContent( ctxWithTimeout, cancel := CtxWithTimeoutOrDefault(ctx, defaultTimeout) defer cancel() - l1Head, err := c.L1.HeaderByNumber(ctx, nil) + // Get the latest L2 block header at first. + l2Head, err := c.L2.HeaderByNumber(ctx, nil) if err != nil { return nil, err } - l2Head, err := c.L2.HeaderByNumber(ctx, nil) + l1Origin, err := c.L2.L1OriginByID(ctx, l2Head.Number) + if err != nil && err.Error() != ethereum.NotFound.Error() { + return nil, err + } + + var ( + L1HeadNum *big.Int + L2HeadNum *big.Int + timestamp = uint64(time.Now().Unix()) + ) + + if l1Origin != nil && l1Origin.IsSoftblock() && !l1Origin.EndOfPreconf && !l1Origin.EndOfBlock { + // Check if this is an unfinished soft block, if not, we will use the latest L1 / L2 block number from the L1Origin. + // Otherwise, we will use the L1 / L2 block number in L1Origin. + L1HeadNum = l1Origin.L1BlockHeight + L2HeadNum = new(big.Int).Sub(l1Origin.BlockID, common.Big1) + } + + l1Head, err := c.L1.HeaderByNumber(ctx, L1HeadNum) if err != nil { return nil, err } + if L2HeadNum != nil { + timestamp = l2Head.Time + l2Head, err = c.L2.HeaderByNumber(ctx, L2HeadNum) + if err != nil { + return nil, err + } + } + baseFee, err := c.CalculateBaseFee( ctx, l2Head, l1Head.Number, - chainConfig.IsOntake(new(big.Int).Add(l2Head.Number, common.Big1)), + true, &chainConfig.ProtocolConfigs.BaseFeeConfig, - uint64(time.Now().Unix()), + timestamp, ) if err != nil { return nil, err From a79ba019c517495f8b0748bb17ea3ba2f5dab19a Mon Sep 17 00:00:00 2001 From: David Date: Mon, 4 Nov 2024 12:45:21 +0800 Subject: [PATCH 49/71] feat: update bindings --- packages/taiko-client/bindings/.githead | 2 +- .../bindings/gen_lib_proposing.go | 1 - .../taiko-client/bindings/gen_taiko_l1.go | 5690 +++++++++++++++++ 3 files changed, 5691 insertions(+), 2 deletions(-) diff --git a/packages/taiko-client/bindings/.githead b/packages/taiko-client/bindings/.githead index e5421357157..317ea121bb9 100644 --- a/packages/taiko-client/bindings/.githead +++ b/packages/taiko-client/bindings/.githead @@ -1 +1 @@ -71cfc5ce1ef06dcf099a4ce9b22bea6100406148 +4adab8b735d7c4dde9a58c3692925e87a580e2d0 diff --git a/packages/taiko-client/bindings/gen_lib_proposing.go b/packages/taiko-client/bindings/gen_lib_proposing.go index 54e935c1666..133643b6ce6 100644 --- a/packages/taiko-client/bindings/gen_lib_proposing.go +++ b/packages/taiko-client/bindings/gen_lib_proposing.go @@ -29,7 +29,6 @@ var ( _ = abi.ConvertType ) - // LibProposingMetaData contains all meta data concerning the LibProposing contract. var LibProposingMetaData = &bind.MetaData{ ABI: "[{\"type\":\"event\",\"name\":\"BlockProposedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CalldataTxList\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"txList\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_AVAILABLE\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_FOUND\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_FORK_HEIGHT_ERROR\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_ANCHOR_BLOCK\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_CUSTOM_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PARAMS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TIMESTAMP\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TOO_MANY_BLOCKS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_PARENT\",\"inputs\":[]}]", diff --git a/packages/taiko-client/bindings/gen_taiko_l1.go b/packages/taiko-client/bindings/gen_taiko_l1.go index e69de29bb2d..1bf4df704ef 100644 --- a/packages/taiko-client/bindings/gen_taiko_l1.go +++ b/packages/taiko-client/bindings/gen_taiko_l1.go @@ -0,0 +1,5690 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package bindings + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// LibSharedDataBaseFeeConfig is an auto generated low-level Go binding around an user-defined struct. +type LibSharedDataBaseFeeConfig struct { + AdjustmentQuotient uint8 + SharingPctg uint8 + GasIssuancePerSecond uint32 + MinGasExcess uint64 + MaxGasIssuancePerBlock uint32 +} + +// TaikoDataBlock is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataBlock struct { + MetaHash [32]byte + AssignedProver common.Address + LivenessBond *big.Int + BlockId uint64 + ProposedAt uint64 + ProposedIn uint64 + NextTransitionId uint32 + VerifiedTransitionId uint32 +} + +// TaikoDataBlockMetadata is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataBlockMetadata struct { + L1Hash [32]byte + Difficulty [32]byte + BlobHash [32]byte + ExtraData [32]byte + DepositsHash [32]byte + Coinbase common.Address + Id uint64 + GasLimit uint32 + Timestamp uint64 + L1Height uint64 + MinTier uint16 + BlobUsed bool + ParentMetaHash [32]byte + Sender common.Address +} + +// TaikoDataBlockMetadataV2 is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataBlockMetadataV2 struct { + AnchorBlockHash [32]byte + Difficulty [32]byte + BlobHash [32]byte + ExtraData [32]byte + Coinbase common.Address + Id uint64 + GasLimit uint32 + Timestamp uint64 + AnchorBlockId uint64 + MinTier uint16 + BlobUsed bool + ParentMetaHash [32]byte + Proposer common.Address + LivenessBond *big.Int + ProposedAt uint64 + ProposedIn uint64 + BlobTxListOffset uint32 + BlobTxListLength uint32 + BlobIndex uint8 + BaseFeeConfig LibSharedDataBaseFeeConfig +} + +// TaikoDataBlockV2 is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataBlockV2 struct { + MetaHash [32]byte + AssignedProver common.Address + LivenessBond *big.Int + BlockId uint64 + ProposedAt uint64 + ProposedIn uint64 + NextTransitionId *big.Int + LivenessBondReturned bool + VerifiedTransitionId *big.Int +} + +// TaikoDataConfig is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataConfig struct { + ChainId uint64 + BlockMaxProposals uint64 + BlockRingBufferSize uint64 + MaxBlocksToVerify uint64 + BlockMaxGasLimit uint32 + LivenessBond *big.Int + StateRootSyncInternal uint8 + MaxAnchorHeightOffset uint64 + BaseFeeConfig LibSharedDataBaseFeeConfig + OntakeForkHeight uint64 +} + +// TaikoDataEthDeposit is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataEthDeposit struct { + Recipient common.Address + Amount *big.Int + Id uint64 +} + +// TaikoDataSlotA is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataSlotA struct { + GenesisHeight uint64 + GenesisTimestamp uint64 + LastSyncedBlockId uint64 + LastSynecdAt uint64 +} + +// TaikoDataSlotB is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataSlotB struct { + NumBlocks uint64 + LastVerifiedBlockId uint64 + ProvingPaused bool + LastProposedIn *big.Int + LastUnpausedAt uint64 +} + +// TaikoDataTransition is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataTransition struct { + ParentHash [32]byte + BlockHash [32]byte + StateRoot [32]byte + Graffiti [32]byte +} + +// TaikoDataTransitionState is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataTransitionState struct { + Key [32]byte + BlockHash [32]byte + StateRoot [32]byte + Prover common.Address + ValidityBond *big.Int + Contester common.Address + ContestBond *big.Int + Timestamp uint64 + Tier uint16 + Reserved1 uint8 +} + +// TaikoL1ClientMetaData contains all meta data concerning the TaikoL1Client contract. +var TaikoL1ClientMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"addressManager\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"bondBalanceOf\",\"inputs\":[{\"name\":\"_user\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"depositBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"getBlock\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"blk_\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.Block\",\"components\":[{\"name\":\"metaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"assignedProver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"nextTransitionId\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"verifiedTransitionId\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getBlockV2\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"blk_\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.BlockV2\",\"components\":[{\"name\":\"metaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"assignedProver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"nextTransitionId\",\"type\":\"uint24\",\"internalType\":\"uint24\"},{\"name\":\"livenessBondReturned\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"verifiedTransitionId\",\"type\":\"uint24\",\"internalType\":\"uint24\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConfig\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.Config\",\"components\":[{\"name\":\"chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockMaxProposals\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockRingBufferSize\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxBlocksToVerify\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockMaxGasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"stateRootSyncInternal\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"maxAnchorHeightOffset\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]},{\"name\":\"ontakeForkHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getLastSyncedBlock\",\"inputs\":[],\"outputs\":[{\"name\":\"blockId_\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockHash_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"verifiedAt_\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLastVerifiedBlock\",\"inputs\":[],\"outputs\":[{\"name\":\"blockId_\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blockHash_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"verifiedAt_\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStateVariables\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotA\",\"components\":[{\"name\":\"genesisHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"genesisTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSyncedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSynecdAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotB\",\"components\":[{\"name\":\"numBlocks\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"provingPaused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"lastProposedIn\",\"type\":\"uint56\",\"internalType\":\"uint56\"},{\"name\":\"lastUnpausedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransition\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_tid\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.TransitionState\",\"components\":[{\"name\":\"key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contester\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"tier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reserved1\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransition\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.TransitionState\",\"components\":[{\"name\":\"key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contester\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"tier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reserved1\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransitions\",\"inputs\":[{\"name\":\"_blockIds\",\"type\":\"uint64[]\",\"internalType\":\"uint64[]\"},{\"name\":\"_parentHashes\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple[]\",\"internalType\":\"structTaikoData.TransitionState[]\",\"components\":[{\"name\":\"key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"contester\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"tier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"__reserved1\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getVerifiedBlockProver\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"prover_\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"impl\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"inNonReentrant\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"init\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_rollupAddressManager\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_genesisBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_toPause\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"init2\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"init3\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"lastProposedIn\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint56\",\"internalType\":\"uint56\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"lastUnpausedAt\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"pauseProving\",\"inputs\":[{\"name\":\"_pause\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pendingOwner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposeBlockV2\",\"inputs\":[{\"name\":\"_params\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_txList\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"meta_\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proposeBlocksV2\",\"inputs\":[{\"name\":\"_paramsArr\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"_txListArr\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[{\"name\":\"metaArr_\",\"type\":\"tuple[]\",\"internalType\":\"structTaikoData.BlockMetadataV2[]\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proveBlock\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_input\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proveBlocks\",\"inputs\":[{\"name\":\"_blockIds\",\"type\":\"uint64[]\",\"internalType\":\"uint64[]\"},{\"name\":\"_inputs\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"_batchProof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"state\",\"inputs\":[],\"outputs\":[{\"name\":\"__reserve1\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"slotA\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotA\",\"components\":[{\"name\":\"genesisHeight\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"genesisTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSyncedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastSynecdAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"slotB\",\"type\":\"tuple\",\"internalType\":\"structTaikoData.SlotB\",\"components\":[{\"name\":\"numBlocks\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"provingPaused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"lastProposedIn\",\"type\":\"uint56\",\"internalType\":\"uint56\"},{\"name\":\"lastUnpausedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeTo\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"verifyBlocks\",\"inputs\":[{\"name\":\"_maxBlocksToVerify\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AdminChanged\",\"inputs\":[{\"name\":\"previousAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"newAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BeaconUpgraded\",\"inputs\":[{\"name\":\"beacon\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockProposed\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"assignedProver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadata\",\"components\":[{\"name\":\"l1Hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"depositsHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"l1Height\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"name\":\"depositsProcessed\",\"type\":\"tuple[]\",\"indexed\":false,\"internalType\":\"structTaikoData.EthDeposit[]\",\"components\":[{\"name\":\"recipient\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockProposedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockProposedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"meta\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadataV2\",\"components\":[{\"name\":\"anchorBlockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"difficulty\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blobHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extraData\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"coinbase\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"id\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"anchorBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"minTier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"blobUsed\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"parentMetaHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"livenessBond\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"proposedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"blobTxListOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobTxListLength\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobIndex\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"baseFeeConfig\",\"type\":\"tuple\",\"internalType\":\"structLibSharedData.BaseFeeConfig\",\"components\":[{\"name\":\"adjustmentQuotient\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"sharingPctg\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasIssuancePerSecond\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"minGasExcess\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxGasIssuancePerBlock\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockVerified\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockVerifiedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BlockVerifiedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondCredited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondCredited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDebited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDebited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDeposited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondDeposited\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BondWithdrawn\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CalldataTxList\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"txList\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CalldataTxList\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"txList\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferStarted\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ProvingPaused\",\"inputs\":[{\"name\":\"paused\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StateVariablesUpdated\",\"inputs\":[{\"name\":\"slotB\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.SlotB\",\"components\":[{\"name\":\"numBlocks\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"provingPaused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"lastProposedIn\",\"type\":\"uint56\",\"internalType\":\"uint56\"},{\"name\":\"lastUnpausedAt\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContested\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContestedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProved\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProvedV2\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"},{\"name\":\"proposedIn\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"FUNC_NOT_IMPLEMENTED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_AVAILABLE\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOB_NOT_FOUND\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOCK_MISMATCH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_FORK_HEIGHT_ERROR\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_FORK_HEIGHT_ERROR\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_ANCHOR_BLOCK\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_BLOCK_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_CUSTOM_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_MSG_VALUE\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PARAMS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PROPOSER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TIMESTAMP\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_PROVING_PAUSED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TOO_MANY_BLOCKS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TRANSITION_ID_ZERO\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_TRANSITION_NOT_FOUND\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_PARENT\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"REENTRANT_CALL\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_DENIED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_INVALID_MANAGER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_UNEXPECTED_CHAINID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_ZERO_ADDR\",\"inputs\":[{\"name\":\"chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ZERO_ADDRESS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ZERO_VALUE\",\"inputs\":[]}]", +} + +// TaikoL1ClientABI is the input ABI used to generate the binding from. +// Deprecated: Use TaikoL1ClientMetaData.ABI instead. +var TaikoL1ClientABI = TaikoL1ClientMetaData.ABI + +// TaikoL1Client is an auto generated Go binding around an Ethereum contract. +type TaikoL1Client struct { + TaikoL1ClientCaller // Read-only binding to the contract + TaikoL1ClientTransactor // Write-only binding to the contract + TaikoL1ClientFilterer // Log filterer for contract events +} + +// TaikoL1ClientCaller is an auto generated read-only Go binding around an Ethereum contract. +type TaikoL1ClientCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TaikoL1ClientTransactor is an auto generated write-only Go binding around an Ethereum contract. +type TaikoL1ClientTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TaikoL1ClientFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type TaikoL1ClientFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TaikoL1ClientSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type TaikoL1ClientSession struct { + Contract *TaikoL1Client // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TaikoL1ClientCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type TaikoL1ClientCallerSession struct { + Contract *TaikoL1ClientCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// TaikoL1ClientTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type TaikoL1ClientTransactorSession struct { + Contract *TaikoL1ClientTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TaikoL1ClientRaw is an auto generated low-level Go binding around an Ethereum contract. +type TaikoL1ClientRaw struct { + Contract *TaikoL1Client // Generic contract binding to access the raw methods on +} + +// TaikoL1ClientCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type TaikoL1ClientCallerRaw struct { + Contract *TaikoL1ClientCaller // Generic read-only contract binding to access the raw methods on +} + +// TaikoL1ClientTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type TaikoL1ClientTransactorRaw struct { + Contract *TaikoL1ClientTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewTaikoL1Client creates a new instance of TaikoL1Client, bound to a specific deployed contract. +func NewTaikoL1Client(address common.Address, backend bind.ContractBackend) (*TaikoL1Client, error) { + contract, err := bindTaikoL1Client(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &TaikoL1Client{TaikoL1ClientCaller: TaikoL1ClientCaller{contract: contract}, TaikoL1ClientTransactor: TaikoL1ClientTransactor{contract: contract}, TaikoL1ClientFilterer: TaikoL1ClientFilterer{contract: contract}}, nil +} + +// NewTaikoL1ClientCaller creates a new read-only instance of TaikoL1Client, bound to a specific deployed contract. +func NewTaikoL1ClientCaller(address common.Address, caller bind.ContractCaller) (*TaikoL1ClientCaller, error) { + contract, err := bindTaikoL1Client(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &TaikoL1ClientCaller{contract: contract}, nil +} + +// NewTaikoL1ClientTransactor creates a new write-only instance of TaikoL1Client, bound to a specific deployed contract. +func NewTaikoL1ClientTransactor(address common.Address, transactor bind.ContractTransactor) (*TaikoL1ClientTransactor, error) { + contract, err := bindTaikoL1Client(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &TaikoL1ClientTransactor{contract: contract}, nil +} + +// NewTaikoL1ClientFilterer creates a new log filterer instance of TaikoL1Client, bound to a specific deployed contract. +func NewTaikoL1ClientFilterer(address common.Address, filterer bind.ContractFilterer) (*TaikoL1ClientFilterer, error) { + contract, err := bindTaikoL1Client(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &TaikoL1ClientFilterer{contract: contract}, nil +} + +// bindTaikoL1Client binds a generic wrapper to an already deployed contract. +func bindTaikoL1Client(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := TaikoL1ClientMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_TaikoL1Client *TaikoL1ClientRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TaikoL1Client.Contract.TaikoL1ClientCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_TaikoL1Client *TaikoL1ClientRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1Client.Contract.TaikoL1ClientTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TaikoL1Client *TaikoL1ClientRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TaikoL1Client.Contract.TaikoL1ClientTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_TaikoL1Client *TaikoL1ClientCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TaikoL1Client.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_TaikoL1Client *TaikoL1ClientTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1Client.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TaikoL1Client *TaikoL1ClientTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TaikoL1Client.Contract.contract.Transact(opts, method, params...) +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_TaikoL1Client *TaikoL1ClientCaller) AddressManager(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "addressManager") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_TaikoL1Client *TaikoL1ClientSession) AddressManager() (common.Address, error) { + return _TaikoL1Client.Contract.AddressManager(&_TaikoL1Client.CallOpts) +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_TaikoL1Client *TaikoL1ClientCallerSession) AddressManager() (common.Address, error) { + return _TaikoL1Client.Contract.AddressManager(&_TaikoL1Client.CallOpts) +} + +// BondBalanceOf is a free data retrieval call binding the contract method 0xa9c2c835. +// +// Solidity: function bondBalanceOf(address _user) view returns(uint256) +func (_TaikoL1Client *TaikoL1ClientCaller) BondBalanceOf(opts *bind.CallOpts, _user common.Address) (*big.Int, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "bondBalanceOf", _user) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BondBalanceOf is a free data retrieval call binding the contract method 0xa9c2c835. +// +// Solidity: function bondBalanceOf(address _user) view returns(uint256) +func (_TaikoL1Client *TaikoL1ClientSession) BondBalanceOf(_user common.Address) (*big.Int, error) { + return _TaikoL1Client.Contract.BondBalanceOf(&_TaikoL1Client.CallOpts, _user) +} + +// BondBalanceOf is a free data retrieval call binding the contract method 0xa9c2c835. +// +// Solidity: function bondBalanceOf(address _user) view returns(uint256) +func (_TaikoL1Client *TaikoL1ClientCallerSession) BondBalanceOf(_user common.Address) (*big.Int, error) { + return _TaikoL1Client.Contract.BondBalanceOf(&_TaikoL1Client.CallOpts, _user) +} + +// GetBlock is a free data retrieval call binding the contract method 0x5fa15e79. +// +// Solidity: function getBlock(uint64 _blockId) view returns((bytes32,address,uint96,uint64,uint64,uint64,uint32,uint32) blk_) +func (_TaikoL1Client *TaikoL1ClientCaller) GetBlock(opts *bind.CallOpts, _blockId uint64) (TaikoDataBlock, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getBlock", _blockId) + + if err != nil { + return *new(TaikoDataBlock), err + } + + out0 := *abi.ConvertType(out[0], new(TaikoDataBlock)).(*TaikoDataBlock) + + return out0, err + +} + +// GetBlock is a free data retrieval call binding the contract method 0x5fa15e79. +// +// Solidity: function getBlock(uint64 _blockId) view returns((bytes32,address,uint96,uint64,uint64,uint64,uint32,uint32) blk_) +func (_TaikoL1Client *TaikoL1ClientSession) GetBlock(_blockId uint64) (TaikoDataBlock, error) { + return _TaikoL1Client.Contract.GetBlock(&_TaikoL1Client.CallOpts, _blockId) +} + +// GetBlock is a free data retrieval call binding the contract method 0x5fa15e79. +// +// Solidity: function getBlock(uint64 _blockId) view returns((bytes32,address,uint96,uint64,uint64,uint64,uint32,uint32) blk_) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetBlock(_blockId uint64) (TaikoDataBlock, error) { + return _TaikoL1Client.Contract.GetBlock(&_TaikoL1Client.CallOpts, _blockId) +} + +// GetBlockV2 is a free data retrieval call binding the contract method 0x3f0c544a. +// +// Solidity: function getBlockV2(uint64 _blockId) view returns((bytes32,address,uint96,uint64,uint64,uint64,uint24,bool,uint24) blk_) +func (_TaikoL1Client *TaikoL1ClientCaller) GetBlockV2(opts *bind.CallOpts, _blockId uint64) (TaikoDataBlockV2, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getBlockV2", _blockId) + + if err != nil { + return *new(TaikoDataBlockV2), err + } + + out0 := *abi.ConvertType(out[0], new(TaikoDataBlockV2)).(*TaikoDataBlockV2) + + return out0, err + +} + +// GetBlockV2 is a free data retrieval call binding the contract method 0x3f0c544a. +// +// Solidity: function getBlockV2(uint64 _blockId) view returns((bytes32,address,uint96,uint64,uint64,uint64,uint24,bool,uint24) blk_) +func (_TaikoL1Client *TaikoL1ClientSession) GetBlockV2(_blockId uint64) (TaikoDataBlockV2, error) { + return _TaikoL1Client.Contract.GetBlockV2(&_TaikoL1Client.CallOpts, _blockId) +} + +// GetBlockV2 is a free data retrieval call binding the contract method 0x3f0c544a. +// +// Solidity: function getBlockV2(uint64 _blockId) view returns((bytes32,address,uint96,uint64,uint64,uint64,uint24,bool,uint24) blk_) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetBlockV2(_blockId uint64) (TaikoDataBlockV2, error) { + return _TaikoL1Client.Contract.GetBlockV2(&_TaikoL1Client.CallOpts, _blockId) +} + +// GetConfig is a free data retrieval call binding the contract method 0xc3f909d4. +// +// Solidity: function getConfig() pure returns((uint64,uint64,uint64,uint64,uint32,uint96,uint8,uint64,(uint8,uint8,uint32,uint64,uint32),uint64)) +func (_TaikoL1Client *TaikoL1ClientCaller) GetConfig(opts *bind.CallOpts) (TaikoDataConfig, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getConfig") + + if err != nil { + return *new(TaikoDataConfig), err + } + + out0 := *abi.ConvertType(out[0], new(TaikoDataConfig)).(*TaikoDataConfig) + + return out0, err + +} + +// GetConfig is a free data retrieval call binding the contract method 0xc3f909d4. +// +// Solidity: function getConfig() pure returns((uint64,uint64,uint64,uint64,uint32,uint96,uint8,uint64,(uint8,uint8,uint32,uint64,uint32),uint64)) +func (_TaikoL1Client *TaikoL1ClientSession) GetConfig() (TaikoDataConfig, error) { + return _TaikoL1Client.Contract.GetConfig(&_TaikoL1Client.CallOpts) +} + +// GetConfig is a free data retrieval call binding the contract method 0xc3f909d4. +// +// Solidity: function getConfig() pure returns((uint64,uint64,uint64,uint64,uint32,uint96,uint8,uint64,(uint8,uint8,uint32,uint64,uint32),uint64)) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetConfig() (TaikoDataConfig, error) { + return _TaikoL1Client.Contract.GetConfig(&_TaikoL1Client.CallOpts) +} + +// GetLastSyncedBlock is a free data retrieval call binding the contract method 0x9413caa9. +// +// Solidity: function getLastSyncedBlock() view returns(uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_, uint64 verifiedAt_) +func (_TaikoL1Client *TaikoL1ClientCaller) GetLastSyncedBlock(opts *bind.CallOpts) (struct { + BlockId uint64 + BlockHash [32]byte + StateRoot [32]byte + VerifiedAt uint64 +}, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getLastSyncedBlock") + + outstruct := new(struct { + BlockId uint64 + BlockHash [32]byte + StateRoot [32]byte + VerifiedAt uint64 + }) + if err != nil { + return *outstruct, err + } + + outstruct.BlockId = *abi.ConvertType(out[0], new(uint64)).(*uint64) + outstruct.BlockHash = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) + outstruct.StateRoot = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) + outstruct.VerifiedAt = *abi.ConvertType(out[3], new(uint64)).(*uint64) + + return *outstruct, err + +} + +// GetLastSyncedBlock is a free data retrieval call binding the contract method 0x9413caa9. +// +// Solidity: function getLastSyncedBlock() view returns(uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_, uint64 verifiedAt_) +func (_TaikoL1Client *TaikoL1ClientSession) GetLastSyncedBlock() (struct { + BlockId uint64 + BlockHash [32]byte + StateRoot [32]byte + VerifiedAt uint64 +}, error) { + return _TaikoL1Client.Contract.GetLastSyncedBlock(&_TaikoL1Client.CallOpts) +} + +// GetLastSyncedBlock is a free data retrieval call binding the contract method 0x9413caa9. +// +// Solidity: function getLastSyncedBlock() view returns(uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_, uint64 verifiedAt_) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetLastSyncedBlock() (struct { + BlockId uint64 + BlockHash [32]byte + StateRoot [32]byte + VerifiedAt uint64 +}, error) { + return _TaikoL1Client.Contract.GetLastSyncedBlock(&_TaikoL1Client.CallOpts) +} + +// GetLastVerifiedBlock is a free data retrieval call binding the contract method 0x26af7986. +// +// Solidity: function getLastVerifiedBlock() view returns(uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_, uint64 verifiedAt_) +func (_TaikoL1Client *TaikoL1ClientCaller) GetLastVerifiedBlock(opts *bind.CallOpts) (struct { + BlockId uint64 + BlockHash [32]byte + StateRoot [32]byte + VerifiedAt uint64 +}, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getLastVerifiedBlock") + + outstruct := new(struct { + BlockId uint64 + BlockHash [32]byte + StateRoot [32]byte + VerifiedAt uint64 + }) + if err != nil { + return *outstruct, err + } + + outstruct.BlockId = *abi.ConvertType(out[0], new(uint64)).(*uint64) + outstruct.BlockHash = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) + outstruct.StateRoot = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) + outstruct.VerifiedAt = *abi.ConvertType(out[3], new(uint64)).(*uint64) + + return *outstruct, err + +} + +// GetLastVerifiedBlock is a free data retrieval call binding the contract method 0x26af7986. +// +// Solidity: function getLastVerifiedBlock() view returns(uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_, uint64 verifiedAt_) +func (_TaikoL1Client *TaikoL1ClientSession) GetLastVerifiedBlock() (struct { + BlockId uint64 + BlockHash [32]byte + StateRoot [32]byte + VerifiedAt uint64 +}, error) { + return _TaikoL1Client.Contract.GetLastVerifiedBlock(&_TaikoL1Client.CallOpts) +} + +// GetLastVerifiedBlock is a free data retrieval call binding the contract method 0x26af7986. +// +// Solidity: function getLastVerifiedBlock() view returns(uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_, uint64 verifiedAt_) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetLastVerifiedBlock() (struct { + BlockId uint64 + BlockHash [32]byte + StateRoot [32]byte + VerifiedAt uint64 +}, error) { + return _TaikoL1Client.Contract.GetLastVerifiedBlock(&_TaikoL1Client.CallOpts) +} + +// GetStateVariables is a free data retrieval call binding the contract method 0xdde89cf5. +// +// Solidity: function getStateVariables() view returns((uint64,uint64,uint64,uint64), (uint64,uint64,bool,uint56,uint64)) +func (_TaikoL1Client *TaikoL1ClientCaller) GetStateVariables(opts *bind.CallOpts) (TaikoDataSlotA, TaikoDataSlotB, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getStateVariables") + + if err != nil { + return *new(TaikoDataSlotA), *new(TaikoDataSlotB), err + } + + out0 := *abi.ConvertType(out[0], new(TaikoDataSlotA)).(*TaikoDataSlotA) + out1 := *abi.ConvertType(out[1], new(TaikoDataSlotB)).(*TaikoDataSlotB) + + return out0, out1, err + +} + +// GetStateVariables is a free data retrieval call binding the contract method 0xdde89cf5. +// +// Solidity: function getStateVariables() view returns((uint64,uint64,uint64,uint64), (uint64,uint64,bool,uint56,uint64)) +func (_TaikoL1Client *TaikoL1ClientSession) GetStateVariables() (TaikoDataSlotA, TaikoDataSlotB, error) { + return _TaikoL1Client.Contract.GetStateVariables(&_TaikoL1Client.CallOpts) +} + +// GetStateVariables is a free data retrieval call binding the contract method 0xdde89cf5. +// +// Solidity: function getStateVariables() view returns((uint64,uint64,uint64,uint64), (uint64,uint64,bool,uint56,uint64)) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetStateVariables() (TaikoDataSlotA, TaikoDataSlotB, error) { + return _TaikoL1Client.Contract.GetStateVariables(&_TaikoL1Client.CallOpts) +} + +// GetTransition is a free data retrieval call binding the contract method 0x563479a5. +// +// Solidity: function getTransition(uint64 _blockId, uint32 _tid) view returns((bytes32,bytes32,bytes32,address,uint96,address,uint96,uint64,uint16,uint8)) +func (_TaikoL1Client *TaikoL1ClientCaller) GetTransition(opts *bind.CallOpts, _blockId uint64, _tid uint32) (TaikoDataTransitionState, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getTransition", _blockId, _tid) + + if err != nil { + return *new(TaikoDataTransitionState), err + } + + out0 := *abi.ConvertType(out[0], new(TaikoDataTransitionState)).(*TaikoDataTransitionState) + + return out0, err + +} + +// GetTransition is a free data retrieval call binding the contract method 0x563479a5. +// +// Solidity: function getTransition(uint64 _blockId, uint32 _tid) view returns((bytes32,bytes32,bytes32,address,uint96,address,uint96,uint64,uint16,uint8)) +func (_TaikoL1Client *TaikoL1ClientSession) GetTransition(_blockId uint64, _tid uint32) (TaikoDataTransitionState, error) { + return _TaikoL1Client.Contract.GetTransition(&_TaikoL1Client.CallOpts, _blockId, _tid) +} + +// GetTransition is a free data retrieval call binding the contract method 0x563479a5. +// +// Solidity: function getTransition(uint64 _blockId, uint32 _tid) view returns((bytes32,bytes32,bytes32,address,uint96,address,uint96,uint64,uint16,uint8)) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetTransition(_blockId uint64, _tid uint32) (TaikoDataTransitionState, error) { + return _TaikoL1Client.Contract.GetTransition(&_TaikoL1Client.CallOpts, _blockId, _tid) +} + +// GetTransition0 is a free data retrieval call binding the contract method 0xfd257e29. +// +// Solidity: function getTransition(uint64 _blockId, bytes32 _parentHash) view returns((bytes32,bytes32,bytes32,address,uint96,address,uint96,uint64,uint16,uint8)) +func (_TaikoL1Client *TaikoL1ClientCaller) GetTransition0(opts *bind.CallOpts, _blockId uint64, _parentHash [32]byte) (TaikoDataTransitionState, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getTransition0", _blockId, _parentHash) + + if err != nil { + return *new(TaikoDataTransitionState), err + } + + out0 := *abi.ConvertType(out[0], new(TaikoDataTransitionState)).(*TaikoDataTransitionState) + + return out0, err + +} + +// GetTransition0 is a free data retrieval call binding the contract method 0xfd257e29. +// +// Solidity: function getTransition(uint64 _blockId, bytes32 _parentHash) view returns((bytes32,bytes32,bytes32,address,uint96,address,uint96,uint64,uint16,uint8)) +func (_TaikoL1Client *TaikoL1ClientSession) GetTransition0(_blockId uint64, _parentHash [32]byte) (TaikoDataTransitionState, error) { + return _TaikoL1Client.Contract.GetTransition0(&_TaikoL1Client.CallOpts, _blockId, _parentHash) +} + +// GetTransition0 is a free data retrieval call binding the contract method 0xfd257e29. +// +// Solidity: function getTransition(uint64 _blockId, bytes32 _parentHash) view returns((bytes32,bytes32,bytes32,address,uint96,address,uint96,uint64,uint16,uint8)) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetTransition0(_blockId uint64, _parentHash [32]byte) (TaikoDataTransitionState, error) { + return _TaikoL1Client.Contract.GetTransition0(&_TaikoL1Client.CallOpts, _blockId, _parentHash) +} + +// GetTransitions is a free data retrieval call binding the contract method 0xb89c61bc. +// +// Solidity: function getTransitions(uint64[] _blockIds, bytes32[] _parentHashes) view returns((bytes32,bytes32,bytes32,address,uint96,address,uint96,uint64,uint16,uint8)[]) +func (_TaikoL1Client *TaikoL1ClientCaller) GetTransitions(opts *bind.CallOpts, _blockIds []uint64, _parentHashes [][32]byte) ([]TaikoDataTransitionState, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getTransitions", _blockIds, _parentHashes) + + if err != nil { + return *new([]TaikoDataTransitionState), err + } + + out0 := *abi.ConvertType(out[0], new([]TaikoDataTransitionState)).(*[]TaikoDataTransitionState) + + return out0, err + +} + +// GetTransitions is a free data retrieval call binding the contract method 0xb89c61bc. +// +// Solidity: function getTransitions(uint64[] _blockIds, bytes32[] _parentHashes) view returns((bytes32,bytes32,bytes32,address,uint96,address,uint96,uint64,uint16,uint8)[]) +func (_TaikoL1Client *TaikoL1ClientSession) GetTransitions(_blockIds []uint64, _parentHashes [][32]byte) ([]TaikoDataTransitionState, error) { + return _TaikoL1Client.Contract.GetTransitions(&_TaikoL1Client.CallOpts, _blockIds, _parentHashes) +} + +// GetTransitions is a free data retrieval call binding the contract method 0xb89c61bc. +// +// Solidity: function getTransitions(uint64[] _blockIds, bytes32[] _parentHashes) view returns((bytes32,bytes32,bytes32,address,uint96,address,uint96,uint64,uint16,uint8)[]) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetTransitions(_blockIds []uint64, _parentHashes [][32]byte) ([]TaikoDataTransitionState, error) { + return _TaikoL1Client.Contract.GetTransitions(&_TaikoL1Client.CallOpts, _blockIds, _parentHashes) +} + +// GetVerifiedBlockProver is a free data retrieval call binding the contract method 0x6074b8c1. +// +// Solidity: function getVerifiedBlockProver(uint64 _blockId) view returns(address prover_) +func (_TaikoL1Client *TaikoL1ClientCaller) GetVerifiedBlockProver(opts *bind.CallOpts, _blockId uint64) (common.Address, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "getVerifiedBlockProver", _blockId) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetVerifiedBlockProver is a free data retrieval call binding the contract method 0x6074b8c1. +// +// Solidity: function getVerifiedBlockProver(uint64 _blockId) view returns(address prover_) +func (_TaikoL1Client *TaikoL1ClientSession) GetVerifiedBlockProver(_blockId uint64) (common.Address, error) { + return _TaikoL1Client.Contract.GetVerifiedBlockProver(&_TaikoL1Client.CallOpts, _blockId) +} + +// GetVerifiedBlockProver is a free data retrieval call binding the contract method 0x6074b8c1. +// +// Solidity: function getVerifiedBlockProver(uint64 _blockId) view returns(address prover_) +func (_TaikoL1Client *TaikoL1ClientCallerSession) GetVerifiedBlockProver(_blockId uint64) (common.Address, error) { + return _TaikoL1Client.Contract.GetVerifiedBlockProver(&_TaikoL1Client.CallOpts, _blockId) +} + +// Impl is a free data retrieval call binding the contract method 0x8abf6077. +// +// Solidity: function impl() view returns(address) +func (_TaikoL1Client *TaikoL1ClientCaller) Impl(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "impl") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Impl is a free data retrieval call binding the contract method 0x8abf6077. +// +// Solidity: function impl() view returns(address) +func (_TaikoL1Client *TaikoL1ClientSession) Impl() (common.Address, error) { + return _TaikoL1Client.Contract.Impl(&_TaikoL1Client.CallOpts) +} + +// Impl is a free data retrieval call binding the contract method 0x8abf6077. +// +// Solidity: function impl() view returns(address) +func (_TaikoL1Client *TaikoL1ClientCallerSession) Impl() (common.Address, error) { + return _TaikoL1Client.Contract.Impl(&_TaikoL1Client.CallOpts) +} + +// InNonReentrant is a free data retrieval call binding the contract method 0x3075db56. +// +// Solidity: function inNonReentrant() view returns(bool) +func (_TaikoL1Client *TaikoL1ClientCaller) InNonReentrant(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "inNonReentrant") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// InNonReentrant is a free data retrieval call binding the contract method 0x3075db56. +// +// Solidity: function inNonReentrant() view returns(bool) +func (_TaikoL1Client *TaikoL1ClientSession) InNonReentrant() (bool, error) { + return _TaikoL1Client.Contract.InNonReentrant(&_TaikoL1Client.CallOpts) +} + +// InNonReentrant is a free data retrieval call binding the contract method 0x3075db56. +// +// Solidity: function inNonReentrant() view returns(bool) +func (_TaikoL1Client *TaikoL1ClientCallerSession) InNonReentrant() (bool, error) { + return _TaikoL1Client.Contract.InNonReentrant(&_TaikoL1Client.CallOpts) +} + +// LastProposedIn is a free data retrieval call binding the contract method 0x5979f17c. +// +// Solidity: function lastProposedIn() view returns(uint56) +func (_TaikoL1Client *TaikoL1ClientCaller) LastProposedIn(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "lastProposedIn") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// LastProposedIn is a free data retrieval call binding the contract method 0x5979f17c. +// +// Solidity: function lastProposedIn() view returns(uint56) +func (_TaikoL1Client *TaikoL1ClientSession) LastProposedIn() (*big.Int, error) { + return _TaikoL1Client.Contract.LastProposedIn(&_TaikoL1Client.CallOpts) +} + +// LastProposedIn is a free data retrieval call binding the contract method 0x5979f17c. +// +// Solidity: function lastProposedIn() view returns(uint56) +func (_TaikoL1Client *TaikoL1ClientCallerSession) LastProposedIn() (*big.Int, error) { + return _TaikoL1Client.Contract.LastProposedIn(&_TaikoL1Client.CallOpts) +} + +// LastUnpausedAt is a free data retrieval call binding the contract method 0xe07baba6. +// +// Solidity: function lastUnpausedAt() view returns(uint64) +func (_TaikoL1Client *TaikoL1ClientCaller) LastUnpausedAt(opts *bind.CallOpts) (uint64, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "lastUnpausedAt") + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// LastUnpausedAt is a free data retrieval call binding the contract method 0xe07baba6. +// +// Solidity: function lastUnpausedAt() view returns(uint64) +func (_TaikoL1Client *TaikoL1ClientSession) LastUnpausedAt() (uint64, error) { + return _TaikoL1Client.Contract.LastUnpausedAt(&_TaikoL1Client.CallOpts) +} + +// LastUnpausedAt is a free data retrieval call binding the contract method 0xe07baba6. +// +// Solidity: function lastUnpausedAt() view returns(uint64) +func (_TaikoL1Client *TaikoL1ClientCallerSession) LastUnpausedAt() (uint64, error) { + return _TaikoL1Client.Contract.LastUnpausedAt(&_TaikoL1Client.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_TaikoL1Client *TaikoL1ClientCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_TaikoL1Client *TaikoL1ClientSession) Owner() (common.Address, error) { + return _TaikoL1Client.Contract.Owner(&_TaikoL1Client.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_TaikoL1Client *TaikoL1ClientCallerSession) Owner() (common.Address, error) { + return _TaikoL1Client.Contract.Owner(&_TaikoL1Client.CallOpts) +} + +// Paused is a free data retrieval call binding the contract method 0x5c975abb. +// +// Solidity: function paused() view returns(bool) +func (_TaikoL1Client *TaikoL1ClientCaller) Paused(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "paused") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// Paused is a free data retrieval call binding the contract method 0x5c975abb. +// +// Solidity: function paused() view returns(bool) +func (_TaikoL1Client *TaikoL1ClientSession) Paused() (bool, error) { + return _TaikoL1Client.Contract.Paused(&_TaikoL1Client.CallOpts) +} + +// Paused is a free data retrieval call binding the contract method 0x5c975abb. +// +// Solidity: function paused() view returns(bool) +func (_TaikoL1Client *TaikoL1ClientCallerSession) Paused() (bool, error) { + return _TaikoL1Client.Contract.Paused(&_TaikoL1Client.CallOpts) +} + +// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. +// +// Solidity: function pendingOwner() view returns(address) +func (_TaikoL1Client *TaikoL1ClientCaller) PendingOwner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "pendingOwner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. +// +// Solidity: function pendingOwner() view returns(address) +func (_TaikoL1Client *TaikoL1ClientSession) PendingOwner() (common.Address, error) { + return _TaikoL1Client.Contract.PendingOwner(&_TaikoL1Client.CallOpts) +} + +// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. +// +// Solidity: function pendingOwner() view returns(address) +func (_TaikoL1Client *TaikoL1ClientCallerSession) PendingOwner() (common.Address, error) { + return _TaikoL1Client.Contract.PendingOwner(&_TaikoL1Client.CallOpts) +} + +// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d. +// +// Solidity: function proxiableUUID() view returns(bytes32) +func (_TaikoL1Client *TaikoL1ClientCaller) ProxiableUUID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "proxiableUUID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d. +// +// Solidity: function proxiableUUID() view returns(bytes32) +func (_TaikoL1Client *TaikoL1ClientSession) ProxiableUUID() ([32]byte, error) { + return _TaikoL1Client.Contract.ProxiableUUID(&_TaikoL1Client.CallOpts) +} + +// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d. +// +// Solidity: function proxiableUUID() view returns(bytes32) +func (_TaikoL1Client *TaikoL1ClientCallerSession) ProxiableUUID() ([32]byte, error) { + return _TaikoL1Client.Contract.ProxiableUUID(&_TaikoL1Client.CallOpts) +} + +// Resolve is a free data retrieval call binding the contract method 0x3eb6b8cf. +// +// Solidity: function resolve(uint64 _chainId, bytes32 _name, bool _allowZeroAddress) view returns(address) +func (_TaikoL1Client *TaikoL1ClientCaller) Resolve(opts *bind.CallOpts, _chainId uint64, _name [32]byte, _allowZeroAddress bool) (common.Address, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "resolve", _chainId, _name, _allowZeroAddress) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Resolve is a free data retrieval call binding the contract method 0x3eb6b8cf. +// +// Solidity: function resolve(uint64 _chainId, bytes32 _name, bool _allowZeroAddress) view returns(address) +func (_TaikoL1Client *TaikoL1ClientSession) Resolve(_chainId uint64, _name [32]byte, _allowZeroAddress bool) (common.Address, error) { + return _TaikoL1Client.Contract.Resolve(&_TaikoL1Client.CallOpts, _chainId, _name, _allowZeroAddress) +} + +// Resolve is a free data retrieval call binding the contract method 0x3eb6b8cf. +// +// Solidity: function resolve(uint64 _chainId, bytes32 _name, bool _allowZeroAddress) view returns(address) +func (_TaikoL1Client *TaikoL1ClientCallerSession) Resolve(_chainId uint64, _name [32]byte, _allowZeroAddress bool) (common.Address, error) { + return _TaikoL1Client.Contract.Resolve(&_TaikoL1Client.CallOpts, _chainId, _name, _allowZeroAddress) +} + +// Resolve0 is a free data retrieval call binding the contract method 0xa86f9d9e. +// +// Solidity: function resolve(bytes32 _name, bool _allowZeroAddress) view returns(address) +func (_TaikoL1Client *TaikoL1ClientCaller) Resolve0(opts *bind.CallOpts, _name [32]byte, _allowZeroAddress bool) (common.Address, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "resolve0", _name, _allowZeroAddress) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Resolve0 is a free data retrieval call binding the contract method 0xa86f9d9e. +// +// Solidity: function resolve(bytes32 _name, bool _allowZeroAddress) view returns(address) +func (_TaikoL1Client *TaikoL1ClientSession) Resolve0(_name [32]byte, _allowZeroAddress bool) (common.Address, error) { + return _TaikoL1Client.Contract.Resolve0(&_TaikoL1Client.CallOpts, _name, _allowZeroAddress) +} + +// Resolve0 is a free data retrieval call binding the contract method 0xa86f9d9e. +// +// Solidity: function resolve(bytes32 _name, bool _allowZeroAddress) view returns(address) +func (_TaikoL1Client *TaikoL1ClientCallerSession) Resolve0(_name [32]byte, _allowZeroAddress bool) (common.Address, error) { + return _TaikoL1Client.Contract.Resolve0(&_TaikoL1Client.CallOpts, _name, _allowZeroAddress) +} + +// State is a free data retrieval call binding the contract method 0xc19d93fb. +// +// Solidity: function state() view returns(bytes32 __reserve1, (uint64,uint64,uint64,uint64) slotA, (uint64,uint64,bool,uint56,uint64) slotB) +func (_TaikoL1Client *TaikoL1ClientCaller) State(opts *bind.CallOpts) (struct { + Reserve1 [32]byte + SlotA TaikoDataSlotA + SlotB TaikoDataSlotB +}, error) { + var out []interface{} + err := _TaikoL1Client.contract.Call(opts, &out, "state") + + outstruct := new(struct { + Reserve1 [32]byte + SlotA TaikoDataSlotA + SlotB TaikoDataSlotB + }) + if err != nil { + return *outstruct, err + } + + outstruct.Reserve1 = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + outstruct.SlotA = *abi.ConvertType(out[1], new(TaikoDataSlotA)).(*TaikoDataSlotA) + outstruct.SlotB = *abi.ConvertType(out[2], new(TaikoDataSlotB)).(*TaikoDataSlotB) + + return *outstruct, err + +} + +// State is a free data retrieval call binding the contract method 0xc19d93fb. +// +// Solidity: function state() view returns(bytes32 __reserve1, (uint64,uint64,uint64,uint64) slotA, (uint64,uint64,bool,uint56,uint64) slotB) +func (_TaikoL1Client *TaikoL1ClientSession) State() (struct { + Reserve1 [32]byte + SlotA TaikoDataSlotA + SlotB TaikoDataSlotB +}, error) { + return _TaikoL1Client.Contract.State(&_TaikoL1Client.CallOpts) +} + +// State is a free data retrieval call binding the contract method 0xc19d93fb. +// +// Solidity: function state() view returns(bytes32 __reserve1, (uint64,uint64,uint64,uint64) slotA, (uint64,uint64,bool,uint56,uint64) slotB) +func (_TaikoL1Client *TaikoL1ClientCallerSession) State() (struct { + Reserve1 [32]byte + SlotA TaikoDataSlotA + SlotB TaikoDataSlotB +}, error) { + return _TaikoL1Client.Contract.State(&_TaikoL1Client.CallOpts) +} + +// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. +// +// Solidity: function acceptOwnership() returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "acceptOwnership") +} + +// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. +// +// Solidity: function acceptOwnership() returns() +func (_TaikoL1Client *TaikoL1ClientSession) AcceptOwnership() (*types.Transaction, error) { + return _TaikoL1Client.Contract.AcceptOwnership(&_TaikoL1Client.TransactOpts) +} + +// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. +// +// Solidity: function acceptOwnership() returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) AcceptOwnership() (*types.Transaction, error) { + return _TaikoL1Client.Contract.AcceptOwnership(&_TaikoL1Client.TransactOpts) +} + +// DepositBond is a paid mutator transaction binding the contract method 0x4dcb05f9. +// +// Solidity: function depositBond(uint256 _amount) payable returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) DepositBond(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "depositBond", _amount) +} + +// DepositBond is a paid mutator transaction binding the contract method 0x4dcb05f9. +// +// Solidity: function depositBond(uint256 _amount) payable returns() +func (_TaikoL1Client *TaikoL1ClientSession) DepositBond(_amount *big.Int) (*types.Transaction, error) { + return _TaikoL1Client.Contract.DepositBond(&_TaikoL1Client.TransactOpts, _amount) +} + +// DepositBond is a paid mutator transaction binding the contract method 0x4dcb05f9. +// +// Solidity: function depositBond(uint256 _amount) payable returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) DepositBond(_amount *big.Int) (*types.Transaction, error) { + return _TaikoL1Client.Contract.DepositBond(&_TaikoL1Client.TransactOpts, _amount) +} + +// Init is a paid mutator transaction binding the contract method 0x29d1b62f. +// +// Solidity: function init(address _owner, address _rollupAddressManager, bytes32 _genesisBlockHash, bool _toPause) returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) Init(opts *bind.TransactOpts, _owner common.Address, _rollupAddressManager common.Address, _genesisBlockHash [32]byte, _toPause bool) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "init", _owner, _rollupAddressManager, _genesisBlockHash, _toPause) +} + +// Init is a paid mutator transaction binding the contract method 0x29d1b62f. +// +// Solidity: function init(address _owner, address _rollupAddressManager, bytes32 _genesisBlockHash, bool _toPause) returns() +func (_TaikoL1Client *TaikoL1ClientSession) Init(_owner common.Address, _rollupAddressManager common.Address, _genesisBlockHash [32]byte, _toPause bool) (*types.Transaction, error) { + return _TaikoL1Client.Contract.Init(&_TaikoL1Client.TransactOpts, _owner, _rollupAddressManager, _genesisBlockHash, _toPause) +} + +// Init is a paid mutator transaction binding the contract method 0x29d1b62f. +// +// Solidity: function init(address _owner, address _rollupAddressManager, bytes32 _genesisBlockHash, bool _toPause) returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) Init(_owner common.Address, _rollupAddressManager common.Address, _genesisBlockHash [32]byte, _toPause bool) (*types.Transaction, error) { + return _TaikoL1Client.Contract.Init(&_TaikoL1Client.TransactOpts, _owner, _rollupAddressManager, _genesisBlockHash, _toPause) +} + +// Init2 is a paid mutator transaction binding the contract method 0x069489a2. +// +// Solidity: function init2() returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) Init2(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "init2") +} + +// Init2 is a paid mutator transaction binding the contract method 0x069489a2. +// +// Solidity: function init2() returns() +func (_TaikoL1Client *TaikoL1ClientSession) Init2() (*types.Transaction, error) { + return _TaikoL1Client.Contract.Init2(&_TaikoL1Client.TransactOpts) +} + +// Init2 is a paid mutator transaction binding the contract method 0x069489a2. +// +// Solidity: function init2() returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) Init2() (*types.Transaction, error) { + return _TaikoL1Client.Contract.Init2(&_TaikoL1Client.TransactOpts) +} + +// Init3 is a paid mutator transaction binding the contract method 0x486e3cd7. +// +// Solidity: function init3() returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) Init3(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "init3") +} + +// Init3 is a paid mutator transaction binding the contract method 0x486e3cd7. +// +// Solidity: function init3() returns() +func (_TaikoL1Client *TaikoL1ClientSession) Init3() (*types.Transaction, error) { + return _TaikoL1Client.Contract.Init3(&_TaikoL1Client.TransactOpts) +} + +// Init3 is a paid mutator transaction binding the contract method 0x486e3cd7. +// +// Solidity: function init3() returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) Init3() (*types.Transaction, error) { + return _TaikoL1Client.Contract.Init3(&_TaikoL1Client.TransactOpts) +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "pause") +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_TaikoL1Client *TaikoL1ClientSession) Pause() (*types.Transaction, error) { + return _TaikoL1Client.Contract.Pause(&_TaikoL1Client.TransactOpts) +} + +// Pause is a paid mutator transaction binding the contract method 0x8456cb59. +// +// Solidity: function pause() returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) Pause() (*types.Transaction, error) { + return _TaikoL1Client.Contract.Pause(&_TaikoL1Client.TransactOpts) +} + +// PauseProving is a paid mutator transaction binding the contract method 0xff00c391. +// +// Solidity: function pauseProving(bool _pause) returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) PauseProving(opts *bind.TransactOpts, _pause bool) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "pauseProving", _pause) +} + +// PauseProving is a paid mutator transaction binding the contract method 0xff00c391. +// +// Solidity: function pauseProving(bool _pause) returns() +func (_TaikoL1Client *TaikoL1ClientSession) PauseProving(_pause bool) (*types.Transaction, error) { + return _TaikoL1Client.Contract.PauseProving(&_TaikoL1Client.TransactOpts, _pause) +} + +// PauseProving is a paid mutator transaction binding the contract method 0xff00c391. +// +// Solidity: function pauseProving(bool _pause) returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) PauseProving(_pause bool) (*types.Transaction, error) { + return _TaikoL1Client.Contract.PauseProving(&_TaikoL1Client.TransactOpts, _pause) +} + +// ProposeBlockV2 is a paid mutator transaction binding the contract method 0x648885fb. +// +// Solidity: function proposeBlockV2(bytes _params, bytes _txList) returns((bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta_) +func (_TaikoL1Client *TaikoL1ClientTransactor) ProposeBlockV2(opts *bind.TransactOpts, _params []byte, _txList []byte) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "proposeBlockV2", _params, _txList) +} + +// ProposeBlockV2 is a paid mutator transaction binding the contract method 0x648885fb. +// +// Solidity: function proposeBlockV2(bytes _params, bytes _txList) returns((bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta_) +func (_TaikoL1Client *TaikoL1ClientSession) ProposeBlockV2(_params []byte, _txList []byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.ProposeBlockV2(&_TaikoL1Client.TransactOpts, _params, _txList) +} + +// ProposeBlockV2 is a paid mutator transaction binding the contract method 0x648885fb. +// +// Solidity: function proposeBlockV2(bytes _params, bytes _txList) returns((bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta_) +func (_TaikoL1Client *TaikoL1ClientTransactorSession) ProposeBlockV2(_params []byte, _txList []byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.ProposeBlockV2(&_TaikoL1Client.TransactOpts, _params, _txList) +} + +// ProposeBlocksV2 is a paid mutator transaction binding the contract method 0x0c8f4a10. +// +// Solidity: function proposeBlocksV2(bytes[] _paramsArr, bytes[] _txListArr) returns((bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32))[] metaArr_) +func (_TaikoL1Client *TaikoL1ClientTransactor) ProposeBlocksV2(opts *bind.TransactOpts, _paramsArr [][]byte, _txListArr [][]byte) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "proposeBlocksV2", _paramsArr, _txListArr) +} + +// ProposeBlocksV2 is a paid mutator transaction binding the contract method 0x0c8f4a10. +// +// Solidity: function proposeBlocksV2(bytes[] _paramsArr, bytes[] _txListArr) returns((bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32))[] metaArr_) +func (_TaikoL1Client *TaikoL1ClientSession) ProposeBlocksV2(_paramsArr [][]byte, _txListArr [][]byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.ProposeBlocksV2(&_TaikoL1Client.TransactOpts, _paramsArr, _txListArr) +} + +// ProposeBlocksV2 is a paid mutator transaction binding the contract method 0x0c8f4a10. +// +// Solidity: function proposeBlocksV2(bytes[] _paramsArr, bytes[] _txListArr) returns((bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32))[] metaArr_) +func (_TaikoL1Client *TaikoL1ClientTransactorSession) ProposeBlocksV2(_paramsArr [][]byte, _txListArr [][]byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.ProposeBlocksV2(&_TaikoL1Client.TransactOpts, _paramsArr, _txListArr) +} + +// ProveBlock is a paid mutator transaction binding the contract method 0x10d008bd. +// +// Solidity: function proveBlock(uint64 _blockId, bytes _input) returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) ProveBlock(opts *bind.TransactOpts, _blockId uint64, _input []byte) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "proveBlock", _blockId, _input) +} + +// ProveBlock is a paid mutator transaction binding the contract method 0x10d008bd. +// +// Solidity: function proveBlock(uint64 _blockId, bytes _input) returns() +func (_TaikoL1Client *TaikoL1ClientSession) ProveBlock(_blockId uint64, _input []byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.ProveBlock(&_TaikoL1Client.TransactOpts, _blockId, _input) +} + +// ProveBlock is a paid mutator transaction binding the contract method 0x10d008bd. +// +// Solidity: function proveBlock(uint64 _blockId, bytes _input) returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) ProveBlock(_blockId uint64, _input []byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.ProveBlock(&_TaikoL1Client.TransactOpts, _blockId, _input) +} + +// ProveBlocks is a paid mutator transaction binding the contract method 0x440b6e18. +// +// Solidity: function proveBlocks(uint64[] _blockIds, bytes[] _inputs, bytes _batchProof) returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) ProveBlocks(opts *bind.TransactOpts, _blockIds []uint64, _inputs [][]byte, _batchProof []byte) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "proveBlocks", _blockIds, _inputs, _batchProof) +} + +// ProveBlocks is a paid mutator transaction binding the contract method 0x440b6e18. +// +// Solidity: function proveBlocks(uint64[] _blockIds, bytes[] _inputs, bytes _batchProof) returns() +func (_TaikoL1Client *TaikoL1ClientSession) ProveBlocks(_blockIds []uint64, _inputs [][]byte, _batchProof []byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.ProveBlocks(&_TaikoL1Client.TransactOpts, _blockIds, _inputs, _batchProof) +} + +// ProveBlocks is a paid mutator transaction binding the contract method 0x440b6e18. +// +// Solidity: function proveBlocks(uint64[] _blockIds, bytes[] _inputs, bytes _batchProof) returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) ProveBlocks(_blockIds []uint64, _inputs [][]byte, _batchProof []byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.ProveBlocks(&_TaikoL1Client.TransactOpts, _blockIds, _inputs, _batchProof) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_TaikoL1Client *TaikoL1ClientSession) RenounceOwnership() (*types.Transaction, error) { + return _TaikoL1Client.Contract.RenounceOwnership(&_TaikoL1Client.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _TaikoL1Client.Contract.RenounceOwnership(&_TaikoL1Client.TransactOpts) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_TaikoL1Client *TaikoL1ClientSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _TaikoL1Client.Contract.TransferOwnership(&_TaikoL1Client.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _TaikoL1Client.Contract.TransferOwnership(&_TaikoL1Client.TransactOpts, newOwner) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) Unpause(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "unpause") +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_TaikoL1Client *TaikoL1ClientSession) Unpause() (*types.Transaction, error) { + return _TaikoL1Client.Contract.Unpause(&_TaikoL1Client.TransactOpts) +} + +// Unpause is a paid mutator transaction binding the contract method 0x3f4ba83a. +// +// Solidity: function unpause() returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) Unpause() (*types.Transaction, error) { + return _TaikoL1Client.Contract.Unpause(&_TaikoL1Client.TransactOpts) +} + +// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6. +// +// Solidity: function upgradeTo(address newImplementation) returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) UpgradeTo(opts *bind.TransactOpts, newImplementation common.Address) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "upgradeTo", newImplementation) +} + +// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6. +// +// Solidity: function upgradeTo(address newImplementation) returns() +func (_TaikoL1Client *TaikoL1ClientSession) UpgradeTo(newImplementation common.Address) (*types.Transaction, error) { + return _TaikoL1Client.Contract.UpgradeTo(&_TaikoL1Client.TransactOpts, newImplementation) +} + +// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6. +// +// Solidity: function upgradeTo(address newImplementation) returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) UpgradeTo(newImplementation common.Address) (*types.Transaction, error) { + return _TaikoL1Client.Contract.UpgradeTo(&_TaikoL1Client.TransactOpts, newImplementation) +} + +// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286. +// +// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) UpgradeToAndCall(opts *bind.TransactOpts, newImplementation common.Address, data []byte) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "upgradeToAndCall", newImplementation, data) +} + +// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286. +// +// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns() +func (_TaikoL1Client *TaikoL1ClientSession) UpgradeToAndCall(newImplementation common.Address, data []byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.UpgradeToAndCall(&_TaikoL1Client.TransactOpts, newImplementation, data) +} + +// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286. +// +// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) UpgradeToAndCall(newImplementation common.Address, data []byte) (*types.Transaction, error) { + return _TaikoL1Client.Contract.UpgradeToAndCall(&_TaikoL1Client.TransactOpts, newImplementation, data) +} + +// VerifyBlocks is a paid mutator transaction binding the contract method 0x8778209d. +// +// Solidity: function verifyBlocks(uint64 _maxBlocksToVerify) returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) VerifyBlocks(opts *bind.TransactOpts, _maxBlocksToVerify uint64) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "verifyBlocks", _maxBlocksToVerify) +} + +// VerifyBlocks is a paid mutator transaction binding the contract method 0x8778209d. +// +// Solidity: function verifyBlocks(uint64 _maxBlocksToVerify) returns() +func (_TaikoL1Client *TaikoL1ClientSession) VerifyBlocks(_maxBlocksToVerify uint64) (*types.Transaction, error) { + return _TaikoL1Client.Contract.VerifyBlocks(&_TaikoL1Client.TransactOpts, _maxBlocksToVerify) +} + +// VerifyBlocks is a paid mutator transaction binding the contract method 0x8778209d. +// +// Solidity: function verifyBlocks(uint64 _maxBlocksToVerify) returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) VerifyBlocks(_maxBlocksToVerify uint64) (*types.Transaction, error) { + return _TaikoL1Client.Contract.VerifyBlocks(&_TaikoL1Client.TransactOpts, _maxBlocksToVerify) +} + +// WithdrawBond is a paid mutator transaction binding the contract method 0xc3daab96. +// +// Solidity: function withdrawBond(uint256 _amount) returns() +func (_TaikoL1Client *TaikoL1ClientTransactor) WithdrawBond(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _TaikoL1Client.contract.Transact(opts, "withdrawBond", _amount) +} + +// WithdrawBond is a paid mutator transaction binding the contract method 0xc3daab96. +// +// Solidity: function withdrawBond(uint256 _amount) returns() +func (_TaikoL1Client *TaikoL1ClientSession) WithdrawBond(_amount *big.Int) (*types.Transaction, error) { + return _TaikoL1Client.Contract.WithdrawBond(&_TaikoL1Client.TransactOpts, _amount) +} + +// WithdrawBond is a paid mutator transaction binding the contract method 0xc3daab96. +// +// Solidity: function withdrawBond(uint256 _amount) returns() +func (_TaikoL1Client *TaikoL1ClientTransactorSession) WithdrawBond(_amount *big.Int) (*types.Transaction, error) { + return _TaikoL1Client.Contract.WithdrawBond(&_TaikoL1Client.TransactOpts, _amount) +} + +// TaikoL1ClientAdminChangedIterator is returned from FilterAdminChanged and is used to iterate over the raw logs and unpacked data for AdminChanged events raised by the TaikoL1Client contract. +type TaikoL1ClientAdminChangedIterator struct { + Event *TaikoL1ClientAdminChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientAdminChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientAdminChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientAdminChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientAdminChanged represents a AdminChanged event raised by the TaikoL1Client contract. +type TaikoL1ClientAdminChanged struct { + PreviousAdmin common.Address + NewAdmin common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAdminChanged is a free log retrieval operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f. +// +// Solidity: event AdminChanged(address previousAdmin, address newAdmin) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterAdminChanged(opts *bind.FilterOpts) (*TaikoL1ClientAdminChangedIterator, error) { + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "AdminChanged") + if err != nil { + return nil, err + } + return &TaikoL1ClientAdminChangedIterator{contract: _TaikoL1Client.contract, event: "AdminChanged", logs: logs, sub: sub}, nil +} + +// WatchAdminChanged is a free log subscription operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f. +// +// Solidity: event AdminChanged(address previousAdmin, address newAdmin) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchAdminChanged(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientAdminChanged) (event.Subscription, error) { + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "AdminChanged") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientAdminChanged) + if err := _TaikoL1Client.contract.UnpackLog(event, "AdminChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAdminChanged is a log parse operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f. +// +// Solidity: event AdminChanged(address previousAdmin, address newAdmin) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseAdminChanged(log types.Log) (*TaikoL1ClientAdminChanged, error) { + event := new(TaikoL1ClientAdminChanged) + if err := _TaikoL1Client.contract.UnpackLog(event, "AdminChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBeaconUpgradedIterator is returned from FilterBeaconUpgraded and is used to iterate over the raw logs and unpacked data for BeaconUpgraded events raised by the TaikoL1Client contract. +type TaikoL1ClientBeaconUpgradedIterator struct { + Event *TaikoL1ClientBeaconUpgraded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBeaconUpgradedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBeaconUpgraded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBeaconUpgraded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBeaconUpgradedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBeaconUpgradedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBeaconUpgraded represents a BeaconUpgraded event raised by the TaikoL1Client contract. +type TaikoL1ClientBeaconUpgraded struct { + Beacon common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBeaconUpgraded is a free log retrieval operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e. +// +// Solidity: event BeaconUpgraded(address indexed beacon) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBeaconUpgraded(opts *bind.FilterOpts, beacon []common.Address) (*TaikoL1ClientBeaconUpgradedIterator, error) { + + var beaconRule []interface{} + for _, beaconItem := range beacon { + beaconRule = append(beaconRule, beaconItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BeaconUpgraded", beaconRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBeaconUpgradedIterator{contract: _TaikoL1Client.contract, event: "BeaconUpgraded", logs: logs, sub: sub}, nil +} + +// WatchBeaconUpgraded is a free log subscription operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e. +// +// Solidity: event BeaconUpgraded(address indexed beacon) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBeaconUpgraded(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBeaconUpgraded, beacon []common.Address) (event.Subscription, error) { + + var beaconRule []interface{} + for _, beaconItem := range beacon { + beaconRule = append(beaconRule, beaconItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BeaconUpgraded", beaconRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBeaconUpgraded) + if err := _TaikoL1Client.contract.UnpackLog(event, "BeaconUpgraded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBeaconUpgraded is a log parse operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e. +// +// Solidity: event BeaconUpgraded(address indexed beacon) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBeaconUpgraded(log types.Log) (*TaikoL1ClientBeaconUpgraded, error) { + event := new(TaikoL1ClientBeaconUpgraded) + if err := _TaikoL1Client.contract.UnpackLog(event, "BeaconUpgraded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBlockProposedIterator is returned from FilterBlockProposed and is used to iterate over the raw logs and unpacked data for BlockProposed events raised by the TaikoL1Client contract. +type TaikoL1ClientBlockProposedIterator struct { + Event *TaikoL1ClientBlockProposed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBlockProposedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockProposed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockProposed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBlockProposedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBlockProposedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBlockProposed represents a BlockProposed event raised by the TaikoL1Client contract. +type TaikoL1ClientBlockProposed struct { + BlockId *big.Int + AssignedProver common.Address + LivenessBond *big.Int + Meta TaikoDataBlockMetadata + DepositsProcessed []TaikoDataEthDeposit + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockProposed is a free log retrieval operation binding the contract event 0xcda4e564245eb15494bc6da29f6a42e1941cf57f5314bf35bab8a1fca0a9c60a. +// +// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, (bytes32,bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address) meta, (address,uint96,uint64)[] depositsProcessed) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBlockProposed(opts *bind.FilterOpts, blockId []*big.Int, assignedProver []common.Address) (*TaikoL1ClientBlockProposedIterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var assignedProverRule []interface{} + for _, assignedProverItem := range assignedProver { + assignedProverRule = append(assignedProverRule, assignedProverItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BlockProposed", blockIdRule, assignedProverRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBlockProposedIterator{contract: _TaikoL1Client.contract, event: "BlockProposed", logs: logs, sub: sub}, nil +} + +// WatchBlockProposed is a free log subscription operation binding the contract event 0xcda4e564245eb15494bc6da29f6a42e1941cf57f5314bf35bab8a1fca0a9c60a. +// +// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, (bytes32,bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address) meta, (address,uint96,uint64)[] depositsProcessed) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBlockProposed(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBlockProposed, blockId []*big.Int, assignedProver []common.Address) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var assignedProverRule []interface{} + for _, assignedProverItem := range assignedProver { + assignedProverRule = append(assignedProverRule, assignedProverItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BlockProposed", blockIdRule, assignedProverRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBlockProposed) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockProposed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockProposed is a log parse operation binding the contract event 0xcda4e564245eb15494bc6da29f6a42e1941cf57f5314bf35bab8a1fca0a9c60a. +// +// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, (bytes32,bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address) meta, (address,uint96,uint64)[] depositsProcessed) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBlockProposed(log types.Log) (*TaikoL1ClientBlockProposed, error) { + event := new(TaikoL1ClientBlockProposed) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockProposed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBlockProposedV2Iterator is returned from FilterBlockProposedV2 and is used to iterate over the raw logs and unpacked data for BlockProposedV2 events raised by the TaikoL1Client contract. +type TaikoL1ClientBlockProposedV2Iterator struct { + Event *TaikoL1ClientBlockProposedV2 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBlockProposedV2Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockProposedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockProposedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBlockProposedV2Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBlockProposedV2Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBlockProposedV2 represents a BlockProposedV2 event raised by the TaikoL1Client contract. +type TaikoL1ClientBlockProposedV2 struct { + BlockId *big.Int + Meta TaikoDataBlockMetadataV2 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockProposedV2 is a free log retrieval operation binding the contract event 0xefe9c6c0b5cbd9c0eed2d1e9c00cfc1a010d6f1aff50f7facd665a639b622b26. +// +// Solidity: event BlockProposedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBlockProposedV2(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientBlockProposedV2Iterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BlockProposedV2", blockIdRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBlockProposedV2Iterator{contract: _TaikoL1Client.contract, event: "BlockProposedV2", logs: logs, sub: sub}, nil +} + +// WatchBlockProposedV2 is a free log subscription operation binding the contract event 0xefe9c6c0b5cbd9c0eed2d1e9c00cfc1a010d6f1aff50f7facd665a639b622b26. +// +// Solidity: event BlockProposedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBlockProposedV2(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBlockProposedV2, blockId []*big.Int) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BlockProposedV2", blockIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBlockProposedV2) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockProposedV2", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockProposedV2 is a log parse operation binding the contract event 0xefe9c6c0b5cbd9c0eed2d1e9c00cfc1a010d6f1aff50f7facd665a639b622b26. +// +// Solidity: event BlockProposedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBlockProposedV2(log types.Log) (*TaikoL1ClientBlockProposedV2, error) { + event := new(TaikoL1ClientBlockProposedV2) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockProposedV2", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBlockProposedV20Iterator is returned from FilterBlockProposedV20 and is used to iterate over the raw logs and unpacked data for BlockProposedV20 events raised by the TaikoL1Client contract. +type TaikoL1ClientBlockProposedV20Iterator struct { + Event *TaikoL1ClientBlockProposedV20 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBlockProposedV20Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockProposedV20) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockProposedV20) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBlockProposedV20Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBlockProposedV20Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBlockProposedV20 represents a BlockProposedV20 event raised by the TaikoL1Client contract. +type TaikoL1ClientBlockProposedV20 struct { + BlockId *big.Int + Meta TaikoDataBlockMetadataV2 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockProposedV20 is a free log retrieval operation binding the contract event 0xefe9c6c0b5cbd9c0eed2d1e9c00cfc1a010d6f1aff50f7facd665a639b622b26. +// +// Solidity: event BlockProposedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBlockProposedV20(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientBlockProposedV20Iterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BlockProposedV20", blockIdRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBlockProposedV20Iterator{contract: _TaikoL1Client.contract, event: "BlockProposedV20", logs: logs, sub: sub}, nil +} + +// WatchBlockProposedV20 is a free log subscription operation binding the contract event 0xefe9c6c0b5cbd9c0eed2d1e9c00cfc1a010d6f1aff50f7facd665a639b622b26. +// +// Solidity: event BlockProposedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBlockProposedV20(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBlockProposedV20, blockId []*big.Int) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BlockProposedV20", blockIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBlockProposedV20) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockProposedV20", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockProposedV20 is a log parse operation binding the contract event 0xefe9c6c0b5cbd9c0eed2d1e9c00cfc1a010d6f1aff50f7facd665a639b622b26. +// +// Solidity: event BlockProposedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32,address,uint64,uint32,uint64,uint64,uint16,bool,bytes32,address,uint96,uint64,uint64,uint32,uint32,uint8,(uint8,uint8,uint32,uint64,uint32)) meta) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBlockProposedV20(log types.Log) (*TaikoL1ClientBlockProposedV20, error) { + event := new(TaikoL1ClientBlockProposedV20) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockProposedV20", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBlockVerifiedIterator is returned from FilterBlockVerified and is used to iterate over the raw logs and unpacked data for BlockVerified events raised by the TaikoL1Client contract. +type TaikoL1ClientBlockVerifiedIterator struct { + Event *TaikoL1ClientBlockVerified // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBlockVerifiedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockVerified) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockVerified) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBlockVerifiedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBlockVerifiedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBlockVerified represents a BlockVerified event raised by the TaikoL1Client contract. +type TaikoL1ClientBlockVerified struct { + BlockId *big.Int + Prover common.Address + BlockHash [32]byte + StateRoot [32]byte + Tier uint16 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockVerified is a free log retrieval operation binding the contract event 0xdecbd2c61cbda254917d6fd4c980a470701e8f9f1b744f6ad163ca70ca5db289. +// +// Solidity: event BlockVerified(uint256 indexed blockId, address indexed prover, bytes32 blockHash, bytes32 stateRoot, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBlockVerified(opts *bind.FilterOpts, blockId []*big.Int, prover []common.Address) (*TaikoL1ClientBlockVerifiedIterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BlockVerified", blockIdRule, proverRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBlockVerifiedIterator{contract: _TaikoL1Client.contract, event: "BlockVerified", logs: logs, sub: sub}, nil +} + +// WatchBlockVerified is a free log subscription operation binding the contract event 0xdecbd2c61cbda254917d6fd4c980a470701e8f9f1b744f6ad163ca70ca5db289. +// +// Solidity: event BlockVerified(uint256 indexed blockId, address indexed prover, bytes32 blockHash, bytes32 stateRoot, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBlockVerified(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBlockVerified, blockId []*big.Int, prover []common.Address) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BlockVerified", blockIdRule, proverRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBlockVerified) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockVerified", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockVerified is a log parse operation binding the contract event 0xdecbd2c61cbda254917d6fd4c980a470701e8f9f1b744f6ad163ca70ca5db289. +// +// Solidity: event BlockVerified(uint256 indexed blockId, address indexed prover, bytes32 blockHash, bytes32 stateRoot, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBlockVerified(log types.Log) (*TaikoL1ClientBlockVerified, error) { + event := new(TaikoL1ClientBlockVerified) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockVerified", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBlockVerifiedV2Iterator is returned from FilterBlockVerifiedV2 and is used to iterate over the raw logs and unpacked data for BlockVerifiedV2 events raised by the TaikoL1Client contract. +type TaikoL1ClientBlockVerifiedV2Iterator struct { + Event *TaikoL1ClientBlockVerifiedV2 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBlockVerifiedV2Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockVerifiedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockVerifiedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBlockVerifiedV2Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBlockVerifiedV2Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBlockVerifiedV2 represents a BlockVerifiedV2 event raised by the TaikoL1Client contract. +type TaikoL1ClientBlockVerifiedV2 struct { + BlockId *big.Int + Prover common.Address + BlockHash [32]byte + Tier uint16 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockVerifiedV2 is a free log retrieval operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. +// +// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBlockVerifiedV2(opts *bind.FilterOpts, blockId []*big.Int, prover []common.Address) (*TaikoL1ClientBlockVerifiedV2Iterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BlockVerifiedV2", blockIdRule, proverRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBlockVerifiedV2Iterator{contract: _TaikoL1Client.contract, event: "BlockVerifiedV2", logs: logs, sub: sub}, nil +} + +// WatchBlockVerifiedV2 is a free log subscription operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. +// +// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBlockVerifiedV2(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBlockVerifiedV2, blockId []*big.Int, prover []common.Address) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BlockVerifiedV2", blockIdRule, proverRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBlockVerifiedV2) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockVerifiedV2", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockVerifiedV2 is a log parse operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. +// +// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBlockVerifiedV2(log types.Log) (*TaikoL1ClientBlockVerifiedV2, error) { + event := new(TaikoL1ClientBlockVerifiedV2) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockVerifiedV2", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBlockVerifiedV20Iterator is returned from FilterBlockVerifiedV20 and is used to iterate over the raw logs and unpacked data for BlockVerifiedV20 events raised by the TaikoL1Client contract. +type TaikoL1ClientBlockVerifiedV20Iterator struct { + Event *TaikoL1ClientBlockVerifiedV20 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBlockVerifiedV20Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockVerifiedV20) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBlockVerifiedV20) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBlockVerifiedV20Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBlockVerifiedV20Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBlockVerifiedV20 represents a BlockVerifiedV20 event raised by the TaikoL1Client contract. +type TaikoL1ClientBlockVerifiedV20 struct { + BlockId *big.Int + Prover common.Address + BlockHash [32]byte + Tier uint16 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockVerifiedV20 is a free log retrieval operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. +// +// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBlockVerifiedV20(opts *bind.FilterOpts, blockId []*big.Int, prover []common.Address) (*TaikoL1ClientBlockVerifiedV20Iterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BlockVerifiedV20", blockIdRule, proverRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBlockVerifiedV20Iterator{contract: _TaikoL1Client.contract, event: "BlockVerifiedV20", logs: logs, sub: sub}, nil +} + +// WatchBlockVerifiedV20 is a free log subscription operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. +// +// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBlockVerifiedV20(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBlockVerifiedV20, blockId []*big.Int, prover []common.Address) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BlockVerifiedV20", blockIdRule, proverRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBlockVerifiedV20) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockVerifiedV20", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockVerifiedV20 is a log parse operation binding the contract event 0xe5a390d9800811154279af0c1a80d3bdf558ea91f1301e7c6ec3c1ad83e80aef. +// +// Solidity: event BlockVerifiedV2(uint256 indexed blockId, address indexed prover, bytes32 blockHash, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBlockVerifiedV20(log types.Log) (*TaikoL1ClientBlockVerifiedV20, error) { + event := new(TaikoL1ClientBlockVerifiedV20) + if err := _TaikoL1Client.contract.UnpackLog(event, "BlockVerifiedV20", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBondCreditedIterator is returned from FilterBondCredited and is used to iterate over the raw logs and unpacked data for BondCredited events raised by the TaikoL1Client contract. +type TaikoL1ClientBondCreditedIterator struct { + Event *TaikoL1ClientBondCredited // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBondCreditedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondCredited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondCredited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBondCreditedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBondCreditedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBondCredited represents a BondCredited event raised by the TaikoL1Client contract. +type TaikoL1ClientBondCredited struct { + User common.Address + BlockId *big.Int + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBondCredited is a free log retrieval operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondCredited(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondCreditedIterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondCredited", userRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBondCreditedIterator{contract: _TaikoL1Client.contract, event: "BondCredited", logs: logs, sub: sub}, nil +} + +// WatchBondCredited is a free log subscription operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondCredited(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondCredited, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondCredited", userRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBondCredited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBondCredited is a log parse operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondCredited(log types.Log) (*TaikoL1ClientBondCredited, error) { + event := new(TaikoL1ClientBondCredited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBondCredited0Iterator is returned from FilterBondCredited0 and is used to iterate over the raw logs and unpacked data for BondCredited0 events raised by the TaikoL1Client contract. +type TaikoL1ClientBondCredited0Iterator struct { + Event *TaikoL1ClientBondCredited0 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBondCredited0Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondCredited0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondCredited0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBondCredited0Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBondCredited0Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBondCredited0 represents a BondCredited0 event raised by the TaikoL1Client contract. +type TaikoL1ClientBondCredited0 struct { + User common.Address + BlockId *big.Int + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBondCredited0 is a free log retrieval operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondCredited0(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondCredited0Iterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondCredited0", userRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBondCredited0Iterator{contract: _TaikoL1Client.contract, event: "BondCredited0", logs: logs, sub: sub}, nil +} + +// WatchBondCredited0 is a free log subscription operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondCredited0(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondCredited0, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondCredited0", userRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBondCredited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited0", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBondCredited0 is a log parse operation binding the contract event 0x767672484792852973001cc22546fd96c3d7466da3c383e42741793dce5e4169. +// +// Solidity: event BondCredited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondCredited0(log types.Log) (*TaikoL1ClientBondCredited0, error) { + event := new(TaikoL1ClientBondCredited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondCredited0", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBondDebitedIterator is returned from FilterBondDebited and is used to iterate over the raw logs and unpacked data for BondDebited events raised by the TaikoL1Client contract. +type TaikoL1ClientBondDebitedIterator struct { + Event *TaikoL1ClientBondDebited // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBondDebitedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondDebited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondDebited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBondDebitedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBondDebitedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBondDebited represents a BondDebited event raised by the TaikoL1Client contract. +type TaikoL1ClientBondDebited struct { + User common.Address + BlockId *big.Int + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBondDebited is a free log retrieval operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. +// +// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondDebited(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondDebitedIterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondDebited", userRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBondDebitedIterator{contract: _TaikoL1Client.contract, event: "BondDebited", logs: logs, sub: sub}, nil +} + +// WatchBondDebited is a free log subscription operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. +// +// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondDebited(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondDebited, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondDebited", userRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBondDebited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBondDebited is a log parse operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. +// +// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondDebited(log types.Log) (*TaikoL1ClientBondDebited, error) { + event := new(TaikoL1ClientBondDebited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBondDebited0Iterator is returned from FilterBondDebited0 and is used to iterate over the raw logs and unpacked data for BondDebited0 events raised by the TaikoL1Client contract. +type TaikoL1ClientBondDebited0Iterator struct { + Event *TaikoL1ClientBondDebited0 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBondDebited0Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondDebited0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondDebited0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBondDebited0Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBondDebited0Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBondDebited0 represents a BondDebited0 event raised by the TaikoL1Client contract. +type TaikoL1ClientBondDebited0 struct { + User common.Address + BlockId *big.Int + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBondDebited0 is a free log retrieval operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. +// +// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondDebited0(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondDebited0Iterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondDebited0", userRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBondDebited0Iterator{contract: _TaikoL1Client.contract, event: "BondDebited0", logs: logs, sub: sub}, nil +} + +// WatchBondDebited0 is a free log subscription operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. +// +// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondDebited0(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondDebited0, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondDebited0", userRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBondDebited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited0", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBondDebited0 is a log parse operation binding the contract event 0xf4636413c66bd7ef2a1d735c30d22543acb0fba1b0892503bef0734b237c3f37. +// +// Solidity: event BondDebited(address indexed user, uint256 blockId, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondDebited0(log types.Log) (*TaikoL1ClientBondDebited0, error) { + event := new(TaikoL1ClientBondDebited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDebited0", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBondDepositedIterator is returned from FilterBondDeposited and is used to iterate over the raw logs and unpacked data for BondDeposited events raised by the TaikoL1Client contract. +type TaikoL1ClientBondDepositedIterator struct { + Event *TaikoL1ClientBondDeposited // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBondDepositedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBondDepositedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBondDepositedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBondDeposited represents a BondDeposited event raised by the TaikoL1Client contract. +type TaikoL1ClientBondDeposited struct { + User common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBondDeposited is a free log retrieval operation binding the contract event 0x8ed8c6869618197b68315ade66e75ed3906c97b111fa3ab81e5760046825c7db. +// +// Solidity: event BondDeposited(address indexed user, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondDeposited(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondDepositedIterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondDeposited", userRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBondDepositedIterator{contract: _TaikoL1Client.contract, event: "BondDeposited", logs: logs, sub: sub}, nil +} + +// WatchBondDeposited is a free log subscription operation binding the contract event 0x8ed8c6869618197b68315ade66e75ed3906c97b111fa3ab81e5760046825c7db. +// +// Solidity: event BondDeposited(address indexed user, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondDeposited(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondDeposited, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondDeposited", userRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBondDeposited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDeposited", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBondDeposited is a log parse operation binding the contract event 0x8ed8c6869618197b68315ade66e75ed3906c97b111fa3ab81e5760046825c7db. +// +// Solidity: event BondDeposited(address indexed user, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondDeposited(log types.Log) (*TaikoL1ClientBondDeposited, error) { + event := new(TaikoL1ClientBondDeposited) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDeposited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBondDeposited0Iterator is returned from FilterBondDeposited0 and is used to iterate over the raw logs and unpacked data for BondDeposited0 events raised by the TaikoL1Client contract. +type TaikoL1ClientBondDeposited0Iterator struct { + Event *TaikoL1ClientBondDeposited0 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBondDeposited0Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondDeposited0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondDeposited0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBondDeposited0Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBondDeposited0Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBondDeposited0 represents a BondDeposited0 event raised by the TaikoL1Client contract. +type TaikoL1ClientBondDeposited0 struct { + User common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBondDeposited0 is a free log retrieval operation binding the contract event 0x8ed8c6869618197b68315ade66e75ed3906c97b111fa3ab81e5760046825c7db. +// +// Solidity: event BondDeposited(address indexed user, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondDeposited0(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondDeposited0Iterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondDeposited0", userRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBondDeposited0Iterator{contract: _TaikoL1Client.contract, event: "BondDeposited0", logs: logs, sub: sub}, nil +} + +// WatchBondDeposited0 is a free log subscription operation binding the contract event 0x8ed8c6869618197b68315ade66e75ed3906c97b111fa3ab81e5760046825c7db. +// +// Solidity: event BondDeposited(address indexed user, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondDeposited0(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondDeposited0, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondDeposited0", userRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBondDeposited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDeposited0", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBondDeposited0 is a log parse operation binding the contract event 0x8ed8c6869618197b68315ade66e75ed3906c97b111fa3ab81e5760046825c7db. +// +// Solidity: event BondDeposited(address indexed user, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondDeposited0(log types.Log) (*TaikoL1ClientBondDeposited0, error) { + event := new(TaikoL1ClientBondDeposited0) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondDeposited0", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientBondWithdrawnIterator is returned from FilterBondWithdrawn and is used to iterate over the raw logs and unpacked data for BondWithdrawn events raised by the TaikoL1Client contract. +type TaikoL1ClientBondWithdrawnIterator struct { + Event *TaikoL1ClientBondWithdrawn // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientBondWithdrawnIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientBondWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientBondWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientBondWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientBondWithdrawn represents a BondWithdrawn event raised by the TaikoL1Client contract. +type TaikoL1ClientBondWithdrawn struct { + User common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBondWithdrawn is a free log retrieval operation binding the contract event 0x0d41118e36df44efb77a471fc49fb9c0be0406d802ef95520e9fbf606e65b455. +// +// Solidity: event BondWithdrawn(address indexed user, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterBondWithdrawn(opts *bind.FilterOpts, user []common.Address) (*TaikoL1ClientBondWithdrawnIterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "BondWithdrawn", userRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientBondWithdrawnIterator{contract: _TaikoL1Client.contract, event: "BondWithdrawn", logs: logs, sub: sub}, nil +} + +// WatchBondWithdrawn is a free log subscription operation binding the contract event 0x0d41118e36df44efb77a471fc49fb9c0be0406d802ef95520e9fbf606e65b455. +// +// Solidity: event BondWithdrawn(address indexed user, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchBondWithdrawn(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientBondWithdrawn, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "BondWithdrawn", userRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientBondWithdrawn) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondWithdrawn", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBondWithdrawn is a log parse operation binding the contract event 0x0d41118e36df44efb77a471fc49fb9c0be0406d802ef95520e9fbf606e65b455. +// +// Solidity: event BondWithdrawn(address indexed user, uint256 amount) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseBondWithdrawn(log types.Log) (*TaikoL1ClientBondWithdrawn, error) { + event := new(TaikoL1ClientBondWithdrawn) + if err := _TaikoL1Client.contract.UnpackLog(event, "BondWithdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientCalldataTxListIterator is returned from FilterCalldataTxList and is used to iterate over the raw logs and unpacked data for CalldataTxList events raised by the TaikoL1Client contract. +type TaikoL1ClientCalldataTxListIterator struct { + Event *TaikoL1ClientCalldataTxList // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientCalldataTxListIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientCalldataTxList) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientCalldataTxList) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientCalldataTxListIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientCalldataTxListIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientCalldataTxList represents a CalldataTxList event raised by the TaikoL1Client contract. +type TaikoL1ClientCalldataTxList struct { + BlockId *big.Int + TxList []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterCalldataTxList is a free log retrieval operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. +// +// Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterCalldataTxList(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientCalldataTxListIterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "CalldataTxList", blockIdRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientCalldataTxListIterator{contract: _TaikoL1Client.contract, event: "CalldataTxList", logs: logs, sub: sub}, nil +} + +// WatchCalldataTxList is a free log subscription operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. +// +// Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchCalldataTxList(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientCalldataTxList, blockId []*big.Int) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "CalldataTxList", blockIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientCalldataTxList) + if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseCalldataTxList is a log parse operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. +// +// Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseCalldataTxList(log types.Log) (*TaikoL1ClientCalldataTxList, error) { + event := new(TaikoL1ClientCalldataTxList) + if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientCalldataTxList0Iterator is returned from FilterCalldataTxList0 and is used to iterate over the raw logs and unpacked data for CalldataTxList0 events raised by the TaikoL1Client contract. +type TaikoL1ClientCalldataTxList0Iterator struct { + Event *TaikoL1ClientCalldataTxList0 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientCalldataTxList0Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientCalldataTxList0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientCalldataTxList0) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientCalldataTxList0Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientCalldataTxList0Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientCalldataTxList0 represents a CalldataTxList0 event raised by the TaikoL1Client contract. +type TaikoL1ClientCalldataTxList0 struct { + BlockId *big.Int + TxList []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterCalldataTxList0 is a free log retrieval operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. +// +// Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterCalldataTxList0(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientCalldataTxList0Iterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "CalldataTxList0", blockIdRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientCalldataTxList0Iterator{contract: _TaikoL1Client.contract, event: "CalldataTxList0", logs: logs, sub: sub}, nil +} + +// WatchCalldataTxList0 is a free log subscription operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. +// +// Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchCalldataTxList0(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientCalldataTxList0, blockId []*big.Int) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "CalldataTxList0", blockIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientCalldataTxList0) + if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList0", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseCalldataTxList0 is a log parse operation binding the contract event 0xa07bc5e8f00f6065c8727821591c519efd2348e4ff0c26560a85592e85b6f418. +// +// Solidity: event CalldataTxList(uint256 indexed blockId, bytes txList) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseCalldataTxList0(log types.Log) (*TaikoL1ClientCalldataTxList0, error) { + event := new(TaikoL1ClientCalldataTxList0) + if err := _TaikoL1Client.contract.UnpackLog(event, "CalldataTxList0", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the TaikoL1Client contract. +type TaikoL1ClientInitializedIterator struct { + Event *TaikoL1ClientInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientInitialized represents a Initialized event raised by the TaikoL1Client contract. +type TaikoL1ClientInitialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterInitialized(opts *bind.FilterOpts) (*TaikoL1ClientInitializedIterator, error) { + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &TaikoL1ClientInitializedIterator{contract: _TaikoL1Client.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientInitialized) (event.Subscription, error) { + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientInitialized) + if err := _TaikoL1Client.contract.UnpackLog(event, "Initialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseInitialized(log types.Log) (*TaikoL1ClientInitialized, error) { + event := new(TaikoL1ClientInitialized) + if err := _TaikoL1Client.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientOwnershipTransferStartedIterator is returned from FilterOwnershipTransferStarted and is used to iterate over the raw logs and unpacked data for OwnershipTransferStarted events raised by the TaikoL1Client contract. +type TaikoL1ClientOwnershipTransferStartedIterator struct { + Event *TaikoL1ClientOwnershipTransferStarted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientOwnershipTransferStartedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientOwnershipTransferStarted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientOwnershipTransferStarted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientOwnershipTransferStartedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientOwnershipTransferStartedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientOwnershipTransferStarted represents a OwnershipTransferStarted event raised by the TaikoL1Client contract. +type TaikoL1ClientOwnershipTransferStarted struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferStarted is a free log retrieval operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. +// +// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterOwnershipTransferStarted(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*TaikoL1ClientOwnershipTransferStartedIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "OwnershipTransferStarted", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientOwnershipTransferStartedIterator{contract: _TaikoL1Client.contract, event: "OwnershipTransferStarted", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferStarted is a free log subscription operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. +// +// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchOwnershipTransferStarted(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientOwnershipTransferStarted, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "OwnershipTransferStarted", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientOwnershipTransferStarted) + if err := _TaikoL1Client.contract.UnpackLog(event, "OwnershipTransferStarted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferStarted is a log parse operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. +// +// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseOwnershipTransferStarted(log types.Log) (*TaikoL1ClientOwnershipTransferStarted, error) { + event := new(TaikoL1ClientOwnershipTransferStarted) + if err := _TaikoL1Client.contract.UnpackLog(event, "OwnershipTransferStarted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the TaikoL1Client contract. +type TaikoL1ClientOwnershipTransferredIterator struct { + Event *TaikoL1ClientOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientOwnershipTransferred represents a OwnershipTransferred event raised by the TaikoL1Client contract. +type TaikoL1ClientOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*TaikoL1ClientOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientOwnershipTransferredIterator{contract: _TaikoL1Client.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientOwnershipTransferred) + if err := _TaikoL1Client.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseOwnershipTransferred(log types.Log) (*TaikoL1ClientOwnershipTransferred, error) { + event := new(TaikoL1ClientOwnershipTransferred) + if err := _TaikoL1Client.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientPausedIterator is returned from FilterPaused and is used to iterate over the raw logs and unpacked data for Paused events raised by the TaikoL1Client contract. +type TaikoL1ClientPausedIterator struct { + Event *TaikoL1ClientPaused // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientPausedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientPaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientPaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientPausedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientPausedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientPaused represents a Paused event raised by the TaikoL1Client contract. +type TaikoL1ClientPaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPaused is a free log retrieval operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// +// Solidity: event Paused(address account) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterPaused(opts *bind.FilterOpts) (*TaikoL1ClientPausedIterator, error) { + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "Paused") + if err != nil { + return nil, err + } + return &TaikoL1ClientPausedIterator{contract: _TaikoL1Client.contract, event: "Paused", logs: logs, sub: sub}, nil +} + +// WatchPaused is a free log subscription operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// +// Solidity: event Paused(address account) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchPaused(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientPaused) (event.Subscription, error) { + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "Paused") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientPaused) + if err := _TaikoL1Client.contract.UnpackLog(event, "Paused", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParsePaused is a log parse operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. +// +// Solidity: event Paused(address account) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParsePaused(log types.Log) (*TaikoL1ClientPaused, error) { + event := new(TaikoL1ClientPaused) + if err := _TaikoL1Client.contract.UnpackLog(event, "Paused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientProvingPausedIterator is returned from FilterProvingPaused and is used to iterate over the raw logs and unpacked data for ProvingPaused events raised by the TaikoL1Client contract. +type TaikoL1ClientProvingPausedIterator struct { + Event *TaikoL1ClientProvingPaused // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientProvingPausedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientProvingPaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientProvingPaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientProvingPausedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientProvingPausedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientProvingPaused represents a ProvingPaused event raised by the TaikoL1Client contract. +type TaikoL1ClientProvingPaused struct { + Paused bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterProvingPaused is a free log retrieval operation binding the contract event 0xed64db85835d07c3c990b8ebdd55e32d64e5ed53143b6ef2179e7bfaf17ddc3b. +// +// Solidity: event ProvingPaused(bool paused) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterProvingPaused(opts *bind.FilterOpts) (*TaikoL1ClientProvingPausedIterator, error) { + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "ProvingPaused") + if err != nil { + return nil, err + } + return &TaikoL1ClientProvingPausedIterator{contract: _TaikoL1Client.contract, event: "ProvingPaused", logs: logs, sub: sub}, nil +} + +// WatchProvingPaused is a free log subscription operation binding the contract event 0xed64db85835d07c3c990b8ebdd55e32d64e5ed53143b6ef2179e7bfaf17ddc3b. +// +// Solidity: event ProvingPaused(bool paused) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchProvingPaused(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientProvingPaused) (event.Subscription, error) { + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "ProvingPaused") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientProvingPaused) + if err := _TaikoL1Client.contract.UnpackLog(event, "ProvingPaused", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseProvingPaused is a log parse operation binding the contract event 0xed64db85835d07c3c990b8ebdd55e32d64e5ed53143b6ef2179e7bfaf17ddc3b. +// +// Solidity: event ProvingPaused(bool paused) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseProvingPaused(log types.Log) (*TaikoL1ClientProvingPaused, error) { + event := new(TaikoL1ClientProvingPaused) + if err := _TaikoL1Client.contract.UnpackLog(event, "ProvingPaused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientStateVariablesUpdatedIterator is returned from FilterStateVariablesUpdated and is used to iterate over the raw logs and unpacked data for StateVariablesUpdated events raised by the TaikoL1Client contract. +type TaikoL1ClientStateVariablesUpdatedIterator struct { + Event *TaikoL1ClientStateVariablesUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientStateVariablesUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientStateVariablesUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientStateVariablesUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientStateVariablesUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientStateVariablesUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientStateVariablesUpdated represents a StateVariablesUpdated event raised by the TaikoL1Client contract. +type TaikoL1ClientStateVariablesUpdated struct { + SlotB TaikoDataSlotB + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStateVariablesUpdated is a free log retrieval operation binding the contract event 0xb4be1a16d35fdd62eeaf9f552e025df3639847ddf2d61f011c72565056785ad2. +// +// Solidity: event StateVariablesUpdated((uint64,uint64,bool,uint56,uint64) slotB) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterStateVariablesUpdated(opts *bind.FilterOpts) (*TaikoL1ClientStateVariablesUpdatedIterator, error) { + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "StateVariablesUpdated") + if err != nil { + return nil, err + } + return &TaikoL1ClientStateVariablesUpdatedIterator{contract: _TaikoL1Client.contract, event: "StateVariablesUpdated", logs: logs, sub: sub}, nil +} + +// WatchStateVariablesUpdated is a free log subscription operation binding the contract event 0xb4be1a16d35fdd62eeaf9f552e025df3639847ddf2d61f011c72565056785ad2. +// +// Solidity: event StateVariablesUpdated((uint64,uint64,bool,uint56,uint64) slotB) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchStateVariablesUpdated(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientStateVariablesUpdated) (event.Subscription, error) { + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "StateVariablesUpdated") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientStateVariablesUpdated) + if err := _TaikoL1Client.contract.UnpackLog(event, "StateVariablesUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStateVariablesUpdated is a log parse operation binding the contract event 0xb4be1a16d35fdd62eeaf9f552e025df3639847ddf2d61f011c72565056785ad2. +// +// Solidity: event StateVariablesUpdated((uint64,uint64,bool,uint56,uint64) slotB) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseStateVariablesUpdated(log types.Log) (*TaikoL1ClientStateVariablesUpdated, error) { + event := new(TaikoL1ClientStateVariablesUpdated) + if err := _TaikoL1Client.contract.UnpackLog(event, "StateVariablesUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientTransitionContestedIterator is returned from FilterTransitionContested and is used to iterate over the raw logs and unpacked data for TransitionContested events raised by the TaikoL1Client contract. +type TaikoL1ClientTransitionContestedIterator struct { + Event *TaikoL1ClientTransitionContested // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientTransitionContestedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientTransitionContested) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientTransitionContested) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientTransitionContestedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientTransitionContestedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientTransitionContested represents a TransitionContested event raised by the TaikoL1Client contract. +type TaikoL1ClientTransitionContested struct { + BlockId *big.Int + Tran TaikoDataTransition + Contester common.Address + ContestBond *big.Int + Tier uint16 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransitionContested is a free log retrieval operation binding the contract event 0xb4c0a86c1ff239277697775b1e91d3375fd3a5ef6b345aa4e2f6001c890558f6. +// +// Solidity: event TransitionContested(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address contester, uint96 contestBond, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterTransitionContested(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientTransitionContestedIterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "TransitionContested", blockIdRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientTransitionContestedIterator{contract: _TaikoL1Client.contract, event: "TransitionContested", logs: logs, sub: sub}, nil +} + +// WatchTransitionContested is a free log subscription operation binding the contract event 0xb4c0a86c1ff239277697775b1e91d3375fd3a5ef6b345aa4e2f6001c890558f6. +// +// Solidity: event TransitionContested(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address contester, uint96 contestBond, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchTransitionContested(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientTransitionContested, blockId []*big.Int) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "TransitionContested", blockIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientTransitionContested) + if err := _TaikoL1Client.contract.UnpackLog(event, "TransitionContested", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransitionContested is a log parse operation binding the contract event 0xb4c0a86c1ff239277697775b1e91d3375fd3a5ef6b345aa4e2f6001c890558f6. +// +// Solidity: event TransitionContested(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address contester, uint96 contestBond, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseTransitionContested(log types.Log) (*TaikoL1ClientTransitionContested, error) { + event := new(TaikoL1ClientTransitionContested) + if err := _TaikoL1Client.contract.UnpackLog(event, "TransitionContested", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientTransitionContestedV2Iterator is returned from FilterTransitionContestedV2 and is used to iterate over the raw logs and unpacked data for TransitionContestedV2 events raised by the TaikoL1Client contract. +type TaikoL1ClientTransitionContestedV2Iterator struct { + Event *TaikoL1ClientTransitionContestedV2 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientTransitionContestedV2Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientTransitionContestedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientTransitionContestedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientTransitionContestedV2Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientTransitionContestedV2Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientTransitionContestedV2 represents a TransitionContestedV2 event raised by the TaikoL1Client contract. +type TaikoL1ClientTransitionContestedV2 struct { + BlockId *big.Int + Tran TaikoDataTransition + Contester common.Address + ContestBond *big.Int + Tier uint16 + ProposedIn uint64 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransitionContestedV2 is a free log retrieval operation binding the contract event 0x53b2379d5e9bcacdfe56b4a51c3fd92ebfff4b1e8e8638f7f7e85163260a6f99. +// +// Solidity: event TransitionContestedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address contester, uint96 contestBond, uint16 tier, uint64 proposedIn) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterTransitionContestedV2(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientTransitionContestedV2Iterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "TransitionContestedV2", blockIdRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientTransitionContestedV2Iterator{contract: _TaikoL1Client.contract, event: "TransitionContestedV2", logs: logs, sub: sub}, nil +} + +// WatchTransitionContestedV2 is a free log subscription operation binding the contract event 0x53b2379d5e9bcacdfe56b4a51c3fd92ebfff4b1e8e8638f7f7e85163260a6f99. +// +// Solidity: event TransitionContestedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address contester, uint96 contestBond, uint16 tier, uint64 proposedIn) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchTransitionContestedV2(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientTransitionContestedV2, blockId []*big.Int) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "TransitionContestedV2", blockIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientTransitionContestedV2) + if err := _TaikoL1Client.contract.UnpackLog(event, "TransitionContestedV2", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransitionContestedV2 is a log parse operation binding the contract event 0x53b2379d5e9bcacdfe56b4a51c3fd92ebfff4b1e8e8638f7f7e85163260a6f99. +// +// Solidity: event TransitionContestedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address contester, uint96 contestBond, uint16 tier, uint64 proposedIn) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseTransitionContestedV2(log types.Log) (*TaikoL1ClientTransitionContestedV2, error) { + event := new(TaikoL1ClientTransitionContestedV2) + if err := _TaikoL1Client.contract.UnpackLog(event, "TransitionContestedV2", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientTransitionProvedIterator is returned from FilterTransitionProved and is used to iterate over the raw logs and unpacked data for TransitionProved events raised by the TaikoL1Client contract. +type TaikoL1ClientTransitionProvedIterator struct { + Event *TaikoL1ClientTransitionProved // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientTransitionProvedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientTransitionProved) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientTransitionProved) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientTransitionProvedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientTransitionProvedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientTransitionProved represents a TransitionProved event raised by the TaikoL1Client contract. +type TaikoL1ClientTransitionProved struct { + BlockId *big.Int + Tran TaikoDataTransition + Prover common.Address + ValidityBond *big.Int + Tier uint16 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransitionProved is a free log retrieval operation binding the contract event 0xc195e4be3b936845492b8be4b1cf604db687a4d79ad84d979499c136f8e6701f. +// +// Solidity: event TransitionProved(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address prover, uint96 validityBond, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterTransitionProved(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientTransitionProvedIterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "TransitionProved", blockIdRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientTransitionProvedIterator{contract: _TaikoL1Client.contract, event: "TransitionProved", logs: logs, sub: sub}, nil +} + +// WatchTransitionProved is a free log subscription operation binding the contract event 0xc195e4be3b936845492b8be4b1cf604db687a4d79ad84d979499c136f8e6701f. +// +// Solidity: event TransitionProved(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address prover, uint96 validityBond, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchTransitionProved(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientTransitionProved, blockId []*big.Int) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "TransitionProved", blockIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientTransitionProved) + if err := _TaikoL1Client.contract.UnpackLog(event, "TransitionProved", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransitionProved is a log parse operation binding the contract event 0xc195e4be3b936845492b8be4b1cf604db687a4d79ad84d979499c136f8e6701f. +// +// Solidity: event TransitionProved(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address prover, uint96 validityBond, uint16 tier) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseTransitionProved(log types.Log) (*TaikoL1ClientTransitionProved, error) { + event := new(TaikoL1ClientTransitionProved) + if err := _TaikoL1Client.contract.UnpackLog(event, "TransitionProved", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientTransitionProvedV2Iterator is returned from FilterTransitionProvedV2 and is used to iterate over the raw logs and unpacked data for TransitionProvedV2 events raised by the TaikoL1Client contract. +type TaikoL1ClientTransitionProvedV2Iterator struct { + Event *TaikoL1ClientTransitionProvedV2 // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientTransitionProvedV2Iterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientTransitionProvedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientTransitionProvedV2) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientTransitionProvedV2Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientTransitionProvedV2Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientTransitionProvedV2 represents a TransitionProvedV2 event raised by the TaikoL1Client contract. +type TaikoL1ClientTransitionProvedV2 struct { + BlockId *big.Int + Tran TaikoDataTransition + Prover common.Address + ValidityBond *big.Int + Tier uint16 + ProposedIn uint64 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransitionProvedV2 is a free log retrieval operation binding the contract event 0x11a9112e5724f21b226e2535a95a264a80c9626ed4c0923faaa9fa6556467488. +// +// Solidity: event TransitionProvedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address prover, uint96 validityBond, uint16 tier, uint64 proposedIn) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterTransitionProvedV2(opts *bind.FilterOpts, blockId []*big.Int) (*TaikoL1ClientTransitionProvedV2Iterator, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "TransitionProvedV2", blockIdRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientTransitionProvedV2Iterator{contract: _TaikoL1Client.contract, event: "TransitionProvedV2", logs: logs, sub: sub}, nil +} + +// WatchTransitionProvedV2 is a free log subscription operation binding the contract event 0x11a9112e5724f21b226e2535a95a264a80c9626ed4c0923faaa9fa6556467488. +// +// Solidity: event TransitionProvedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address prover, uint96 validityBond, uint16 tier, uint64 proposedIn) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchTransitionProvedV2(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientTransitionProvedV2, blockId []*big.Int) (event.Subscription, error) { + + var blockIdRule []interface{} + for _, blockIdItem := range blockId { + blockIdRule = append(blockIdRule, blockIdItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "TransitionProvedV2", blockIdRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientTransitionProvedV2) + if err := _TaikoL1Client.contract.UnpackLog(event, "TransitionProvedV2", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransitionProvedV2 is a log parse operation binding the contract event 0x11a9112e5724f21b226e2535a95a264a80c9626ed4c0923faaa9fa6556467488. +// +// Solidity: event TransitionProvedV2(uint256 indexed blockId, (bytes32,bytes32,bytes32,bytes32) tran, address prover, uint96 validityBond, uint16 tier, uint64 proposedIn) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseTransitionProvedV2(log types.Log) (*TaikoL1ClientTransitionProvedV2, error) { + event := new(TaikoL1ClientTransitionProvedV2) + if err := _TaikoL1Client.contract.UnpackLog(event, "TransitionProvedV2", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientUnpausedIterator is returned from FilterUnpaused and is used to iterate over the raw logs and unpacked data for Unpaused events raised by the TaikoL1Client contract. +type TaikoL1ClientUnpausedIterator struct { + Event *TaikoL1ClientUnpaused // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientUnpausedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientUnpaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientUnpaused) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientUnpausedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientUnpausedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientUnpaused represents a Unpaused event raised by the TaikoL1Client contract. +type TaikoL1ClientUnpaused struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUnpaused is a free log retrieval operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. +// +// Solidity: event Unpaused(address account) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterUnpaused(opts *bind.FilterOpts) (*TaikoL1ClientUnpausedIterator, error) { + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "Unpaused") + if err != nil { + return nil, err + } + return &TaikoL1ClientUnpausedIterator{contract: _TaikoL1Client.contract, event: "Unpaused", logs: logs, sub: sub}, nil +} + +// WatchUnpaused is a free log subscription operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. +// +// Solidity: event Unpaused(address account) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchUnpaused(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientUnpaused) (event.Subscription, error) { + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "Unpaused") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientUnpaused) + if err := _TaikoL1Client.contract.UnpackLog(event, "Unpaused", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUnpaused is a log parse operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. +// +// Solidity: event Unpaused(address account) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseUnpaused(log types.Log) (*TaikoL1ClientUnpaused, error) { + event := new(TaikoL1ClientUnpaused) + if err := _TaikoL1Client.contract.UnpackLog(event, "Unpaused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ClientUpgradedIterator is returned from FilterUpgraded and is used to iterate over the raw logs and unpacked data for Upgraded events raised by the TaikoL1Client contract. +type TaikoL1ClientUpgradedIterator struct { + Event *TaikoL1ClientUpgraded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ClientUpgradedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientUpgraded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ClientUpgraded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ClientUpgradedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ClientUpgradedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ClientUpgraded represents a Upgraded event raised by the TaikoL1Client contract. +type TaikoL1ClientUpgraded struct { + Implementation common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpgraded is a free log retrieval operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b. +// +// Solidity: event Upgraded(address indexed implementation) +func (_TaikoL1Client *TaikoL1ClientFilterer) FilterUpgraded(opts *bind.FilterOpts, implementation []common.Address) (*TaikoL1ClientUpgradedIterator, error) { + + var implementationRule []interface{} + for _, implementationItem := range implementation { + implementationRule = append(implementationRule, implementationItem) + } + + logs, sub, err := _TaikoL1Client.contract.FilterLogs(opts, "Upgraded", implementationRule) + if err != nil { + return nil, err + } + return &TaikoL1ClientUpgradedIterator{contract: _TaikoL1Client.contract, event: "Upgraded", logs: logs, sub: sub}, nil +} + +// WatchUpgraded is a free log subscription operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b. +// +// Solidity: event Upgraded(address indexed implementation) +func (_TaikoL1Client *TaikoL1ClientFilterer) WatchUpgraded(opts *bind.WatchOpts, sink chan<- *TaikoL1ClientUpgraded, implementation []common.Address) (event.Subscription, error) { + + var implementationRule []interface{} + for _, implementationItem := range implementation { + implementationRule = append(implementationRule, implementationItem) + } + + logs, sub, err := _TaikoL1Client.contract.WatchLogs(opts, "Upgraded", implementationRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ClientUpgraded) + if err := _TaikoL1Client.contract.UnpackLog(event, "Upgraded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUpgraded is a log parse operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b. +// +// Solidity: event Upgraded(address indexed implementation) +func (_TaikoL1Client *TaikoL1ClientFilterer) ParseUpgraded(log types.Log) (*TaikoL1ClientUpgraded, error) { + event := new(TaikoL1ClientUpgraded) + if err := _TaikoL1Client.contract.UnpackLog(event, "Upgraded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} From e2daf45f39539c54895e6455eb5d8458895375ed Mon Sep 17 00:00:00 2001 From: David Date: Mon, 4 Nov 2024 12:58:45 +0800 Subject: [PATCH 50/71] feat: add `--softBlock.signatureCheck` flag --- packages/taiko-client/cmd/flags/driver.go | 8 ++++++ packages/taiko-client/driver/config.go | 2 ++ packages/taiko-client/driver/driver.go | 1 + packages/taiko-client/driver/driver_test.go | 1 + .../taiko-client/driver/soft_blocks/api.go | 25 +++++++++++-------- .../taiko-client/driver/soft_blocks/server.go | 5 +++- .../driver/soft_blocks/server_test.go | 2 +- 7 files changed, 31 insertions(+), 13 deletions(-) diff --git a/packages/taiko-client/cmd/flags/driver.go b/packages/taiko-client/cmd/flags/driver.go index 221d8394115..db1e36db29c 100644 --- a/packages/taiko-client/cmd/flags/driver.go +++ b/packages/taiko-client/cmd/flags/driver.go @@ -72,6 +72,13 @@ var ( Value: "*", EnvVars: []string{"SOFT_BLOCK_SERVER_CORS_ORIGINS"}, } + SoftBlockServerCheckSig = &cli.BoolFlag{ + Name: "softBlock.signatureCheck", + Usage: "If the soft block server will check the signature of the incoming transactions batches", + Category: driverCategory, + Value: true, + EnvVars: []string{"SOFT_BLOCK_SERVER_SIGNATURE_CHECK"}, + } ) // DriverFlags All driver flags. @@ -89,4 +96,5 @@ var DriverFlags = MergeFlags(CommonFlags, []cli.Flag{ SoftBlockServerPort, SoftBlockServerJWTSecret, SoftBlockServerCORSOrigins, + SoftBlockServerCheckSig, }) diff --git a/packages/taiko-client/driver/config.go b/packages/taiko-client/driver/config.go index ad7f867a451..e393128c33b 100644 --- a/packages/taiko-client/driver/config.go +++ b/packages/taiko-client/driver/config.go @@ -26,6 +26,7 @@ type Config struct { SoftBlockServerPort uint64 SoftBlockServerJWTSecret []byte SoftBlockServerCORSOrigins string + SoftBlockServerCheckSig bool } // NewConfigFromCliContext creates a new config instance from @@ -103,5 +104,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { SoftBlockServerPort: c.Uint64(flags.SoftBlockServerPort.Name), SoftBlockServerJWTSecret: softBlockServerJWTSecret, SoftBlockServerCORSOrigins: c.String(flags.SoftBlockServerCORSOrigins.Name), + SoftBlockServerCheckSig: c.Bool(flags.SoftBlockServerCheckSig.Name), }, nil } diff --git a/packages/taiko-client/driver/driver.go b/packages/taiko-client/driver/driver.go index 79450c7202e..aa2198dd67e 100644 --- a/packages/taiko-client/driver/driver.go +++ b/packages/taiko-client/driver/driver.go @@ -96,6 +96,7 @@ func (d *Driver) InitFromConfig(ctx context.Context, cfg *Config) (err error) { d.SoftBlockServerJWTSecret, d.l2ChainSyncer.BlobSyncer(), d.rpc, + d.Config.SoftBlockServerCheckSig, ); err != nil { return err } diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 8883ca83aff..80ec9f7a1c9 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -363,6 +363,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, + true, ) s.Nil(err) go func() { s.d.softblockServer.Start(port) }() diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index b18fc60ce79..65ecc60fda0 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -138,17 +138,20 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { return c.JSON(http.StatusBadRequest, map[string]string{"error": "empty coinbase"}) } - ok, err := reqBody.TransactionBatch.ValidateSignature() - if err != nil { - return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) - } - if !ok { - log.Warn( - "Invalid signature", - "signature", reqBody.TransactionBatch.Signature, - "coinbase", reqBody.TransactionBatch.BlockParams.Coinbase.Hex(), - ) - return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid signature"}) + // If the `--softBlock.signatureCheck` flag is enabled, validate the signature. + if s.checkSig { + ok, err := reqBody.TransactionBatch.ValidateSignature() + if err != nil { + return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + } + if !ok { + log.Warn( + "Invalid signature", + "signature", reqBody.TransactionBatch.Signature, + "coinbase", reqBody.TransactionBatch.BlockParams.Coinbase.Hex(), + ) + return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid signature"}) + } } // Check if the L2 execution engine is syncing from L1. diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index 058bebddf69..4eb5fd5f854 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -43,6 +43,7 @@ type SoftBlockAPIServer struct { chainSyncer softBlockChainSyncer rpc *rpc.Client txListDecompressor *txListDecompressor.TxListDecompressor + checkSig bool } // New creates a new soft blcok server instance, and starts the server. @@ -51,6 +52,7 @@ func New( jwtSecret []byte, chainSyncer softBlockChainSyncer, cli *rpc.Client, + checkSig bool, ) (*SoftBlockAPIServer, error) { protocolConfigs, err := rpc.GetProtocolConfigs(cli.TaikoL1, nil) if err != nil { @@ -65,7 +67,8 @@ func New( rpc.BlockMaxTxListBytes, cli.L2.ChainID, ), - rpc: cli, + rpc: cli, + checkSig: checkSig, } server.echo.HideBanner = true diff --git a/packages/taiko-client/driver/soft_blocks/server_test.go b/packages/taiko-client/driver/soft_blocks/server_test.go index 99156fc90be..3288fe53ac2 100644 --- a/packages/taiko-client/driver/soft_blocks/server_test.go +++ b/packages/taiko-client/driver/soft_blocks/server_test.go @@ -15,7 +15,7 @@ type SoftBlockAPIServerTestSuite struct { func (s *SoftBlockAPIServerTestSuite) SetupTest() { s.ClientTestSuite.SetupTest() - server, err := New("*", nil, nil, s.RPCClient) + server, err := New("*", nil, nil, s.RPCClient, true) s.Nil(err) s.s = server go s.s.Start(uint64(testutils.RandomPort())) From a35179c9a72d09f006b859900ef4455f00655d38 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 4 Nov 2024 16:05:41 +0800 Subject: [PATCH 51/71] feat: check EOB && EOP --- .../driver/chain_syncer/blob/soft_block.go | 2 +- packages/taiko-client/driver/driver_test.go | 130 ++++++++++++++---- .../taiko-client/driver/soft_blocks/api.go | 20 +++ 3 files changed, 126 insertions(+), 26 deletions(-) diff --git a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go index 56fb1ede383..32f05d803a6 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go +++ b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go @@ -95,7 +95,7 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( txList = append([]*types.Transaction{anchorTx}, txList...) } else { - prevSoftBlock, err := s.rpc.L2.BlockByNumber(ctx, new(big.Int).SetUint64(blockID-1)) + prevSoftBlock, err := s.rpc.L2.BlockByNumber(ctx, new(big.Int).SetUint64(blockID)) if err != nil { return nil, fmt.Errorf("failed to fetch previous soft block (%d): %w", blockID, err) } diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 80ec9f7a1c9..1a4dccc63a5 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -392,6 +392,83 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { s.Nil(err) s.True(res.IsSuccess()) + // Try to insert a soft block with batch ID 0 + s.True(s.insertSoftBlock(url, l1Head1, l2Head2.Number.Uint64()+1, 0, false, false).IsSuccess()) + l2Head3, err := s.d.rpc.L2.BlockByNumber(context.Background(), nil) + s.Nil(err) + + s.Equal(2, len(l2Head3.Transactions())) + + l1Origin, err := s.RPCClient.L2.L1OriginByID(context.Background(), new(big.Int).Add(l2Head2.Number, common.Big1)) + s.Nil(err) + s.Equal(l2Head3.Number().Uint64(), l1Origin.BlockID.Uint64()) + s.Equal(l2Head3.Hash(), l1Origin.L2BlockHash) + s.Equal(uint64(0), l1Origin.L1BlockHeight.Uint64()) + s.Equal(common.Hash{}, l1Origin.L1BlockHash) + s.Equal(false, l1Origin.EndOfBlock) + s.Equal(false, l1Origin.EndOfPreconf) + s.Equal(uint64(0), l1Origin.BatchID.Uint64()) + s.True(l1Origin.IsSoftblock()) + + // Try to patch a soft block with batch ID 1 + s.True(s.insertSoftBlock(url, l1Head1, l2Head2.Number.Uint64()+1, 1, true, false).IsSuccess()) + l2Head4, err := s.d.rpc.L2.BlockByNumber(context.Background(), nil) + s.Nil(err) + s.Equal(3, len(l2Head4.Transactions())) + s.Equal(l2Head3.Number().Uint64(), l2Head4.Number().Uint64()) + s.NotEqual(l2Head3.Hash(), l2Head4.Hash()) + + l1Origin2, err := s.RPCClient.L2.L1OriginByID(context.Background(), new(big.Int).Add(l2Head2.Number, common.Big1)) + s.Nil(err) + s.Equal(l2Head4.Number().Uint64(), l1Origin2.BlockID.Uint64()) + s.Equal(l2Head4.Hash(), l1Origin2.L2BlockHash) + s.Equal(uint64(0), l1Origin2.L1BlockHeight.Uint64()) + s.Equal(common.Hash{}, l1Origin2.L1BlockHash) + s.Equal(true, l1Origin2.EndOfBlock) + s.Equal(false, l1Origin2.EndOfPreconf) + s.Equal(uint64(1), l1Origin2.BatchID.Uint64()) + s.True(l1Origin2.IsSoftblock()) + + canonicalL1Origin, err := s.RPCClient.L2.HeadL1Origin(context.Background()) + s.Nil(err) + s.Equal(l2Head2.Number.Uint64(), canonicalL1Origin.BlockID.Uint64()) + + // // Try to patch an ended soft block + s.False(s.insertSoftBlock(url, l1Head1, l2Head2.Number.Uint64()+1, 1, true, true).IsSuccess()) + + // Propose 3 valid L2 blocks + s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) + + l2Head5, err := s.d.rpc.L2.BlockByNumber(context.Background(), l2Head3.Number()) + s.Nil(err) + s.Equal(l2Head3.Number().Uint64(), l2Head5.Number().Uint64()) + s.Equal(1, len(l2Head5.Transactions())) + + l1Origin3, err := s.RPCClient.L2.L1OriginByID(context.Background(), l2Head5.Number()) + s.Nil(err) + s.Equal(l2Head3.Number().Uint64(), l1Origin3.BlockID.Uint64()) + s.Equal(l2Head5.Hash(), l1Origin3.L2BlockHash) + s.NotZero(l1Origin3.L1BlockHeight.Uint64()) + s.NotEmpty(l1Origin3.L1BlockHash) + s.Equal(false, l1Origin3.EndOfBlock) + s.Equal(false, l1Origin3.EndOfPreconf) + s.Equal(uint64(0), l1Origin3.BatchID.Uint64()) + s.False(l1Origin3.IsSoftblock()) +} + +func TestDriverTestSuite(t *testing.T) { + suite.Run(t, new(DriverTestSuite)) +} + +// insertSoftBlock inserts a soft block with the given parameters. +func (s *DriverTestSuite) insertSoftBlock( + url *url.URL, + anchoredL1Block *types.Header, + l2BlockID uint64, + batchID uint64, + endOfBlock bool, + endOfPreconf bool, +) *resty.Response { preconferPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROPOSER_PRIVATE_KEY"))) s.Nil(err) @@ -415,16 +492,25 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { b, err := encodeAndCompressTxList([]*types.Transaction{signedTx}) s.Nil(err) + var marker softblocks.TransactionBatchMarker + if endOfBlock { + marker = softblocks.BatchMarkerEOB + } else if endOfPreconf { + marker = softblocks.BatchMarkerEOP + } else { + marker = softblocks.BatchMarkerEmpty + } + txBatch := softblocks.TransactionBatch{ - BlockID: l2Head2.Number.Uint64() + 1, - ID: 0, + BlockID: l2BlockID, + ID: batchID, TransactionsList: b, - BatchMarker: softblocks.BatchMarkerEmpty, + BatchMarker: marker, Signature: "", BlockParams: &softblocks.SoftBlockParams{ - AnchorBlockID: l1Head1.Number.Uint64(), - AnchorStateRoot: l1Head1.Root, - Timestamp: l1Head1.Time + 12, + AnchorBlockID: anchoredL1Block.Number.Uint64(), + AnchorStateRoot: anchoredL1Block.Root, + Timestamp: anchoredL1Block.Time + 12, Coinbase: preconferAddress, }, } @@ -437,32 +523,16 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { s.Nil(err) txBatch.Signature = common.Bytes2Hex(sig) - // Try to propose a soft block - res, err = resty.New(). + // Try to propose a soft block with batch ID 0 + res, err := resty.New(). R(). SetBody(&softblocks.BuildSoftBlockRequestBody{ TransactionBatch: txBatch, }). Post(url.String() + "/softBlocks") s.Nil(err) - s.True(res.IsSuccess()) - // Propose a valid L2 block - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) -} - -func TestDriverTestSuite(t *testing.T) { - suite.Run(t, new(DriverTestSuite)) -} - -// encodeAndCompressTxList encodes and compresses the given transactions list. -func encodeAndCompressTxList(txs types.Transactions) ([]byte, error) { - b, err := rlp.EncodeToBytes(txs) - if err != nil { - return nil, err - } - - return compress(b) + return res } // compress compresses the given txList bytes using zlib. @@ -481,3 +551,13 @@ func compress(txListBytes []byte) ([]byte, error) { return b.Bytes(), nil } + +// encodeAndCompressTxList encodes and compresses the given transactions list. +func encodeAndCompressTxList(txs types.Transactions) ([]byte, error) { + b, err := rlp.EncodeToBytes(txs) + if err != nil { + return nil, err + } + + return compress(b) +} diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 65ecc60fda0..8f1ac8cd1f7 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -4,6 +4,7 @@ import ( "math/big" "net/http" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" @@ -163,6 +164,25 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { return c.JSON(http.StatusBadRequest, map[string]string{"error": "L2 execution engine is syncing"}) } + // Check if the softblock batch or the current preconf process is ended. + l1Origin, err := s.rpc.L2.L1OriginByID( + c.Request().Context(), + new(big.Int).SetUint64(reqBody.TransactionBatch.BlockID), + ) + if err != nil && err.Error() != ethereum.NotFound.Error() { + return err + } + if l1Origin != nil { + if l1Origin.EndOfBlock { + return c.JSON(http.StatusBadRequest, map[string]string{"error": "soft block has already been marked as ended"}) + } + if l1Origin.EndOfPreconf { + return c.JSON(http.StatusBadRequest, map[string]string{ + "error": "preconfirmation has already been marked as ended", + }) + } + } + var txListBytes []byte if s.rpc.L2.ChainID.Cmp(params.HeklaNetworkID) == 0 { txListBytes = s.txListDecompressor.TryDecompressHekla( From 0a23ce7de021a53a1312cf270d5524f8e93b9045 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 4 Nov 2024 23:01:23 +0800 Subject: [PATCH 52/71] feat: implement `RemoveSoftBlocks` --- .../driver/chain_syncer/blob/soft_block.go | 34 ++++++ packages/taiko-client/driver/driver_test.go | 108 +++++++++++++++--- .../taiko-client/driver/soft_blocks/api.go | 49 +++++++- .../taiko-client/driver/soft_blocks/server.go | 2 +- 4 files changed, 172 insertions(+), 21 deletions(-) diff --git a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go index 32f05d803a6..604e59ccb24 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go +++ b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go @@ -160,6 +160,7 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( "mixHash", attributes.BlockMetadata.MixHash, "baseFee", utils.WeiToGWei(attributes.BaseFeePerGas), "extraData", common.Bytes2Hex(attributes.BlockMetadata.ExtraData), + "transactions", len(txList), ) // Step 1, prepare a payload @@ -237,7 +238,40 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( "transactions", len(payload.Transactions), "baseFee", utils.WeiToGWei(header.BaseFee), "withdrawals", len(payload.Withdrawals), + "endOfBlock", attributes.L1Origin.EndOfBlock, + "endOfPreconf", attributes.L1Origin.EndOfPreconf, ) return header, nil } + +// RemoveSoftBlocks removes soft blocks from the L2 execution engine's blockchain. +func (s *Syncer) RemoveSoftBlocks(ctx context.Context, newLastBlockId uint64) error { + s.mutex.Lock() + defer s.mutex.Unlock() + + newHead, err := s.rpc.L2.HeaderByNumber(ctx, new(big.Int).SetUint64(newLastBlockId)) + if err != nil { + return err + } + + lastVerifiedBlockHash, err := s.rpc.GetLastVerifiedBlockHash(ctx) + if err != nil { + return fmt.Errorf("failed to fetch last verified block hash: %w", err) + } + + fc := &engine.ForkchoiceStateV1{ + HeadBlockHash: newHead.Hash(), + SafeBlockHash: newHead.Hash(), + FinalizedBlockHash: lastVerifiedBlockHash, + } + fcRes, err := s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, nil) + if err != nil { + return err + } + if fcRes.PayloadStatus.Status != engine.VALID { + return fmt.Errorf("unexpected ForkchoiceUpdate response status: %s", fcRes.PayloadStatus.Status) + } + + return nil +} diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 1a4dccc63a5..6640c2a2885 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -15,6 +15,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" "github.com/go-resty/resty/v2" @@ -358,13 +359,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { port = uint64(testutils.RandomPort()) err error ) - s.d.softblockServer, err = softblocks.New( - "*", - nil, - s.d.ChainSyncer().BlobSyncer(), - s.RPCClient, - true, - ) + s.d.softblockServer, err = softblocks.New("*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, true) s.Nil(err) go func() { s.d.softblockServer.Start(port) }() defer s.d.softblockServer.Shutdown(s.d.ctx) @@ -433,21 +428,27 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { s.Nil(err) s.Equal(l2Head2.Number.Uint64(), canonicalL1Origin.BlockID.Uint64()) - // // Try to patch an ended soft block - s.False(s.insertSoftBlock(url, l1Head1, l2Head2.Number.Uint64()+1, 1, true, true).IsSuccess()) + // Try to patch an ended soft block + s.False(s.insertSoftBlock(url, l1Head1, l2Head2.Number.Uint64()+1, 1, true, false).IsSuccess()) + + // Try to insert a new soft block with batch ID 0 + s.True(s.insertSoftBlock(url, l1Head1, l2Head2.Number.Uint64()+2, 0, false, false).IsSuccess()) + l2Head5, err := s.d.rpc.L2.BlockByNumber(context.Background(), nil) + s.Nil(err) + s.Equal(2, len(l2Head5.Transactions())) // Propose 3 valid L2 blocks s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) - l2Head5, err := s.d.rpc.L2.BlockByNumber(context.Background(), l2Head3.Number()) + l2Head6, err := s.d.rpc.L2.BlockByNumber(context.Background(), l2Head3.Number()) s.Nil(err) - s.Equal(l2Head3.Number().Uint64(), l2Head5.Number().Uint64()) - s.Equal(1, len(l2Head5.Transactions())) + s.Equal(l2Head3.Number().Uint64(), l2Head6.Number().Uint64()) + s.Equal(1, len(l2Head6.Transactions())) - l1Origin3, err := s.RPCClient.L2.L1OriginByID(context.Background(), l2Head5.Number()) + l1Origin3, err := s.RPCClient.L2.L1OriginByID(context.Background(), l2Head6.Number()) s.Nil(err) s.Equal(l2Head3.Number().Uint64(), l1Origin3.BlockID.Uint64()) - s.Equal(l2Head5.Hash(), l1Origin3.L2BlockHash) + s.Equal(l2Head6.Hash(), l1Origin3.L2BlockHash) s.NotZero(l1Origin3.L1BlockHeight.Uint64()) s.NotEmpty(l1Origin3.L1BlockHash) s.Equal(false, l1Origin3.EndOfBlock) @@ -456,6 +457,74 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { s.False(l1Origin3.IsSoftblock()) } +func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOB() { + var ( + port = uint64(testutils.RandomPort()) + epochs = testutils.RandomHash().Big().Uint64() % 10 + err error + ) + s.d.softblockServer, err = softblocks.New("*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, true) + s.Nil(err) + go func() { s.d.softblockServer.Start(port) }() + defer s.d.softblockServer.Shutdown(s.d.ctx) + + url, err := url.Parse(fmt.Sprintf("http://localhost:%v", port)) + s.Nil(err) + + headL1Origin, err := s.RPCClient.L2.HeadL1Origin(context.Background()) + s.Nil(err) + + for range headL1Origin.BlockID.Uint64() + epochs + 1 { + s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) + } + + l1Head, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + l2Head, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + for i := range epochs { + s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, i, false, false).IsSuccess()) + } + s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs, true, false).IsSuccess()) + s.False(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs+1, false, false).IsSuccess()) +} + +func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOP() { + var ( + port = uint64(testutils.RandomPort()) + epochs = testutils.RandomHash().Big().Uint64() % 10 + err error + ) + s.d.softblockServer, err = softblocks.New("*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, true) + s.Nil(err) + go func() { s.d.softblockServer.Start(port) }() + defer s.d.softblockServer.Shutdown(s.d.ctx) + + url, err := url.Parse(fmt.Sprintf("http://localhost:%v", port)) + s.Nil(err) + + headL1Origin, err := s.RPCClient.L2.HeadL1Origin(context.Background()) + s.Nil(err) + + for range headL1Origin.BlockID.Uint64() + epochs + 1 { + s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) + } + + l1Head, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + l2Head, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + for i := range epochs { + s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, i, false, false).IsSuccess()) + } + s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs, false, true).IsSuccess()) + s.False(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs+1, false, false).IsSuccess()) +} + func TestDriverTestSuite(t *testing.T) { suite.Run(t, new(DriverTestSuite)) } @@ -474,7 +543,7 @@ func (s *DriverTestSuite) insertSoftBlock( preconferAddress := crypto.PubkeyToAddress(preconferPrivKey.PublicKey) - nonce, err := s.RPCClient.L2.PendingNonceAt(context.Background(), s.TestAddr) + nonce, err := s.RPCClient.L2.NonceAt(context.Background(), s.TestAddr, nil) s.Nil(err) tx := types.NewTransaction( @@ -487,7 +556,12 @@ func (s *DriverTestSuite) insertSoftBlock( ) signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(s.RPCClient.L2.ChainID), s.TestAddrPrivKey) s.Nil(err) - s.Nil(s.RPCClient.L2.SendTransaction(context.Background(), signedTx)) + + // If the transaction is underpriced, we just ingore it. + err = s.RPCClient.L2.SendTransaction(context.Background(), signedTx) + if err != nil { + s.Equal("replacement transaction underpriced", err.Error()) + } b, err := encodeAndCompressTxList([]*types.Transaction{signedTx}) s.Nil(err) @@ -531,7 +605,7 @@ func (s *DriverTestSuite) insertSoftBlock( }). Post(url.String() + "/softBlocks") s.Nil(err) - + log.Info("Soft block response", "body", res.String()) return res } diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 8f1ac8cd1f7..cb7bf2ff70d 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -83,7 +83,7 @@ type BuildSoftBlockRequestBody struct { // blocks creation requests. type BuildSoftBlockResponseBody struct { // @param blockHeader types.Header Header of the soft block - BlockHeader types.Header `json:"blockHeader"` + BlockHeader *types.Header `json:"blockHeader"` } // BuildSoftBlock handles a soft block creation request, @@ -211,7 +211,7 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()}) } - return c.JSON(http.StatusOK, BuildSoftBlockResponseBody{BlockHeader: *header}) + return c.JSON(http.StatusOK, BuildSoftBlockResponseBody{BlockHeader: header}) } // RemoveSoftBlocksRequestBody represents a request body when resetting the backend @@ -246,7 +246,50 @@ type RemoveSoftBlocksResponseBody struct { // @Success 200 {object} RemoveSoftBlocksResponseBody // @Router /softBlocks [delete] func (s *SoftBlockAPIServer) RemoveSoftBlocks(c echo.Context) error { - return c.NoContent(http.StatusOK) + // Parse the request body. + reqBody := new(RemoveSoftBlocksRequestBody) + if err := c.Bind(reqBody); err != nil { + return c.JSON(http.StatusUnprocessableEntity, map[string]string{"error": err.Error()}) + } + + // Request body validation. + canonicalHeadL1Origin, err := s.rpc.L2.HeadL1Origin(c.Request().Context()) + if err != nil { + return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + } + + currentHead, err := s.rpc.L2.HeaderByNumber(c.Request().Context(), nil) + if err != nil { + return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + } + + log.Info( + "New soft block removing request", + "newLastBlockId", reqBody.NewLastBlockID, + "canonicalHead", canonicalHeadL1Origin.BlockID.Uint64(), + "currentHead", currentHead.Number.Uint64(), + ) + + if reqBody.NewLastBlockID < canonicalHeadL1Origin.BlockID.Uint64() { + return c.JSON(http.StatusBadRequest, map[string]string{ + "error": "newLastBlockId must not be smaller than the canonical chain's highest block ID", + }) + } + + if err := s.chainSyncer.RemoveSoftBlocks(c.Request().Context(), reqBody.NewLastBlockID); err != nil { + return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + } + + newHead, err := s.rpc.L2.HeaderByNumber(c.Request().Context(), nil) + if err != nil { + return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + } + + return c.JSON(http.StatusOK, RemoveSoftBlocksResponseBody{ + LastBlockID: newHead.Number.Uint64(), + LastProposedBlockID: canonicalHeadL1Origin.BlockID.Uint64(), + HeadsRemoved: currentHead.Number.Uint64() - newHead.Number.Uint64(), + }) } // HealthCheck is the endpoints for probes. diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index 4eb5fd5f854..3edf86e89e3 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -17,7 +17,6 @@ import ( // softBlockChainSyncer is an interface for soft block chain syncer. type softBlockChainSyncer interface { InsertSoftBlockFromTransactionsBatch( - // Transactions batch parameters ctx context.Context, blockID uint64, batchID uint64, @@ -25,6 +24,7 @@ type softBlockChainSyncer interface { batchMarker TransactionBatchMarker, softBlockParams *SoftBlockParams, ) (*types.Header, error) + RemoveSoftBlocks(ctx context.Context, newLastBlockId uint64) error } // @title Taiko Soft Block Server API From 89ef5ff58ac97f99c11d0d8bf68dd4818de2f1ab Mon Sep 17 00:00:00 2001 From: David Date: Mon, 4 Nov 2024 23:39:30 +0800 Subject: [PATCH 53/71] test: update tests --- packages/taiko-client/driver/driver_test.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 6640c2a2885..733808d3811 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -460,7 +460,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOB() { var ( port = uint64(testutils.RandomPort()) - epochs = testutils.RandomHash().Big().Uint64() % 10 + epochs = testutils.RandomHash().Big().Uint64() % 5 err error ) s.d.softblockServer, err = softblocks.New("*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, true) @@ -494,7 +494,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOB() { func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOP() { var ( port = uint64(testutils.RandomPort()) - epochs = testutils.RandomHash().Big().Uint64() % 10 + epochs = testutils.RandomHash().Big().Uint64() % 5 err error ) s.d.softblockServer, err = softblocks.New("*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, true) @@ -523,6 +523,23 @@ func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOP() { } s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs, false, true).IsSuccess()) s.False(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs+1, false, false).IsSuccess()) + + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + // Remove soft blocks + res, err := resty.New(). + R(). + SetBody(&softblocks.RemoveSoftBlocksRequestBody{ + NewLastBlockID: l2Head2.Number.Uint64() - 1, + }). + Delete(url.String() + "/softBlocks") + s.Nil(err) + s.True(res.IsSuccess()) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.Equal(l2Head2.Number.Uint64()-1, l2Head3.Number.Uint64()) } func TestDriverTestSuite(t *testing.T) { From 2db8d10cb3a4a8828a04e528419deb7b38b7e9ed Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Nov 2024 00:22:58 +0800 Subject: [PATCH 54/71] fix: fix lint errors --- .../driver/chain_syncer/blob/soft_block.go | 4 +- packages/taiko-client/driver/driver.go | 4 +- packages/taiko-client/driver/driver_test.go | 455 +++++++++--------- .../taiko-client/driver/soft_blocks/server.go | 2 +- .../driver/soft_blocks/server_test.go | 3 +- 5 files changed, 235 insertions(+), 233 deletions(-) diff --git a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go index 604e59ccb24..cbf00037f2d 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go +++ b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go @@ -246,11 +246,11 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( } // RemoveSoftBlocks removes soft blocks from the L2 execution engine's blockchain. -func (s *Syncer) RemoveSoftBlocks(ctx context.Context, newLastBlockId uint64) error { +func (s *Syncer) RemoveSoftBlocks(ctx context.Context, newLastBlockID uint64) error { s.mutex.Lock() defer s.mutex.Unlock() - newHead, err := s.rpc.L2.HeaderByNumber(ctx, new(big.Int).SetUint64(newLastBlockId)) + newHead, err := s.rpc.L2.HeaderByNumber(ctx, new(big.Int).SetUint64(newLastBlockID)) if err != nil { return err } diff --git a/packages/taiko-client/driver/driver.go b/packages/taiko-client/driver/driver.go index aa2198dd67e..64993c77602 100644 --- a/packages/taiko-client/driver/driver.go +++ b/packages/taiko-client/driver/driver.go @@ -129,7 +129,9 @@ func (d *Driver) Close(_ context.Context) { d.state.Close() // Close the soft block server if it is enabled. if d.softblockServer != nil { - d.softblockServer.Shutdown(d.ctx) + if err := d.softblockServer.Shutdown(d.ctx); err != nil { + log.Error("Failed to shutdown soft block server", "error", err) + } } d.wg.Wait() } diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 733808d3811..a9a99268d27 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -21,7 +21,6 @@ import ( "github.com/go-resty/resty/v2" "github.com/stretchr/testify/suite" - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" softblocks "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/soft_blocks" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/jwt" @@ -67,227 +66,227 @@ func (s *DriverTestSuite) TestName() { s.Equal("driver", s.d.Name()) } -func (s *DriverTestSuite) TestProcessL1Blocks() { - l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - - // Propose a valid L2 block - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - - // Empty blocks - s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) - s.Nil(err) - - l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) - - for _, height := range []uint64{l2Head3.Number.Uint64(), l2Head3.Number.Uint64() - 1} { - header, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(height)) - s.Nil(err) - - txCount, err := s.d.rpc.L2.TransactionCount(context.Background(), header.Hash()) - s.Nil(err) - s.GreaterOrEqual(txCount, uint(1)) - - anchorTx, err := s.d.rpc.L2.TransactionInBlock(context.Background(), header.Hash(), 0) - s.Nil(err) - - method, err := encoding.TaikoL2ABI.MethodById(anchorTx.Data()) - s.Nil(err) - s.Contains(method.Name, "anchor") - } -} - -func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { - // TODO: Temporarily skip this test case when use l2_reth node. - if os.Getenv("L2_NODE") == "l2_reth" { - s.T().Skip() - } - var ( - testnetL1SnapshotID = s.SetL1Snapshot() - ) - l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - // Propose two L2 blocks - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - - res, err := s.RPCClient.CheckL1Reorg( - context.Background(), - l2Head2.Number, - ) - s.Nil(err) - s.False(res.IsReorged) - - // Reorg back to l2Head1 - s.RevertL1Snapshot(testnetL1SnapshotID) - s.InitProposer() - - // Because of evm_revert operation, the nonce of the proposer need to be adjusted. - // Propose ten blocks on another fork - for i := 0; i < 10; i++ { - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - } - - l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) - - l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Equal(l2Head1.Number.Uint64()+10, l2Head3.Number.Uint64()) - - parent, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(l2Head1.Number.Uint64()+1)) - s.Nil(err) - s.Equal(parent.ParentHash, l2Head1.Hash()) - s.NotEqual(parent.Hash(), l2Head2.ParentHash) -} - -func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() { - var ( - testnetL1SnapshotID = s.SetL1Snapshot() - ) - l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - // Propose two L2 blocks - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - time.Sleep(3 * time.Second) - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - - res, err := s.RPCClient.CheckL1Reorg( - context.Background(), - l2Head2.Number, - ) - s.Nil(err) - s.False(res.IsReorged) - - // Reorg back to l2Head1 - s.RevertL1Snapshot(testnetL1SnapshotID) - s.InitProposer() - - l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) - - // Propose one blocks on another fork - s.ProposeValidBlock(s.p) - - l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) - s.Less(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) - - s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - - l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) - s.Nil(err) - s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()-1) - s.Equal(parent.Hash(), l2Head1.Hash()) -} - -func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() { - var ( - testnetL1SnapshotID = s.SetL1Snapshot() - ) - l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - // Propose two L2 blocks - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - time.Sleep(3 * time.Second) - s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - - l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - - res, err := s.RPCClient.CheckL1Reorg( - context.Background(), - l2Head2.Number, - ) - s.Nil(err) - s.False(res.IsReorged) - - // Reorg back to l2Head1 - s.RevertL1Snapshot(testnetL1SnapshotID) - s.InitProposer() - - l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) - - // Propose two blocks on another fork - s.ProposeValidBlock(s.p) - time.Sleep(3 * time.Second) - s.ProposeValidBlock(s.p) - - l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) - - s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - - l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - - parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) - s.Nil(err) - s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) - s.NotEqual(l2Head3.Hash(), l2Head2.Hash()) - s.Equal(parent.ParentHash, l2Head1.Hash()) -} - -func (s *DriverTestSuite) TestDoSyncNoNewL2Blocks() { - s.Nil(s.d.l2ChainSyncer.Sync()) -} - -func (s *DriverTestSuite) TestStartClose() { - s.Nil(s.d.Start()) - s.cancel() - s.d.Close(s.d.ctx) -} +// func (s *DriverTestSuite) TestProcessL1Blocks() { +// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + +// // Propose a valid L2 block +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + +// // Empty blocks +// s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) +// s.Nil(err) + +// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) + +// for _, height := range []uint64{l2Head3.Number.Uint64(), l2Head3.Number.Uint64() - 1} { +// header, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(height)) +// s.Nil(err) + +// txCount, err := s.d.rpc.L2.TransactionCount(context.Background(), header.Hash()) +// s.Nil(err) +// s.GreaterOrEqual(txCount, uint(1)) + +// anchorTx, err := s.d.rpc.L2.TransactionInBlock(context.Background(), header.Hash(), 0) +// s.Nil(err) + +// method, err := encoding.TaikoL2ABI.MethodById(anchorTx.Data()) +// s.Nil(err) +// s.Contains(method.Name, "anchor") +// } +// } + +// func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { +// // TODO: Temporarily skip this test case when use l2_reth node. +// if os.Getenv("L2_NODE") == "l2_reth" { +// s.T().Skip() +// } +// var ( +// testnetL1SnapshotID = s.SetL1Snapshot() +// ) +// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// // Propose two L2 blocks +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) +// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + +// res, err := s.RPCClient.CheckL1Reorg( +// context.Background(), +// l2Head2.Number, +// ) +// s.Nil(err) +// s.False(res.IsReorged) + +// // Reorg back to l2Head1 +// s.RevertL1Snapshot(testnetL1SnapshotID) +// s.InitProposer() + +// // Because of evm_revert operation, the nonce of the proposer need to be adjusted. +// // Propose ten blocks on another fork +// for i := 0; i < 10; i++ { +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) +// } + +// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) + +// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Equal(l2Head1.Number.Uint64()+10, l2Head3.Number.Uint64()) + +// parent, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(l2Head1.Number.Uint64()+1)) +// s.Nil(err) +// s.Equal(parent.ParentHash, l2Head1.Hash()) +// s.NotEqual(parent.Hash(), l2Head2.ParentHash) +// } + +// func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() { +// var ( +// testnetL1SnapshotID = s.SetL1Snapshot() +// ) +// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// // Propose two L2 blocks +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) +// time.Sleep(3 * time.Second) +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) +// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + +// res, err := s.RPCClient.CheckL1Reorg( +// context.Background(), +// l2Head2.Number, +// ) +// s.Nil(err) +// s.False(res.IsReorged) + +// // Reorg back to l2Head1 +// s.RevertL1Snapshot(testnetL1SnapshotID) +// s.InitProposer() + +// l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) + +// // Propose one blocks on another fork +// s.ProposeValidBlock(s.p) + +// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) +// s.Less(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) + +// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + +// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) +// s.Nil(err) +// s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()-1) +// s.Equal(parent.Hash(), l2Head1.Hash()) +// } + +// func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() { +// var ( +// testnetL1SnapshotID = s.SetL1Snapshot() +// ) +// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// // Propose two L2 blocks +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) +// time.Sleep(3 * time.Second) +// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + +// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) +// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + +// res, err := s.RPCClient.CheckL1Reorg( +// context.Background(), +// l2Head2.Number, +// ) +// s.Nil(err) +// s.False(res.IsReorged) + +// // Reorg back to l2Head1 +// s.RevertL1Snapshot(testnetL1SnapshotID) +// s.InitProposer() + +// l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) +// s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) + +// // Propose two blocks on another fork +// s.ProposeValidBlock(s.p) +// time.Sleep(3 * time.Second) +// s.ProposeValidBlock(s.p) + +// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) + +// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + +// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) +// s.Nil(err) + +// parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) +// s.Nil(err) +// s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) +// s.NotEqual(l2Head3.Hash(), l2Head2.Hash()) +// s.Equal(parent.ParentHash, l2Head1.Hash()) +// } + +// func (s *DriverTestSuite) TestDoSyncNoNewL2Blocks() { +// s.Nil(s.d.l2ChainSyncer.Sync()) +// } + +// func (s *DriverTestSuite) TestStartClose() { +// s.Nil(s.d.Start()) +// s.cancel() +// s.d.Close(s.d.ctx) +// } func (s *DriverTestSuite) TestL1Current() { // propose and insert a block @@ -361,8 +360,8 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { ) s.d.softblockServer, err = softblocks.New("*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, true) s.Nil(err) - go func() { s.d.softblockServer.Start(port) }() - defer s.d.softblockServer.Shutdown(s.d.ctx) + go func() { s.NotNil(s.d.softblockServer.Start(port)) }() + defer func() { s.Nil(s.d.softblockServer.Shutdown(s.d.ctx)) }() url, err := url.Parse(fmt.Sprintf("http://localhost:%v", port)) s.Nil(err) @@ -465,8 +464,8 @@ func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOB() { ) s.d.softblockServer, err = softblocks.New("*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, true) s.Nil(err) - go func() { s.d.softblockServer.Start(port) }() - defer s.d.softblockServer.Shutdown(s.d.ctx) + go func() { s.NotNil(s.d.softblockServer.Start(port)) }() + defer func() { s.Nil(s.d.softblockServer.Shutdown(s.d.ctx)) }() url, err := url.Parse(fmt.Sprintf("http://localhost:%v", port)) s.Nil(err) @@ -499,8 +498,8 @@ func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOP() { ) s.d.softblockServer, err = softblocks.New("*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, true) s.Nil(err) - go func() { s.d.softblockServer.Start(port) }() - defer s.d.softblockServer.Shutdown(s.d.ctx) + go func() { s.NotNil(s.d.softblockServer.Start(port)) }() + defer func() { s.Nil(s.d.softblockServer.Shutdown(s.d.ctx)) }() url, err := url.Parse(fmt.Sprintf("http://localhost:%v", port)) s.Nil(err) diff --git a/packages/taiko-client/driver/soft_blocks/server.go b/packages/taiko-client/driver/soft_blocks/server.go index 3edf86e89e3..e27cac912fd 100644 --- a/packages/taiko-client/driver/soft_blocks/server.go +++ b/packages/taiko-client/driver/soft_blocks/server.go @@ -24,7 +24,7 @@ type softBlockChainSyncer interface { batchMarker TransactionBatchMarker, softBlockParams *SoftBlockParams, ) (*types.Header, error) - RemoveSoftBlocks(ctx context.Context, newLastBlockId uint64) error + RemoveSoftBlocks(ctx context.Context, newLastBlockID uint64) error } // @title Taiko Soft Block Server API diff --git a/packages/taiko-client/driver/soft_blocks/server_test.go b/packages/taiko-client/driver/soft_blocks/server_test.go index 3288fe53ac2..d3c750572b2 100644 --- a/packages/taiko-client/driver/soft_blocks/server_test.go +++ b/packages/taiko-client/driver/soft_blocks/server_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" ) @@ -18,7 +19,7 @@ func (s *SoftBlockAPIServerTestSuite) SetupTest() { server, err := New("*", nil, nil, s.RPCClient, true) s.Nil(err) s.s = server - go s.s.Start(uint64(testutils.RandomPort())) + go func() { s.Nil(s.s.Start(uint64(testutils.RandomPort()))) }() } func (s *SoftBlockAPIServerTestSuite) TestShutdown() { From 3178f292310d2850e0b992c8817e5f85d29bc7bd Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Nov 2024 00:23:18 +0800 Subject: [PATCH 55/71] fix: fix lint errors --- packages/taiko-client/driver/driver_test.go | 443 ++++++++++---------- 1 file changed, 222 insertions(+), 221 deletions(-) diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index a9a99268d27..080dd981f1c 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -21,6 +21,7 @@ import ( "github.com/go-resty/resty/v2" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" softblocks "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/soft_blocks" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/jwt" @@ -66,227 +67,227 @@ func (s *DriverTestSuite) TestName() { s.Equal("driver", s.d.Name()) } -// func (s *DriverTestSuite) TestProcessL1Blocks() { -// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - -// // Propose a valid L2 block -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) - -// // Empty blocks -// s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) -// s.Nil(err) - -// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) - -// for _, height := range []uint64{l2Head3.Number.Uint64(), l2Head3.Number.Uint64() - 1} { -// header, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(height)) -// s.Nil(err) - -// txCount, err := s.d.rpc.L2.TransactionCount(context.Background(), header.Hash()) -// s.Nil(err) -// s.GreaterOrEqual(txCount, uint(1)) - -// anchorTx, err := s.d.rpc.L2.TransactionInBlock(context.Background(), header.Hash(), 0) -// s.Nil(err) - -// method, err := encoding.TaikoL2ABI.MethodById(anchorTx.Data()) -// s.Nil(err) -// s.Contains(method.Name, "anchor") -// } -// } - -// func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { -// // TODO: Temporarily skip this test case when use l2_reth node. -// if os.Getenv("L2_NODE") == "l2_reth" { -// s.T().Skip() -// } -// var ( -// testnetL1SnapshotID = s.SetL1Snapshot() -// ) -// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// // Propose two L2 blocks -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) -// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - -// res, err := s.RPCClient.CheckL1Reorg( -// context.Background(), -// l2Head2.Number, -// ) -// s.Nil(err) -// s.False(res.IsReorged) - -// // Reorg back to l2Head1 -// s.RevertL1Snapshot(testnetL1SnapshotID) -// s.InitProposer() - -// // Because of evm_revert operation, the nonce of the proposer need to be adjusted. -// // Propose ten blocks on another fork -// for i := 0; i < 10; i++ { -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) -// } - -// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) - -// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Equal(l2Head1.Number.Uint64()+10, l2Head3.Number.Uint64()) - -// parent, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(l2Head1.Number.Uint64()+1)) -// s.Nil(err) -// s.Equal(parent.ParentHash, l2Head1.Hash()) -// s.NotEqual(parent.Hash(), l2Head2.ParentHash) -// } - -// func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() { -// var ( -// testnetL1SnapshotID = s.SetL1Snapshot() -// ) -// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// // Propose two L2 blocks -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) -// time.Sleep(3 * time.Second) -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) -// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - -// res, err := s.RPCClient.CheckL1Reorg( -// context.Background(), -// l2Head2.Number, -// ) -// s.Nil(err) -// s.False(res.IsReorged) - -// // Reorg back to l2Head1 -// s.RevertL1Snapshot(testnetL1SnapshotID) -// s.InitProposer() - -// l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) - -// // Propose one blocks on another fork -// s.ProposeValidBlock(s.p) - -// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) -// s.Less(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) - -// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - -// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) -// s.Nil(err) -// s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()-1) -// s.Equal(parent.Hash(), l2Head1.Hash()) -// } - -// func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() { -// var ( -// testnetL1SnapshotID = s.SetL1Snapshot() -// ) -// l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// // Propose two L2 blocks -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) -// time.Sleep(3 * time.Second) -// s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) - -// l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) -// s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) - -// res, err := s.RPCClient.CheckL1Reorg( -// context.Background(), -// l2Head2.Number, -// ) -// s.Nil(err) -// s.False(res.IsReorged) - -// // Reorg back to l2Head1 -// s.RevertL1Snapshot(testnetL1SnapshotID) -// s.InitProposer() - -// l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) -// s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) - -// // Propose two blocks on another fork -// s.ProposeValidBlock(s.p) -// time.Sleep(3 * time.Second) -// s.ProposeValidBlock(s.p) - -// l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) - -// s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - -// l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) -// s.Nil(err) - -// parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) -// s.Nil(err) -// s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) -// s.NotEqual(l2Head3.Hash(), l2Head2.Hash()) -// s.Equal(parent.ParentHash, l2Head1.Hash()) -// } - -// func (s *DriverTestSuite) TestDoSyncNoNewL2Blocks() { -// s.Nil(s.d.l2ChainSyncer.Sync()) -// } - -// func (s *DriverTestSuite) TestStartClose() { -// s.Nil(s.d.Start()) -// s.cancel() -// s.d.Close(s.d.ctx) -// } +func (s *DriverTestSuite) TestProcessL1Blocks() { + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + + // Propose a valid L2 block + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + + // Empty blocks + s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) + s.Nil(err) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) + + for _, height := range []uint64{l2Head3.Number.Uint64(), l2Head3.Number.Uint64() - 1} { + header, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(height)) + s.Nil(err) + + txCount, err := s.d.rpc.L2.TransactionCount(context.Background(), header.Hash()) + s.Nil(err) + s.GreaterOrEqual(txCount, uint(1)) + + anchorTx, err := s.d.rpc.L2.TransactionInBlock(context.Background(), header.Hash(), 0) + s.Nil(err) + + method, err := encoding.TaikoL2ABI.MethodById(anchorTx.Data()) + s.Nil(err) + s.Contains(method.Name, "anchor") + } +} + +func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { + // TODO: Temporarily skip this test case when use l2_reth node. + if os.Getenv("L2_NODE") == "l2_reth" { + s.T().Skip() + } + var ( + testnetL1SnapshotID = s.SetL1Snapshot() + ) + l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + // Propose two L2 blocks + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + + res, err := s.RPCClient.CheckL1Reorg( + context.Background(), + l2Head2.Number, + ) + s.Nil(err) + s.False(res.IsReorged) + + // Reorg back to l2Head1 + s.RevertL1Snapshot(testnetL1SnapshotID) + s.InitProposer() + + // Because of evm_revert operation, the nonce of the proposer need to be adjusted. + // Propose ten blocks on another fork + for i := 0; i < 10; i++ { + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + } + + l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Equal(l2Head1.Number.Uint64()+10, l2Head3.Number.Uint64()) + + parent, err := s.d.rpc.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(l2Head1.Number.Uint64()+1)) + s.Nil(err) + s.Equal(parent.ParentHash, l2Head1.Hash()) + s.NotEqual(parent.Hash(), l2Head2.ParentHash) +} + +func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() { + var ( + testnetL1SnapshotID = s.SetL1Snapshot() + ) + l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + // Propose two L2 blocks + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + time.Sleep(3 * time.Second) + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + + res, err := s.RPCClient.CheckL1Reorg( + context.Background(), + l2Head2.Number, + ) + s.Nil(err) + s.False(res.IsReorged) + + // Reorg back to l2Head1 + s.RevertL1Snapshot(testnetL1SnapshotID) + s.InitProposer() + + l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) + + // Propose one blocks on another fork + s.ProposeValidBlock(s.p) + + l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) + s.Less(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) + + s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) + s.Nil(err) + s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()-1) + s.Equal(parent.Hash(), l2Head1.Hash()) +} + +func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() { + var ( + testnetL1SnapshotID = s.SetL1Snapshot() + ) + l1Head1, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head1, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + // Propose two L2 blocks + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + time.Sleep(3 * time.Second) + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) + + l1Head2, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.Greater(l2Head2.Number.Uint64(), l2Head1.Number.Uint64()) + s.Greater(l1Head2.Number.Uint64(), l1Head1.Number.Uint64()) + + res, err := s.RPCClient.CheckL1Reorg( + context.Background(), + l2Head2.Number, + ) + s.Nil(err) + s.False(res.IsReorged) + + // Reorg back to l2Head1 + s.RevertL1Snapshot(testnetL1SnapshotID) + s.InitProposer() + + l1Head3, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) + + // Propose two blocks on another fork + s.ProposeValidBlock(s.p) + time.Sleep(3 * time.Second) + s.ProposeValidBlock(s.p) + + l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Greater(l1Head4.Number.Uint64(), l1Head3.Number.Uint64()) + + s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + parent, err := s.d.rpc.L2.HeaderByHash(context.Background(), l2Head3.ParentHash) + s.Nil(err) + s.Equal(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) + s.NotEqual(l2Head3.Hash(), l2Head2.Hash()) + s.Equal(parent.ParentHash, l2Head1.Hash()) +} + +func (s *DriverTestSuite) TestDoSyncNoNewL2Blocks() { + s.Nil(s.d.l2ChainSyncer.Sync()) +} + +func (s *DriverTestSuite) TestStartClose() { + s.Nil(s.d.Start()) + s.cancel() + s.d.Close(s.d.ctx) +} func (s *DriverTestSuite) TestL1Current() { // propose and insert a block From bebfe6aef149e61a64c461359f4b75579aa89f0d Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Nov 2024 00:42:01 +0800 Subject: [PATCH 56/71] test: update tests --- packages/taiko-client/driver/soft_blocks/server_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/taiko-client/driver/soft_blocks/server_test.go b/packages/taiko-client/driver/soft_blocks/server_test.go index d3c750572b2..c1aa66d1777 100644 --- a/packages/taiko-client/driver/soft_blocks/server_test.go +++ b/packages/taiko-client/driver/soft_blocks/server_test.go @@ -4,6 +4,7 @@ import ( "context" "testing" + "github.com/ethereum/go-ethereum/log" "github.com/stretchr/testify/suite" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" @@ -19,7 +20,11 @@ func (s *SoftBlockAPIServerTestSuite) SetupTest() { server, err := New("*", nil, nil, s.RPCClient, true) s.Nil(err) s.s = server - go func() { s.Nil(s.s.Start(uint64(testutils.RandomPort()))) }() + go func() { + s.NotPanics(func() { + log.Error("Start test soft block server", "error", s.s.Start(uint64(testutils.RandomPort()))) + }) + }() } func (s *SoftBlockAPIServerTestSuite) TestShutdown() { From 479711d6de4ed1d924dd035343ac1200a858ded4 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Nov 2024 13:48:45 +0800 Subject: [PATCH 57/71] feat: changes based on comments --- .../taiko-client/driver/soft_blocks/api.go | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index cb7bf2ff70d..d043102fd1c 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -1,6 +1,7 @@ package softblocks import ( + "errors" "math/big" "net/http" @@ -106,7 +107,7 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { // Parse the request body. reqBody := new(BuildSoftBlockRequestBody) if err := c.Bind(reqBody); err != nil { - return c.JSON(http.StatusUnprocessableEntity, map[string]string{"error": err.Error()}) + s.returnError(c, http.StatusUnprocessableEntity, err) } log.Info( @@ -124,19 +125,19 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { // Request body validation. if reqBody.TransactionBatch.BlockParams == nil { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "blockParams is required"}) + return s.returnError(c, http.StatusBadRequest, errors.New("blockParams is required")) } if reqBody.TransactionBatch.BlockParams.AnchorBlockID == 0 { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "non-zero anchorBlockID is required"}) + return s.returnError(c, http.StatusBadRequest, errors.New("non-zero anchorBlockID is required")) } if reqBody.TransactionBatch.BlockParams.AnchorStateRoot == (common.Hash{}) { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "empty anchorStateRoot"}) + return s.returnError(c, http.StatusBadRequest, errors.New("empty anchorStateRoot")) } if reqBody.TransactionBatch.BlockParams.Timestamp == 0 { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "non-zero timestamp is required"}) + return s.returnError(c, http.StatusBadRequest, errors.New("non-zero timestamp is required")) } if reqBody.TransactionBatch.BlockParams.Coinbase == (common.Address{}) { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "empty coinbase"}) + return s.returnError(c, http.StatusBadRequest, errors.New("empty coinbase")) } // If the `--softBlock.signatureCheck` flag is enabled, validate the signature. @@ -151,7 +152,7 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { "signature", reqBody.TransactionBatch.Signature, "coinbase", reqBody.TransactionBatch.BlockParams.Coinbase.Hex(), ) - return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid signature"}) + return s.returnError(c, http.StatusBadRequest, errors.New("invalid signature")) } } @@ -161,7 +162,7 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) } if progress.IsSyncing() { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "L2 execution engine is syncing"}) + return s.returnError(c, http.StatusBadRequest, errors.New("L2 execution engine is syncing")) } // Check if the softblock batch or the current preconf process is ended. @@ -170,16 +171,18 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { new(big.Int).SetUint64(reqBody.TransactionBatch.BlockID), ) if err != nil && err.Error() != ethereum.NotFound.Error() { - return err + return s.returnError(c, http.StatusInternalServerError, err) } if l1Origin != nil { if l1Origin.EndOfBlock { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "soft block has already been marked as ended"}) + return s.returnError(c, http.StatusBadRequest, errors.New("soft block has already been marked as ended")) } if l1Origin.EndOfPreconf { - return c.JSON(http.StatusBadRequest, map[string]string{ - "error": "preconfirmation has already been marked as ended", - }) + return s.returnError( + c, + http.StatusBadRequest, + errors.New("preconfirmation has already been marked as ended"), + ) } } @@ -208,7 +211,7 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { reqBody.TransactionBatch.BlockParams, ) if err != nil { - return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()}) + return s.returnError(c, http.StatusInternalServerError, err) } return c.JSON(http.StatusOK, BuildSoftBlockResponseBody{BlockHeader: header}) @@ -249,18 +252,18 @@ func (s *SoftBlockAPIServer) RemoveSoftBlocks(c echo.Context) error { // Parse the request body. reqBody := new(RemoveSoftBlocksRequestBody) if err := c.Bind(reqBody); err != nil { - return c.JSON(http.StatusUnprocessableEntity, map[string]string{"error": err.Error()}) + return s.returnError(c, http.StatusUnprocessableEntity, err) } // Request body validation. canonicalHeadL1Origin, err := s.rpc.L2.HeadL1Origin(c.Request().Context()) if err != nil { - return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + return s.returnError(c, http.StatusInternalServerError, err) } currentHead, err := s.rpc.L2.HeaderByNumber(c.Request().Context(), nil) if err != nil { - return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + return s.returnError(c, http.StatusInternalServerError, err) } log.Info( @@ -271,18 +274,20 @@ func (s *SoftBlockAPIServer) RemoveSoftBlocks(c echo.Context) error { ) if reqBody.NewLastBlockID < canonicalHeadL1Origin.BlockID.Uint64() { - return c.JSON(http.StatusBadRequest, map[string]string{ - "error": "newLastBlockId must not be smaller than the canonical chain's highest block ID", - }) + return s.returnError( + c, + http.StatusBadRequest, + errors.New("newLastBlockId must not be smaller than the canonical chain's highest block ID"), + ) } if err := s.chainSyncer.RemoveSoftBlocks(c.Request().Context(), reqBody.NewLastBlockID); err != nil { - return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + return s.returnError(c, http.StatusBadRequest, err) } newHead, err := s.rpc.L2.HeaderByNumber(c.Request().Context(), nil) if err != nil { - return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) + return s.returnError(c, http.StatusInternalServerError, err) } return c.JSON(http.StatusOK, RemoveSoftBlocksResponseBody{ @@ -303,3 +308,8 @@ func (s *SoftBlockAPIServer) RemoveSoftBlocks(c echo.Context) error { func (s *SoftBlockAPIServer) HealthCheck(c echo.Context) error { return c.NoContent(http.StatusOK) } + +// returnError is a helper function to return an error response. +func (s *SoftBlockAPIServer) returnError(c echo.Context, statusCode int, err error) error { + return c.JSON(statusCode, map[string]string{"error": err.Error()}) +} From f6860b56b74fa26b23fbbf8cb38ddd22d2da46ca Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Nov 2024 13:53:18 +0800 Subject: [PATCH 58/71] feat: changes based on comments --- packages/taiko-client/driver/chain_syncer/blob/syncer.go | 3 +-- packages/taiko-client/driver/driver_test.go | 2 +- packages/taiko-client/driver/soft_blocks/api.go | 5 ++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index 7075877ecd1..aa9ab13bb66 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -49,7 +49,7 @@ type Syncer struct { reorgDetectedFlag bool maxRetrieveExponent uint64 blobDatasource *rpc.BlobDataSource - mutex *sync.Mutex + mutex sync.Mutex } // NewSyncer creates a new syncer instance. @@ -90,7 +90,6 @@ func NewSyncer( blobServerEndpoint, socialScanEndpoint, ), - mutex: new(sync.Mutex), }, nil } diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 080dd981f1c..4a23a6ffeab 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -592,7 +592,7 @@ func (s *DriverTestSuite) insertSoftBlock( marker = softblocks.BatchMarkerEmpty } - txBatch := softblocks.TransactionBatch{ + txBatch := &softblocks.TransactionBatch{ BlockID: l2BlockID, ID: batchID, TransactionsList: b, diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index d043102fd1c..0b4cb794bee 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -77,7 +77,7 @@ func (b *TransactionBatch) ValidateSignature() (bool, error) { // soft blocks creation requests. type BuildSoftBlockRequestBody struct { // @param transactionBatch TransactionBatch Transaction batch to be inserted into the soft block - TransactionBatch TransactionBatch `json:"transactionBatch"` + TransactionBatch *TransactionBatch `json:"transactionBatch"` } // CreateOrUpdateBlocksFromBatchResponseBody represents a response body when handling soft @@ -109,6 +109,9 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { if err := c.Bind(reqBody); err != nil { s.returnError(c, http.StatusUnprocessableEntity, err) } + if reqBody.TransactionBatch == nil { + return s.returnError(c, http.StatusBadRequest, errors.New("transactionBatch is required")) + } log.Info( "New soft block building request", From bf1616886c0d315fc8efcc47867e5e45b12be836 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Nov 2024 13:57:53 +0800 Subject: [PATCH 59/71] fix: fix lint errors --- .../taiko-client/driver/soft_blocks/api.go | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 0b4cb794bee..1f818e7ce36 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -10,7 +10,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" "github.com/labstack/echo/v4" ) @@ -107,7 +106,7 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { // Parse the request body. reqBody := new(BuildSoftBlockRequestBody) if err := c.Bind(reqBody); err != nil { - s.returnError(c, http.StatusUnprocessableEntity, err) + return s.returnError(c, http.StatusUnprocessableEntity, err) } if reqBody.TransactionBatch == nil { return s.returnError(c, http.StatusBadRequest, errors.New("transactionBatch is required")) @@ -189,27 +188,17 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { } } - var txListBytes []byte - if s.rpc.L2.ChainID.Cmp(params.HeklaNetworkID) == 0 { - txListBytes = s.txListDecompressor.TryDecompressHekla( - new(big.Int).SetUint64(reqBody.TransactionBatch.BlockID), - reqBody.TransactionBatch.TransactionsList, - true, - ) - } else { - txListBytes = s.txListDecompressor.TryDecompress( - new(big.Int).SetUint64(reqBody.TransactionBatch.BlockID), - reqBody.TransactionBatch.TransactionsList, - true, - ) - } - // Insert the soft block. header, err := s.chainSyncer.InsertSoftBlockFromTransactionsBatch( c.Request().Context(), reqBody.TransactionBatch.BlockID, reqBody.TransactionBatch.ID, - txListBytes, + s.txListDecompressor.TryDecompress( + s.rpc.L2.ChainID, + new(big.Int).SetUint64(reqBody.TransactionBatch.BlockID), + reqBody.TransactionBatch.TransactionsList, + true, + ), reqBody.TransactionBatch.BatchMarker, reqBody.TransactionBatch.BlockParams, ) From 72d676b2a186ece5b0f851e014a21d85f24580d5 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 6 Nov 2024 13:38:17 +0800 Subject: [PATCH 60/71] test: add more tests --- packages/taiko-client/driver/driver_test.go | 41 +++++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 4a23a6ffeab..d4e6a746cb3 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -460,7 +460,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOB() { var ( port = uint64(testutils.RandomPort()) - epochs = testutils.RandomHash().Big().Uint64() % 5 + epochs = testutils.RandomHash().Big().Uint64()%10 + 5 err error ) s.d.softblockServer, err = softblocks.New("*", nil, s.d.ChainSyncer().BlobSyncer(), s.RPCClient, true) @@ -485,10 +485,43 @@ func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOB() { s.Nil(err) for i := range epochs { - s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, i, false, false).IsSuccess()) + s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1+i, 0, false, false).IsSuccess()) + s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1+i, 1, true, false).IsSuccess()) + s.False(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1+i, 0, true, false).IsSuccess()) } - s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs, true, false).IsSuccess()) - s.False(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs+1, false, false).IsSuccess()) + s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1+epochs, 0, true, false).IsSuccess()) + s.False(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1+epochs, 1, false, false).IsSuccess()) + s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+2+epochs, 0, false, true).IsSuccess()) + s.False(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+2+epochs, 1, true, false).IsSuccess()) + + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Equal(l2Head.Number.Uint64()+2+epochs, l2Head2.Number.Uint64()) + + l1Origin, err := s.RPCClient.L2.L1OriginByID(context.Background(), l2Head2.Number) + s.Nil(err) + + s.Equal(l2Head2.Number.Uint64(), l1Origin.BlockID.Uint64()) + s.Equal(false, l1Origin.EndOfBlock) + s.Equal(true, l1Origin.EndOfPreconf) + s.True(l1Origin.IsSoftblock()) + + headL1Origin, err = s.RPCClient.L2.HeadL1Origin(context.Background()) + s.Nil(err) + s.Equal(l2Head.Number.Uint64(), headL1Origin.BlockID.Uint64()) + s.False(headL1Origin.IsSoftblock()) + + s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) + + l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) + s.Nil(err) + + s.Less(l2Head3.Number.Uint64(), l2Head2.Number.Uint64()) + headL1Origin, err = s.RPCClient.L2.HeadL1Origin(context.Background()) + s.Nil(err) + s.Equal(l2Head3.Number.Uint64(), headL1Origin.BlockID.Uint64()) + s.False(headL1Origin.IsSoftblock()) } func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOP() { From f8b8cd3843325e5c11bfb49f06bfc782ebe88709 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 6 Nov 2024 15:42:34 +0800 Subject: [PATCH 61/71] test: add more tests --- packages/taiko-client/driver/driver_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index d4e6a746cb3..d0bc3eddb26 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -553,10 +553,22 @@ func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOP() { for i := range epochs { s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, i, false, false).IsSuccess()) + + latestSafeBlock, err := s.RPCClient.L2.HeaderByNumber(context.Background(), big.NewInt(-4)) + s.Nil(err) + s.Equal(l2Head.Number.Uint64(), latestSafeBlock.Number.Uint64()) + + latestFinalizedBlock, err := s.RPCClient.L2.HeaderByNumber(context.Background(), big.NewInt(-3)) + s.Nil(err) + s.Equal(uint64(0), latestFinalizedBlock.Number.Uint64()) } s.True(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs, false, true).IsSuccess()) s.False(s.insertSoftBlock(url, l1Head, l2Head.Number.Uint64()+1, epochs+1, false, false).IsSuccess()) + latestSafeBlock, err := s.RPCClient.L2.HeaderByNumber(context.Background(), big.NewInt(-4)) + s.Nil(err) + s.Equal(l2Head.Number.Uint64(), latestSafeBlock.Number.Uint64()) + l2Head2, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) s.Nil(err) @@ -573,6 +585,10 @@ func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOP() { l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) s.Nil(err) s.Equal(l2Head2.Number.Uint64()-1, l2Head3.Number.Uint64()) + + latestFinalizedBlock, err := s.RPCClient.L2.HeaderByNumber(context.Background(), big.NewInt(-3)) + s.Nil(err) + s.Equal(uint64(0), latestFinalizedBlock.Number.Uint64()) } func TestDriverTestSuite(t *testing.T) { From 87fbe4382e20d3093ff93fbd8dbbed6d74b045b3 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 7 Nov 2024 14:51:41 +0800 Subject: [PATCH 62/71] chore: update some comments --- packages/taiko-client/docs/docs.go | 15 ++++++++++----- packages/taiko-client/docs/swagger.json | 17 ++++++++++++----- packages/taiko-client/docs/swagger.yaml | 18 +++++++++++------- .../taiko-client/driver/soft_blocks/api.go | 8 ++++---- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/packages/taiko-client/docs/docs.go b/packages/taiko-client/docs/docs.go index 716fc382652..f82f6be1ce0 100644 --- a/packages/taiko-client/docs/docs.go +++ b/packages/taiko-client/docs/docs.go @@ -46,7 +46,7 @@ const docTemplate = `{ }, "/softBlocks": { "post": { - "description": "Insert a group of transactions into a soft block for preconfirmation. If the group is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft\n2) block-level parameters are invalid or do not match the current soft block’s parameters\n3) the group ID is not exactly 1 greater than the previous one\n4) the last group of the block indicates no further transactions are allowed", + "description": "Insert a batch of transactions into a soft block for preconfirmation. If the batch is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft\n2) block-level parameters are invalid or do not match the current soft block’s parameters\n3) the batch ID is not exactly 1 greater than the previous one\n4) the last batch of the block indicates no further transactions are allowed", "consumes": [ "application/json" ], @@ -174,8 +174,11 @@ const docTemplate = `{ } }, "coinbase": { - "description": "@param coinbase uint64 Coinbase of the soft block", - "type": "string" + "description": "@param coinbase string Coinbase of the soft block", + "type": "array", + "items": { + "type": "integer" + } }, "timestamp": { "description": "@param timestamp uint64 Timestamp of the soft block", @@ -226,10 +229,12 @@ const docTemplate = `{ "softblocks.TransactionBatchMarker": { "type": "string", "enum": [ - "end_of_block", - "end_of_preconf" + "", + "endOfBlock", + "endOfPreconf" ], "x-enum-varnames": [ + "BatchMarkerEmpty", "BatchMarkerEOB", "BatchMarkerEOP" ] diff --git a/packages/taiko-client/docs/swagger.json b/packages/taiko-client/docs/swagger.json index 078524beb0b..85f3a08f1f4 100644 --- a/packages/taiko-client/docs/swagger.json +++ b/packages/taiko-client/docs/swagger.json @@ -33,7 +33,7 @@ }, "/softBlocks": { "post": { - "description": "Insert a group of transactions into a soft block for preconfirmation. If the group is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft\n2) block-level parameters are invalid or do not match the current soft block’s parameters\n3) the group ID is not exactly 1 greater than the previous one\n4) the last group of the block indicates no further transactions are allowed", + "description": "Insert a batch of transactions into a soft block for preconfirmation. If the batch is the\nfirst for a block, a new soft block will be created. Otherwise, the transactions will\nbe appended to the existing soft block. The API will fail if:\n1) the block is not soft\n2) block-level parameters are invalid or do not match the current soft block’s parameters\n3) the batch ID is not exactly 1 greater than the previous one\n4) the last batch of the block indicates no further transactions are allowed", "consumes": ["application/json"], "produces": ["application/json"], "parameters": [ @@ -153,8 +153,11 @@ } }, "coinbase": { - "description": "@param coinbase uint64 Coinbase of the soft block", - "type": "string" + "description": "@param coinbase string Coinbase of the soft block", + "type": "array", + "items": { + "type": "integer" + } }, "timestamp": { "description": "@param timestamp uint64 Timestamp of the soft block", @@ -204,8 +207,12 @@ }, "softblocks.TransactionBatchMarker": { "type": "string", - "enum": ["end_of_block", "end_of_preconf"], - "x-enum-varnames": ["BatchMarkerEOB", "BatchMarkerEOP"] + "enum": ["", "endOfBlock", "endOfPreconf"], + "x-enum-varnames": [ + "BatchMarkerEmpty", + "BatchMarkerEOB", + "BatchMarkerEOP" + ] }, "types.Header": { "type": "object", diff --git a/packages/taiko-client/docs/swagger.yaml b/packages/taiko-client/docs/swagger.yaml index fa62613b65a..fa7adf15247 100644 --- a/packages/taiko-client/docs/swagger.yaml +++ b/packages/taiko-client/docs/swagger.yaml @@ -56,8 +56,10 @@ definitions: type: integer type: array coinbase: - description: "@param coinbase uint64 Coinbase of the soft block" - type: string + description: "@param coinbase string Coinbase of the soft block" + items: + type: integer + type: array timestamp: description: "@param timestamp uint64 Timestamp of the soft block" type: integer @@ -95,10 +97,12 @@ definitions: type: object softblocks.TransactionBatchMarker: enum: - - end_of_block - - end_of_preconf + - "" + - endOfBlock + - endOfPreconf type: string x-enum-varnames: + - BatchMarkerEmpty - BatchMarkerEOB - BatchMarkerEOP types.Header: @@ -238,13 +242,13 @@ paths: consumes: - application/json description: |- - Insert a group of transactions into a soft block for preconfirmation. If the group is the + Insert a batch of transactions into a soft block for preconfirmation. If the batch is the first for a block, a new soft block will be created. Otherwise, the transactions will be appended to the existing soft block. The API will fail if: 1) the block is not soft 2) block-level parameters are invalid or do not match the current soft block’s parameters - 3) the group ID is not exactly 1 greater than the previous one - 4) the last group of the block indicates no further transactions are allowed + 3) the batch ID is not exactly 1 greater than the previous one + 4) the last batch of the block indicates no further transactions are allowed parameters: - description: soft block creation request body in: body diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 1f818e7ce36..551e50a608e 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -87,16 +87,16 @@ type BuildSoftBlockResponseBody struct { } // BuildSoftBlock handles a soft block creation request, -// if the soft block group in request are valid, it will insert the correspoinding new soft +// if the soft block transactions batch in request are valid, it will insert or reorg the correspoinding the soft // block to the backend L2 execution engine and return a success response. // -// @Description Insert a group of transactions into a soft block for preconfirmation. If the group is the +// @Description Insert a batch of transactions into a soft block for preconfirmation. If the batch is the // @Description first for a block, a new soft block will be created. Otherwise, the transactions will // @Description be appended to the existing soft block. The API will fail if: // @Description 1) the block is not soft // @Description 2) block-level parameters are invalid or do not match the current soft block’s parameters -// @Description 3) the group ID is not exactly 1 greater than the previous one -// @Description 4) the last group of the block indicates no further transactions are allowed +// @Description 3) the batch ID is not exactly 1 greater than the previous one +// @Description 4) the last batch of the block indicates no further transactions are allowed // @Param body body BuildSoftBlockRequestBody true "soft block creation request body" // @Accept json // @Produce json From 4158e3a6f09748884f91c11a51a064de4eef17d3 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 7 Nov 2024 15:14:21 +0800 Subject: [PATCH 63/71] feat: check soft block height --- .../driver/chain_syncer/blob/soft_block.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go index cbf00037f2d..f6326a05d48 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go +++ b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go @@ -100,6 +100,20 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( return nil, fmt.Errorf("failed to fetch previous soft block (%d): %w", blockID, err) } + // Ensure the previous soft block is the current chain head. + blockNums, err := s.rpc.L2.BlockNumber(ctx) + if err != nil { + return nil, fmt.Errorf("failed to fetch the chain block number: %w", err) + } + + if prevSoftBlock.Number().Uint64() != blockNums { + return nil, fmt.Errorf( + "soft block (%d) to update is not the current chain head (%d)", + prevSoftBlock.Number().Uint64(), + blockNums, + ) + } + // Check the previous soft block status. l1Origin, err := s.rpc.L2.L1OriginByID(ctx, prevSoftBlock.Number()) if err != nil { From 3d4d180fbd0cdffdd827c26f83b642e207a8df6b Mon Sep 17 00:00:00 2001 From: maskpp Date: Fri, 8 Nov 2024 10:42:30 +0800 Subject: [PATCH 64/71] build docker image which will used in hive test --- .github/workflows/taiko-client--docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taiko-client--docker.yml b/.github/workflows/taiko-client--docker.yml index aaeb9efe684..76ef09ee15a 100644 --- a/.github/workflows/taiko-client--docker.yml +++ b/.github/workflows/taiko-client--docker.yml @@ -2,7 +2,7 @@ name: "Build and Push Multi-Arch Docker Image" on: push: - branches: [main] + branches: [main, preconf-driver-apis] tags: - "taiko-client-v*" paths: From eb2aababf8f2ab82f0089ca8f9eeefcbb417f434 Mon Sep 17 00:00:00 2001 From: maskpp Date: Fri, 8 Nov 2024 10:44:39 +0800 Subject: [PATCH 65/71] build docker image which will used in hive test --- packages/taiko-client/integration_test/hive_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/taiko-client/integration_test/hive_test.go b/packages/taiko-client/integration_test/hive_test.go index 0df80196797..cbf4a74e5af 100644 --- a/packages/taiko-client/integration_test/hive_test.go +++ b/packages/taiko-client/integration_test/hive_test.go @@ -80,6 +80,7 @@ func testBlobAPI(t *testing.T, pattern string, clients []string) { handler, err := hivesim.NewHiveFramework(&hivesim.HiveConfig{ BuildOutput: false, ContainerOutput: true, + DockerPull: false, BaseDir: os.Getenv("HIVE_DIR"), SimPattern: "taiko", SimTestPattern: pattern, From 324ebf0fa7d97b34e9c90dece322534772401f05 Mon Sep 17 00:00:00 2001 From: maskpp Date: Fri, 8 Nov 2024 10:46:17 +0800 Subject: [PATCH 66/71] feat(taiko-client): avoid coping the whole struct (#18463) --- .../guardian-prover-health-check-ui.yml | 2 -- .../taiko-client/driver/soft_blocks/api.go | 31 +++++++++---------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/.github/workflows/guardian-prover-health-check-ui.yml b/.github/workflows/guardian-prover-health-check-ui.yml index 7bf6a6eef0d..894482b7e9d 100644 --- a/.github/workflows/guardian-prover-health-check-ui.yml +++ b/.github/workflows/guardian-prover-health-check-ui.yml @@ -28,8 +28,6 @@ jobs: # vercel_org_id: ${{ secrets.VERCEL_ORG_ID }} # vercel_token: ${{ secrets.VERCEL_TOKEN }} - - deploy_guardians-ui_hekla_preview: if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }} needs: build-and-test diff --git a/packages/taiko-client/driver/soft_blocks/api.go b/packages/taiko-client/driver/soft_blocks/api.go index 551e50a608e..9e096d336eb 100644 --- a/packages/taiko-client/driver/soft_blocks/api.go +++ b/packages/taiko-client/driver/soft_blocks/api.go @@ -49,17 +49,14 @@ type TransactionBatch struct { // @param either `end_of_block`, `end_of_preconf` or empty BatchMarker TransactionBatchMarker `json:"batchType"` // @param signature string Signature of this transaction batch - Signature string `json:"signature"` + Signature string `json:"signature" rlp:"-"` // @param blockParams SoftBlockParams Block parameters of the soft block BlockParams *SoftBlockParams `json:"blockParams"` } // ValidateSignature validates the signature of the transaction batch. func (b *TransactionBatch) ValidateSignature() (bool, error) { - batchWithoutSig := *b - batchWithoutSig.Signature = "" - - payload, err := rlp.EncodeToBytes(batchWithoutSig) + payload, err := rlp.EncodeToBytes(b) if err != nil { return false, err } @@ -82,7 +79,7 @@ type BuildSoftBlockRequestBody struct { // CreateOrUpdateBlocksFromBatchResponseBody represents a response body when handling soft // blocks creation requests. type BuildSoftBlockResponseBody struct { - // @param blockHeader types.Header Header of the soft block + // @param blockHeader types.Header of the soft block BlockHeader *types.Header `json:"blockHeader"` } @@ -94,11 +91,11 @@ type BuildSoftBlockResponseBody struct { // @Description first for a block, a new soft block will be created. Otherwise, the transactions will // @Description be appended to the existing soft block. The API will fail if: // @Description 1) the block is not soft -// @Description 2) block-level parameters are invalid or do not match the current soft block’s parameters -// @Description 3) the batch ID is not exactly 1 greater than the previous one -// @Description 4) the last batch of the block indicates no further transactions are allowed -// @Param body body BuildSoftBlockRequestBody true "soft block creation request body" -// @Accept json +// @Description 2) block-level parameters are invalid or do not match the current soft block’s parameters +// @Description 3) the batch ID is not exactly 1 greater than the previous one +// @Description 4) the last batch of the block indicates no further transactions are allowed +// @Param body BuildSoftBlockRequestBody true "soft block creation request body" +// @Accept json // @Produce json // @Success 200 {object} BuildSoftBlockResponseBody // @Router /softBlocks [post] @@ -230,12 +227,12 @@ type RemoveSoftBlocksResponseBody struct { // RemoveSoftBlocks removes the backend L2 execution engine soft head. // -// @Description Remove all soft blocks from the blockchain beyond the specified block height, -// @Description ensuring the latest block ID does not exceed the given height. This method will fail if -// @Description the block with an ID one greater than the specified height is not a soft block. If the -// @Description specified block height is greater than the latest soft block ID, the method will succeed -// @Description without modifying the blockchain. -// @Param body body RemoveSoftBlocksRequestBody true "soft blocks removing request body" +// @Description Remove all soft blocks from the blockchain beyond the specified block height, +// @Description ensuring the latest block ID does not exceed the given height. This method will fail if +// @Description the block with an ID one greater than the specified height is not a soft block. If the +// @Description specified block height is greater than the latest soft block ID, the method will succeed +// @Description without modifying the blockchain. +// @Param body RemoveSoftBlocksRequestBody true "soft blocks removing request body" // @Accept json // @Produce json // @Success 200 {object} RemoveSoftBlocksResponseBody From 24017af6bc57103e9861e9601f25084a1ba5bac7 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 17 Nov 2024 11:08:38 +0700 Subject: [PATCH 67/71] feat: check if BatchID is nil --- packages/taiko-client/driver/chain_syncer/blob/soft_block.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go index f6326a05d48..644919a33d3 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/soft_block.go +++ b/packages/taiko-client/driver/chain_syncer/blob/soft_block.go @@ -119,6 +119,9 @@ func (s *Syncer) InsertSoftBlockFromTransactionsBatch( if err != nil { return nil, fmt.Errorf("failed to fetch L1 origin for block %d: %w", blockID, err) } + if l1Origin.BatchID == nil { + return nil, fmt.Errorf("batch ID is nil for block %d", blockID) + } if l1Origin.BatchID.Uint64()+1 != batchID { return nil, fmt.Errorf("batch ID mismatch: expected %d, got %d", l1Origin.BatchID.Uint64()+1, batchID) } From e5c82ab30f7f00d6ffcc10e31ac5d84ad65b44d1 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 17 Nov 2024 11:10:29 +0700 Subject: [PATCH 68/71] chore: update go.sum --- go.sum | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/go.sum b/go.sum index 012ea479671..8a03e3c4c02 100644 --- a/go.sum +++ b/go.sum @@ -19,6 +19,8 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= @@ -207,14 +209,19 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre 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-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= -github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= -github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= -github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= -github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= -github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= -github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= -github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -395,6 +402,9 @@ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -463,6 +473,7 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/neko-neko/echo-logrus/v2 v2.0.1 h1:BX2U6uv2N3UiUY75y+SntQak5S1AJIel9j+5Y6h4Nb4= github.com/neko-neko/echo-logrus/v2 v2.0.1/go.mod h1:GDYWo9CY4VXk/vn5ac5reoutYEkZEexlFI01MzHXVG0= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= @@ -699,6 +710,7 @@ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226101413-39120d07d75e/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -749,6 +761,7 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/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= @@ -834,7 +847,9 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 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-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -858,6 +873,7 @@ 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= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/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= gorm.io/datatypes v1.2.4 h1:uZmGAcK/QZ0uyfCuVg0VQY1ZmV9h1fuG0tMwKByO1z4= From ea20873ef9dae81244d59b7e7abea65cc0a54972 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 17 Nov 2024 14:01:50 +0700 Subject: [PATCH 69/71] chore: update go.mod --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 95835fb7e7f..cf21d01ca46 100644 --- a/go.mod +++ b/go.mod @@ -235,7 +235,7 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -replace github.com/ethereum/go-ethereum v1.14.11 => github.com/taikoxyz/taiko-geth v1.11.2-0.20241031044538-43ab184d9ebd +replace github.com/ethereum/go-ethereum v1.14.11 => github.com/taikoxyz/taiko-geth v1.11.2-0.20241117065921-51d42ec9f39f replace github.com/ethereum-optimism/optimism v1.7.4 => github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39 diff --git a/go.sum b/go.sum index 8a03e3c4c02..705694317f0 100644 --- a/go.sum +++ b/go.sum @@ -607,8 +607,8 @@ github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082 h1:ymZR+Y88LOnA8i3Ke github.com/taikoxyz/hive v0.0.0-20240827015317-405b241dd082/go.mod h1:RHnIu3EFehrWX3JhFAMQSXD5uz7l0xaNroTzXrap7EQ= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39 h1:JssMxaDmORjQ9RPZNulVJhAD8zSPd6LZFq5wsr6Nwz8= github.com/taikoxyz/optimism v0.0.0-20241003061504-cdf8af288f39/go.mod h1:ym7scR7ZHvEmwx1DLGVDzFlAdR+uhP1+Z4XCiFuSD5s= -github.com/taikoxyz/taiko-geth v1.11.2-0.20241031044538-43ab184d9ebd h1:QAdpo8oqI+X66EA5dc6cT77fEgNk2sqVKC6j14vv6uk= -github.com/taikoxyz/taiko-geth v1.11.2-0.20241031044538-43ab184d9ebd/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241117065921-51d42ec9f39f h1:Jccr7lSc98y4YeXRT0Tb601nMDxFYUFm4wrVKZILcmA= +github.com/taikoxyz/taiko-geth v1.11.2-0.20241117065921-51d42ec9f39f/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= github.com/testcontainers/testcontainers-go v0.34.0 h1:5fbgF0vIN5u+nD3IWabQwRybuB4GY8G2HHgCkbMzMHo= github.com/testcontainers/testcontainers-go v0.34.0/go.mod h1:6P/kMkQe8yqPHfPWNulFGdFHTD8HB2vLq/231xY2iPQ= github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e h1:cR8/SYRgyQCt5cNCMniB/ZScMkhI9nk8U5C7SbISXjo= From e3303dd45253c60b703f75731dc244f49e1ffdee Mon Sep 17 00:00:00 2001 From: David Date: Sun, 17 Nov 2024 14:07:12 +0700 Subject: [PATCH 70/71] feat: only snap sync to the highest safe block --- .../taiko-client/driver/chain_syncer/chain_syncer.go | 9 ++++----- packages/taiko-client/driver/driver_test.go | 12 ++++++------ packages/taiko-client/pkg/rpc/methods.go | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/taiko-client/driver/chain_syncer/chain_syncer.go b/packages/taiko-client/driver/chain_syncer/chain_syncer.go index 6e17215d73d..5402b5766f6 100644 --- a/packages/taiko-client/driver/chain_syncer/chain_syncer.go +++ b/packages/taiko-client/driver/chain_syncer/chain_syncer.go @@ -182,15 +182,14 @@ func (s *L2ChainSyncer) needNewBeaconSyncTriggered() (uint64, bool, error) { // For full sync mode, we will use the verified block head, // and for snap sync mode, we will use the latest block head. - var ( - blockID uint64 - err error - ) + var blockID uint64 switch s.syncMode { case downloader.SnapSync.String(): - if blockID, err = s.rpc.L2CheckPoint.BlockNumber(s.ctx); err != nil { + headL1Origin, err := s.rpc.L2CheckPoint.HeadL1Origin(s.ctx) + if err != nil { return 0, false, err } + blockID = headL1Origin.BlockID.Uint64() case downloader.FullSync.String(): stateVars, err := s.rpc.GetProtocolStateVariables(&bind.CallOpts{Context: s.ctx}) if err != nil { diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index d0bc3eddb26..774f5f49f8e 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -403,7 +403,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { s.Equal(false, l1Origin.EndOfBlock) s.Equal(false, l1Origin.EndOfPreconf) s.Equal(uint64(0), l1Origin.BatchID.Uint64()) - s.True(l1Origin.IsSoftblock()) + s.True(l1Origin.IsSoftBlock()) // Try to patch a soft block with batch ID 1 s.True(s.insertSoftBlock(url, l1Head1, l2Head2.Number.Uint64()+1, 1, true, false).IsSuccess()) @@ -422,7 +422,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { s.Equal(true, l1Origin2.EndOfBlock) s.Equal(false, l1Origin2.EndOfPreconf) s.Equal(uint64(1), l1Origin2.BatchID.Uint64()) - s.True(l1Origin2.IsSoftblock()) + s.True(l1Origin2.IsSoftBlock()) canonicalL1Origin, err := s.RPCClient.L2.HeadL1Origin(context.Background()) s.Nil(err) @@ -454,7 +454,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { s.Equal(false, l1Origin3.EndOfBlock) s.Equal(false, l1Origin3.EndOfPreconf) s.Equal(uint64(0), l1Origin3.BatchID.Uint64()) - s.False(l1Origin3.IsSoftblock()) + s.False(l1Origin3.IsSoftBlock()) } func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOB() { @@ -505,12 +505,12 @@ func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOB() { s.Equal(l2Head2.Number.Uint64(), l1Origin.BlockID.Uint64()) s.Equal(false, l1Origin.EndOfBlock) s.Equal(true, l1Origin.EndOfPreconf) - s.True(l1Origin.IsSoftblock()) + s.True(l1Origin.IsSoftBlock()) headL1Origin, err = s.RPCClient.L2.HeadL1Origin(context.Background()) s.Nil(err) s.Equal(l2Head.Number.Uint64(), headL1Origin.BlockID.Uint64()) - s.False(headL1Origin.IsSoftblock()) + s.False(headL1Origin.IsSoftBlock()) s.ProposeAndInsertEmptyBlocks(s.p, s.d.ChainSyncer().BlobSyncer()) @@ -521,7 +521,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOB() { headL1Origin, err = s.RPCClient.L2.HeadL1Origin(context.Background()) s.Nil(err) s.Equal(l2Head3.Number.Uint64(), headL1Origin.BlockID.Uint64()) - s.False(headL1Origin.IsSoftblock()) + s.False(headL1Origin.IsSoftBlock()) } func (s *DriverTestSuite) TestInsertSoftBlocksAfterEOP() { diff --git a/packages/taiko-client/pkg/rpc/methods.go b/packages/taiko-client/pkg/rpc/methods.go index 3b40f6be4c9..3cda9c75803 100644 --- a/packages/taiko-client/pkg/rpc/methods.go +++ b/packages/taiko-client/pkg/rpc/methods.go @@ -391,7 +391,7 @@ func (c *Client) GetPoolContent( timestamp = uint64(time.Now().Unix()) ) - if l1Origin != nil && l1Origin.IsSoftblock() && !l1Origin.EndOfPreconf && !l1Origin.EndOfBlock { + if l1Origin != nil && l1Origin.IsSoftBlock() && !l1Origin.EndOfPreconf && !l1Origin.EndOfBlock { // Check if this is an unfinished soft block, if not, we will use the latest L1 / L2 block number from the L1Origin. // Otherwise, we will use the L1 / L2 block number in L1Origin. L1HeadNum = l1Origin.L1BlockHeight From ca653a44f5469d0b5288a948a6c4ec88f14c6c5a Mon Sep 17 00:00:00 2001 From: David Date: Mon, 18 Nov 2024 10:43:02 +0700 Subject: [PATCH 71/71] test: fix tests --- packages/taiko-client/driver/driver_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 774f5f49f8e..e3217b84076 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -453,7 +453,7 @@ func (s *DriverTestSuite) TestInsertSoftBlocks() { s.NotEmpty(l1Origin3.L1BlockHash) s.Equal(false, l1Origin3.EndOfBlock) s.Equal(false, l1Origin3.EndOfPreconf) - s.Equal(uint64(0), l1Origin3.BatchID.Uint64()) + s.Nil(l1Origin3.BatchID) s.False(l1Origin3.IsSoftBlock()) }