Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Remove validium dep
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaubennassar committed Dec 19, 2023
1 parent 2ab8b2c commit 928ab79
Show file tree
Hide file tree
Showing 15 changed files with 156 additions and 121 deletions.
4 changes: 2 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"time"

"github.com/0xPolygon/beethoven/rpc/types"
"github.com/0xPolygon/cdk-validium-node/ethtxmanager"
"github.com/0xPolygon/cdk-validium-node/jsonrpc/client"
"github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
"github.com/0xPolygonHermez/zkevm-node/jsonrpc/client"
"github.com/ethereum/go-ethereum/common"

"github.com/0xPolygon/beethoven/tx"
Expand Down
17 changes: 6 additions & 11 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import (
"os/signal"
"time"

"github.com/0xPolygon/cdk-data-availability/dummyinterfaces"
dbConf "github.com/0xPolygon/cdk-validium-node/db"
"github.com/0xPolygon/cdk-validium-node/ethtxmanager"
"github.com/0xPolygon/cdk-validium-node/jsonrpc"
"github.com/0xPolygon/cdk-validium-node/log"
jRPC "github.com/0xPolygon/cdk-data-availability/rpc"
dbConf "github.com/0xPolygonHermez/zkevm-node/db"
"github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
Expand Down Expand Up @@ -125,13 +124,9 @@ func start(cliCtx *cli.Context) error {
}

// Register services
server := jsonrpc.NewServer(
server := jRPC.NewServer(
c.RPC,
0,
&dummyinterfaces.DummyPool{},
&dummyinterfaces.DummyState{},
&dummyinterfaces.DummyStorage{},
[]jsonrpc.Service{
[]jRPC.Service{
{
Name: rpc.INTEROP,
Service: rpc.NewInteropEndpoints(addr, storage, &ethMan,
Expand Down
12 changes: 6 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"path/filepath"
"strings"

"github.com/0xPolygon/cdk-validium-node/config/types"
"github.com/0xPolygon/cdk-validium-node/db"
"github.com/0xPolygon/cdk-validium-node/ethtxmanager"
"github.com/0xPolygon/cdk-validium-node/jsonrpc"
"github.com/0xPolygon/cdk-validium-node/log"
jRPC "github.com/0xPolygon/cdk-data-availability/rpc"
"github.com/0xPolygonHermez/zkevm-node/config/types"
"github.com/0xPolygonHermez/zkevm-node/db"
"github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/mitchellh/mapstructure"
"github.com/spf13/viper"
Expand All @@ -27,7 +27,7 @@ const (
// Config represents the full configuration of the data node
type Config struct {
FullNodeRPCs rpc.FullNodeRPCs `mapstructure:"FullNodeRPCs"`
RPC jsonrpc.Config `mapstructure:"RPC"`
RPC jRPC.Config `mapstructure:"RPC"`
Log log.Config `mapstructure:"Log"`
DB db.Config `mapstructure:"DB"`
EthTxManager ethtxmanager.Config `mapstructure:"EthTxManager"`
Expand Down
2 changes: 1 addition & 1 deletion db/migrations.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package db

import (
"github.com/0xPolygon/cdk-validium-node/log"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/gobuffalo/packr/v2"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v4/stdlib"
Expand Down
2 changes: 1 addition & 1 deletion docker/data/zkevm/genesis.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"l1Config" : {
"chainId": 1337,
"cdkValidiumAddress": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
"polygonZkEVMAddress": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
"maticTokenAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"polygonZkEVMGlobalExitRootAddress": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
"cdkDataCommitteeContract": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6"
Expand Down
89 changes: 61 additions & 28 deletions docker/data/zkevm/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,27 @@ Environment = "development" # "production" or "development"
Level = "debug"
Outputs = ["stderr"]

[StateDB]
User = "state_user"
Password = "state_password"
Name = "state_db"
Host = "zkevm-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
[State]
[State.DB]
User = "state_user"
Password = "state_password"
Name = "state_db"
Host = "zkevm-state-db"
Port = "5432"
EnableLog = false
MaxConns = 200
[State.Batch]
[State.Batch.Constraints]
MaxTxsPerBatch = 300
MaxBatchBytesSize = 120000
MaxCumulativeGasUsed = 30000000
MaxKeccakHashes = 2145
MaxPoseidonHashes = 252357
MaxPoseidonPaddings = 135191
MaxMemAligns = 236585
MaxArithmetics = 236585
MaxBinaries = 473170
MaxSteps = 7570538

[Pool]
FreeClaimGasLimit = 1500000
Expand All @@ -23,6 +36,17 @@ MaxTxDataBytesSize=100000
DefaultMinGasPriceAllowed = 1000000000
MinAllowedGasPriceInterval = "5m"
PollMinAllowedGasPriceInterval = "15s"
AccountQueue = 64
GlobalQueue = 1024
[Pool.EffectiveGasPrice]
Enabled = false
L1GasPriceFactor = 0.25
ByteGasCost = 16
ZeroByteGasCost = 4
NetProfit = 1
BreakEvenFactor = 1.1
FinalDeviationPct = 10
L2GasPriceSuggesterFactor = 0.5
[Pool.DB]
User = "pool_user"
Password = "pool_password"
Expand Down Expand Up @@ -55,22 +79,26 @@ EnableL2SuggestedGasPricePolling = true
SyncInterval = "1s"
SyncChunkSize = 100
TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc.
L1SynchronizationMode = "sequential" # "sequential" or "parallel"
[Synchronizer.L1ParallelSynchronization]
MaxClients = 10
MaxPendingNoProcessedBlocks = 25
RequestLastBlockPeriod = "5s"
RequestLastBlockTimeout = "5s"
RequestLastBlockMaxRetries = 3
StatisticsPeriod = "5m"
TimeoutMainLoop = "5m"
RollupInfoRetriesSpacing= "5s"
FallbackToSequentialModeOnSynchronized = false
[Synchronizer.L1ParallelSynchronization.PerformanceWarning]
AceptableInacctivityTime = "5s"
ApplyAfterNumRollupReceived = 10

[Sequencer]
WaitPeriodPoolIsEmpty = "1s"
LastBatchVirtualizationTimeMaxWaitPeriod = "10s"
BlocksAmountForTxsToBeDeleted = 100
FrequencyToCheckTxsForDelete = "12h"
MaxTxsPerBatch = 300
MaxBatchBytesSize = 120000
MaxCumulativeGasUsed = 30000000
MaxKeccakHashes = 2145
MaxPoseidonHashes = 252357
MaxPoseidonPaddings = 135191
MaxMemAligns = 236585
MaxArithmetics = 236585
MaxBinaries = 473170
MaxSteps = 7570538
TxLifetimeCheckTimeout = "10m"
MaxTxLifetime = "3h"
[Sequencer.Finalizer]
Expand All @@ -88,12 +116,10 @@ MaxTxLifetime = "3h"
[Sequencer.DBManager]
PoolRetrievalInterval = "500ms"
L2ReorgRetrievalInterval = "5s"
[Sequencer.EffectiveGasPrice]
MaxBreakEvenGasPriceDeviationPercentage = 10
L1GasPriceFactor = 0.25
ByteGasCost = 16
MarginFactor = 1
Enabled = false
[Sequencer.StreamServer]
Port = 6900
Filename = "/datastreamer/datastream.bin"
Enabled = true

[SequenceSender]
WaitPeriodSendSequence = "15s"
Expand All @@ -113,15 +139,12 @@ ProofStatePollingInterval = "5s"
SenderAddress = "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"
CleanupLockedProofsInterval = "2m"
GeneratingProofCleanupThreshold = "10m"
SetlementBackend = "beethoven"
BeethovenURL = "http://beethoven:4444"
BeethovenTxTimeout = "30s"
SequencerPrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}

[EthTxManager]
ForcedGas = 0
PrivateKeys = [
{Path = "/pk/sequencer.keystore", Password = "testonly"},
{Path = "/pk/aggregator.keystore", Password = "testonly"}
]

[L2GasPriceSuggester]
Expand All @@ -146,6 +169,16 @@ ProfilingHost = "0.0.0.0"
ProfilingPort = 6060
ProfilingEnabled = true

[EventLog]
[EventLog.DB]
User = "event_user"
Password = "event_password"
Name = "event_db"
Host = "zkevm-event-db"
Port = "5432"
EnableLog = false
MaxConns = 200

[HashDB]
User = "prover_user"
Password = "prover_pass"
Expand Down
10 changes: 5 additions & 5 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.9'
services:
l1:
container_name: l1
image: hermeznetwork/geth-cdk-validium-contracts:v0.0.1
image: hermeznetwork/geth-cdk-validium-contracts:v0.0.2
command: [
"--http",
"--http.api", "admin,eth,debug,miner,net,txpool,personal,web3",
Expand Down Expand Up @@ -64,7 +64,7 @@ services:
- beethoven-localnet

zkevm-prover:
image: hermeznetwork/zkevm-prover:v2.2.0
image: hermeznetwork/zkevm-prover:v3.0.2
command: [
"zkProver",
"-c",
Expand All @@ -82,12 +82,12 @@ services:
- beethoven-localnet

zkevm-node:
image: hermeznetwork/cdk-validium-node:beethoven
image: hermeznetwork/cdk-validium-node:beethoven-v0.0.1
command:
- "/bin/sh"
- "-c"
- "/app/cdk-validium-node approve --network custom --custom-network-file /app/genesis.json --am 115792089237316195423570985008687907853269984665640564039457584007913129639935 -y --cfg /app/config.toml --key-store-path /pk/sequencer.keystore --password testonly &&
/app/cdk-validium-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components \"synchronizer,rpc,sequencer,sequence-sender,aggregator,eth-tx-manager,l2gaspricer\""
- "/app/zkevm-node approve --network custom --custom-network-file /app/genesis.json --am 115792089237316195423570985008687907853269984665640564039457584007913129639935 -y --cfg /app/config.toml --key-store-path /pk/sequencer.keystore --password testonly &&
/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components \"synchronizer,rpc,sequencer,sequence-sender,aggregator,eth-tx-manager,l2gaspricer\""
ports:
- '8123:8123'
- '61090:61090'
Expand Down
14 changes: 7 additions & 7 deletions etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"math/big"
"time"

"github.com/0xPolygon/cdk-validium-node/etherman/smartcontracts/cdkvalidium"
"github.com/0xPolygon/cdk-validium-node/log"
"github.com/0xPolygon/cdk-validium-node/state"
"github.com/0xPolygon/cdk-validium-node/test/operations"
"github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygonzkevm"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/0xPolygonHermez/zkevm-node/state"
"github.com/0xPolygonHermez/zkevm-node/test/operations"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -57,7 +57,7 @@ func (e *Etherman) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifie
}

const pendStateNum uint64 = 0 // TODO hardcoded for now until we implement the pending state feature
abi, err := cdkvalidium.CdkvalidiumMetaData.GetAbi()
abi, err := polygonzkevm.PolygonzkevmMetaData.GetAbi()
if err != nil {
log.Errorf("error geting ABI: %v, Proof: %s", err)
return nil, err
Expand All @@ -78,15 +78,15 @@ func (e *Etherman) CallContract(ctx context.Context, call ethereum.CallMsg, bloc
return e.ethClient.CallContract(ctx, call, blockNumber)
}

func (e *Etherman) contractCaller(from, to common.Address) (*bind.TransactOpts, *cdkvalidium.Cdkvalidium, error) {
func (e *Etherman) contractCaller(from, to common.Address) (*bind.TransactOpts, *polygonzkevm.Polygonzkevm, error) {
opts := bind.TransactOpts{}
opts.From = from
opts.NoSend = true
// force nonce, gas limit and gas price to avoid querying it from the chain
opts.Nonce = big.NewInt(1)
opts.GasLimit = uint64(1)
opts.GasPrice = big.NewInt(1)
contract, err := cdkvalidium.NewCdkvalidium(to, e.ethClient)
contract, err := polygonzkevm.NewPolygonzkevm(to, e.ethClient)
if err != nil {
log.Errorf("error instantiating contract: %s", err)
return nil, nil, err
Expand Down
2 changes: 1 addition & 1 deletion etherman/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

"github.com/0xPolygon/cdk-validium-node/encoding"
"github.com/0xPolygonHermez/zkevm-node/encoding"
)

type Proof [ProofLength][HashLength]byte
Expand Down
Loading

0 comments on commit 928ab79

Please sign in to comment.