Skip to content

Commit

Permalink
Update Beethoven
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaubennassar committed Dec 19, 2023
1 parent 3bebb97 commit e774772
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 150 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# CONTAINER FOR BUILDING BINARY
FROM golang:1.21 AS build

# TODO: REMOVE SSH BEFORE MERGING, ONCE BEETHOVEN IS PUBLIC

# SSH KEY
ARG SSH_PRIVATE_KEY
RUN mkdir /root/.ssh/
RUN echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh/id_rsa
RUN echo "Host github.com\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
RUN git config --global --add url."[email protected]:".insteadOf "https://github.com/"
ENV GOPRIVATE=github.com/0xPolygon/beethoven

# INSTALL DEPENDENCIES
RUN go install github.com/gobuffalo/packr/v2/[email protected]
COPY go.mod go.sum /src/
Expand All @@ -11,6 +22,9 @@ COPY . /src
RUN cd /src/db && packr2
RUN cd /src && make build

# REMOVE SSH PRIVATE KEY
RUN rm /root/.ssh/id_rsa

# CONTAINER FOR RUNNING BINARY
FROM alpine:3.18.0
COPY --from=build /src/dist/zkevm-node /app/zkevm-node
Expand Down
15 changes: 8 additions & 7 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func New(
profitabilityChecker = NewTxProfitabilityCheckerAcceptAll(stateInterface, cfg.IntervalAfterWhichBatchConsolidateAnyway.Duration)
}

if cfg.SetlementBackend == Beethoven {
if cfg.SettlementBackend == Beethoven {
if sequencerPrivateKey == nil {
return Aggregator{}, fmt.Errorf("the private key of the sequencer needs to be provided")
}
Expand Down Expand Up @@ -297,18 +297,19 @@ func (a *Aggregator) sendFinalProof() {

log.Infof("Final proof inputs: NewLocalExitRoot [%#x], NewStateRoot [%#x]", inputs.NewLocalExitRoot, inputs.NewStateRoot)

if a.cfg.SetlementBackend == L1 {
switch a.cfg.SettlementBackend {
case L1:
if success := a.settleProofToL1(ctx, proof, inputs); !success {
continue
}
} else if a.cfg.SetlementBackend == Beethoven {
case Beethoven:
if success := a.settleProofToBeethoven(ctx, proof, inputs); !success {
continue
}
} else {
log.Errorf("Invalid settlement backed for the ZKPs: %s", a.cfg.SetlementBackend)
a.endProofVerification()
continue
default:
if success := a.settleProofToL1(ctx, proof, inputs); !success {
continue
}
}

a.resetVerifyProofTime()
Expand Down
10 changes: 5 additions & 5 deletions aggregator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func (t *TokenAmountWithDecimals) UnmarshalText(data []byte) error {
return nil
}

type SetlementBackend string
type SettlementBackend string

const (
Beethoven SetlementBackend = "beethoven"
L1 SetlementBackend = "l1"
Beethoven SettlementBackend = "beethoven"
L1 SettlementBackend = "l1"
)

// Config represents the configuration of the aggregator
Expand Down Expand Up @@ -93,8 +93,8 @@ type Config struct {
// final gas: 1100
GasOffset uint64 `mapstructure:"GasOffset"`

// SetlementBackend indicates where ZKPs are settled. It can be "l1" or "beethoven"
SetlementBackend SetlementBackend `mapstructure:"SetlementBackend"`
// SettlementBackend indicates where ZKPs are settled. It can be "l1" or "beethoven"
SettlementBackend SettlementBackend `mapstructure:"SettlementBackend"`

// BeethovenTxTimeout is the interval time to wait for a tx to be mined from the beethoven
BeethovenTxTimeout types.Duration `mapstructure:"BeethovenTxTimeout"`
Expand Down
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ func createSequenceSender(cfg config.Config, pool *pool.Pool, etmStorage *ethtxm
func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State) {
var beethCli *beethovenClient.Client
var sequencerPrivateKey *ecdsa.PrivateKey
if c.SetlementBackend == aggregator.Beethoven {
if c.SettlementBackend == aggregator.Beethoven {
var err error
beethCli = beethovenClient.New(c.BeethovenURL)
_, sequencerPrivateKey, err = etherman.LoadAuthFromKeyStore(
Expand Down
78 changes: 34 additions & 44 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,41 @@ module github.com/0xPolygonHermez/zkevm-node
go 1.21

require (
github.com/0xPolygon/beethoven v0.0.0-20231219171447-aec77becacf9
github.com/0xPolygon/cdk-data-availability v0.0.3
github.com/0xPolygonHermez/zkevm-data-streamer v0.1.14
github.com/didip/tollbooth/v6 v6.1.2
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127
github.com/ethereum/go-ethereum v1.13.5
github.com/ethereum/go-ethereum v1.13.2
github.com/fatih/color v1.14.1
github.com/go-git/go-billy/v5 v5.5.0
github.com/go-git/go-git/v5 v5.10.0
github.com/go-git/go-git/v5 v5.11.0
github.com/gobuffalo/packr/v2 v2.8.3
github.com/google/uuid v1.4.0
github.com/gorilla/websocket v1.5.1
github.com/habx/pg-commands v0.6.1
github.com/hermeznetwork/tracerr v0.3.2
github.com/holiman/uint256 v1.2.4
github.com/iden3/go-iden3-crypto v0.0.15
github.com/invopop/jsonschema v0.12.0
github.com/jackc/pgconn v1.14.1
github.com/jackc/pgx/v4 v4.18.1
github.com/joho/godotenv v1.5.1
github.com/mitchellh/mapstructure v1.5.0
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/client_model v0.5.0
github.com/prometheus/common v0.45.0
github.com/rubenv/sql-migrate v1.5.2
github.com/spf13/afero v1.10.0
github.com/spf13/viper v1.17.0
github.com/rubenv/sql-migrate v1.6.0
github.com/spf13/afero v1.11.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
github.com/umbracle/ethgo v0.1.4-0.20230712173909-df37dddf16f0
github.com/urfave/cli/v2 v2.26.0
github.com/urfave/cli/v2 v2.25.7
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.14.0
golang.org/x/net v0.17.0
golang.org/x/sync v0.4.0
golang.org/x/crypto v0.17.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/net v0.19.0
golang.org/x/sync v0.5.0
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v2 v2.4.0
Expand All @@ -38,37 +46,34 @@ require (

require (
dario.cat/mergo v1.0.0 // indirect
github.com/0xPolygon/cdk-validium-node v0.0.2-0.20230922123231-07ce723e6268 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/bits-and-blooms/bitset v1.12.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.3.3 // 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-20230928194634-aa077af62593 // indirect
github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/fsnotify/fsnotify v1.7.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.1-0.20230307220236-3a3c6141e376 // indirect
Expand Down Expand Up @@ -111,7 +116,7 @@ require (
github.com/markbates/safe v1.0.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/miguelmota/go-solidity-sha3 v0.1.1 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
Expand All @@ -121,22 +126,22 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/skeema/knownhosts v1.2.0 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/cast v1.6.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.6.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
Expand All @@ -147,28 +152,13 @@ require (
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

require (
github.com/gorilla/websocket v1.5.1
github.com/holiman/uint256 v1.2.3
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
)

require (
github.com/0xPolygon/beethoven v0.0.0-20231218164321-2ab8b2cc50e7
github.com/0xPolygon/cdk-data-availability v0.0.3
github.com/fatih/color v1.15.0
github.com/joho/godotenv v1.5.1
github.com/prometheus/client_golang v1.17.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
)
Loading

0 comments on commit e774772

Please sign in to comment.