Skip to content

Commit

Permalink
Merge pull request #13 from 0xPolygon/cdk
Browse files Browse the repository at this point in the history
Rename to CDK
  • Loading branch information
arnaubennassar authored Aug 28, 2023
2 parents 8365568 + 6728be7 commit a40e2f6
Show file tree
Hide file tree
Showing 34 changed files with 196 additions and 307 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ RUN cd /src && make build

# CONTAINER FOR RUNNING BINARY
FROM alpine:3.16.0
COPY --from=build /src/dist/supernets2-data-availability /app/supernets2-data-availability
COPY --from=build /src/dist/cdk-data-availability /app/cdk-data-availability
EXPOSE 8444
CMD ["/bin/sh", "-c", "/app/supernets2-data-availability run"]
CMD ["/bin/sh", "-c", "/app/cdk-data-availability run"]
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ GOBASE := $(shell pwd)
GOBIN := $(GOBASE)/dist
GOOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
GOENVVARS := GOBIN=$(GOBIN) CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(ARCH)
GOBINARY := supernets2-data-availability
GOBINARY := cdk-data-availability
GOCMD := $(GOBASE)/cmd

LDFLAGS += -X 'github.com/0xPolygon/supernets2-data-availability.Version=$(VERSION)'
LDFLAGS += -X 'github.com/0xPolygon/supernets2-data-availability.GitRev=$(GITREV)'
LDFLAGS += -X 'github.com/0xPolygon/supernets2-data-availability.GitBranch=$(GITBRANCH)'
LDFLAGS += -X 'github.com/0xPolygon/supernets2-data-availability.BuildDate=$(DATE)'
LDFLAGS += -X 'github.com/0xPolygon/cdk-data-availability.Version=$(VERSION)'
LDFLAGS += -X 'github.com/0xPolygon/cdk-data-availability.GitRev=$(GITREV)'
LDFLAGS += -X 'github.com/0xPolygon/cdk-data-availability.GitBranch=$(GITBRANCH)'
LDFLAGS += -X 'github.com/0xPolygon/cdk-data-availability.BuildDate=$(DATE)'

.PHONY: build
build: ## Builds the binary locally into ./dist
$(GOENVVARS) go build -ldflags "all=$(LDFLAGS)" -o $(GOBIN)/$(GOBINARY) $(GOCMD)

.PHONY: build-docker
build-docker: ## Builds a docker image with the node binary
docker build -t supernets2-data-availability -f ./Dockerfile .
docker build -t cdk-data-availability -f ./Dockerfile .

.PHONY: build-docker-nc
build-docker-nc: ## Builds a docker image with the node binary - but without build cache
docker build --no-cache=true -t supernets2-data-availability -f ./Dockerfile .
docker build --no-cache=true -t cdk-data-availability -f ./Dockerfile .

.PHONY: install-linter
install-linter: ## Installs the linter
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# supernets2-data-availability
supernets2-data-availability
# cdk-data-availability
cdk-data-availability
2 changes: 1 addition & 1 deletion batch/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package batch
import (
"crypto/ecdsa"

"github.com/0xPolygon/supernets2-node/jsonrpc/types"
"github.com/0xPolygon/cdk-validium-node/jsonrpc/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
Expand Down
2 changes: 1 addition & 1 deletion batch/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/ecdsa"
"testing"

"github.com/0xPolygon/supernets2-node/jsonrpc/types"
"github.com/0xPolygon/cdk-validium-node/jsonrpc/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"context"

"github.com/0xPolygon/supernets2-data-availability/sequence"
"github.com/0xPolygon/cdk-data-availability/sequence"
"github.com/ethereum/go-ethereum/common"
)

Expand Down
6 changes: 3 additions & 3 deletions client/datacom.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/json"
"fmt"

"github.com/0xPolygon/supernets2-data-availability/sequence"
"github.com/0xPolygon/supernets2-node/jsonrpc/client"
"github.com/0xPolygon/supernets2-node/jsonrpc/types"
"github.com/0xPolygon/cdk-data-availability/sequence"
"github.com/0xPolygon/cdk-validium-node/jsonrpc/client"
"github.com/0xPolygon/cdk-validium-node/jsonrpc/types"
)

// SignSequence sends a request to sign the given sequence by the data committee member
Expand Down
4 changes: 2 additions & 2 deletions client/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"encoding/json"
"fmt"

