Skip to content

Commit

Permalink
Merge Release/v0.0.3 into develop (0xPolygonHermez#1673)
Browse files Browse the repository at this point in the history
* Fix closing signals manager and pool (0xPolygonHermez#1671)

* Fix closing signals manager and pool

* remove inSec from config parameters

* remove inSec from config parameters

* remove inSec from config parameters

* Fix/random forced (0xPolygonHermez#1668)

* Wip

* making the sequencer to store forced batches even if it fails while processing.

Signed-off-by: Nikolay Nedkov <[email protected]>

* finishing forced batches error handling

Signed-off-by: Nikolay Nedkov <[email protected]>

* fix

* remove

* fix script + linter

* remove acc

* update geth library and go version

* go 1.18

* fix + helper random test

* add tests helper

* log

* linter

---------

Signed-off-by: Nikolay Nedkov <[email protected]>
Co-authored-by: Nikolay Nedkov <[email protected]>

---------

Signed-off-by: Nikolay Nedkov <[email protected]>
Co-authored-by: Alonso Rodriguez <[email protected]>
Co-authored-by: Nikolay Nedkov <[email protected]>
  • Loading branch information
3 people authored Feb 20, 2023
1 parent 6b62e7f commit 3ce6dbe
Show file tree
Hide file tree
Showing 40 changed files with 463 additions and 1,082 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.17.x
go-version: 1.18.x
- name: Checkout code
uses: actions/checkout@v3
- name: Lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.18

- name: Get packr
run: go get -u github.com/gobuffalo/packr/v2/packr2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: [ 1.17.x ]
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
e2e-group: [ 1, 2, 3, 4 ]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
strategy:
matrix:
go-version: [ 1.17.x ]
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
e2e-group: [ 1, 2, 3, 4 ]
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-from-prover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
go-version: [ 1.17.x ]
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
e2e-group: [ 2 ]

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-full-non-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
strategy:
matrix:
go-version: [ 1.17.x ]
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
strategy:
matrix:
go-version: [ 1.17.x ]
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/updatedeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.17.x"
go-version: "1.18.x"
env:
GOARCH: "amd64"

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CONTAINER FOR BUILDING BINARY
FROM golang:1.17 AS build
FROM golang:1.18 AS build

# INSTALL DEPENDENCIES
RUN go install github.com/gobuffalo/packr/v2/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ It's recommended to use `make` for building, and testing the code, ... Run `make

### Requirements

- Go 1.17
- Go 1.18
- Docker
- Docker Compose
- Make
Expand Down
14 changes: 13 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,21 @@ func Test_Defaults(t *testing.T) {
expectedValue: uint64(64),
},
{
path: "Sequencer.Finalizer.ClosingSignalsManagerWaitForL1OperationsInSec",
path: "Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingL1Timeout",
expectedValue: types.NewDuration(10 * time.Second),
},
{
path: "Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingGER",
expectedValue: types.NewDuration(10 * time.Second),
},
{
path: "Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingForcedBatches",
expectedValue: types.NewDuration(10 * time.Second),
},
{
path: "Sequencer.Finalizer.ForcedBatchesFinalityNumberOfBlocks",
expectedValue: uint64(64),
},
{
path: "Etherman.URL",
expectedValue: "http://localhost:8545",
Expand Down
5 changes: 4 additions & 1 deletion config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ MaxAllowedFailedCounter = 50
SleepDurationInMs = "100ms"
ResourcePercentageToCloseBatch = 10
GERFinalityNumberOfBlocks = 64
ClosingSignalsManagerWaitForL1OperationsInSec = "10s"
ClosingSignalsManagerWaitForCheckingL1Timeout = "10s"
ClosingSignalsManagerWaitForCheckingGER = "10s"
ClosingSignalsManagerWaitForCheckingForcedBatches = "10s"
ForcedBatchesFinalityNumberOfBlocks = 64
SenderAddress = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
PrivateKeys = [{Path = "/pk/sequencer.keystore", Password = "testonly"}]
Expand Down
5 changes: 4 additions & 1 deletion config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ MaxAllowedFailedCounter = 50
SleepDurationInMs = "100ms"
ResourcePercentageToCloseBatch = 10
GERFinalityNumberOfBlocks = 0
ClosingSignalsManagerWaitForL1OperationsInSec = "10s"
ClosingSignalsManagerWaitForCheckingL1Timeout = "10s"
ClosingSignalsManagerWaitForCheckingGER = "10s"
ClosingSignalsManagerWaitForCheckingForcedBatches = "10s"
ForcedBatchesFinalityNumberOfBlocks = 64
SenderAddress = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
PrivateKeys = [{Path = "/pk/sequencer.keystore", Password = "testonly"}]

Expand Down
6 changes: 3 additions & 3 deletions docs/ci/groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ for each of the jobs looks like this:
```
strategy:
matrix:
go-version: [ 1.17.x ]
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
e2e-group: [ 1, 2, 3 ]
```
Expand All @@ -54,15 +54,15 @@ groups 1 and 3, the matrix strategy config should look like:
```
strategy:
matrix:
go-version: [ 1.17.x ]
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
e2e-group: [ 2 ]
```
If we want to re-add group 1:
```
strategy:
matrix:
go-version: [ 1.17.x ]
go-version: [ 1.18.x ]
goarch: [ "amd64" ]
e2e-group: [ 1, 2 ]
```
Expand Down
9 changes: 2 additions & 7 deletions etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,15 +425,11 @@ func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequen
func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence) (*types.Transaction, error) {
var batches []polygonzkevm.PolygonZkEVMBatchData
for _, seq := range sequences {
batchL2Data, err := state.EncodeTransactions(seq.Txs)
if err != nil {
return nil, fmt.Errorf("failed to encode transactions, err: %v", err)
}
batch := polygonzkevm.PolygonZkEVMBatchData{
Transactions: batchL2Data,
Transactions: seq.BatchL2Data,
GlobalExitRoot: seq.GlobalExitRoot,
Timestamp: uint64(seq.Timestamp),
MinForcedTimestamp: 0, // TODO If this batch is forced, this value must be different than zero. If it is a non forced sequence, then the value will be valid
MinForcedTimestamp: uint64(seq.ForcedBatchTimestamp),
}

batches = append(batches, batch)
Expand Down Expand Up @@ -571,7 +567,6 @@ func (etherMan *Client) forcedBatchEvent(ctx context.Context, vLog types.Log, bl
}
t := time.Unix(int64(fullBlock.Time()), 0)
forcedBatch.ForcedAt = t

if len(*blocks) == 0 || ((*blocks)[len(*blocks)-1].BlockHash != vLog.BlockHash || (*blocks)[len(*blocks)-1].BlockNumber != vLog.BlockNumber) {
block := prepareBlock(vLog, t, fullBlock)
block.ForcedBatches = append(block.ForcedBatches, forcedBatch)
Expand Down
5 changes: 4 additions & 1 deletion etherman/etherman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygonzkevmbridge"
ethmanTypes "github.com/0xPolygonHermez/zkevm-node/etherman/types"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/0xPolygonHermez/zkevm-node/state"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
Expand Down Expand Up @@ -312,10 +313,12 @@ func TestSendSequences(t *testing.T) {
require.NoError(t, err)

tx1 := types.NewTransaction(uint64(0), common.Address{}, big.NewInt(10), uint64(1), big.NewInt(10), []byte{})
batchL2Data, err := state.EncodeTransactions([]types.Transaction{*tx1})
require.NoError(t, err)
sequence := ethmanTypes.Sequence{
GlobalExitRoot: ger,
Timestamp: int64(currentBlock.Time() - 1),
Txs: []types.Transaction{*tx1},
BatchL2Data: batchL2Data,
}
tx, err := etherman.sequenceBatches(*auth, []ethmanTypes.Sequence{sequence})
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions etherman/types/sequence.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"reflect"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)

// Sequence represents an operation sent to the PoE smart contract to be
Expand All @@ -13,9 +12,10 @@ type Sequence struct {
GlobalExitRoot, StateRoot, LocalExitRoot common.Hash
AccInputHash common.Hash
Timestamp int64
Txs []types.Transaction
BatchL2Data []byte
IsSequenceTooBig bool
BatchNumber uint64
ForcedBatchTimestamp int64
}

// IsEmpty checks is sequence struct is empty
Expand Down
44 changes: 30 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/0xPolygonHermez/zkevm-node

go 1.17
go 1.18

require (
github.com/didip/tollbooth/v6 v6.1.2
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf
github.com/ethereum/go-ethereum v1.10.19
github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7
github.com/ethereum/go-ethereum v1.11.0
github.com/go-git/go-billy/v5 v5.4.1
github.com/go-git/go-git/v5 v5.4.2
github.com/gobuffalo/packr/v2 v2.8.3
Expand Down Expand Up @@ -33,6 +33,7 @@ require (
)

require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
Expand All @@ -41,38 +42,50 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-kit/kit v0.9.0 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-pkgz/expirable-cache v0.0.3 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/gobuffalo/logger v1.0.6 // indirect
github.com/gobuffalo/packd v1.0.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/big v0.0.0-20221017200358-a027dc42d04e // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgtype v1.14.0 // indirect
github.com/jackc/puddle v1.3.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/markbates/errx v1.1.0 // indirect
Expand All @@ -85,26 +98,29 @@ require (
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect
github.com/rjeczalik/notify v0.9.1 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 // indirect
github.com/valyala/fastjson v1.4.1 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect
golang.org/x/net v0.6.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
Expand Down
Loading

0 comments on commit 3ce6dbe

Please sign in to comment.