Skip to content

Commit

Permalink
Integrate the zkevm-node v0.7.0 changes (0xPolygon#146) (#9)
Browse files Browse the repository at this point in the history
* Adding initial for deb packaging for amd64

* Fix typo in comment

* Removing unnecessary directory creation, artifact from testing

* Adding fix for mkdir in postinstall

* Fix broken Unit declaration in service file

* Integrate the `zkevm-node` v0.7.0 changes (0xPolygon#146)

* Update DS Format (0xPolygonHermez#3608)

* protobuf datastream

* proto batch end (0xPolygonHermez#3612)

* fix genesis DS (0xPolygonHermez#3615)

* Fix DSSendL2Block batch number (0xPolygonHermez#3617)

* Fix DSSendL2Block batch number

* latest proto (0xPolygonHermez#3620)

* Fix DSSendBatchEnd (0xPolygonHermez#3621)

* add TxFeeCap config (0xPolygonHermez#3611)

* Add delay when getting storedFlushId from the executor/hashdb (0xPolygonHermez#3625)

* Add sleep delay when getting storedFlushId from the executor/hashdb

* update config doc

* Fix use of L2coinbase configured in sequencesender.L2Coinbase parameter (0xPolygonHermez#3642)

* fix use l2coinbase configured in sequencesender.L2Coinbase parameter

* update doc

* Feature/3640 synchronizer choose to sync from l2 (0xPolygonHermez#3641)

* 0xPolygonHermez#3640. New Param Synchronizer.L2Synchronization.Enable to choose if sync from L2

* change synchronization config params 'Enable' to 'Enabled' (0xPolygonHermez#3656)

* change 'Enable' to 'Enabled' on sync config and changed comments

* Cherry-pick 0xPolygonHermez#3650: Do fatal when datastream channel is full (workaround to fix datastream blocking issue) (0xPolygonHermez#3654)

* Do fatal when datastream channel is full (workaround to fix datastream blocking issue) (0xPolygonHermez#3650)

* Do fatal when datastream channel is full (this will restart sequencer automatically)

* update datastream library (more ds-debug logs)

* fix decrease DataToStreamChannelCount

* add optimistic gas computation while estimating gas (0xPolygonHermez#3653)

* Use Eth block hash for l2 blocks in data stream (0xPolygonHermez#3661)

* Use Eth block hash for l2 blocks in data stream

* handle minTimestamp

* empty imStateRoot (0xPolygonHermez#3663)

* empty imStateRoot

* fix comment

* Cherry-pick 0xPolygonHermez#3659,0xPolygonHermez#3662: Remove sync with virtual state (synchronizer). Add L1 block confirmations (0xPolygonHermez#3666)

* Remove sync with virtual state (synchronizer). Add L1 block confirmat… (0xPolygonHermez#3659)

* Remove sync with virtual state (synchronizer). Add L1 block confirmations to consider sequence final

* fix get monitored tx receipt

* update doc

* Skip wait L1 block confirmations after restart (0xPolygonHermez#3662)

* skip wait L1 block confirmations after restart

* skip checking last batch sequenced in SC after restart

* set default value of SequenceL1BlockConfirmations to 32

* set default value of SequenceL1BlockConfirmations to 2 for debug/test

* fix config_test

* fix doc

* remove db tx from RPC (0xPolygonHermez#3648) (0xPolygonHermez#3683)

* remove synchronizer dependency from eth tx manager to confirm monitored tx (0xPolygonHermez#3658) (0xPolygonHermez#3677)

* Cherry-pick 0xPolygonHermez#3669: Add WriteTimeout config parameter to StreamServer (0xPolygonHermez#3690)

* Add WriteTimeout config parameter to StreamServer (0xPolygonHermez#3669)

* Add WriteTimeout config parameter to StreamServer. Update DS library

* update doc

* update default value for StreamServer.WriteTimeout config parameter. Increase buffer for datastream channel

* fix doc

* fix config test

* fix doc

* change imstateroot handling in DS (0xPolygonHermez#3698)

* change imstateroot handling in DS

* Fix tests

* Generate node config doc

* Update the diff

---------

Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: Thiago Coimbra Lemos <[email protected]>
Co-authored-by: Joan Esteban <[email protected]>

* Added Polygon R&D Link (0xPolygon#147)

---------

Co-authored-by: Daniel Jones <[email protected]>
Co-authored-by: Stefan Negovanović <[email protected]>
Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: Thiago Coimbra Lemos <[email protected]>
Co-authored-by: Joan Esteban <[email protected]>
Co-authored-by: Daniel Jones <[email protected]>
Co-authored-by: AMAN PANDEY <[email protected]>
  • Loading branch information
9 people authored Jul 25, 2024
1 parent c8f2c73 commit 1ed2273
Show file tree
Hide file tree
Showing 69 changed files with 54,073 additions and 281,497 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/deb_packager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: deb_packager
# test

on:
push:
branches:
- 'main'
paths:
- '**'
tags:
- 'v*.*.*'
- 'v*.*.*-*'

jobs:
build:
permissions:
id-token: write
contents: write
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@master
with:
go-version: 1.22.x
# Variables
- name: Adding TAG to ENV
run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
- name: adding version
run: |
NUMERIC_VERSION=$( echo ${{ env.GIT_TAG }} | sed 's/[^0-9.]//g' )
echo "VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV
- name: make clean for good measure
run: make clean

- name: build the binary
run: make build

- name: making directory structure
run: mkdir -p packaging/deb/cdk-validium-node/usr/bin/
- name: copying necessary binary for amd64
run: cp -rp dist/zkevm-node packaging/deb/cdk-validium-node/usr/bin/cdk-validium-node
- name: create directory for service file
run: mkdir -p packaging/deb/cdk-validium-node/lib/systemd/system
- name: copy the service file
run: cp -rp packaging/systemd/cdk-validium-node.service packaging/deb/cdk-validium-node/lib/systemd/system/


# Control file creation
- name: create control file
run: |
echo "Package: cdk-validium-node" >> packaging/deb/cdk-validium-node/DEBIAN/control
echo "Version: ${{ env.VERSION }}" >> packaging/deb/cdk-validium-node/DEBIAN/control
echo "Section: base" >> packaging/deb/cdk-validium-node/DEBIAN/control
echo "Priority: optional" >> packaging/deb/cdk-validium-node/DEBIAN/control
echo "Architecture: amd64" >> packaging/deb/cdk-validium-node/DEBIAN/control
echo "Maintainer: [email protected]" >> packaging/deb/cdk-validium-node/DEBIAN/control
echo "Description: cdk-validium-node binary package" >> packaging/deb/cdk-validium-node/DEBIAN/control
- name: Creating package for binary for cdk-validium-node ${{ env.ARCH }}
run: cp -rp packaging/deb/cdk-validium-node packaging/deb/cdk-validium-node-${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: amd64

- name: Running package build
run: dpkg-deb --build --root-owner-group packaging/deb/cdk-validium-node-${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: amd64

- name: create checksum for the amd64 package
run: cd packaging/deb/ && sha256sum cdk-validium-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb > cdk-validium-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum
env:
ARCH: amd64


- name: Release cdk-validium-node Packages
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.GIT_TAG }}
prerelease: true
files: |
packaging/deb/cdk-validium-node**.deb
packaging/deb/cdk-validium-node**.deb.checksum
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ check-python:
check-curl:
@which curl > /dev/null || (echo "Error: curl is not installed" && exit 1)

clean:
env GO111MODULE=on go clean -cache
rm -fr build/_workspace/pkg/ $(GOBIN)/*

# Targets that require the checks
build: check-go
lint: check-go
Expand Down Expand Up @@ -164,6 +168,7 @@ generate-code-from-proto: ## Generates code from proto files
cd proto/src/proto/hashdb/v1 && protoc --proto_path=. --proto_path=../../../../include --go_out=../../../../../merkletree/hashdb --go-grpc_out=../../../../../merkletree/hashdb --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative hashdb.proto
cd proto/src/proto/executor/v1 && protoc --proto_path=. --go_out=../../../../../state/runtime/executor --go-grpc_out=../../../../../state/runtime/executor --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative executor.proto
cd proto/src/proto/aggregator/v1 && protoc --proto_path=. --proto_path=../../../../include --go_out=../../../../../aggregator/prover --go-grpc_out=../../../../../aggregator/prover --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative aggregator.proto
cd proto/src/proto/datastream/v1 && protoc --proto_path=. --proto_path=../../../../include --go_out=../../../../../state/datastream --go-grpc_out=../../../../../state/datastream --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative datastream.proto

## Help display.
## Pulls comments from beside commands and prints a nicely formatted
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ The L2GasPricer is responsible for calculating the gas price on L2 based on the

Before opening a pull request, please read [this guide](./CONTRIBUTING.md).

## Contact

For more discussions, please head to the [R&D Discord](https://discord.gg/0xPolygonRnD)

## License

The cdk-validium-node project is licensed under the GNU Affero General Public License free software license.
2 changes: 2 additions & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,8 @@ func runJSONRPCServer(c config.Config, etherman *etherman.Client, chainID uint64
}

func createSequencer(cfg config.Config, pool *pool.Pool, st *state.State, etherman *etherman.Client, eventLog *event.EventLog) *sequencer.Sequencer {
cfg.Sequencer.L2Coinbase = cfg.SequenceSender.L2Coinbase

seq, err := sequencer.New(cfg.Sequencer, cfg.State.Batch, cfg.Pool, pool, st, etherman, eventLog)
if err != nil {
log.Fatal(err)
Expand Down
28 changes: 28 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ func Test_Defaults(t *testing.T) {
path: "Synchronizer.L2Synchronization.DataSourcePriority",
expectedValue: []dataavailability.DataSourcePriority{"local", "trusted", "external"},
},
{
path: "Synchronizer.L1BlockCheck.Enabled",
expectedValue: true,
},
{
path: "Synchronizer.L1BlockCheck.PreCheckEnabled",
expectedValue: true,
},
{
path: "Synchronizer.L2Synchronization.Enabled",
expectedValue: true,
},
{
path: "Sequencer.DeletePoolTxsL1BlockConfirmations",
expectedValue: uint64(100),
Expand Down Expand Up @@ -137,6 +149,10 @@ func Test_Defaults(t *testing.T) {
path: "Sequencer.Finalizer.BatchMaxDeltaTimestamp",
expectedValue: types.NewDuration(1800 * time.Second),
},
{
path: "Sequencer.Finalizer.FlushIdCheckInterval",
expectedValue: types.NewDuration(50 * time.Millisecond),
},
{
path: "Sequencer.Finalizer.Metrics.Interval",
expectedValue: types.NewDuration(60 * time.Minute),
Expand All @@ -157,6 +173,10 @@ func Test_Defaults(t *testing.T) {
path: "Sequencer.StreamServer.Version",
expectedValue: uint8(0),
},
{
path: "Sequencer.StreamServer.WriteTimeout",
expectedValue: types.NewDuration(5 * time.Second),
},
{
path: "Sequencer.StreamServer.Enabled",
expectedValue: false,
Expand Down Expand Up @@ -185,6 +205,10 @@ func Test_Defaults(t *testing.T) {
path: "SequenceSender.MaxBatchesForL1",
expectedValue: uint64(300),
},
{
path: "SequenceSender.SequenceL1BlockConfirmations",
expectedValue: uint64(32),
},
{
path: "Etherman.URL",
expectedValue: "http://localhost:8545",
Expand Down Expand Up @@ -306,6 +330,10 @@ func Test_Defaults(t *testing.T) {
path: "Pool.GlobalQueue",
expectedValue: uint64(1024),
},
{
path: "Pool.TxFeeCap",
expectedValue: float64(1),
},
{
path: "Pool.EffectiveGasPrice.Enabled",
expectedValue: false,
Expand Down
9 changes: 7 additions & 2 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ MinAllowedGasPriceInterval = "5m"
PollMinAllowedGasPriceInterval = "15s"
AccountQueue = 64
GlobalQueue = 1024
TxFeeCap = 1.0
[Pool.EffectiveGasPrice]
Enabled = false
L1GasPriceFactor = 0.25
Expand Down Expand Up @@ -107,11 +108,11 @@ L1SynchronizationMode = "sequential"
L1SyncCheckL2BlockHash = true
L1SyncCheckL2BlockNumberhModulus = 600
[Synchronizer.L1BlockCheck]
Enable = true
Enabled = true
L1SafeBlockPoint = "finalized"
L1SafeBlockOffset = 0
ForceCheckBeforeStart = true
PreCheckEnable = true
PreCheckEnabled = true
L1PreSafeBlockPoint = "safe"
L1PreSafeBlockOffset = 0
[Synchronizer.L1ParallelSynchronization]
Expand All @@ -128,6 +129,7 @@ L1SyncCheckL2BlockNumberhModulus = 600
AceptableInacctivityTime = "5s"
ApplyAfterNumRollupReceived = 10
[Synchronizer.L2Synchronization]
Enabled = true
AcceptEmptyClosedBatches = false
ReprocessFullBatchOnClose = false
CheckLastL2BlockHashOnCloseBatch = true
Expand All @@ -151,6 +153,7 @@ StateConsistencyCheckInterval = "5s"
L2BlockMaxDeltaTimestamp = "3s"
ResourceExhaustedMarginPct = 10
StateRootSyncInterval = "3600s"
FlushIdCheckInterval = "50ms"
HaltOnBatchNumber = 0
SequentialBatchSanityCheck = false
SequentialProcessL2Block = false
Expand All @@ -161,13 +164,15 @@ StateConsistencyCheckInterval = "5s"
Port = 0
Filename = ""
Version = 0
WriteTimeout = "5s"
Enabled = false
[SequenceSender]
WaitPeriodSendSequence = "5s"
LastBatchVirtualizationTimeMaxWaitPeriod = "5s"
L1BlockTimestampMargin = "30s"
MaxTxSizeForL1 = 131072
SequenceL1BlockConfirmations = 32
L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
GasOffset = 80000
Expand Down
3 changes: 3 additions & 0 deletions config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ StateConsistencyCheckInterval = "5s"
L2BlockMaxDeltaTimestamp = "3s"
ResourceExhaustedMarginPct = 10
StateRootSyncInterval = "360s"
FlushIdCheckInterval = "50ms"
HaltOnBatchNumber = 0
SequentialBatchSanityCheck = false
SequentialProcessL2Block = false
Expand All @@ -111,13 +112,15 @@ StateConsistencyCheckInterval = "5s"
[Sequencer.StreamServer]
Port = 0
Filename = ""
WriteTimeout = "5s"
Enabled = false

[SequenceSender]
WaitPeriodSendSequence = "5s"
LastBatchVirtualizationTimeMaxWaitPeriod = "5s"
L1BlockTimestampMargin = "30s"
MaxTxSizeForL1 = 131072
SequenceL1BlockConfirmations = 32
L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}

Expand Down
Loading

0 comments on commit 1ed2273

Please sign in to comment.