"github.com/0xPolygon/supernets2-node/jsonrpc/client"
"github.com/0xPolygon/supernets2-node/jsonrpc/types"
"github.com/0xPolygon/cdk-validium-node/jsonrpc/client"
"github.com/0xPolygon/cdk-validium-node/jsonrpc/types"
"github.com/ethereum/go-ethereum/common"
)

Expand Down
22 changes: 11 additions & 11 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import (
"os/signal"
"time"

dataavailability "github.com/0xPolygon/supernets2-data-availability"
"github.com/0xPolygon/supernets2-data-availability/config"
"github.com/0xPolygon/supernets2-data-availability/db"
"github.com/0xPolygon/supernets2-data-availability/dummyinterfaces"
"github.com/0xPolygon/supernets2-data-availability/services/datacom"
"github.com/0xPolygon/supernets2-data-availability/services/sync"
"github.com/0xPolygon/supernets2-data-availability/synchronizer"
dbConf "github.com/0xPolygon/supernets2-node/db"
"github.com/0xPolygon/supernets2-node/jsonrpc"
"github.com/0xPolygon/supernets2-node/log"
dataavailability "github.com/0xPolygon/cdk-data-availability"
"github.com/0xPolygon/cdk-data-availability/config"
"github.com/0xPolygon/cdk-data-availability/db"
"github.com/0xPolygon/cdk-data-availability/dummyinterfaces"
"github.com/0xPolygon/cdk-data-availability/services/datacom"
"github.com/0xPolygon/cdk-data-availability/services/sync"
"github.com/0xPolygon/cdk-data-availability/synchronizer"
dbConf "github.com/0xPolygon/cdk-validium-node/db"
"github.com/0xPolygon/cdk-validium-node/jsonrpc"
"github.com/0xPolygon/cdk-validium-node/log"
"github.com/ethereum/go-ethereum/crypto"
"github.com/urfave/cli/v2"
)

const appName = "supernets2-data-availability"
const appName = "cdk-data-availability"

