Skip to content

Commit

Permalink
Rebrand: rename lazyledger to celestia (dymensionxyz#91)
Browse files Browse the repository at this point in the history
* Change go package name
* Rename links
* Use up to date Tendermint instead of lazyledger-core
* Switch to plain Tendermint v0.34.13
* update mempool code in mempool directory
* update go.mod
  * lazyledger-core => tendermint
  * lazyledger/lazyledger-app => celestiaorg/celestia-app (with replace
    directive)
  * lazyledger/cosmos-sdk => cosmos-sdk
* re-generated mock App
* code updated because of changes in Tendermint
* Rename Data Availability Layer Client
  • Loading branch information
tzdybal authored Sep 15, 2021
1 parent 4c58a3e commit d0dcc50
Show file tree
Hide file tree
Showing 46 changed files with 808 additions and 388 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ABCI-client implementation for Optimistic Rollups.

Design document: https://docs.google.com/document/d/12gZow_JTJjRrmaD2mNTmYniLhyxVLSyDd7Fbxo5UnA8/edit?usp=sharing

[![build-and-test](https://github.com/lazyledger/optimint/actions/workflows/test.yml/badge.svg)](https://github.com/lazyledger/optimint/actions/workflows/test.yml)
[![golangci-lint](https://github.com/lazyledger/optimint/actions/workflows/lint.yml/badge.svg)](https://github.com/lazyledger/optimint/actions/workflows/lint.yml)
[![codecov](https://codecov.io/gh/lazyledger/optimint/branch/main/graph/badge.svg?token=CWGA4RLDS9)](https://codecov.io/gh/lazyledger/optimint)
[![GoDoc](https://godoc.org/github.com/lazyledger/optimint?status.svg)](https://godoc.org/github.com/lazyledger/optimint)
[![build-and-test](https://github.com/celestiaorg/optimint/actions/workflows/test.yml/badge.svg)](https://github.com/celestiaorg/optimint/actions/workflows/test.yml)
[![golangci-lint](https://github.com/celestiaorg/optimint/actions/workflows/lint.yml/badge.svg)](https://github.com/celestiaorg/optimint/actions/workflows/lint.yml)
[![codecov](https://codecov.io/gh/celestiaorg/optimint/branch/main/graph/badge.svg?token=CWGA4RLDS9)](https://codecov.io/gh/celestiaorg/optimint)
[![GoDoc](https://godoc.org/github.com/celestiaorg/optimint?status.svg)](https://godoc.org/github.com/celestiaorg/optimint)
6 changes: 3 additions & 3 deletions conv/abci/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package abci
import (
"time"

tmproto "github.com/lazyledger/lazyledger-core/proto/tendermint/types"
tmversion "github.com/lazyledger/lazyledger-core/proto/tendermint/version"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmversion "github.com/tendermint/tendermint/proto/tendermint/version"

"github.com/lazyledger/optimint/types"
"github.com/celestiaorg/optimint/types"
)

// ToABCIHeader converts Optimint header to Header format defined in ABCI.
Expand Down
3 changes: 2 additions & 1 deletion conv/addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package conv
import (
"strings"

"github.com/lazyledger/optimint/config"
"github.com/multiformats/go-multiaddr"

"github.com/celestiaorg/optimint/config"
)

// TranslateAddresses updates conf by changing Cosmos-style addresses to Multiaddr format.
Expand Down
2 changes: 1 addition & 1 deletion conv/addr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/assert"

"github.com/lazyledger/optimint/config"
"github.com/celestiaorg/optimint/config"
)

func TestTranslateAddresses(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions conv/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package conv

import (
tmcfg "github.com/lazyledger/lazyledger-core/config"
tmcfg "github.com/tendermint/tendermint/config"

"github.com/lazyledger/optimint/config"
"github.com/celestiaorg/optimint/config"
)

// GetNodeConfig translates Tendermint's configuration into Optimint configuration.
Expand Down
4 changes: 2 additions & 2 deletions conv/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/stretchr/testify/assert"

tmcfg "github.com/lazyledger/lazyledger-core/config"
"github.com/lazyledger/optimint/config"
"github.com/celestiaorg/optimint/config"
tmcfg "github.com/tendermint/tendermint/config"
)

func TestGetNodeConfig(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion conv/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"errors"
"fmt"

"github.com/lazyledger/lazyledger-core/p2p"
"github.com/libp2p/go-libp2p-core/crypto"

"github.com/tendermint/tendermint/p2p"
)

var (
Expand Down
10 changes: 7 additions & 3 deletions conv/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/lazyledger/lazyledger-core/crypto/secp256k1"
"github.com/lazyledger/lazyledger-core/p2p"
pb "github.com/libp2p/go-libp2p-core/crypto/pb"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/secp256k1"
"github.com/tendermint/tendermint/p2p"
)

func TestGetNodeKey(t *testing.T) {
t.Parallel()

valid := p2p.GenNodeKey()
privKey := ed25519.GenPrivKey()
valid := p2p.NodeKey{
PrivKey: privKey,
}
invalid := p2p.NodeKey{
PrivKey: secp256k1.GenPrivKey(),
}
Expand Down
40 changes: 20 additions & 20 deletions da/lazyledger/lazyledger.go → da/celestia/celestia.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package lazyledger
package celestia

import (
"context"
Expand All @@ -8,19 +8,19 @@ import (
"github.com/pelletier/go-toml"
"google.golang.org/grpc"

appclient "github.com/celestiaorg/celestia-app/x/payment/client"
apptypes "github.com/celestiaorg/celestia-app/x/payment/types"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx"
appclient "github.com/lazyledger/lazyledger-app/x/lazyledgerapp/client"
apptypes "github.com/lazyledger/lazyledger-app/x/lazyledgerapp/types"

"github.com/lazyledger/optimint/da"
"github.com/lazyledger/optimint/log"
"github.com/lazyledger/optimint/store"
"github.com/lazyledger/optimint/types"
"github.com/celestiaorg/optimint/da"
"github.com/celestiaorg/optimint/log"
"github.com/celestiaorg/optimint/store"
"github.com/celestiaorg/optimint/types"
)

// Config holds all configuration required by LazyLedger DA layer client.
// Config holds all configuration required by Celestia DA layer client.
type Config struct {
// PayForMessage related params
NamespaceID []byte
Expand All @@ -47,9 +47,9 @@ type Config struct {
RootDir string
}

// LazyLedger implements DataAvailabilityLayerClient interface.
// It use lazyledger-app via gRPC.
type LazyLedger struct {
// Celestia implements DataAvailabilityLayerClient interface.
// It use celestia-app via gRPC.
type Celestia struct {
config Config
kvStore store.KVStore
logger log.Logger
Expand All @@ -59,10 +59,10 @@ type LazyLedger struct {
rpcClient *grpc.ClientConn
}

var _ da.DataAvailabilityLayerClient = &LazyLedger{}
var _ da.DataAvailabilityLayerClient = &Celestia{}

// Init is called once to allow DA client to read configuration and initialize resources.
func (ll *LazyLedger) Init(config []byte, kvStore store.KVStore, logger log.Logger) error {
func (ll *Celestia) Init(config []byte, kvStore store.KVStore, logger log.Logger) error {
ll.logger = logger
ll.kvStore = kvStore
err := toml.Unmarshal(config, &ll.config)
Expand All @@ -76,21 +76,21 @@ func (ll *LazyLedger) Init(config []byte, kvStore store.KVStore, logger log.Logg
return err
}

// Start establishes gRPC connection to lazyledger app.
func (ll *LazyLedger) Start() (err error) {
// Start establishes gRPC connection to celestia-app.
func (ll *Celestia) Start() (err error) {
ll.rpcClient, err = grpc.Dial(ll.config.RPCAddress, grpc.WithInsecure())
return
}

// Stop closes gRPC connection.
func (ll *LazyLedger) Stop() error {
func (ll *Celestia) Stop() error {
return ll.rpcClient.Close()
}

// SubmitBlock submits the passed in block to the DA layer.
// This should create a transaction which (potentially)
// triggers a state transition in the DA layer.
func (ll *LazyLedger) SubmitBlock(block *types.Block) da.ResultSubmitBlock {
func (ll *Celestia) SubmitBlock(block *types.Block) da.ResultSubmitBlock {
msg, err := ll.preparePayForMessage(block)
if err != nil {
return da.ResultSubmitBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}}
Expand All @@ -108,11 +108,11 @@ func (ll *LazyLedger) SubmitBlock(block *types.Block) da.ResultSubmitBlock {
}

// CheckBlockAvailability queries DA layer to check data availability of block corresponding to given header.
func (l *LazyLedger) CheckBlockAvailability(header *types.Header) da.ResultCheckBlock {
func (l *Celestia) CheckBlockAvailability(header *types.Header) da.ResultCheckBlock {
panic("not implemented") // TODO: Implement
}

func (ll *LazyLedger) callRPC(ctx context.Context, msg *apptypes.MsgWirePayForMessage) error {
func (ll *Celestia) callRPC(ctx context.Context, msg *apptypes.MsgWirePayForMessage) error {
signer := appclient.NewKeyringSigner(ll.keyring, ll.config.KeyringAccName, ll.config.ChainID)

err := signer.QueryAccountNumber(ctx, ll.rpcClient)
Expand Down Expand Up @@ -148,7 +148,7 @@ func (ll *LazyLedger) callRPC(ctx context.Context, msg *apptypes.MsgWirePayForMe
return nil
}

func (ll *LazyLedger) preparePayForMessage(block *types.Block) (*apptypes.MsgWirePayForMessage, error) {
func (ll *Celestia) preparePayForMessage(block *types.Block) (*apptypes.MsgWirePayForMessage, error) {
// TODO(tzdybal): serialize block
var message []byte
message, err := block.MarshalBinary()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package lazyledger
package celestia

import (
"errors"
"fmt"
"strconv"
"testing"

"github.com/celestiaorg/optimint/da"
"github.com/celestiaorg/optimint/types"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/lazyledger/optimint/da"
"github.com/lazyledger/optimint/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -29,7 +29,7 @@ func TestConfiguration(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
assert := assert.New(t)
ll := &LazyLedger{}
ll := &Celestia{}
err := ll.Init(c.input, nil, nil)

if c.err != nil {
Expand All @@ -44,14 +44,14 @@ func TestConfiguration(t *testing.T) {
}

func TestSubmission(t *testing.T) {
t.Skip("this test requires configured and running lazyledger-appd")
t.Skip("this test requires configured and running celestia-appd")
assert := assert.New(t)
require := require.New(t)
block := &types.Block{Header: types.Header{
Height: 1,
}}

ll := &LazyLedger{}
ll := &Celestia{}
kr := generateKeyring(t)
key, err := kr.Key("test-account")
require.NoError(err)
Expand Down
6 changes: 3 additions & 3 deletions da/da.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package da

import (
"github.com/lazyledger/optimint/log"
"github.com/lazyledger/optimint/store"
"github.com/lazyledger/optimint/types"
"github.com/celestiaorg/optimint/log"
"github.com/celestiaorg/optimint/store"
"github.com/celestiaorg/optimint/types"
)

// StatusCode is a type for DA layer return status.
Expand Down
8 changes: 4 additions & 4 deletions da/mock/mock.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package mock

import (
"github.com/lazyledger/optimint/da"
"github.com/lazyledger/optimint/log"
"github.com/lazyledger/optimint/store"
"github.com/lazyledger/optimint/types"
"github.com/celestiaorg/optimint/da"
"github.com/celestiaorg/optimint/log"
"github.com/celestiaorg/optimint/store"
"github.com/celestiaorg/optimint/types"
)

// MockDataAvailabilityLayerClient is intended only for usage in tests.
Expand Down
6 changes: 3 additions & 3 deletions da/mock/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/lazyledger/optimint/da"
"github.com/lazyledger/optimint/log/test"
"github.com/lazyledger/optimint/types"
"github.com/celestiaorg/optimint/da"
"github.com/celestiaorg/optimint/log/test"
"github.com/celestiaorg/optimint/types"
)

func TestLifecycle(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions da/registry/registry.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package registry

import (
"github.com/lazyledger/optimint/da"
"github.com/lazyledger/optimint/da/lazyledger"
"github.com/lazyledger/optimint/da/mock"
"github.com/celestiaorg/optimint/da"
"github.com/celestiaorg/optimint/da/celestia"
"github.com/celestiaorg/optimint/da/mock"
)

// this is a central registry for all Data Availability Layer Clients
var clients = map[string]func() da.DataAvailabilityLayerClient{
"mock": func() da.DataAvailabilityLayerClient { return &mock.MockDataAvailabilityLayerClient{} },
"lazyledger": func() da.DataAvailabilityLayerClient { return &lazyledger.LazyLedger{} },
"mock": func() da.DataAvailabilityLayerClient { return &mock.MockDataAvailabilityLayerClient{} },
"celestia": func() da.DataAvailabilityLayerClient { return &celestia.Celestia{} },
}

// GetClient returns client identified by name.
Expand Down
2 changes: 1 addition & 1 deletion docs/lazy-adr/adr-004-core-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,6 @@ For finishing the implementation these items need to be tackled at least:

## References

- https://github.com/lazyledger/optimint/pull/41
- https://github.com/celestiaorg/optimint/pull/41


20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
module github.com/lazyledger/optimint
module github.com/celestiaorg/optimint

go 1.15

require (
github.com/celestiaorg/celestia-app v0.0.0-00010101000000-000000000000
github.com/cosmos/cosmos-sdk v0.40.0-rc5
github.com/dgraph-io/badger/v3 v3.2011.1
github.com/fortytw2/leaktest v1.3.0
github.com/go-kit/kit v0.10.0
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.4.3
github.com/golang/protobuf v1.5.2
github.com/ipfs/go-log v1.0.4
github.com/lazyledger/lazyledger-app v0.0.0-20210615142030-0e60861ff7f5
github.com/lazyledger/lazyledger-core v0.0.0-20210219190522-0eccfb24e2aa
github.com/libp2p/go-libp2p v0.13.0
github.com/libp2p/go-libp2p-core v0.8.5
github.com/libp2p/go-libp2p-discovery v0.5.0
github.com/libp2p/go-libp2p-kad-dht v0.11.1
github.com/libp2p/go-libp2p-pubsub v0.4.1
github.com/minio/sha256-simd v0.1.1 // indirect
github.com/minio/sha256-simd v0.1.1
github.com/multiformats/go-multiaddr v0.3.1
github.com/pelletier/go-toml v1.9.0
github.com/prometheus/client_golang v1.8.0
github.com/pelletier/go-toml v1.9.3
github.com/prometheus/client_golang v1.11.0
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.13
go.uber.org/multierr v1.6.0
golang.org/x/crypto v0.0.0-20210415154028-4f45737414dc // indirect
google.golang.org/grpc v1.35.0
google.golang.org/grpc v1.40.0
)

replace (
github.com/cosmos/cosmos-sdk v0.40.0-rc5 => github.com/lazyledger/cosmos-sdk v0.40.0-rc5.0.20210121152417-3addd7f65d1c
github.com/celestiaorg/celestia-app => github.com/celestiaorg/lazyledger-app v0.0.0-20210909134530-18e69b513b3f
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4
)
Loading

0 comments on commit d0dcc50

Please sign in to comment.