diff --git a/.gitignore b/.gitignore index e69de29..6dd29b7 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +bin/ \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9544cc3 --- /dev/null +++ b/Makefile @@ -0,0 +1,135 @@ +#! /usr/bin/make -f + +# Project variables. +PACKAGE := github.com/hermeznetwork/hermez-node +VERSION := $(shell git describe --tags --always) +BUILD := $(shell git rev-parse --short HEAD) +BUILD_DATE := $(shell date +%Y-%m-%dT%H:%M:%S%z) +PROJECT_NAME := $(shell basename "$(PWD)") + +# Go related variables. +GO_FILES ?= $$(find . -name '*.go' | grep -v vendor) +GOBASE := $(shell pwd) +GOBIN := $(GOBASE)/bin +GOPKG := $(.) +GOENVVARS := GOBIN=$(GOBIN) +GOCMD := $(GOBASE)/cli/node +GOPROOF := $(GOBASE)/test/proofserver/cli +GOBINARY := node + +# Project configs. +MODE ?= sync +CONFIG ?= $(GOBASE)/cli/node/cfg.buidler.toml +POSTGRES_PASS ?= yourpasswordhere + +# Use linker flags to provide version/build settings. +LDFLAGS=-ldflags "-X=main.Version=$(VERSION) -X=main.Build=$(BUILD) -X=main.Date=$(BUILD_DATE)" + +# PID file will keep the process id of the server. +PID_PROOF_MOCK := /tmp/.$(PROJECT_NAME).proof.pid + +# Make is verbose in Linux. Make it silent. +MAKEFLAGS += --silent + +.PHONY: help +help: Makefile + @echo + @echo " Choose a command run in "$(PROJECT_NAME)":" + @echo + @sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' + @echo + +## test: Run the application check and all tests. +test: govet gocilint test-unit + +## test-unit: Run all unit tests. +test-unit: + @echo " > Running unit tests" + $(GOENVVARS) go test -race -p 1 -failfast -timeout 300s -v ./... + +## test-api-server: Run the API server using the Go tests. +test-api-server: + @echo " > Running unit tests" + $(GOENVVARS) FAKE_SERVER=yes go test -timeout 0 ./api -p 1 -count 1 -v + +## gofmt: Run `go fmt` for all go files. +gofmt: + @echo " > Format all go files" + $(GOENVVARS) gofmt -w ${GO_FILES} + +## govet: Run go vet. +govet: + @echo " > Running go vet" + $(GOENVVARS) go vet ./... + +## golint: Run default golint. +golint: + @echo " > Running golint" + $(GOENVVARS) golint -set_exit_status ./... + +## gocilint: Run Golang CI Lint. +gocilint: + @echo " > Running Golang CI Lint" + $-golangci-lint run --timeout=5m -E whitespace -E gosec -E gci -E misspell -E gomnd -E gofmt -E goimports -E golint --exclude-use-default=false --max-same-issues 0 + +## exec: Run given command. e.g; make exec run="go test ./..." +exec: + GOBIN=$(GOBIN) $(run) + +## clean: Clean build files. Runs `go clean` internally. +clean: + @-rm $(GOBIN)/ 2> /dev/null + @echo " > Cleaning build cache" + $(GOENVVARS) go clean + +## build: Build the project. +build: install + @echo " > Building Hermez binary..." + @bash -c "$(MAKE) migration-pack" + $(GOENVVARS) go build $(LDFLAGS) -o $(GOBIN)/$(GOBINARY) $(GOCMD) + @bash -c "$(MAKE) migration-clean" + +## install: Install missing dependencies. Runs `go get` internally. e.g; make install get=github.com/foo/bar +install: + @echo " > Checking if there is any missing dependencies..." + $(GOENVVARS) go get $(GOCMD)/... $(get) + +## run: Run Hermez node. +run: + @bash -c "$(MAKE) clean build" + @echo " > Running $(PROJECT_NAME)" + @$(GOBIN)/$(GOBINARY) --mode $(MODE) --cfg $(CONFIG) run + +## run-proof-mock: Run proof server mock API. +run-proof-mock: stop-proof-mock + @echo " > Running Proof Server Mock" + $(GOENVVARS) go build -o $(GOBIN)/proof $(GOPROOF) + @$(GOBIN)/proof 2>&1 & echo $$! > $(PID_PROOF_MOCK) + @cat $(PID_PROOF_MOCK) | sed "/^/s/^/ \> Proof Server Mock PID: /" + +## stop-proof-mock: Stop proof server mock API. +stop-proof-mock: + @-touch $(PID_PROOF_MOCK) + @-kill -s INT `cat $(PID_PROOF_MOCK)` 2> /dev/null || true + @-rm $(PID_PROOF_MOCK) $(GOBIN)/proof 2> /dev/null || true + +## migration-pack: Pack the database migrations into the binary. +migration-pack: + @echo " > Packing the migrations..." + @cd /tmp && go get -u github.com/gobuffalo/packr/v2/packr2 && cd - + @cd $(GOBASE)/db && packr2 && cd - + +## migration-clean: Clean the database migrations pack. +migration-clean: + @echo " > Cleaning the migrations..." + @cd $(GOBASE)/db && packr2 clean && cd - + +## run-database-container: Run the Postgres container +run-database-container: + @echo " > Running the postgreSQL DB..." + @-docker run --rm --name hermez-db -p 5432:5432 -e POSTGRES_DB=hermez -e POSTGRES_USER=hermez -e POSTGRES_PASSWORD="$(POSTGRES_PASS)" -d postgres + +## stop-database-container: Stop the Postgres container +stop-database-container: + @echo " > Stopping the postgreSQL DB..." + @-docker stop hermez-db diff --git a/README.md b/README.md index 3873531..12b0a21 100644 --- a/README.md +++ b/README.md @@ -8,42 +8,75 @@ Go implementation of the Hermez node. The `hermez-node` has been tested with go version 1.14 +### Build + +Build the binary and check the current version: + +```shell +$ make build +$ bin/node version +``` + +### Run + +First you must edit the default/template config file into [cli/node/cfg.buidler.toml](cli/node/cfg.buidler.toml), +there are more information about the config file into [cli/node/README.md](cli/node/README.md) + +After setting the config, you can build and run the Hermez Node as a synchronizer: + +```shell +$ make run +``` + +Or build and run as a coordinator, and also passing the config file from other location: + +```shell +$ MODE=sync CONFIG=cli/node/cfg.buidler.toml make run +``` + +To check the useful make commands: + +```shell +$ make help +``` + ### Unit testing Running the unit tests requires a connection to a PostgreSQL database. You can -start PostgreSQL with docker easily this way (where `yourpasswordhere` should +run PostgreSQL with docker easily this way (where `yourpasswordhere` should be your password): -``` -POSTGRES_PASS=yourpasswordhere; sudo docker run --rm --name hermez-db-test -p 5432:5432 -e POSTGRES_DB=hermez -e POSTGRES_USER=hermez -e POSTGRES_PASSWORD="$POSTGRES_PASS" -d postgres +```shell +$ POSTGRES_PASS="yourpasswordhere" make run-database-container ``` -Afterwards, run the tests with the password as env var: +Afterward, run the tests with the password as env var: -``` -POSTGRES_PASS=yourpasswordhere go test -p 1 ./... +```shell +$ POSTGRES_PASS="yourpasswordhere" make test ``` -NOTE: `-p 1` forces execution of package test in serial. Otherwise they may be -executed in paralel and the test may find unexpected entries in the SQL databse +NOTE: `-p 1` forces execution of package test in serial. Otherwise, they may be +executed in parallel, and the test may find unexpected entries in the SQL database because it's shared among all tests. -There is an extra temporary option that allows you to run the API server using -the Go tests. This will be removed once the API can be properly initialized, -with data from the synchronizer and so on. To use this, run: +There is an extra temporary option that allows you to run the API server using the +Go tests. It will be removed once the API can be properly initialized with data +from the synchronizer. To use this, run: -``` -FAKE_SERVER=yes POSTGRES_PASS=yourpasswordhere go test -timeout 0 ./api -p 1 -count 1 -v` +```shell +$ POSTGRES_PASS="yourpasswordhere" make test-api-server ``` ### Lint All Pull Requests need to pass the configured linter. -To run the linter locally, first install [golangci-lint](https://golangci-lint.run). Afterwards you can check the lints with this command: +To run the linter locally, first, install [golangci-lint](https://golangci-lint.run). +Afterward, you can check the lints with this command: -``` -golangci-lint run --timeout=5m -E whitespace -E gosec -E gci -E misspell -E gomnd -E gofmt -E goimports -E golint --exclude-use-default=false --max-same-issues 0 +```shell +$ make gocilint ``` ## Usage @@ -54,13 +87,13 @@ See [cli/node/README.md](cli/node/README.md) ### Proof Server -The node in mode coordinator requires a proof server (a server that is capable -of calculating proofs from the zkInputs). For testing purposes there is a mock -proof server cli at `test/proofserver/cli`. +The node in mode coordinator requires a proof server (a server capable of +calculating proofs from the zkInputs). There is a mock proof server CLI +at `test/proofserver/cli` for testing purposes. Usage of `test/proofserver/cli`: -``` +```shell USAGE: go run ./test/proofserver/cli OPTIONS @@ -71,11 +104,19 @@ OPTIONS: proving time duration (default 2s) ``` +Also, the Makefile commands can be used to run and stop the proof server +in the background: + +```shell +$ make run-proof-mock +$ make stop-proof-mock +``` + ### `/tmp` as tmpfs For every processed batch, the node builds a temporary exit tree in a key-value DB stored in `/tmp`. It is highly recommended that `/tmp` is mounted as a RAM -file system in production to avoid unecessary reads an writes to disk. This +file system in production to avoid unnecessary reads a writes to disk. This can be done by mounting `/tmp` as tmpfs; for example, by having this line in `/etc/fstab`: ``` diff --git a/apitypes/apitypes.go b/apitypes/apitypes.go index 274f363..b9e25e9 100644 --- a/apitypes/apitypes.go +++ b/apitypes/apitypes.go @@ -18,7 +18,10 @@ import ( // BigIntStr is used to scan/value *big.Int directly into strings from/to sql DBs. // It assumes that *big.Int are inserted/fetched to/from the DB using the BigIntMeddler meddler -// defined at github.com/hermeznetwork/hermez-node/db +// defined at github.com/hermeznetwork/hermez-node/db. Since *big.Int is +// stored as DECIMAL in SQL, there's no need to implement Scan()/Value() +// because DECIMALS are encoded/decoded as strings by the sql driver, and +// BigIntStr is already a string. type BigIntStr string // NewBigIntStr creates a *BigIntStr from a *big.Int. @@ -31,34 +34,6 @@ func NewBigIntStr(bigInt *big.Int) *BigIntStr { return &bigIntStr } -// Scan implements Scanner for database/sql -func (b *BigIntStr) Scan(src interface{}) error { - srcBytes, ok := src.([]byte) - if !ok { - return tracerr.Wrap(fmt.Errorf("can't scan %T into apitypes.BigIntStr", src)) - } - // bytes to *big.Int - bigInt := new(big.Int).SetBytes(srcBytes) - // *big.Int to BigIntStr - bigIntStr := NewBigIntStr(bigInt) - if bigIntStr == nil { - return nil - } - *b = *bigIntStr - return nil -} - -// Value implements valuer for database/sql -func (b BigIntStr) Value() (driver.Value, error) { - // string to *big.Int - bigInt, ok := new(big.Int).SetString(string(b), 10) - if !ok || bigInt == nil { - return nil, tracerr.Wrap(errors.New("invalid representation of a *big.Int")) - } - // *big.Int to bytes - return bigInt.Bytes(), nil -} - // StrBigInt is used to unmarshal BigIntStr directly into an alias of big.Int type StrBigInt big.Int diff --git a/cli/node/README.md b/cli/node/README.md index 073ac82..82756c7 100644 --- a/cli/node/README.md +++ b/cli/node/README.md @@ -8,7 +8,7 @@ The `hermez-node` has been tested with go version 1.14 ## Usage -``` +```shell NAME: hermez-node - A new cli application @@ -16,18 +16,18 @@ USAGE: node [global options] command [command options] [arguments...] VERSION: - 0.1.0-alpha + v0.1.0-6-gd8a50c5 COMMANDS: + version Show the application version importkey Import ethereum private key genbjj Generate a new BabyJubJub key - wipesql Wipe the SQL DB (HistoryDB and L2DB), leaving the DB in a clean state + wipesql Wipe the SQL DB (HistoryDB and L2DB) and the StateDBs, leaving the DB in a clean state run Run the hermez-node in the indicated mode + discard Discard blocks up to a specified block number help, h Shows a list of commands or help for one command GLOBAL OPTIONS: - --mode MODE Set node MODE (can be "sync" or "coord") - --cfg FILE Node configuration FILE --help, -h show help (default: false) --version, -v print the version (default: false) ``` @@ -75,7 +75,7 @@ when running the coordinator in sync mode Building the node requires using the packr utility to bundle the database migrations inside the resulting binary. Install the packr utility with: -``` +```shell cd /tmp && go get -u github.com/gobuffalo/packr/v2/packr2 && cd - ``` @@ -83,7 +83,7 @@ Make sure your `$PATH` contains `$GOPATH/bin`, otherwise the packr utility will not be found. Now build the node executable: -``` +```shell cd ../../db && packr2 && cd - go build . cd ../../db && packr2 clean && cd - @@ -98,35 +98,40 @@ run the following examples by replacing `./node` with `go run .` and executing them in the `cli/node` directory to build from source and run at the same time. Run the node in mode synchronizer: -``` -./node --mode sync --cfg cfg.buidler.toml run +```shell +./node run --mode sync --cfg cfg.buidler.toml ``` Run the node in mode coordinator: -``` -./node --mode coord --cfg cfg.buidler.toml run +```shell +./node run --mode coord --cfg cfg.buidler.toml ``` Import an ethereum private key into the keystore: -``` -./node --mode coord --cfg cfg.buidler.toml importkey --privatekey 0x618b35096c477aab18b11a752be619f0023a539bb02dd6c813477a6211916cde +```shell +./node importkey --mode coord --cfg cfg.buidler.toml --privatekey 0x618b35096c477aab18b11a752be619f0023a539bb02dd6c813477a6211916cde ``` Generate a new BabyJubJub key pair: +```shell +./node genbjj ``` -./node --mode coord --cfg cfg.buidler.toml genbjj + +Check the binary version: +```shell +./node version ``` Wipe the entier SQL database (this will destroy all synchronized and pool data): -``` -./node --mode coord --cfg cfg.buidler.toml wipesql +```shell +./node wipesql --mode coord --cfg cfg.buidler.toml ``` Discard all synchronized blocks and associated state up to a given block number. This command is useful in case the synchronizer reaches an invalid state and you want to roll back a few blocks and try again (maybe with some fixes in the code). -``` -./node --mode coord --cfg cfg.buidler.toml discard --block 8061330 +```shell +./node discard --mode coord --cfg cfg.buidler.toml --block 8061330 ``` diff --git a/cli/node/main.go b/cli/node/main.go index 5df6997..e294d84 100644 --- a/cli/node/main.go +++ b/cli/node/main.go @@ -34,6 +34,22 @@ const ( modeCoord = "coord" ) +var ( + // Version represents the program based on the git tag + Version = "v0.1.0" + // Build represents the program based on the git commit + Build = "dev" + // Date represents the date of application was built + Date = "" +) + +func cmdVersion(c *cli.Context) error { + fmt.Printf("Version = \"%v\"\n", Version) + fmt.Printf("Build = \"%v\"\n", Build) + fmt.Printf("Date = \"%v\"\n", Date) + return nil +} + func cmdGenBJJ(c *cli.Context) error { sk := babyjub.NewRandPrivKey() skBuf := [32]byte(sk) @@ -404,8 +420,8 @@ func getConfigAPIServer(c *cli.Context) (*ConfigAPIServer, error) { func main() { app := cli.NewApp() app.Name = "hermez-node" - app.Version = "0.1.0-alpha" - app.Flags = []cli.Flag{ + app.Version = Version + flags := []cli.Flag{ &cli.StringFlag{ Name: flagMode, Usage: fmt.Sprintf("Set node `MODE` (can be \"%v\" or \"%v\")", modeSync, modeCoord), @@ -419,17 +435,23 @@ func main() { } app.Commands = []*cli.Command{ + { + Name: "version", + Aliases: []string{}, + Usage: "Show the application version and build", + Action: cmdVersion, + }, { Name: "importkey", Aliases: []string{}, Usage: "Import ethereum private key", Action: cmdImportKey, - Flags: []cli.Flag{ + Flags: append(flags, &cli.StringFlag{ Name: flagSK, Usage: "ethereum `PRIVATE_KEY` in hex", Required: true, - }}, + }), }, { Name: "genbjj", @@ -443,18 +465,19 @@ func main() { Usage: "Wipe the SQL DB (HistoryDB and L2DB) and the StateDBs, " + "leaving the DB in a clean state", Action: cmdWipeSQL, - Flags: []cli.Flag{ + Flags: append(flags, &cli.BoolFlag{ Name: flagYes, Usage: "automatic yes to the prompt", Required: false, - }}, + }), }, { Name: "run", Aliases: []string{}, Usage: "Run the hermez-node in the indicated mode", Action: cmdRun, + Flags: flags, }, { Name: "serveapi", @@ -467,12 +490,12 @@ func main() { Aliases: []string{}, Usage: "Discard blocks up to a specified block number", Action: cmdDiscard, - Flags: []cli.Flag{ + Flags: append(flags, &cli.Int64Flag{ Name: flagBlock, Usage: "last block number to keep", Required: false, - }}, + }), }, } diff --git a/config/config.go b/config/config.go index 343904d..1db7a32 100644 --- a/config/config.go +++ b/config/config.go @@ -112,11 +112,17 @@ type Coordinator struct { // MustForgeAtSlotDeadline enables the coordinator to forge slots if // the empty slots reach the slot deadline. MustForgeAtSlotDeadline bool - // IgnoreSlotCommitment IgnoreSlotCommitment disables forcing the - // coordinator to forge a slot immediately when the slot is not - // committed. If set to false, the coordinator will immediately forge - // a batch at the beginning of a slot if it's the slot winner. + // IgnoreSlotCommitment disables forcing the coordinator to forge a + // slot immediately when the slot is not committed. If set to false, + // the coordinator will immediately forge a batch at the beginning of a + // slot if it's the slot winner. IgnoreSlotCommitment bool + // ForgeOncePerSlotIfTxs will make the coordinator forge at most one + // batch per slot, only if there are included txs in that batch, or + // pending l1UserTxs in the smart contract. Setting this parameter + // overrides `ForgeDelay`, `ForgeNoTxsDelay`, `MustForgeAtSlotDeadline` + // and `IgnoreSlotCommitment`. + ForgeOncePerSlotIfTxs bool // SyncRetryInterval is the waiting interval between calls to the main // handler of a synced block after an error SyncRetryInterval Duration `validate:"required"` diff --git a/coordinator/batch.go b/coordinator/batch.go index 3ff236b..8df15d8 100644 --- a/coordinator/batch.go +++ b/coordinator/batch.go @@ -85,7 +85,7 @@ type BatchInfo struct { PublicInputs []*big.Int L1Batch bool VerifierIdx uint8 - L1UserTxsExtra []common.L1Tx + L1UserTxs []common.L1Tx L1CoordTxs []common.L1Tx L1CoordinatorTxsAuths [][]byte L2Txs []common.L2Tx diff --git a/coordinator/coordinator.go b/coordinator/coordinator.go index 76481bc..a5a60ed 100644 --- a/coordinator/coordinator.go +++ b/coordinator/coordinator.go @@ -24,10 +24,8 @@ import ( ) var ( - errLastL1BatchNotSynced = fmt.Errorf("last L1Batch not synced yet") - errForgeNoTxsBeforeDelay = fmt.Errorf( - "no txs to forge and we haven't reached the forge no txs delay") - errForgeBeforeDelay = fmt.Errorf("we haven't reached the forge delay") + errLastL1BatchNotSynced = fmt.Errorf("last L1Batch not synced yet") + errSkipBatchByPolicy = fmt.Errorf("skip batch by policy") ) const ( @@ -92,6 +90,12 @@ type Config struct { // the coordinator will immediately forge a batch at the beginning of // a slot if it's the slot winner. IgnoreSlotCommitment bool + // ForgeOncePerSlotIfTxs will make the coordinator forge at most one + // batch per slot, only if there are included txs in that batch, or + // pending l1UserTxs in the smart contract. Setting this parameter + // overrides `ForgeDelay`, `ForgeNoTxsDelay`, `MustForgeAtSlotDeadline` + // and `IgnoreSlotCommitment`. + ForgeOncePerSlotIfTxs bool // SyncRetryInterval is the waiting interval between calls to the main // handler of a synced block after an error SyncRetryInterval time.Duration diff --git a/coordinator/pipeline.go b/coordinator/pipeline.go index c816c49..aa690b4 100644 --- a/coordinator/pipeline.go +++ b/coordinator/pipeline.go @@ -224,8 +224,9 @@ func (p *Pipeline) handleForgeBatch(ctx context.Context, // 2. Forge the batch internally (make a selection of txs and prepare // all the smart contract arguments) + var skipReason *string p.mutexL2DBUpdateDelete.Lock() - batchInfo, err = p.forgeBatch(batchNum) + batchInfo, skipReason, err = p.forgeBatch(batchNum) p.mutexL2DBUpdateDelete.Unlock() if ctx.Err() != nil { return nil, ctx.Err() @@ -234,13 +235,13 @@ func (p *Pipeline) handleForgeBatch(ctx context.Context, log.Warnw("forgeBatch: scheduled L1Batch too early", "err", err, "lastForgeL1TxsNum", p.state.lastForgeL1TxsNum, "syncLastForgeL1TxsNum", p.stats.Sync.LastForgeL1TxsNum) - } else if tracerr.Unwrap(err) == errForgeNoTxsBeforeDelay || - tracerr.Unwrap(err) == errForgeBeforeDelay { - // no log } else { log.Errorw("forgeBatch", "err", err) } return nil, tracerr.Wrap(err) + } else if skipReason != nil { + log.Debugw("skipping batch", "batch", batchNum, "reason", *skipReason) + return nil, tracerr.Wrap(errSkipBatchByPolicy) } // 3. Send the ZKInputs to the proof server @@ -295,8 +296,7 @@ func (p *Pipeline) Start(batchNum common.BatchNum, if p.ctx.Err() != nil { continue } else if tracerr.Unwrap(err) == errLastL1BatchNotSynced || - tracerr.Unwrap(err) == errForgeNoTxsBeforeDelay || - tracerr.Unwrap(err) == errForgeBeforeDelay { + tracerr.Unwrap(err) == errSkipBatchByPolicy { continue } else if err != nil { p.setErrAtBatchNum(batchNum) @@ -389,25 +389,109 @@ func (p *Pipeline) sendServerProof(ctx context.Context, batchInfo *BatchInfo) er return nil } -// check if we reach the ForgeDelay or not before batch forging -func (p *Pipeline) preForgeBatchCheck(slotCommitted bool, now time.Time) error { - if slotCommitted && now.Sub(p.lastForgeTime) < p.cfg.ForgeDelay { - return errForgeBeforeDelay +// slotCommitted returns true if the current slot has already been committed +func (p *Pipeline) slotCommitted() bool { + // Synchronizer has synchronized a batch in the current slot (setting + // CurrentSlot.ForgerCommitment) or the pipeline has already + // internally-forged a batch in the current slot + return p.stats.Sync.Auction.CurrentSlot.ForgerCommitment || + p.stats.Sync.Auction.CurrentSlot.SlotNum == p.state.lastSlotForged +} + +// forgePolicySkipPreSelection is called before doing a tx selection in a batch to +// determine by policy if we should forge the batch or not. Returns true and +// the reason when the forging of the batch must be skipped. +func (p *Pipeline) forgePolicySkipPreSelection(now time.Time) (bool, string) { + // Check if the slot is not yet fulfilled + slotCommitted := p.slotCommitted() + if p.cfg.ForgeOncePerSlotIfTxs { + if slotCommitted { + return true, "cfg.ForgeOncePerSlotIfTxs = true and slot already committed" + } + return false, "" } - return nil + // Determine if we must commit the slot + if !p.cfg.IgnoreSlotCommitment && !slotCommitted { + return false, "" + } + + // If we haven't reached the ForgeDelay, skip forging the batch + if now.Sub(p.lastForgeTime) < p.cfg.ForgeDelay { + return true, "we haven't reached the forge delay" + } + return false, "" +} + +// forgePolicySkipPostSelection is called after doing a tx selection in a batch to +// determine by policy if we should forge the batch or not. Returns true and +// the reason when the forging of the batch must be skipped. +func (p *Pipeline) forgePolicySkipPostSelection(now time.Time, l1UserTxsExtra, l1CoordTxs []common.L1Tx, + poolL2Txs []common.PoolL2Tx, batchInfo *BatchInfo) (bool, string, error) { + // Check if the slot is not yet fulfilled + slotCommitted := p.slotCommitted() + + pendingTxs := true + if len(l1UserTxsExtra) == 0 && len(l1CoordTxs) == 0 && len(poolL2Txs) == 0 { + if batchInfo.L1Batch { + // Query the number of unforged L1UserTxs + // (either in a open queue or in a frozen + // not-yet-forged queue). + count, err := p.historyDB.GetUnforgedL1UserTxsCount() + if err != nil { + return false, "", err + } + // If there are future L1UserTxs, we forge a + // batch to advance the queues to be able to + // forge the L1UserTxs in the future. + // Otherwise, skip. + if count == 0 { + pendingTxs = false + } + } else { + pendingTxs = false + } + } + + if p.cfg.ForgeOncePerSlotIfTxs { + if slotCommitted { + return true, "cfg.ForgeOncePerSlotIfTxs = true and slot already committed", + nil + } + if pendingTxs { + return false, "", nil + } + return true, "cfg.ForgeOncePerSlotIfTxs = true and no pending txs", + nil + } + + // Determine if we must commit the slot + if !p.cfg.IgnoreSlotCommitment && !slotCommitted { + return false, "", nil + } + + // check if there is no txs to forge, no l1UserTxs in the open queue to + // freeze and we haven't reached the ForgeNoTxsDelay + if now.Sub(p.lastForgeTime) < p.cfg.ForgeNoTxsDelay { + if !pendingTxs { + return true, "no txs to forge and we haven't reached the forge no txs delay", + nil + } + } + return false, "", nil } // forgeBatch forges the batchNum batch. -func (p *Pipeline) forgeBatch(batchNum common.BatchNum) (batchInfo *BatchInfo, err error) { +func (p *Pipeline) forgeBatch(batchNum common.BatchNum) (batchInfo *BatchInfo, + skipReason *string, err error) { // remove transactions from the pool that have been there for too long _, err = p.purger.InvalidateMaybe(p.l2DB, p.txSelector.LocalAccountsDB(), p.stats.Sync.LastBlock.Num, int64(batchNum)) if err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } _, err = p.purger.PurgeMaybe(p.l2DB, p.stats.Sync.LastBlock.Num, int64(batchNum)) if err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } // Structure to accumulate data and metadata of the batch now := time.Now() @@ -417,53 +501,48 @@ func (p *Pipeline) forgeBatch(batchNum common.BatchNum) (batchInfo *BatchInfo, e var poolL2Txs []common.PoolL2Tx var discardedL2Txs []common.PoolL2Tx - var l1UserTxsExtra, l1CoordTxs []common.L1Tx + var l1UserTxs, l1CoordTxs []common.L1Tx var auths [][]byte var coordIdxs []common.Idx - // Check if the slot is not yet fulfilled - slotCommitted := p.cfg.IgnoreSlotCommitment - if p.stats.Sync.Auction.CurrentSlot.ForgerCommitment || - p.stats.Sync.Auction.CurrentSlot.SlotNum == p.state.lastSlotForged { - slotCommitted = true - } - - // If we haven't reached the ForgeDelay, skip forging the batch - if err = p.preForgeBatchCheck(slotCommitted, now); err != nil { - return nil, tracerr.Wrap(err) + if skip, reason := p.forgePolicySkipPreSelection(now); skip { + return nil, &reason, nil } // 1. Decide if we forge L2Tx or L1+L2Tx if p.shouldL1L2Batch(batchInfo) { batchInfo.L1Batch = true if p.state.lastForgeL1TxsNum != p.stats.Sync.LastForgeL1TxsNum { - return nil, tracerr.Wrap(errLastL1BatchNotSynced) + return nil, nil, tracerr.Wrap(errLastL1BatchNotSynced) } // 2a: L1+L2 txs - l1UserTxs, err := p.historyDB.GetUnforgedL1UserTxs(p.state.lastForgeL1TxsNum + 1) + _l1UserTxs, err := p.historyDB.GetUnforgedL1UserTxs(p.state.lastForgeL1TxsNum + 1) if err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } - coordIdxs, auths, l1UserTxsExtra, l1CoordTxs, poolL2Txs, discardedL2Txs, err = - p.txSelector.GetL1L2TxSelection(p.cfg.TxProcessorConfig, l1UserTxs) + coordIdxs, auths, l1UserTxs, l1CoordTxs, poolL2Txs, discardedL2Txs, err = + p.txSelector.GetL1L2TxSelection(p.cfg.TxProcessorConfig, _l1UserTxs) if err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } } else { // 2b: only L2 txs coordIdxs, auths, l1CoordTxs, poolL2Txs, discardedL2Txs, err = p.txSelector.GetL2TxSelection(p.cfg.TxProcessorConfig) if err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } - l1UserTxsExtra = nil + l1UserTxs = nil } - // If there are no txs to forge, no l1UserTxs in the open queue to - // freeze, and we haven't reached the ForgeNoTxsDelay, skip forging the - // batch. - if err = p.postForgeBatchCheck(slotCommitted, now, l1UserTxsExtra, l1CoordTxs, poolL2Txs, batchInfo); err != nil { - return nil, tracerr.Wrap(err) + if skip, reason, err := p.forgePolicySkipPostSelection(now, + l1UserTxs, l1CoordTxs, poolL2Txs, batchInfo); err != nil { + return nil, nil, tracerr.Wrap(err) + } else if skip { + if err := p.txSelector.Reset(batchInfo.BatchNum-1, false); err != nil { + return nil, nil, tracerr.Wrap(err) + } + return nil, &reason, tracerr.Wrap(err) } if batchInfo.L1Batch { @@ -472,7 +551,7 @@ func (p *Pipeline) forgeBatch(batchNum common.BatchNum) (batchInfo *BatchInfo, e } // 3. Save metadata from TxSelector output for BatchNum - batchInfo.L1UserTxsExtra = l1UserTxsExtra + batchInfo.L1UserTxs = l1UserTxs batchInfo.L1CoordTxs = l1CoordTxs batchInfo.L1CoordinatorTxsAuths = auths batchInfo.CoordIdxs = coordIdxs @@ -480,10 +559,10 @@ func (p *Pipeline) forgeBatch(batchNum common.BatchNum) (batchInfo *BatchInfo, e if err := p.l2DB.StartForging(common.TxIDsFromPoolL2Txs(poolL2Txs), batchInfo.BatchNum); err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } if err := p.l2DB.UpdateTxsInfo(discardedL2Txs); err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } // Invalidate transactions that become invalid because of @@ -492,21 +571,21 @@ func (p *Pipeline) forgeBatch(batchNum common.BatchNum) (batchInfo *BatchInfo, e // all the nonces smaller than the current one) err = p.l2DB.InvalidateOldNonces(idxsNonceFromPoolL2Txs(poolL2Txs), batchInfo.BatchNum) if err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } // 4. Call BatchBuilder with TxSelector output configBatch := &batchbuilder.ConfigBatch{ TxProcessorConfig: p.cfg.TxProcessorConfig, } - zkInputs, err := p.batchBuilder.BuildBatch(coordIdxs, configBatch, l1UserTxsExtra, + zkInputs, err := p.batchBuilder.BuildBatch(coordIdxs, configBatch, l1UserTxs, l1CoordTxs, poolL2Txs) if err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } l2Txs, err := common.PoolL2TxsToL2Txs(poolL2Txs) // NOTE: This is a big uggly, find a better way if err != nil { - return nil, tracerr.Wrap(err) + return nil, nil, tracerr.Wrap(err) } batchInfo.L2Txs = l2Txs @@ -518,42 +597,7 @@ func (p *Pipeline) forgeBatch(batchNum common.BatchNum) (batchInfo *BatchInfo, e p.state.lastSlotForged = p.stats.Sync.Auction.CurrentSlot.SlotNum - return batchInfo, nil -} - -// check if there is no txs to forge, no l1UserTxs in the open queue to freeze and we haven't reached the ForgeNoTxsDelay -func (p *Pipeline) postForgeBatchCheck(slotCommitted bool, now time.Time, l1UserTxsExtra, l1CoordTxs []common.L1Tx, - poolL2Txs []common.PoolL2Tx, batchInfo *BatchInfo) error { - if slotCommitted && now.Sub(p.lastForgeTime) < p.cfg.ForgeNoTxsDelay { - noTxs := false - if len(l1UserTxsExtra) == 0 && len(l1CoordTxs) == 0 && len(poolL2Txs) == 0 { - if batchInfo.L1Batch { - // Query the number of unforged L1UserTxs - // (either in a open queue or in a frozen - // not-yet-forged queue). - count, err := p.historyDB.GetUnforgedL1UserTxsCount() - if err != nil { - return err - } - // If there are future L1UserTxs, we forge a - // batch to advance the queues to be able to - // forge the L1UserTxs in the future. - // Otherwise, skip. - if count == 0 { - noTxs = true - } - } else { - noTxs = true - } - } - if noTxs { - if err := p.txSelector.Reset(batchInfo.BatchNum-1, false); err != nil { - return err - } - return errForgeNoTxsBeforeDelay - } - } - return nil + return batchInfo, nil, nil } // waitServerProof gets the generated zkProof & sends it to the SmartContract @@ -598,7 +642,7 @@ func prepareForgeBatchArgs(batchInfo *BatchInfo) *eth.RollupForgeBatchArgs { NewLastIdx: int64(zki.Metadata.NewLastIdxRaw), NewStRoot: zki.Metadata.NewStateRootRaw.BigInt(), NewExitRoot: zki.Metadata.NewExitRootRaw.BigInt(), - L1UserTxs: batchInfo.L1UserTxsExtra, + L1UserTxs: batchInfo.L1UserTxs, L1CoordinatorTxs: batchInfo.L1CoordTxs, L1CoordinatorTxsAuths: batchInfo.L1CoordinatorTxsAuths, L2TxsData: batchInfo.L2Txs, diff --git a/coordinator/pipeline_test.go b/coordinator/pipeline_test.go index 1a4a1e4..a43e63d 100644 --- a/coordinator/pipeline_test.go +++ b/coordinator/pipeline_test.go @@ -224,12 +224,12 @@ PoolTransfer(0) User2-User3: 300 (126) batchNum++ - batchInfo, err := pipeline.forgeBatch(batchNum) + batchInfo, _, err := pipeline.forgeBatch(batchNum) require.NoError(t, err) assert.Equal(t, 3, len(batchInfo.L2Txs)) batchNum++ - batchInfo, err = pipeline.forgeBatch(batchNum) + batchInfo, _, err = pipeline.forgeBatch(batchNum) require.NoError(t, err) assert.Equal(t, 0, len(batchInfo.L2Txs)) } diff --git a/coordinator/txmanager.go b/coordinator/txmanager.go index 0a8aacb..d949caa 100644 --- a/coordinator/txmanager.go +++ b/coordinator/txmanager.go @@ -147,7 +147,7 @@ func (t *TxManager) NewAuth(ctx context.Context, batchInfo *BatchInfo) (*bind.Tr auth.Value = big.NewInt(0) // in wei gasLimit := t.cfg.ForgeBatchGasCost.Fixed + - uint64(len(batchInfo.L1UserTxsExtra))*t.cfg.ForgeBatchGasCost.L1UserTx + + uint64(len(batchInfo.L1UserTxs))*t.cfg.ForgeBatchGasCost.L1UserTx + uint64(len(batchInfo.L1CoordTxs))*t.cfg.ForgeBatchGasCost.L1CoordTx + uint64(len(batchInfo.L2Txs))*t.cfg.ForgeBatchGasCost.L2Tx auth.GasLimit = gasLimit diff --git a/db/historydb/historydb.go b/db/historydb/historydb.go index d16a0c5..8261a6e 100644 --- a/db/historydb/historydb.go +++ b/db/historydb/historydb.go @@ -693,11 +693,11 @@ func (hdb *HistoryDB) GetAllExits() ([]common.ExitInfo, error) { func (hdb *HistoryDB) GetAllL1UserTxs() ([]common.L1Tx, error) { var txs []*common.L1Tx err := meddler.QueryAll( - hdb.dbRead, &txs, // Note that '\x' gets parsed as a big.Int with value = 0 + hdb.dbRead, &txs, `SELECT tx.id, tx.to_forge_l1_txs_num, tx.position, tx.user_origin, tx.from_idx, tx.effective_from_idx, tx.from_eth_addr, tx.from_bjj, tx.to_idx, tx.token_id, - tx.amount, (CASE WHEN tx.batch_num IS NULL THEN NULL WHEN tx.amount_success THEN tx.amount ELSE '\x' END) AS effective_amount, - tx.deposit_amount, (CASE WHEN tx.batch_num IS NULL THEN NULL WHEN tx.deposit_amount_success THEN tx.deposit_amount ELSE '\x' END) AS effective_deposit_amount, + tx.amount, (CASE WHEN tx.batch_num IS NULL THEN NULL WHEN tx.amount_success THEN tx.amount ELSE 0 END) AS effective_amount, + tx.deposit_amount, (CASE WHEN tx.batch_num IS NULL THEN NULL WHEN tx.deposit_amount_success THEN tx.deposit_amount ELSE 0 END) AS effective_deposit_amount, tx.eth_block_num, tx.type, tx.batch_num FROM tx WHERE is_l1 = TRUE AND user_origin = TRUE ORDER BY item_id;`, ) diff --git a/db/migrations/0001.sql b/db/migrations/0001.sql index 268c0e6..ec481e3 100644 --- a/db/migrations/0001.sql +++ b/db/migrations/0001.sql @@ -1,5 +1,11 @@ -- +migrate Up +-- NOTE: We use "DECIMAL(78,0)" to encode go *big.Int types. All the *big.Int +-- that we deal with represent a value in the SNARK field, which is an integer +-- of 256 bits. `log(2**256, 10) = 77.06`: that is, a 256 bit number can have +-- at most 78 digits, so we use this value to specify the precision in the +-- PostgreSQL DECIMAL guaranteeing that we will never lose precision. + -- History CREATE TABLE block ( eth_block_num BIGINT PRIMARY KEY, @@ -22,10 +28,10 @@ CREATE TABLE batch ( forger_addr BYTEA NOT NULL, -- fake foreign key for coordinator fees_collected BYTEA NOT NULL, fee_idxs_coordinator BYTEA NOT NULL, - state_root BYTEA NOT NULL, + state_root DECIMAL(78,0) NOT NULL, num_accounts BIGINT NOT NULL, last_idx BIGINT NOT NULL, - exit_root BYTEA NOT NULL, + exit_root DECIMAL(78,0) NOT NULL, forge_l1_txs_num BIGINT, slot_num BIGINT NOT NULL, total_fees_usd NUMERIC @@ -34,7 +40,7 @@ CREATE TABLE batch ( CREATE TABLE bid ( item_id SERIAL PRIMARY KEY, slot_num BIGINT NOT NULL, - bid_value BYTEA NOT NULL, + bid_value DECIMAL(78,0) NOT NULL, eth_block_num BIGINT NOT NULL REFERENCES block (eth_block_num) ON DELETE CASCADE, bidder_addr BYTEA NOT NULL -- fake foreign key for coordinator ); @@ -106,7 +112,7 @@ CREATE TABLE account_update ( batch_num BIGINT NOT NULL REFERENCES batch (batch_num) ON DELETE CASCADE, idx BIGINT NOT NULL REFERENCES account (idx) ON DELETE CASCADE, nonce BIGINT NOT NULL, - balance BYTEA NOT NULL + balance DECIMAL(78,0) NOT NULL ); CREATE TABLE exit_tree ( @@ -114,7 +120,7 @@ CREATE TABLE exit_tree ( batch_num BIGINT REFERENCES batch (batch_num) ON DELETE CASCADE, account_idx BIGINT REFERENCES account (idx) ON DELETE CASCADE, merkle_proof BYTEA NOT NULL, - balance BYTEA NOT NULL, + balance DECIMAL(78,0) NOT NULL, instant_withdrawn BIGINT REFERENCES block (eth_block_num) ON DELETE SET NULL, delayed_withdraw_request BIGINT REFERENCES block (eth_block_num) ON DELETE SET NULL, owner BYTEA, @@ -164,7 +170,7 @@ CREATE TABLE tx ( to_idx BIGINT NOT NULL, to_eth_addr BYTEA, to_bjj BYTEA, - amount BYTEA NOT NULL, + amount DECIMAL(78,0) NOT NULL, amount_success BOOLEAN NOT NULL DEFAULT true, amount_f NUMERIC NOT NULL, token_id INT NOT NULL REFERENCES token (token_id), @@ -174,7 +180,7 @@ CREATE TABLE tx ( -- L1 to_forge_l1_txs_num BIGINT, user_origin BOOLEAN, - deposit_amount BYTEA, + deposit_amount DECIMAL(78,0), deposit_amount_success BOOLEAN NOT NULL DEFAULT true, deposit_amount_f NUMERIC, deposit_amount_usd NUMERIC, @@ -544,7 +550,7 @@ FOR EACH ROW EXECUTE PROCEDURE forge_l1_user_txs(); CREATE TABLE rollup_vars ( eth_block_num BIGINT PRIMARY KEY REFERENCES block (eth_block_num) ON DELETE CASCADE, - fee_add_token BYTEA NOT NULL, + fee_add_token DECIMAL(78,0) NOT NULL, forge_l1_timeout BIGINT NOT NULL, withdrawal_delay BIGINT NOT NULL, buckets BYTEA NOT NULL, @@ -556,7 +562,7 @@ CREATE TABLE bucket_update ( eth_block_num BIGINT NOT NULL REFERENCES block (eth_block_num) ON DELETE CASCADE, num_bucket BIGINT NOT NULL, block_stamp BIGINT NOT NULL, - withdrawals BYTEA NOT NULL + withdrawals DECIMAL(78,0) NOT NULL ); CREATE TABLE token_exchange ( @@ -572,7 +578,7 @@ CREATE TABLE escape_hatch_withdrawal ( who_addr BYTEA NOT NULL, to_addr BYTEA NOT NULL, token_addr BYTEA NOT NULL, - amount BYTEA NOT NULL + amount DECIMAL(78,0) NOT NULL ); CREATE TABLE auction_vars ( @@ -610,7 +616,7 @@ CREATE TABLE tx_pool ( effective_to_eth_addr BYTEA, effective_to_bjj BYTEA, token_id INT NOT NULL REFERENCES token (token_id) ON DELETE CASCADE, - amount BYTEA NOT NULL, + amount DECIMAL(78,0) NOT NULL, amount_f NUMERIC NOT NULL, fee SMALLINT NOT NULL, nonce BIGINT NOT NULL, @@ -624,7 +630,7 @@ CREATE TABLE tx_pool ( rq_to_eth_addr BYTEA, rq_to_bjj BYTEA, rq_token_id INT, - rq_amount BYTEA, + rq_amount DECIMAL(78,0), rq_fee SMALLINT, rq_nonce BIGINT, tx_type VARCHAR(40) NOT NULL, diff --git a/db/utils.go b/db/utils.go index bf7d304..f7bdcc5 100644 --- a/db/utils.go +++ b/db/utils.go @@ -13,6 +13,9 @@ import ( "github.com/hermeznetwork/hermez-node/log" "github.com/hermeznetwork/tracerr" "github.com/jmoiron/sqlx" + + //nolint:errcheck // driver for postgres DB + _ "github.com/lib/pq" migrate "github.com/rubenv/sql-migrate" "github.com/russross/meddler" "golang.org/x/sync/semaphore" @@ -165,7 +168,11 @@ func (b BigIntMeddler) PostRead(fieldPtr, scanTarget interface{}) error { return tracerr.Wrap(fmt.Errorf("BigIntMeddler.PostRead: nil pointer")) } field := fieldPtr.(**big.Int) - *field = new(big.Int).SetBytes([]byte(*ptr)) + var ok bool + *field, ok = new(big.Int).SetString(*ptr, 10) + if !ok { + return tracerr.Wrap(fmt.Errorf("big.Int.SetString failed on \"%v\"", *ptr)) + } return nil } @@ -173,7 +180,7 @@ func (b BigIntMeddler) PostRead(fieldPtr, scanTarget interface{}) error { func (b BigIntMeddler) PreWrite(fieldPtr interface{}) (saveValue interface{}, err error) { field := fieldPtr.(*big.Int) - return field.Bytes(), nil + return field.String(), nil } // BigIntNullMeddler encodes or decodes the field value to or from JSON @@ -198,7 +205,12 @@ func (b BigIntNullMeddler) PostRead(fieldPtr, scanTarget interface{}) error { if ptr == nil { return tracerr.Wrap(fmt.Errorf("BigIntMeddler.PostRead: nil pointer")) } - *field = new(big.Int).SetBytes(ptr) + var ok bool + *field, ok = new(big.Int).SetString(string(ptr), 10) + if !ok { + return tracerr.Wrap(fmt.Errorf("big.Int.SetString failed on \"%v\"", string(ptr))) + } + return nil } @@ -208,7 +220,7 @@ func (b BigIntNullMeddler) PreWrite(fieldPtr interface{}) (saveValue interface{} if field == nil { return nil, nil } - return field.Bytes(), nil + return field.String(), nil } // SliceToSlicePtrs converts any []Foo to []*Foo diff --git a/db/utils_test.go b/db/utils_test.go index a5c83b2..b007abf 100644 --- a/db/utils_test.go +++ b/db/utils_test.go @@ -1,9 +1,13 @@ package db import ( + "math/big" + "os" "testing" + "github.com/russross/meddler" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) type foo struct { @@ -33,3 +37,42 @@ func TestSlicePtrsToSlice(t *testing.T) { assert.Equal(t, *a[i], b[i]) } } + +func TestBigInt(t *testing.T) { + pass := os.Getenv("POSTGRES_PASS") + db, err := InitSQLDB(5432, "localhost", "hermez", pass, "hermez") + require.NoError(t, err) + defer func() { + _, err := db.Exec("DROP TABLE IF EXISTS test_big_int;") + require.NoError(t, err) + err = db.Close() + require.NoError(t, err) + }() + + _, err = db.Exec("DROP TABLE IF EXISTS test_big_int;") + require.NoError(t, err) + + _, err = db.Exec(`CREATE TABLE test_big_int ( + item_id SERIAL PRIMARY KEY, + value1 DECIMAL(78, 0) NOT NULL, + value2 DECIMAL(78, 0), + value3 DECIMAL(78, 0) + );`) + require.NoError(t, err) + + type Entry struct { + ItemID int `meddler:"item_id"` + Value1 *big.Int `meddler:"value1,bigint"` + Value2 *big.Int `meddler:"value2,bigintnull"` + Value3 *big.Int `meddler:"value3,bigintnull"` + } + + entry := Entry{ItemID: 1, Value1: big.NewInt(1234567890), Value2: big.NewInt(9876543210), Value3: nil} + err = meddler.Insert(db, "test_big_int", &entry) + require.NoError(t, err) + + var dbEntry Entry + err = meddler.QueryRow(db, &dbEntry, "SELECT * FROM test_big_int WHERE item_id = 1;") + require.NoError(t, err) + assert.Equal(t, entry, dbEntry) +} diff --git a/eth/contracts/auction/HermezAuctionProtocol.go b/eth/contracts/auction/HermezAuctionProtocol.go index 7b36b19..43e4d71 100644 --- a/eth/contracts/auction/HermezAuctionProtocol.go +++ b/eth/contracts/auction/HermezAuctionProtocol.go @@ -309,9 +309,12 @@ func (_HermezAuctionProtocol *HermezAuctionProtocolCaller) Coordinators(opts *bi Forger common.Address CoordinatorURL string }) + if err != nil { + return *outstruct, err + } - outstruct.Forger = out[0].(common.Address) - outstruct.CoordinatorURL = out[1].(string) + outstruct.Forger = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.CoordinatorURL = *abi.ConvertType(out[1], new(string)).(*string) return *outstruct, err @@ -884,12 +887,15 @@ func (_HermezAuctionProtocol *HermezAuctionProtocolCaller) Slots(opts *bind.Call BidAmount *big.Int ClosedMinBid *big.Int }) + if err != nil { + return *outstruct, err + } - outstruct.Bidder = out[0].(common.Address) - outstruct.Fulfilled = out[1].(bool) - outstruct.ForgerCommitment = out[2].(bool) - outstruct.BidAmount = out[3].(*big.Int) - outstruct.ClosedMinBid = out[4].(*big.Int) + outstruct.Bidder = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.Fulfilled = *abi.ConvertType(out[1], new(bool)).(*bool) + outstruct.ForgerCommitment = *abi.ConvertType(out[2], new(bool)).(*bool) + outstruct.BidAmount = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.ClosedMinBid = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) return *outstruct, err diff --git a/eth/contracts/hermez/Hermez.go b/eth/contracts/hermez/Hermez.go index 69d2bb5..8171700 100644 --- a/eth/contracts/hermez/Hermez.go +++ b/eth/contracts/hermez/Hermez.go @@ -27,7 +27,7 @@ var ( ) // HermezABI is the input ABI used to generate the binding from. -const HermezABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"tokenID\",\"type\":\"uint32\"}],\"name\":\"AddToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"batchNum\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"l1UserTxsLen\",\"type\":\"uint16\"}],\"name\":\"ForgeBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"forgeL1L2BatchTimeout\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAddToken\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"withdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"InitializeHermezEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"queueIndex\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint8\",\"name\":\"position\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"l1UserTx\",\"type\":\"bytes\"}],\"name\":\"L1UserTxEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"SafeMode\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint8\",\"name\":\"numBucket\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockStamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawals\",\"type\":\"uint256\"}],\"name\":\"UpdateBucketWithdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[4][5]\",\"name\":\"arrayBuckets\",\"type\":\"uint256[4][5]\"}],\"name\":\"UpdateBucketsParameters\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newFeeAddToken\",\"type\":\"uint256\"}],\"name\":\"UpdateFeeAddToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"newForgeL1L2BatchTimeout\",\"type\":\"uint8\"}],\"name\":\"UpdateForgeL1L2BatchTimeout\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"addressArray\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint64[]\",\"name\":\"valueArray\",\"type\":\"uint64[]\"}],\"name\":\"UpdateTokenExchange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newWithdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"UpdateWithdrawalDelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint48\",\"name\":\"idx\",\"type\":\"uint48\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"numExitRoot\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"instantWithdraw\",\"type\":\"bool\"}],\"name\":\"WithdrawEvent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ABSOLUTE_MAX_L1L2BATCHTIMEOUT\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"babyPubKey\",\"type\":\"uint256\"},{\"internalType\":\"uint48\",\"name\":\"fromIdx\",\"type\":\"uint48\"},{\"internalType\":\"uint16\",\"name\":\"loadAmountF\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"amountF\",\"type\":\"uint16\"},{\"internalType\":\"uint32\",\"name\":\"tokenID\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"toIdx\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"}],\"name\":\"addL1Transaction\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"}],\"name\":\"addToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"buckets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ceilUSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockStamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawals\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rateBlocks\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rateWithdrawals\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxWithdrawals\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"name\":\"exitNullifierMap\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"exitRootsMap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeAddToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint48\",\"name\":\"newLastIdx\",\"type\":\"uint48\"},{\"internalType\":\"uint256\",\"name\":\"newStRoot\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newExitRoot\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"encodedL1CoordinatorTx\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"l1L2TxsData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"feeIdxCoordinator\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"verifierIdx\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"l1Batch\",\"type\":\"bool\"},{\"internalType\":\"uint256[2]\",\"name\":\"proofA\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2][2]\",\"name\":\"proofB\",\"type\":\"uint256[2][2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"proofC\",\"type\":\"uint256[2]\"}],\"name\":\"forgeBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"forgeL1L2BatchTimeout\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hermezAuctionContract\",\"outputs\":[{\"internalType\":\"contractIHermezAuctionProtocol\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hermezGovernanceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_verifiers\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_verifiersParams\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"_withdrawVerifier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hermezAuctionContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_tokenHEZ\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_forgeL1L2BatchTimeout\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_feeAddToken\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_poseidon2Elements\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poseidon3Elements\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poseidon4Elements\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hermezGovernanceAddress\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"_withdrawalDelay\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"_withdrawDelayerContract\",\"type\":\"address\"}],\"name\":\"initializeHermez\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"}],\"name\":\"instantWithdrawalViewer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"l1L2TxsDataHashMap\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastForgedBatch\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastIdx\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastL1L2Batch\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"mapL1TxQueue\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextL1FillingQueue\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextL1ToForgeQueue\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registerTokensCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rollupVerifiers\",\"outputs\":[{\"internalType\":\"contractVerifierRollupInterface\",\"name\":\"verifierInterface\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"maxTx\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nLevels\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rollupVerifiersLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"safeMode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"stateRootMap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenExchange\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenHEZ\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenList\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenMap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[4][5]\",\"name\":\"arrayBuckets\",\"type\":\"uint256[4][5]\"}],\"name\":\"updateBucketsParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newFeeAddToken\",\"type\":\"uint256\"}],\"name\":\"updateFeeAddToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"newForgeL1L2BatchTimeout\",\"type\":\"uint8\"}],\"name\":\"updateForgeL1L2BatchTimeout\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"addressArray\",\"type\":\"address[]\"},{\"internalType\":\"uint64[]\",\"name\":\"valueArray\",\"type\":\"uint64[]\"}],\"name\":\"updateTokenExchange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"newWithdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"updateWithdrawalDelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[2]\",\"name\":\"proofA\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2][2]\",\"name\":\"proofB\",\"type\":\"uint256[2][2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"proofC\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint32\",\"name\":\"tokenID\",\"type\":\"uint32\"},{\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"},{\"internalType\":\"uint32\",\"name\":\"numExitRoot\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"idx\",\"type\":\"uint48\"},{\"internalType\":\"bool\",\"name\":\"instantWithdraw\",\"type\":\"bool\"}],\"name\":\"withdrawCircuit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawDelayerContract\",\"outputs\":[{\"internalType\":\"contractIWithdrawalDelayer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"tokenID\",\"type\":\"uint32\"},{\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"},{\"internalType\":\"uint256\",\"name\":\"babyPubKey\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"numExitRoot\",\"type\":\"uint32\"},{\"internalType\":\"uint256[]\",\"name\":\"siblings\",\"type\":\"uint256[]\"},{\"internalType\":\"uint48\",\"name\":\"idx\",\"type\":\"uint48\"},{\"internalType\":\"bool\",\"name\":\"instantWithdraw\",\"type\":\"bool\"}],\"name\":\"withdrawMerkleProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawVerifier\",\"outputs\":[{\"internalType\":\"contractVerifierWithdrawInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawalDelay\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]" +const HermezABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"tokenID\",\"type\":\"uint32\"}],\"name\":\"AddToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"batchNum\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"l1UserTxsLen\",\"type\":\"uint16\"}],\"name\":\"ForgeBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"forgeL1L2BatchTimeout\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAddToken\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"withdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"InitializeHermezEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"queueIndex\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint8\",\"name\":\"position\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"l1UserTx\",\"type\":\"bytes\"}],\"name\":\"L1UserTxEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"SafeMode\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint8\",\"name\":\"numBucket\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockStamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawals\",\"type\":\"uint256\"}],\"name\":\"UpdateBucketWithdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"arrayBuckets\",\"type\":\"uint256[]\"}],\"name\":\"UpdateBucketsParameters\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newFeeAddToken\",\"type\":\"uint256\"}],\"name\":\"UpdateFeeAddToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"newForgeL1L2BatchTimeout\",\"type\":\"uint8\"}],\"name\":\"UpdateForgeL1L2BatchTimeout\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"addressArray\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint64[]\",\"name\":\"valueArray\",\"type\":\"uint64[]\"}],\"name\":\"UpdateTokenExchange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newWithdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"UpdateWithdrawalDelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint48\",\"name\":\"idx\",\"type\":\"uint48\"},{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"numExitRoot\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"instantWithdraw\",\"type\":\"bool\"}],\"name\":\"WithdrawEvent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ABSOLUTE_MAX_L1L2BATCHTIMEOUT\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ACCOUNT_CREATION_HASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"AUTHORISE_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"domainSeparator\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"EIP712DOMAIN_HASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"HERMEZ_NETWORK_HASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NAME_HASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VERSION_HASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"babyPubKey\",\"type\":\"uint256\"},{\"internalType\":\"uint48\",\"name\":\"fromIdx\",\"type\":\"uint48\"},{\"internalType\":\"uint40\",\"name\":\"loadAmountF\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"amountF\",\"type\":\"uint40\"},{\"internalType\":\"uint32\",\"name\":\"tokenID\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"toIdx\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"}],\"name\":\"addL1Transaction\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"}],\"name\":\"addToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"name\":\"buckets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"name\":\"exitNullifierMap\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"exitRootsMap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeAddToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint48\",\"name\":\"newLastIdx\",\"type\":\"uint48\"},{\"internalType\":\"uint256\",\"name\":\"newStRoot\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newExitRoot\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"encodedL1CoordinatorTx\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"l1L2TxsData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"feeIdxCoordinator\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"verifierIdx\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"l1Batch\",\"type\":\"bool\"},{\"internalType\":\"uint256[2]\",\"name\":\"proofA\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2][2]\",\"name\":\"proofB\",\"type\":\"uint256[2][2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"proofC\",\"type\":\"uint256[2]\"}],\"name\":\"forgeBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"forgeL1L2BatchTimeout\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hermezAuctionContract\",\"outputs\":[{\"internalType\":\"contractIHermezAuctionProtocol\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hermezGovernanceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_verifiers\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_verifiersParams\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"_withdrawVerifier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hermezAuctionContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_tokenHEZ\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_forgeL1L2BatchTimeout\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_feeAddToken\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_poseidon2Elements\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poseidon3Elements\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_poseidon4Elements\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_hermezGovernanceAddress\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"_withdrawalDelay\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"_withdrawDelayerContract\",\"type\":\"address\"}],\"name\":\"initializeHermez\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"}],\"name\":\"instantWithdrawalViewer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"l1L2TxsDataHashMap\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastForgedBatch\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastIdx\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastL1L2Batch\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"mapL1TxQueue\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nBuckets\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextL1FillingQueue\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextL1ToForgeQueue\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"ceilUSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockStamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawals\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rateBlocks\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rateWithdrawals\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxWithdrawals\",\"type\":\"uint256\"}],\"name\":\"packBucket\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ret\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registerTokensCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rollupVerifiers\",\"outputs\":[{\"internalType\":\"contractVerifierRollupInterface\",\"name\":\"verifierInterface\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"maxTx\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nLevels\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rollupVerifiersLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"safeMode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"stateRootMap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenExchange\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenHEZ\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenList\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenMap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"bucket\",\"type\":\"uint256\"}],\"name\":\"unpackBucket\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"ceilUSD\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockStamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdrawals\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rateBlocks\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rateWithdrawals\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxWithdrawals\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"newBuckets\",\"type\":\"uint256[]\"}],\"name\":\"updateBucketsParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newFeeAddToken\",\"type\":\"uint256\"}],\"name\":\"updateFeeAddToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"newForgeL1L2BatchTimeout\",\"type\":\"uint8\"}],\"name\":\"updateForgeL1L2BatchTimeout\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"addressArray\",\"type\":\"address[]\"},{\"internalType\":\"uint64[]\",\"name\":\"valueArray\",\"type\":\"uint64[]\"}],\"name\":\"updateTokenExchange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"newWithdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"updateWithdrawalDelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[2]\",\"name\":\"proofA\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2][2]\",\"name\":\"proofB\",\"type\":\"uint256[2][2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"proofC\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint32\",\"name\":\"tokenID\",\"type\":\"uint32\"},{\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"},{\"internalType\":\"uint32\",\"name\":\"numExitRoot\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"idx\",\"type\":\"uint48\"},{\"internalType\":\"bool\",\"name\":\"instantWithdraw\",\"type\":\"bool\"}],\"name\":\"withdrawCircuit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawDelayerContract\",\"outputs\":[{\"internalType\":\"contractIWithdrawalDelayer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"tokenID\",\"type\":\"uint32\"},{\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"},{\"internalType\":\"uint256\",\"name\":\"babyPubKey\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"numExitRoot\",\"type\":\"uint32\"},{\"internalType\":\"uint256[]\",\"name\":\"siblings\",\"type\":\"uint256[]\"},{\"internalType\":\"uint48\",\"name\":\"idx\",\"type\":\"uint48\"},{\"internalType\":\"bool\",\"name\":\"instantWithdraw\",\"type\":\"bool\"}],\"name\":\"withdrawMerkleProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawVerifier\",\"outputs\":[{\"internalType\":\"contractVerifierWithdrawInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawalDelay\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]" // Hermez is an auto generated Go binding around an Ethereum contract. type Hermez struct { @@ -202,65 +202,251 @@ func (_Hermez *HermezCallerSession) ABSOLUTEMAXL1L2BATCHTIMEOUT() (uint8, error) return _Hermez.Contract.ABSOLUTEMAXL1L2BATCHTIMEOUT(&_Hermez.CallOpts) } -// Buckets is a free data retrieval call binding the contract method 0x9b51fb0d. +// ACCOUNTCREATIONHASH is a free data retrieval call binding the contract method 0x1300aff0. // -// Solidity: function buckets(uint256 ) view returns(uint256 ceilUSD, uint256 blockStamp, uint256 withdrawals, uint256 rateBlocks, uint256 rateWithdrawals, uint256 maxWithdrawals) -func (_Hermez *HermezCaller) Buckets(opts *bind.CallOpts, arg0 *big.Int) (struct { - CeilUSD *big.Int - BlockStamp *big.Int - Withdrawals *big.Int - RateBlocks *big.Int - RateWithdrawals *big.Int - MaxWithdrawals *big.Int -}, error) { +// Solidity: function ACCOUNT_CREATION_HASH() view returns(bytes32) +func (_Hermez *HermezCaller) ACCOUNTCREATIONHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "ACCOUNT_CREATION_HASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ACCOUNTCREATIONHASH is a free data retrieval call binding the contract method 0x1300aff0. +// +// Solidity: function ACCOUNT_CREATION_HASH() view returns(bytes32) +func (_Hermez *HermezSession) ACCOUNTCREATIONHASH() ([32]byte, error) { + return _Hermez.Contract.ACCOUNTCREATIONHASH(&_Hermez.CallOpts) +} + +// ACCOUNTCREATIONHASH is a free data retrieval call binding the contract method 0x1300aff0. +// +// Solidity: function ACCOUNT_CREATION_HASH() view returns(bytes32) +func (_Hermez *HermezCallerSession) ACCOUNTCREATIONHASH() ([32]byte, error) { + return _Hermez.Contract.ACCOUNTCREATIONHASH(&_Hermez.CallOpts) +} + +// AUTHORISETYPEHASH is a free data retrieval call binding the contract method 0xe62f6b92. +// +// Solidity: function AUTHORISE_TYPEHASH() view returns(bytes32) +func (_Hermez *HermezCaller) AUTHORISETYPEHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "AUTHORISE_TYPEHASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// AUTHORISETYPEHASH is a free data retrieval call binding the contract method 0xe62f6b92. +// +// Solidity: function AUTHORISE_TYPEHASH() view returns(bytes32) +func (_Hermez *HermezSession) AUTHORISETYPEHASH() ([32]byte, error) { + return _Hermez.Contract.AUTHORISETYPEHASH(&_Hermez.CallOpts) +} + +// AUTHORISETYPEHASH is a free data retrieval call binding the contract method 0xe62f6b92. +// +// Solidity: function AUTHORISE_TYPEHASH() view returns(bytes32) +func (_Hermez *HermezCallerSession) AUTHORISETYPEHASH() ([32]byte, error) { + return _Hermez.Contract.AUTHORISETYPEHASH(&_Hermez.CallOpts) +} + +// DOMAINSEPARATOR is a free data retrieval call binding the contract method 0x3644e515. +// +// Solidity: function DOMAIN_SEPARATOR() view returns(bytes32 domainSeparator) +func (_Hermez *HermezCaller) DOMAINSEPARATOR(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "DOMAIN_SEPARATOR") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DOMAINSEPARATOR is a free data retrieval call binding the contract method 0x3644e515. +// +// Solidity: function DOMAIN_SEPARATOR() view returns(bytes32 domainSeparator) +func (_Hermez *HermezSession) DOMAINSEPARATOR() ([32]byte, error) { + return _Hermez.Contract.DOMAINSEPARATOR(&_Hermez.CallOpts) +} + +// DOMAINSEPARATOR is a free data retrieval call binding the contract method 0x3644e515. +// +// Solidity: function DOMAIN_SEPARATOR() view returns(bytes32 domainSeparator) +func (_Hermez *HermezCallerSession) DOMAINSEPARATOR() ([32]byte, error) { + return _Hermez.Contract.DOMAINSEPARATOR(&_Hermez.CallOpts) +} + +// EIP712DOMAINHASH is a free data retrieval call binding the contract method 0xc473af33. +// +// Solidity: function EIP712DOMAIN_HASH() view returns(bytes32) +func (_Hermez *HermezCaller) EIP712DOMAINHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "EIP712DOMAIN_HASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// EIP712DOMAINHASH is a free data retrieval call binding the contract method 0xc473af33. +// +// Solidity: function EIP712DOMAIN_HASH() view returns(bytes32) +func (_Hermez *HermezSession) EIP712DOMAINHASH() ([32]byte, error) { + return _Hermez.Contract.EIP712DOMAINHASH(&_Hermez.CallOpts) +} + +// EIP712DOMAINHASH is a free data retrieval call binding the contract method 0xc473af33. +// +// Solidity: function EIP712DOMAIN_HASH() view returns(bytes32) +func (_Hermez *HermezCallerSession) EIP712DOMAINHASH() ([32]byte, error) { + return _Hermez.Contract.EIP712DOMAINHASH(&_Hermez.CallOpts) +} + +// HERMEZNETWORKHASH is a free data retrieval call binding the contract method 0xf1f2fcab. +// +// Solidity: function HERMEZ_NETWORK_HASH() view returns(bytes32) +func (_Hermez *HermezCaller) HERMEZNETWORKHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "HERMEZ_NETWORK_HASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// HERMEZNETWORKHASH is a free data retrieval call binding the contract method 0xf1f2fcab. +// +// Solidity: function HERMEZ_NETWORK_HASH() view returns(bytes32) +func (_Hermez *HermezSession) HERMEZNETWORKHASH() ([32]byte, error) { + return _Hermez.Contract.HERMEZNETWORKHASH(&_Hermez.CallOpts) +} + +// HERMEZNETWORKHASH is a free data retrieval call binding the contract method 0xf1f2fcab. +// +// Solidity: function HERMEZ_NETWORK_HASH() view returns(bytes32) +func (_Hermez *HermezCallerSession) HERMEZNETWORKHASH() ([32]byte, error) { + return _Hermez.Contract.HERMEZNETWORKHASH(&_Hermez.CallOpts) +} + +// NAMEHASH is a free data retrieval call binding the contract method 0x04622c2e. +// +// Solidity: function NAME_HASH() view returns(bytes32) +func (_Hermez *HermezCaller) NAMEHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "NAME_HASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// NAMEHASH is a free data retrieval call binding the contract method 0x04622c2e. +// +// Solidity: function NAME_HASH() view returns(bytes32) +func (_Hermez *HermezSession) NAMEHASH() ([32]byte, error) { + return _Hermez.Contract.NAMEHASH(&_Hermez.CallOpts) +} + +// NAMEHASH is a free data retrieval call binding the contract method 0x04622c2e. +// +// Solidity: function NAME_HASH() view returns(bytes32) +func (_Hermez *HermezCallerSession) NAMEHASH() ([32]byte, error) { + return _Hermez.Contract.NAMEHASH(&_Hermez.CallOpts) +} + +// VERSIONHASH is a free data retrieval call binding the contract method 0x9e4e7318. +// +// Solidity: function VERSION_HASH() view returns(bytes32) +func (_Hermez *HermezCaller) VERSIONHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "VERSION_HASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// VERSIONHASH is a free data retrieval call binding the contract method 0x9e4e7318. +// +// Solidity: function VERSION_HASH() view returns(bytes32) +func (_Hermez *HermezSession) VERSIONHASH() ([32]byte, error) { + return _Hermez.Contract.VERSIONHASH(&_Hermez.CallOpts) +} + +// VERSIONHASH is a free data retrieval call binding the contract method 0x9e4e7318. +// +// Solidity: function VERSION_HASH() view returns(bytes32) +func (_Hermez *HermezCallerSession) VERSIONHASH() ([32]byte, error) { + return _Hermez.Contract.VERSIONHASH(&_Hermez.CallOpts) +} + +// Buckets is a free data retrieval call binding the contract method 0x061d0964. +// +// Solidity: function buckets(int256 ) view returns(uint256) +func (_Hermez *HermezCaller) Buckets(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) { var out []interface{} err := _Hermez.contract.Call(opts, &out, "buckets", arg0) - outstruct := new(struct { - CeilUSD *big.Int - BlockStamp *big.Int - Withdrawals *big.Int - RateBlocks *big.Int - RateWithdrawals *big.Int - MaxWithdrawals *big.Int - }) + if err != nil { + return *new(*big.Int), err + } - outstruct.CeilUSD = out[0].(*big.Int) - outstruct.BlockStamp = out[1].(*big.Int) - outstruct.Withdrawals = out[2].(*big.Int) - outstruct.RateBlocks = out[3].(*big.Int) - outstruct.RateWithdrawals = out[4].(*big.Int) - outstruct.MaxWithdrawals = out[5].(*big.Int) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - return *outstruct, err + return out0, err } -// Buckets is a free data retrieval call binding the contract method 0x9b51fb0d. +// Buckets is a free data retrieval call binding the contract method 0x061d0964. // -// Solidity: function buckets(uint256 ) view returns(uint256 ceilUSD, uint256 blockStamp, uint256 withdrawals, uint256 rateBlocks, uint256 rateWithdrawals, uint256 maxWithdrawals) -func (_Hermez *HermezSession) Buckets(arg0 *big.Int) (struct { - CeilUSD *big.Int - BlockStamp *big.Int - Withdrawals *big.Int - RateBlocks *big.Int - RateWithdrawals *big.Int - MaxWithdrawals *big.Int -}, error) { +// Solidity: function buckets(int256 ) view returns(uint256) +func (_Hermez *HermezSession) Buckets(arg0 *big.Int) (*big.Int, error) { return _Hermez.Contract.Buckets(&_Hermez.CallOpts, arg0) } -// Buckets is a free data retrieval call binding the contract method 0x9b51fb0d. +// Buckets is a free data retrieval call binding the contract method 0x061d0964. // -// Solidity: function buckets(uint256 ) view returns(uint256 ceilUSD, uint256 blockStamp, uint256 withdrawals, uint256 rateBlocks, uint256 rateWithdrawals, uint256 maxWithdrawals) -func (_Hermez *HermezCallerSession) Buckets(arg0 *big.Int) (struct { - CeilUSD *big.Int - BlockStamp *big.Int - Withdrawals *big.Int - RateBlocks *big.Int - RateWithdrawals *big.Int - MaxWithdrawals *big.Int -}, error) { +// Solidity: function buckets(int256 ) view returns(uint256) +func (_Hermez *HermezCallerSession) Buckets(arg0 *big.Int) (*big.Int, error) { return _Hermez.Contract.Buckets(&_Hermez.CallOpts, arg0) } @@ -388,6 +574,37 @@ func (_Hermez *HermezCallerSession) ForgeL1L2BatchTimeout() (uint8, error) { return _Hermez.Contract.ForgeL1L2BatchTimeout(&_Hermez.CallOpts) } +// GetChainId is a free data retrieval call binding the contract method 0x3408e470. +// +// Solidity: function getChainId() pure returns(uint256 chainId) +func (_Hermez *HermezCaller) GetChainId(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "getChainId") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetChainId is a free data retrieval call binding the contract method 0x3408e470. +// +// Solidity: function getChainId() pure returns(uint256 chainId) +func (_Hermez *HermezSession) GetChainId() (*big.Int, error) { + return _Hermez.Contract.GetChainId(&_Hermez.CallOpts) +} + +// GetChainId is a free data retrieval call binding the contract method 0x3408e470. +// +// Solidity: function getChainId() pure returns(uint256 chainId) +func (_Hermez *HermezCallerSession) GetChainId() (*big.Int, error) { + return _Hermez.Contract.GetChainId(&_Hermez.CallOpts) +} + // HermezAuctionContract is a free data retrieval call binding the contract method 0x2bd83626. // // Solidity: function hermezAuctionContract() view returns(address) @@ -636,6 +853,37 @@ func (_Hermez *HermezCallerSession) MapL1TxQueue(arg0 uint32) ([]byte, error) { return _Hermez.Contract.MapL1TxQueue(&_Hermez.CallOpts, arg0) } +// NBuckets is a free data retrieval call binding the contract method 0x07feef6e. +// +// Solidity: function nBuckets() view returns(uint256) +func (_Hermez *HermezCaller) NBuckets(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "nBuckets") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// NBuckets is a free data retrieval call binding the contract method 0x07feef6e. +// +// Solidity: function nBuckets() view returns(uint256) +func (_Hermez *HermezSession) NBuckets() (*big.Int, error) { + return _Hermez.Contract.NBuckets(&_Hermez.CallOpts) +} + +// NBuckets is a free data retrieval call binding the contract method 0x07feef6e. +// +// Solidity: function nBuckets() view returns(uint256) +func (_Hermez *HermezCallerSession) NBuckets() (*big.Int, error) { + return _Hermez.Contract.NBuckets(&_Hermez.CallOpts) +} + // NextL1FillingQueue is a free data retrieval call binding the contract method 0x0ee8e52b. // // Solidity: function nextL1FillingQueue() view returns(uint32) @@ -698,6 +946,37 @@ func (_Hermez *HermezCallerSession) NextL1ToForgeQueue() (uint32, error) { return _Hermez.Contract.NextL1ToForgeQueue(&_Hermez.CallOpts) } +// PackBucket is a free data retrieval call binding the contract method 0xccd226a7. +// +// Solidity: function packBucket(uint256 ceilUSD, uint256 blockStamp, uint256 withdrawals, uint256 rateBlocks, uint256 rateWithdrawals, uint256 maxWithdrawals) pure returns(uint256 ret) +func (_Hermez *HermezCaller) PackBucket(opts *bind.CallOpts, ceilUSD *big.Int, blockStamp *big.Int, withdrawals *big.Int, rateBlocks *big.Int, rateWithdrawals *big.Int, maxWithdrawals *big.Int) (*big.Int, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "packBucket", ceilUSD, blockStamp, withdrawals, rateBlocks, rateWithdrawals, maxWithdrawals) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// PackBucket is a free data retrieval call binding the contract method 0xccd226a7. +// +// Solidity: function packBucket(uint256 ceilUSD, uint256 blockStamp, uint256 withdrawals, uint256 rateBlocks, uint256 rateWithdrawals, uint256 maxWithdrawals) pure returns(uint256 ret) +func (_Hermez *HermezSession) PackBucket(ceilUSD *big.Int, blockStamp *big.Int, withdrawals *big.Int, rateBlocks *big.Int, rateWithdrawals *big.Int, maxWithdrawals *big.Int) (*big.Int, error) { + return _Hermez.Contract.PackBucket(&_Hermez.CallOpts, ceilUSD, blockStamp, withdrawals, rateBlocks, rateWithdrawals, maxWithdrawals) +} + +// PackBucket is a free data retrieval call binding the contract method 0xccd226a7. +// +// Solidity: function packBucket(uint256 ceilUSD, uint256 blockStamp, uint256 withdrawals, uint256 rateBlocks, uint256 rateWithdrawals, uint256 maxWithdrawals) pure returns(uint256 ret) +func (_Hermez *HermezCallerSession) PackBucket(ceilUSD *big.Int, blockStamp *big.Int, withdrawals *big.Int, rateBlocks *big.Int, rateWithdrawals *big.Int, maxWithdrawals *big.Int) (*big.Int, error) { + return _Hermez.Contract.PackBucket(&_Hermez.CallOpts, ceilUSD, blockStamp, withdrawals, rateBlocks, rateWithdrawals, maxWithdrawals) +} + // RegisterTokensCount is a free data retrieval call binding the contract method 0x9f34e9a3. // // Solidity: function registerTokensCount() view returns(uint256) @@ -745,10 +1024,13 @@ func (_Hermez *HermezCaller) RollupVerifiers(opts *bind.CallOpts, arg0 *big.Int) MaxTx *big.Int NLevels *big.Int }) + if err != nil { + return *outstruct, err + } - outstruct.VerifierInterface = out[0].(common.Address) - outstruct.MaxTx = out[1].(*big.Int) - outstruct.NLevels = out[2].(*big.Int) + outstruct.VerifierInterface = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.MaxTx = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.NLevels = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) return *outstruct, err @@ -962,6 +1244,71 @@ func (_Hermez *HermezCallerSession) TokenMap(arg0 common.Address) (*big.Int, err return _Hermez.Contract.TokenMap(&_Hermez.CallOpts, arg0) } +// UnpackBucket is a free data retrieval call binding the contract method 0x3f267155. +// +// Solidity: function unpackBucket(uint256 bucket) pure returns(uint256 ceilUSD, uint256 blockStamp, uint256 withdrawals, uint256 rateBlocks, uint256 rateWithdrawals, uint256 maxWithdrawals) +func (_Hermez *HermezCaller) UnpackBucket(opts *bind.CallOpts, bucket *big.Int) (struct { + CeilUSD *big.Int + BlockStamp *big.Int + Withdrawals *big.Int + RateBlocks *big.Int + RateWithdrawals *big.Int + MaxWithdrawals *big.Int +}, error) { + var out []interface{} + err := _Hermez.contract.Call(opts, &out, "unpackBucket", bucket) + + outstruct := new(struct { + CeilUSD *big.Int + BlockStamp *big.Int + Withdrawals *big.Int + RateBlocks *big.Int + RateWithdrawals *big.Int + MaxWithdrawals *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.CeilUSD = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.BlockStamp = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.Withdrawals = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.RateBlocks = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.RateWithdrawals = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) + outstruct.MaxWithdrawals = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// UnpackBucket is a free data retrieval call binding the contract method 0x3f267155. +// +// Solidity: function unpackBucket(uint256 bucket) pure returns(uint256 ceilUSD, uint256 blockStamp, uint256 withdrawals, uint256 rateBlocks, uint256 rateWithdrawals, uint256 maxWithdrawals) +func (_Hermez *HermezSession) UnpackBucket(bucket *big.Int) (struct { + CeilUSD *big.Int + BlockStamp *big.Int + Withdrawals *big.Int + RateBlocks *big.Int + RateWithdrawals *big.Int + MaxWithdrawals *big.Int +}, error) { + return _Hermez.Contract.UnpackBucket(&_Hermez.CallOpts, bucket) +} + +// UnpackBucket is a free data retrieval call binding the contract method 0x3f267155. +// +// Solidity: function unpackBucket(uint256 bucket) pure returns(uint256 ceilUSD, uint256 blockStamp, uint256 withdrawals, uint256 rateBlocks, uint256 rateWithdrawals, uint256 maxWithdrawals) +func (_Hermez *HermezCallerSession) UnpackBucket(bucket *big.Int) (struct { + CeilUSD *big.Int + BlockStamp *big.Int + Withdrawals *big.Int + RateBlocks *big.Int + RateWithdrawals *big.Int + MaxWithdrawals *big.Int +}, error) { + return _Hermez.Contract.UnpackBucket(&_Hermez.CallOpts, bucket) +} + // WithdrawDelayerContract is a free data retrieval call binding the contract method 0x1b0a8223. // // Solidity: function withdrawDelayerContract() view returns(address) @@ -1055,24 +1402,24 @@ func (_Hermez *HermezCallerSession) WithdrawalDelay() (uint64, error) { return _Hermez.Contract.WithdrawalDelay(&_Hermez.CallOpts) } -// AddL1Transaction is a paid mutator transaction binding the contract method 0x886df587. +// AddL1Transaction is a paid mutator transaction binding the contract method 0xc7273053. // -// Solidity: function addL1Transaction(uint256 babyPubKey, uint48 fromIdx, uint16 loadAmountF, uint16 amountF, uint32 tokenID, uint48 toIdx, bytes permit) payable returns() -func (_Hermez *HermezTransactor) AddL1Transaction(opts *bind.TransactOpts, babyPubKey *big.Int, fromIdx *big.Int, loadAmountF uint16, amountF uint16, tokenID uint32, toIdx *big.Int, permit []byte) (*types.Transaction, error) { +// Solidity: function addL1Transaction(uint256 babyPubKey, uint48 fromIdx, uint40 loadAmountF, uint40 amountF, uint32 tokenID, uint48 toIdx, bytes permit) payable returns() +func (_Hermez *HermezTransactor) AddL1Transaction(opts *bind.TransactOpts, babyPubKey *big.Int, fromIdx *big.Int, loadAmountF *big.Int, amountF *big.Int, tokenID uint32, toIdx *big.Int, permit []byte) (*types.Transaction, error) { return _Hermez.contract.Transact(opts, "addL1Transaction", babyPubKey, fromIdx, loadAmountF, amountF, tokenID, toIdx, permit) } -// AddL1Transaction is a paid mutator transaction binding the contract method 0x886df587. +// AddL1Transaction is a paid mutator transaction binding the contract method 0xc7273053. // -// Solidity: function addL1Transaction(uint256 babyPubKey, uint48 fromIdx, uint16 loadAmountF, uint16 amountF, uint32 tokenID, uint48 toIdx, bytes permit) payable returns() -func (_Hermez *HermezSession) AddL1Transaction(babyPubKey *big.Int, fromIdx *big.Int, loadAmountF uint16, amountF uint16, tokenID uint32, toIdx *big.Int, permit []byte) (*types.Transaction, error) { +// Solidity: function addL1Transaction(uint256 babyPubKey, uint48 fromIdx, uint40 loadAmountF, uint40 amountF, uint32 tokenID, uint48 toIdx, bytes permit) payable returns() +func (_Hermez *HermezSession) AddL1Transaction(babyPubKey *big.Int, fromIdx *big.Int, loadAmountF *big.Int, amountF *big.Int, tokenID uint32, toIdx *big.Int, permit []byte) (*types.Transaction, error) { return _Hermez.Contract.AddL1Transaction(&_Hermez.TransactOpts, babyPubKey, fromIdx, loadAmountF, amountF, tokenID, toIdx, permit) } -// AddL1Transaction is a paid mutator transaction binding the contract method 0x886df587. +// AddL1Transaction is a paid mutator transaction binding the contract method 0xc7273053. // -// Solidity: function addL1Transaction(uint256 babyPubKey, uint48 fromIdx, uint16 loadAmountF, uint16 amountF, uint32 tokenID, uint48 toIdx, bytes permit) payable returns() -func (_Hermez *HermezTransactorSession) AddL1Transaction(babyPubKey *big.Int, fromIdx *big.Int, loadAmountF uint16, amountF uint16, tokenID uint32, toIdx *big.Int, permit []byte) (*types.Transaction, error) { +// Solidity: function addL1Transaction(uint256 babyPubKey, uint48 fromIdx, uint40 loadAmountF, uint40 amountF, uint32 tokenID, uint48 toIdx, bytes permit) payable returns() +func (_Hermez *HermezTransactorSession) AddL1Transaction(babyPubKey *big.Int, fromIdx *big.Int, loadAmountF *big.Int, amountF *big.Int, tokenID uint32, toIdx *big.Int, permit []byte) (*types.Transaction, error) { return _Hermez.Contract.AddL1Transaction(&_Hermez.TransactOpts, babyPubKey, fromIdx, loadAmountF, amountF, tokenID, toIdx, permit) } @@ -1160,25 +1507,25 @@ func (_Hermez *HermezTransactorSession) SafeMode() (*types.Transaction, error) { return _Hermez.Contract.SafeMode(&_Hermez.TransactOpts) } -// UpdateBucketsParameters is a paid mutator transaction binding the contract method 0x68e95e53. +// UpdateBucketsParameters is a paid mutator transaction binding the contract method 0xac300ec9. // -// Solidity: function updateBucketsParameters(uint256[4][5] arrayBuckets) returns() -func (_Hermez *HermezTransactor) UpdateBucketsParameters(opts *bind.TransactOpts, arrayBuckets [5][6]*big.Int) (*types.Transaction, error) { - return _Hermez.contract.Transact(opts, "updateBucketsParameters", arrayBuckets) +// Solidity: function updateBucketsParameters(uint256[] newBuckets) returns() +func (_Hermez *HermezTransactor) UpdateBucketsParameters(opts *bind.TransactOpts, newBuckets []*big.Int) (*types.Transaction, error) { + return _Hermez.contract.Transact(opts, "updateBucketsParameters", newBuckets) } -// UpdateBucketsParameters is a paid mutator transaction binding the contract method 0x68e95e53. +// UpdateBucketsParameters is a paid mutator transaction binding the contract method 0xac300ec9. // -// Solidity: function updateBucketsParameters(uint256[4][5] arrayBuckets) returns() -func (_Hermez *HermezSession) UpdateBucketsParameters(arrayBuckets [5][6]*big.Int) (*types.Transaction, error) { - return _Hermez.Contract.UpdateBucketsParameters(&_Hermez.TransactOpts, arrayBuckets) +// Solidity: function updateBucketsParameters(uint256[] newBuckets) returns() +func (_Hermez *HermezSession) UpdateBucketsParameters(newBuckets []*big.Int) (*types.Transaction, error) { + return _Hermez.Contract.UpdateBucketsParameters(&_Hermez.TransactOpts, newBuckets) } -// UpdateBucketsParameters is a paid mutator transaction binding the contract method 0x68e95e53. +// UpdateBucketsParameters is a paid mutator transaction binding the contract method 0xac300ec9. // -// Solidity: function updateBucketsParameters(uint256[4][5] arrayBuckets) returns() -func (_Hermez *HermezTransactorSession) UpdateBucketsParameters(arrayBuckets [5][6]*big.Int) (*types.Transaction, error) { - return _Hermez.Contract.UpdateBucketsParameters(&_Hermez.TransactOpts, arrayBuckets) +// Solidity: function updateBucketsParameters(uint256[] newBuckets) returns() +func (_Hermez *HermezTransactorSession) UpdateBucketsParameters(newBuckets []*big.Int) (*types.Transaction, error) { + return _Hermez.Contract.UpdateBucketsParameters(&_Hermez.TransactOpts, newBuckets) } // UpdateFeeAddToken is a paid mutator transaction binding the contract method 0x314e5eda. @@ -2243,13 +2590,13 @@ func (it *HermezUpdateBucketsParametersIterator) Close() error { // HermezUpdateBucketsParameters represents a UpdateBucketsParameters event raised by the Hermez contract. type HermezUpdateBucketsParameters struct { - ArrayBuckets [5][4]*big.Int + ArrayBuckets []*big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterUpdateBucketsParameters is a free log retrieval operation binding the contract event 0x3c39a1e91c69d4cfeacb11190befc2b1c983746e6b21ab2441a3051de88d4480. +// FilterUpdateBucketsParameters is a free log retrieval operation binding the contract event 0xd4904145d7eae889c5493798579680417459783db0fa67398bea50e56859075f. // -// Solidity: event UpdateBucketsParameters(uint256[4][5] arrayBuckets) +// Solidity: event UpdateBucketsParameters(uint256[] arrayBuckets) func (_Hermez *HermezFilterer) FilterUpdateBucketsParameters(opts *bind.FilterOpts) (*HermezUpdateBucketsParametersIterator, error) { logs, sub, err := _Hermez.contract.FilterLogs(opts, "UpdateBucketsParameters") @@ -2259,9 +2606,9 @@ func (_Hermez *HermezFilterer) FilterUpdateBucketsParameters(opts *bind.FilterOp return &HermezUpdateBucketsParametersIterator{contract: _Hermez.contract, event: "UpdateBucketsParameters", logs: logs, sub: sub}, nil } -// WatchUpdateBucketsParameters is a free log subscription operation binding the contract event 0x3c39a1e91c69d4cfeacb11190befc2b1c983746e6b21ab2441a3051de88d4480. +// WatchUpdateBucketsParameters is a free log subscription operation binding the contract event 0xd4904145d7eae889c5493798579680417459783db0fa67398bea50e56859075f. // -// Solidity: event UpdateBucketsParameters(uint256[4][5] arrayBuckets) +// Solidity: event UpdateBucketsParameters(uint256[] arrayBuckets) func (_Hermez *HermezFilterer) WatchUpdateBucketsParameters(opts *bind.WatchOpts, sink chan<- *HermezUpdateBucketsParameters) (event.Subscription, error) { logs, sub, err := _Hermez.contract.WatchLogs(opts, "UpdateBucketsParameters") @@ -2296,9 +2643,9 @@ func (_Hermez *HermezFilterer) WatchUpdateBucketsParameters(opts *bind.WatchOpts }), nil } -// ParseUpdateBucketsParameters is a log parse operation binding the contract event 0x3c39a1e91c69d4cfeacb11190befc2b1c983746e6b21ab2441a3051de88d4480. +// ParseUpdateBucketsParameters is a log parse operation binding the contract event 0xd4904145d7eae889c5493798579680417459783db0fa67398bea50e56859075f. // -// Solidity: event UpdateBucketsParameters(uint256[4][5] arrayBuckets) +// Solidity: event UpdateBucketsParameters(uint256[] arrayBuckets) func (_Hermez *HermezFilterer) ParseUpdateBucketsParameters(log types.Log) (*HermezUpdateBucketsParameters, error) { event := new(HermezUpdateBucketsParameters) if err := _Hermez.contract.UnpackLog(event, "UpdateBucketsParameters", log); err != nil { diff --git a/eth/contracts/withdrawdelayer/WithdrawalDelayer.go b/eth/contracts/withdrawdelayer/WithdrawalDelayer.go index ffb4f65..a30ff55 100644 --- a/eth/contracts/withdrawdelayer/WithdrawalDelayer.go +++ b/eth/contracts/withdrawdelayer/WithdrawalDelayer.go @@ -27,7 +27,7 @@ var ( ) // WithdrawalDelayerABI is the input ABI used to generate the binding from. -const WithdrawalDelayerABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"depositTimestamp\",\"type\":\"uint64\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EmergencyModeEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EscapeHatchWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"initialWithdrawalDelay\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"initialHermezGovernanceAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"initialEmergencyCouncil\",\"type\":\"address\"}],\"name\":\"InitializeWithdrawalDelayerEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newEmergencyCouncil\",\"type\":\"address\"}],\"name\":\"NewEmergencyCouncil\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newHermezGovernanceAddress\",\"type\":\"address\"}],\"name\":\"NewHermezGovernanceAddress\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"withdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"NewWithdrawalDelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MAX_EMERGENCY_MODE_TIME\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_WITHDRAWAL_DELAY\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_newWithdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"changeWithdrawalDelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimEmergencyCouncil\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"_amount\",\"type\":\"uint192\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"depositInfo\",\"outputs\":[{\"internalType\":\"uint192\",\"name\":\"\",\"type\":\"uint192\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"},{\"internalType\":\"uint64\",\"name\":\"depositTimestamp\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enableEmergencyMode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"escapeHatchWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getEmergencyCouncil\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getEmergencyModeStartingTime\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getHermezGovernanceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWithdrawalDelay\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hermezRollupAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isEmergencyMode\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingEmergencyCouncil\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"newEmergencyCouncil\",\"type\":\"address\"}],\"name\":\"transferEmergencyCouncil\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newGovernance\",\"type\":\"address\"}],\"name\":\"transferGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"withdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_initialWithdrawalDelay\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"_initialHermezRollup\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_initialHermezGovernanceAddress\",\"type\":\"address\"},{\"internalType\":\"addresspayable\",\"name\":\"_initialEmergencyCouncil\",\"type\":\"address\"}],\"name\":\"withdrawalDelayerInitializer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" +const WithdrawalDelayerABI = "[{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_initialWithdrawalDelay\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"_initialHermezRollup\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_initialHermezGovernanceAddress\",\"type\":\"address\"},{\"internalType\":\"addresspayable\",\"name\":\"_initialEmergencyCouncil\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"depositTimestamp\",\"type\":\"uint64\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EmergencyModeEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EscapeHatchWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"initialWithdrawalDelay\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"initialHermezGovernanceAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"initialEmergencyCouncil\",\"type\":\"address\"}],\"name\":\"InitializeWithdrawalDelayerEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newEmergencyCouncil\",\"type\":\"address\"}],\"name\":\"NewEmergencyCouncil\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newHermezGovernanceAddress\",\"type\":\"address\"}],\"name\":\"NewHermezGovernanceAddress\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"withdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"NewWithdrawalDelay\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MAX_EMERGENCY_MODE_TIME\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_WITHDRAWAL_DELAY\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_newWithdrawalDelay\",\"type\":\"uint64\"}],\"name\":\"changeWithdrawalDelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimEmergencyCouncil\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"_amount\",\"type\":\"uint192\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"depositInfo\",\"outputs\":[{\"internalType\":\"uint192\",\"name\":\"\",\"type\":\"uint192\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"uint192\",\"name\":\"amount\",\"type\":\"uint192\"},{\"internalType\":\"uint64\",\"name\":\"depositTimestamp\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enableEmergencyMode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"escapeHatchWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getEmergencyCouncil\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getEmergencyModeStartingTime\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getHermezGovernanceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWithdrawalDelay\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hermezRollupAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isEmergencyMode\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingEmergencyCouncil\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"newEmergencyCouncil\",\"type\":\"address\"}],\"name\":\"transferEmergencyCouncil\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newGovernance\",\"type\":\"address\"}],\"name\":\"transferGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"withdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" // WithdrawalDelayer is an auto generated Go binding around an Ethereum contract. type WithdrawalDelayer struct { @@ -279,9 +279,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) Deposits(opts *bind.CallOpts, Amount *big.Int DepositTimestamp uint64 }) + if err != nil { + return *outstruct, err + } - outstruct.Amount = out[0].(*big.Int) - outstruct.DepositTimestamp = out[1].(uint64) + outstruct.Amount = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.DepositTimestamp = *abi.ConvertType(out[1], new(uint64)).(*uint64) return *outstruct, err @@ -744,27 +747,6 @@ func (_WithdrawalDelayer *WithdrawalDelayerTransactorSession) Withdrawal(_owner return _WithdrawalDelayer.Contract.Withdrawal(&_WithdrawalDelayer.TransactOpts, _owner, _token) } -// WithdrawalDelayerInitializer is a paid mutator transaction binding the contract method 0x42cb7216. -// -// Solidity: function withdrawalDelayerInitializer(uint64 _initialWithdrawalDelay, address _initialHermezRollup, address _initialHermezGovernanceAddress, address _initialEmergencyCouncil) returns() -func (_WithdrawalDelayer *WithdrawalDelayerTransactor) WithdrawalDelayerInitializer(opts *bind.TransactOpts, _initialWithdrawalDelay uint64, _initialHermezRollup common.Address, _initialHermezGovernanceAddress common.Address, _initialEmergencyCouncil common.Address) (*types.Transaction, error) { - return _WithdrawalDelayer.contract.Transact(opts, "withdrawalDelayerInitializer", _initialWithdrawalDelay, _initialHermezRollup, _initialHermezGovernanceAddress, _initialEmergencyCouncil) -} - -// WithdrawalDelayerInitializer is a paid mutator transaction binding the contract method 0x42cb7216. -// -// Solidity: function withdrawalDelayerInitializer(uint64 _initialWithdrawalDelay, address _initialHermezRollup, address _initialHermezGovernanceAddress, address _initialEmergencyCouncil) returns() -func (_WithdrawalDelayer *WithdrawalDelayerSession) WithdrawalDelayerInitializer(_initialWithdrawalDelay uint64, _initialHermezRollup common.Address, _initialHermezGovernanceAddress common.Address, _initialEmergencyCouncil common.Address) (*types.Transaction, error) { - return _WithdrawalDelayer.Contract.WithdrawalDelayerInitializer(&_WithdrawalDelayer.TransactOpts, _initialWithdrawalDelay, _initialHermezRollup, _initialHermezGovernanceAddress, _initialEmergencyCouncil) -} - -// WithdrawalDelayerInitializer is a paid mutator transaction binding the contract method 0x42cb7216. -// -// Solidity: function withdrawalDelayerInitializer(uint64 _initialWithdrawalDelay, address _initialHermezRollup, address _initialHermezGovernanceAddress, address _initialEmergencyCouncil) returns() -func (_WithdrawalDelayer *WithdrawalDelayerTransactorSession) WithdrawalDelayerInitializer(_initialWithdrawalDelay uint64, _initialHermezRollup common.Address, _initialHermezGovernanceAddress common.Address, _initialEmergencyCouncil common.Address) (*types.Transaction, error) { - return _WithdrawalDelayer.Contract.WithdrawalDelayerInitializer(&_WithdrawalDelayer.TransactOpts, _initialWithdrawalDelay, _initialHermezRollup, _initialHermezGovernanceAddress, _initialEmergencyCouncil) -} - // WithdrawalDelayerDepositIterator is returned from FilterDeposit and is used to iterate over the raw logs and unpacked data for Deposit events raised by the WithdrawalDelayer contract. type WithdrawalDelayerDepositIterator struct { Event *WithdrawalDelayerDeposit // Event containing the contract specifics and raw log diff --git a/node/node.go b/node/node.go index 7a951a2..870b8fe 100644 --- a/node/node.go +++ b/node/node.go @@ -367,6 +367,7 @@ func NewNode(mode Mode, cfg *config.Node) (*Node, error) { ForgeDelay: cfg.Coordinator.ForgeDelay.Duration, MustForgeAtSlotDeadline: cfg.Coordinator.MustForgeAtSlotDeadline, IgnoreSlotCommitment: cfg.Coordinator.IgnoreSlotCommitment, + ForgeOncePerSlotIfTxs: cfg.Coordinator.ForgeOncePerSlotIfTxs, ForgeNoTxsDelay: cfg.Coordinator.ForgeNoTxsDelay.Duration, SyncRetryInterval: cfg.Coordinator.SyncRetryInterval.Duration, PurgeByExtDelInterval: cfg.Coordinator.PurgeByExtDelInterval.Duration,