var (
configFileFlag = cli.StringFlag{
Expand Down
10 changes: 5 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"path/filepath"
"strings"

"github.com/0xPolygon/supernets2-node/config/types"
"github.com/0xPolygon/supernets2-node/db"
"github.com/0xPolygon/supernets2-node/jsonrpc"
"github.com/0xPolygon/supernets2-node/log"
"github.com/0xPolygon/cdk-validium-node/config/types"
"github.com/0xPolygon/cdk-validium-node/db"
"github.com/0xPolygon/cdk-validium-node/jsonrpc"
"github.com/0xPolygon/cdk-validium-node/log"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/mitchellh/mapstructure"
"github.com/spf13/viper"
Expand All @@ -34,7 +34,7 @@ type Config struct {
type L1Config struct {
WsURL string `mapstructure:"WsURL"`
RpcURL string `mapstructure:"RpcURL"`
Supernets2Address string `mapstructure:"Supernets2Address"`
CDKValidiumAddress string `mapstructure:"CDKValidiumAddress"`
DataCommitteeAddress string `mapstructure:"DataCommitteeAddress"`
Timeout types.Duration `mapstructure:"Timeout"`
RetryPeriod types.Duration `mapstructure:"RetryPeriod"`
Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/0xPolygon/supernets2-node/config/types"
"github.com/0xPolygon/cdk-validium-node/config/types"
"github.com/stretchr/testify/require"
"github.com/urfave/cli/v2"
)
Expand All @@ -25,7 +25,7 @@ func Test_Defaults(t *testing.T) {
expectedValue: "http://127.0.0.1:8545",
},
{
path: "L1.Supernets2Address",
path: "L1.CDKValidiumAddress",
expectedValue: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
},
{
Expand Down
4 changes: 2 additions & 2 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PrivateKey = {Path = "/pk/test-member.keystore", Password = "testonly"}
[L1]
WsURL = "ws://127.0.0.1:8546"
RpcURL = "http://127.0.0.1:8545"
Supernets2Address = "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82"
CDKValidiumAddress = "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82"
DataCommitteeAddress = "0x0"
Timeout = "1m"
RetryPeriod = "5s"
Expand All @@ -28,7 +28,7 @@ Outputs = ["stderr"]
User = "committee_user"
Password = "committee_password"
Name = "committee_db"
Host = "supernets2-data-availability-db"
Host = "cdk-data-availability-db"
Port = "5432"
EnableLog = false
MaxConns = 200
Expand Down
6 changes: 3 additions & 3 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"errors"

"github.com/0xPolygon/supernets2-data-availability/offchaindata"
"github.com/0xPolygon/supernets2-node/jsonrpc/types"
"github.com/0xPolygon/supernets2-node/state"
"github.com/0xPolygon/cdk-data-availability/offchaindata"
"github.com/0xPolygon/cdk-validium-node/jsonrpc/types"
"github.com/0xPolygon/cdk-validium-node/state"
"github.com/ethereum/go-ethereum/common"
"github.com/jackc/pgconn"
"github.com/jackc/pgx/v4"
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/supernets2-node/log"
"github.com/0xPolygon/cdk-validium-node/log"
"github.com/gobuffalo/packr/v2"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v4/stdlib"
Expand Down
22 changes: 16 additions & 6 deletions dummyinterfaces/dummyinterfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"math/big"
"time"

"github.com/0xPolygon/supernets2-node/jsonrpc"
"github.com/0xPolygon/supernets2-node/pool"
"github.com/0xPolygon/supernets2-node/state"
"github.com/0xPolygon/supernets2-node/state/runtime"
"github.com/0xPolygon/cdk-validium-node/jsonrpc"
"github.com/0xPolygon/cdk-validium-node/pool"
"github.com/0xPolygon/cdk-validium-node/state"
"github.com/0xPolygon/cdk-validium-node/state/runtime"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/gorilla/websocket"
Expand All @@ -23,6 +23,16 @@ const notImplemented = "not implemented"
// DummyPool foo
type DummyPool struct{}

// GetGasPrices implements types.PoolInterface.
func (*DummyPool) GetGasPrices(ctx context.Context) (pool.GasPrices, error) {
panic("unimplemented")
}

// CheckPolicy foo bar
func (d *DummyPool) CheckPolicy(ctx context.Context, policy pool.PolicyName, address common.Address) (bool, error) {
return false, errors.New(notImplemented)
}

// AddTx foo
func (d *DummyPool) AddTx(ctx context.Context, tx types.Transaction, ip string) error {
return errors.New(notImplemented)
Expand Down Expand Up @@ -275,8 +285,8 @@ func (d *DummyState) GetBatchByNumber(ctx context.Context, batchNumber uint64, d
}

// GetTransactionsByBatchNumber foo
func (d *DummyState) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, err error) {
return nil, errors.New(notImplemented)
func (d *DummyState) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, effectivePercentages []uint8, err error) {
return
}

// GetVirtualBatch foo
Expand Down
34 changes: 18 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
module github.com/0xPolygon/supernets2-data-availability
module github.com/0xPolygon/cdk-data-availability

go 1.19

require (
github.com/0xPolygon/supernets2-node v0.0.0-20230707112214-f7e23fc2f1c4
github.com/0xPolygon/cdk-validium-node v0.0.0-20230828091841-53a4ff42575c
github.com/ethereum/go-ethereum v1.12.0
github.com/gobuffalo/packr/v2 v2.8.3
github.com/gorilla/websocket v1.5.0
github.com/jackc/pgconn v1.14.1
github.com/jackc/pgx/v4 v4.18.1
github.com/miguelmota/go-solidity-sha3 v0.1.1
github.com/mitchellh/mapstructure v1.5.0
github.com/rubenv/sql-migrate v1.4.0
github.com/rubenv/sql-migrate v1.5.2
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
github.com/umbracle/ethgo v0.1.4-0.20230712173909-df37dddf16f0
github.com/urfave/cli/v2 v2.25.5
github.com/urfave/cli/v2 v2.25.7
)

require (
Expand Down Expand Up @@ -55,11 +56,12 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hermeznetwork/tracerr v0.3.2 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.2 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 // indirect
github.com/iden3/go-iden3-crypto v0.0.15 // indirect
github.com/invopop/jsonschema v0.7.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.0 // 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
Expand All @@ -82,10 +84,10 @@ require (
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
Expand All @@ -109,16 +111,16 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.1.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand Down
Loading

0 comments on commit a40e2f6

Please sign in to comment.