diff --git a/block/manager.go b/block/manager.go index 6a6a61d1e39..13637cdaf87 100644 --- a/block/manager.go +++ b/block/manager.go @@ -3,6 +3,7 @@ package block import ( "context" "fmt" + "sync" "sync/atomic" "time" @@ -12,6 +13,7 @@ import ( "github.com/tendermint/tendermint/crypto/merkle" "github.com/tendermint/tendermint/proxy" tmtypes "github.com/tendermint/tendermint/types" + "go.uber.org/multierr" "github.com/celestiaorg/optimint/config" "github.com/celestiaorg/optimint/da" @@ -22,6 +24,9 @@ import ( "github.com/celestiaorg/optimint/types" ) +// defaultDABlockTime is used only if DABlockTime is not configured for manager +const defaultDABlockTime = 30 * time.Second + // Manager is responsible for aggregating transactions into blocks. type Manager struct { lastState state.State @@ -36,15 +41,21 @@ type Manager struct { dalc da.DataAvailabilityLayerClient retriever da.BlockRetriever + // daHeight is the height of the latest processed DA block + daHeight uint64 HeaderOutCh chan *types.Header HeaderInCh chan *types.Header syncTarget uint64 blockInCh chan *types.Block - retrieveCh chan uint64 syncCache map[uint64]*types.Block + // retrieveMtx is used by retrieveCond + retrieveMtx *sync.Mutex + // retrieveCond is used to notify sync goroutine (SyncLoop) that it needs to retrieve data + retrieveCond *sync.Cond + logger log.Logger } @@ -72,12 +83,20 @@ func NewManager( if err != nil { return nil, err } + if s.DAHeight < conf.DAStartHeight { + s.DAHeight = conf.DAStartHeight + } proposerAddress, err := getAddress(proposerKey) if err != nil { return nil, err } + if conf.DABlockTime == 0 { + logger.Info("WARNING: using default DA block time", "DABlockTime", defaultDABlockTime) + conf.DABlockTime = defaultDABlockTime + } + exec := state.NewBlockExecutor(proposerAddress, conf.NamespaceID, genesis.ChainID, mempool, proxyApp, eventBus, logger) if s.LastBlockHeight+1 == genesis.InitialHeight { res, err := exec.InitChain(genesis) @@ -100,13 +119,16 @@ func NewManager( executor: exec, dalc: dalc, retriever: dalc.(da.BlockRetriever), // TODO(tzdybal): do it in more gentle way (after MVP) - HeaderOutCh: make(chan *types.Header), - HeaderInCh: make(chan *types.Header), - blockInCh: make(chan *types.Block), - retrieveCh: make(chan uint64), + daHeight: s.DAHeight, + // channels are buffered to avoid blocking on input/output operations, buffer sizes are arbitrary + HeaderOutCh: make(chan *types.Header, 100), + HeaderInCh: make(chan *types.Header, 100), + blockInCh: make(chan *types.Block, 100), + retrieveMtx: new(sync.Mutex), syncCache: make(map[uint64]*types.Block), logger: logger, } + agg.retrieveCond = sync.NewCond(agg.retrieveMtx) return agg, nil } @@ -142,8 +164,11 @@ func (m *Manager) AggregationLoop(ctx context.Context) { } func (m *Manager) SyncLoop(ctx context.Context) { + daTicker := time.NewTicker(m.conf.DABlockTime) for { select { + case <-daTicker.C: + m.retrieveCond.Signal() case header := <-m.HeaderInCh: m.logger.Debug("block header received", "height", header.Height, "hash", header.Hash()) newHeight := header.Height @@ -153,7 +178,7 @@ func (m *Manager) SyncLoop(ctx context.Context) { // it's handled gently in RetrieveLoop if newHeight > currentHeight { atomic.StoreUint64(&m.syncTarget, newHeight) - m.retrieveCh <- newHeight + m.retrieveCond.Signal() } case block := <-m.blockInCh: m.logger.Debug("block body retrieved from DALC", @@ -161,6 +186,7 @@ func (m *Manager) SyncLoop(ctx context.Context) { "hash", block.Hash(), ) m.syncCache[block.Header.Height] = block + m.retrieveCond.Signal() currentHeight := m.store.Height() // TODO(tzdybal): maybe store a copy in memory b1, ok1 := m.syncCache[currentHeight+1] b2, ok2 := m.syncCache[currentHeight+2] @@ -181,6 +207,7 @@ func (m *Manager) SyncLoop(ctx context.Context) { continue } + newState.DAHeight = atomic.LoadUint64(&m.daHeight) m.lastState = newState err = m.store.UpdateState(m.lastState) if err != nil { @@ -195,14 +222,36 @@ func (m *Manager) SyncLoop(ctx context.Context) { } } +// RetrieveLoop is responsible for interacting with DA layer. func (m *Manager) RetrieveLoop(ctx context.Context) { + // waitCh is used to signal the retrieve loop, that it should process next blocks + // retrieveCond can be signalled in completely async manner, and goroutine below + // works as some kind of "buffer" for those signals + waitCh := make(chan interface{}) + go func() { + for { + m.retrieveMtx.Lock() + m.retrieveCond.Wait() + waitCh <- nil + m.retrieveMtx.Unlock() + if ctx.Err() != nil { + return + } + } + }() + for { select { - case <-m.retrieveCh: - target := atomic.LoadUint64(&m.syncTarget) - for h := m.store.Height() + 1; h <= target; h++ { - m.logger.Debug("trying to retrieve block from DALC", "height", h) - m.mustRetrieveBlock(ctx, h) + case <-waitCh: + for { + daHeight := atomic.LoadUint64(&m.daHeight) + m.logger.Debug("retrieve", "daHeight", daHeight) + err := m.processNextDABlock() + if err != nil { + m.logger.Error("failed to retrieve block from DALC", "daHeight", daHeight, "errors", err.Error()) + break + } + atomic.AddUint64(&m.daHeight, 1) } case <-ctx.Done(): return @@ -210,35 +259,38 @@ func (m *Manager) RetrieveLoop(ctx context.Context) { } } -func (m *Manager) mustRetrieveBlock(ctx context.Context, height uint64) { +func (m *Manager) processNextDABlock() error { // TODO(tzdybal): extract configuration option maxRetries := 10 + daHeight := atomic.LoadUint64(&m.daHeight) + var err error + m.logger.Debug("trying to retrieve block from DA", "daHeight", daHeight) for r := 0; r < maxRetries; r++ { - err := m.fetchBlock(ctx, height) - if err == nil { - return + blockResp, fetchErr := m.fetchBlock(daHeight) + if fetchErr != nil { + err = multierr.Append(err, fetchErr) + time.Sleep(100 * time.Millisecond) + } else { + for _, block := range blockResp.Blocks { + m.blockInCh <- block + } + return nil } - // TODO(tzdybal): configuration option - // TODO(tzdybal): exponential backoff - time.Sleep(100 * time.Millisecond) } - // TODO(tzdybal): this is only temporary solution, for MVP - panic("failed to retrieve block with DALC") + return err } -func (m *Manager) fetchBlock(ctx context.Context, height uint64) error { +func (m *Manager) fetchBlock(daHeight uint64) (da.ResultRetrieveBlocks, error) { var err error - blockRes := m.retriever.RetrieveBlock(height) + blockRes := m.retriever.RetrieveBlocks(daHeight) switch blockRes.Code { - case da.StatusSuccess: - m.blockInCh <- blockRes.Block case da.StatusError: err = fmt.Errorf("failed to retrieve block: %s", blockRes.Message) case da.StatusTimeout: err = fmt.Errorf("timeout during retrieve block: %s", blockRes.Message) } - return err + return blockRes, err } func (m *Manager) getRemainingSleep(start time.Time) time.Duration { @@ -305,6 +357,7 @@ func (m *Manager) publishBlock(ctx context.Context) error { return err } + newState.DAHeight = atomic.LoadUint64(&m.daHeight) m.lastState = newState err = m.store.UpdateState(m.lastState) if err != nil { @@ -320,6 +373,7 @@ func (m *Manager) publishBlock(ctx context.Context) error { } func (m *Manager) broadcastBlock(ctx context.Context, block *types.Block) error { + m.logger.Debug("submitting block to DA layer", "height", block.Header.Height) res := m.dalc.SubmitBlock(block) if res.Code != da.StatusSuccess { return fmt.Errorf("DA layer submission failed: %s", res.Message) diff --git a/config/config.go b/config/config.go index da4fc6f09de..fd6abfb6569 100644 --- a/config/config.go +++ b/config/config.go @@ -32,8 +32,13 @@ type NodeConfig struct { // BlockManagerConfig consists of all parameters required by BlockManagerConfig type BlockManagerConfig struct { - BlockTime time.Duration `mapstructure:"block_time"` - NamespaceID [8]byte `mapstructure:"namespace_id"` + // BlockTime defines how often new blocks are produced + BlockTime time.Duration `mapstructure:"block_time"` + // DABlockTime informs about block time of underlying data availability layer + DABlockTime time.Duration `mapstructure:"da_block_time"` + // DAStartHeight allows skipping first DAStartHeight-1 blocks when querying for blocks. + DAStartHeight uint64 `mapstructure:"da_start_height"` + NamespaceID [8]byte `mapstructure:"namespace_id"` } func (nc *NodeConfig) GetViperConfig(v *viper.Viper) error { diff --git a/da/da.go b/da/da.go index 769f343af66..ed32d94fb1c 100644 --- a/da/da.go +++ b/da/da.go @@ -25,6 +25,8 @@ type DAResult struct { Code StatusCode // Message may contain DA layer specific information (like DA block height/hash, detailed error message, etc) Message string + // DAHeight informs about a height on Data Availability Layer for given result. + DAHeight uint64 } // ResultSubmitBlock contains information returned from DA layer after block submission. @@ -43,11 +45,11 @@ type ResultCheckBlock struct { DataAvailable bool } -type ResultRetrieveBlock struct { +type ResultRetrieveBlocks struct { DAResult // Block is the full block retrieved from Data Availability Layer. // If Code is not equal to StatusSuccess, it has to be nil. - Block *types.Block + Blocks []*types.Block } // DataAvailabilityLayerClient defines generic interface for DA layer block submission. @@ -65,12 +67,12 @@ type DataAvailabilityLayerClient interface { SubmitBlock(block *types.Block) ResultSubmitBlock // CheckBlockAvailability queries DA layer to check data availability of block corresponding to given header. - CheckBlockAvailability(header *types.Header) ResultCheckBlock + CheckBlockAvailability(dataLayerHeight uint64) ResultCheckBlock } // BlockRetriever is additional interface that can be implemented by Data Availability Layer Client that is able to retrieve // block data from DA layer. This gives the ability to use it for block synchronization. type BlockRetriever interface { - // RetrieveBlock returns block at given height from data availability layer. - RetrieveBlock(height uint64) ResultRetrieveBlock + // RetrieveBlocks returns blocks at given data layer height from data availability layer. + RetrieveBlocks(dataLayerHeight uint64) ResultRetrieveBlocks } diff --git a/da/grpc/grpc.go b/da/grpc/grpc.go index 21e0ff6ac34..f2706379472 100644 --- a/da/grpc/grpc.go +++ b/da/grpc/grpc.go @@ -75,12 +75,16 @@ func (d *DataAvailabilityLayerClient) SubmitBlock(block *types.Block) da.ResultS } } return da.ResultSubmitBlock{ - DAResult: da.DAResult{Code: da.StatusCode(resp.Result.Code), Message: resp.Result.Message}, + DAResult: da.DAResult{ + Code: da.StatusCode(resp.Result.Code), + Message: resp.Result.Message, + DAHeight: resp.Result.DataLayerHeight, + }, } } -func (d *DataAvailabilityLayerClient) CheckBlockAvailability(header *types.Header) da.ResultCheckBlock { - resp, err := d.client.CheckBlockAvailability(context.TODO(), &dalc.CheckBlockAvailabilityRequest{Header: header.ToProto()}) +func (d *DataAvailabilityLayerClient) CheckBlockAvailability(dataLayerHeight uint64) da.ResultCheckBlock { + resp, err := d.client.CheckBlockAvailability(context.TODO(), &dalc.CheckBlockAvailabilityRequest{DataLayerHeight: dataLayerHeight}) if err != nil { return da.ResultCheckBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} } @@ -90,19 +94,27 @@ func (d *DataAvailabilityLayerClient) CheckBlockAvailability(header *types.Heade } } -func (d *DataAvailabilityLayerClient) RetrieveBlock(height uint64) da.ResultRetrieveBlock { - resp, err := d.client.RetrieveBlock(context.TODO(), &dalc.RetrieveBlockRequest{Height: height}) +func (d *DataAvailabilityLayerClient) RetrieveBlocks(dataLayerHeight uint64) da.ResultRetrieveBlocks { + resp, err := d.client.RetrieveBlocks(context.TODO(), &dalc.RetrieveBlocksRequest{DataLayerHeight: dataLayerHeight}) if err != nil { - return da.ResultRetrieveBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} + return da.ResultRetrieveBlocks{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} } - var b types.Block - err = b.FromProto(resp.Block) - if err != nil { - return da.ResultRetrieveBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} + blocks := make([]*types.Block, len(resp.Blocks)) + for i, block := range resp.Blocks { + var b types.Block + err = b.FromProto(block) + if err != nil { + return da.ResultRetrieveBlocks{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} + } + blocks[i] = &b } - return da.ResultRetrieveBlock{ - DAResult: da.DAResult{Code: da.StatusCode(resp.Result.Code), Message: resp.Result.Message}, - Block: &b, + return da.ResultRetrieveBlocks{ + DAResult: da.DAResult{ + Code: da.StatusCode(resp.Result.Code), + Message: resp.Result.Message, + DAHeight: dataLayerHeight, + }, + Blocks: blocks, } } diff --git a/da/grpc/mockserv/cmd/main.go b/da/grpc/mockserv/cmd/main.go index cfc30453df7..b69189f15dc 100644 --- a/da/grpc/mockserv/cmd/main.go +++ b/da/grpc/mockserv/cmd/main.go @@ -24,7 +24,7 @@ func main() { log.Panic(err) } log.Println("Listening on:", lis.Addr()) - srv := mockserv.GetServer(kv, conf) + srv := mockserv.GetServer(kv, conf, nil) if err := srv.Serve(lis); err != nil { log.Println("error while serving:", err) } diff --git a/da/grpc/mockserv/mockserv.go b/da/grpc/mockserv/mockserv.go index aae7e5e4e56..b0fc5d5d73a 100644 --- a/da/grpc/mockserv/mockserv.go +++ b/da/grpc/mockserv/mockserv.go @@ -4,25 +4,32 @@ import ( "context" "os" + tmlog "github.com/tendermint/tendermint/libs/log" + "google.golang.org/grpc" + grpcda "github.com/celestiaorg/optimint/da/grpc" "github.com/celestiaorg/optimint/da/mock" "github.com/celestiaorg/optimint/store" "github.com/celestiaorg/optimint/types" "github.com/celestiaorg/optimint/types/pb/dalc" - tmlog "github.com/tendermint/tendermint/libs/log" - "google.golang.org/grpc" + "github.com/celestiaorg/optimint/types/pb/optimint" ) -func GetServer(kv store.KVStore, conf grpcda.Config) *grpc.Server { +func GetServer(kv store.KVStore, conf grpcda.Config, mockConfig []byte) *grpc.Server { logger := tmlog.NewTMLogger(os.Stdout) srv := grpc.NewServer() mockImpl := &mockImpl{} - err := mockImpl.mock.Init(nil, kv, logger) + err := mockImpl.mock.Init(mockConfig, kv, logger) if err != nil { logger.Error("failed to initialize mock DALC", "error", err) panic(err) } + err = mockImpl.mock.Start() + if err != nil { + logger.Error("failed to start mock DALC", "error", err) + panic(err) + } dalc.RegisterDALCServiceServer(srv, mockImpl) return srv } @@ -40,19 +47,15 @@ func (m *mockImpl) SubmitBlock(_ context.Context, request *dalc.SubmitBlockReque resp := m.mock.SubmitBlock(&b) return &dalc.SubmitBlockResponse{ Result: &dalc.DAResponse{ - Code: dalc.StatusCode(resp.Code), - Message: resp.Message, + Code: dalc.StatusCode(resp.Code), + Message: resp.Message, + DataLayerHeight: resp.DAHeight, }, }, nil } func (m *mockImpl) CheckBlockAvailability(_ context.Context, request *dalc.CheckBlockAvailabilityRequest) (*dalc.CheckBlockAvailabilityResponse, error) { - var h types.Header - err := h.FromProto(request.Header) - if err != nil { - return nil, err - } - resp := m.mock.CheckBlockAvailability(&h) + resp := m.mock.CheckBlockAvailability(request.DataLayerHeight) return &dalc.CheckBlockAvailabilityResponse{ Result: &dalc.DAResponse{ Code: dalc.StatusCode(resp.Code), @@ -62,13 +65,17 @@ func (m *mockImpl) CheckBlockAvailability(_ context.Context, request *dalc.Check }, nil } -func (m *mockImpl) RetrieveBlock(context context.Context, request *dalc.RetrieveBlockRequest) (*dalc.RetrieveBlockResponse, error) { - resp := m.mock.RetrieveBlock(request.Height) - return &dalc.RetrieveBlockResponse{ +func (m *mockImpl) RetrieveBlocks(context context.Context, request *dalc.RetrieveBlocksRequest) (*dalc.RetrieveBlocksResponse, error) { + resp := m.mock.RetrieveBlocks(request.DataLayerHeight) + blocks := make([]*optimint.Block, len(resp.Blocks)) + for i := range resp.Blocks { + blocks[i] = resp.Blocks[i].ToProto() + } + return &dalc.RetrieveBlocksResponse{ Result: &dalc.DAResponse{ Code: dalc.StatusCode(resp.Code), Message: resp.Message, }, - Block: resp.Block.ToProto(), + Blocks: blocks, }, nil } diff --git a/da/mock/mock.go b/da/mock/mock.go index b701acae1c8..1ced5dacbc9 100644 --- a/da/mock/mock.go +++ b/da/mock/mock.go @@ -2,7 +2,9 @@ package mock import ( "encoding/binary" - "errors" + "math/rand" + "sync/atomic" + "time" "github.com/celestiaorg/optimint/da" "github.com/celestiaorg/optimint/log" @@ -13,8 +15,16 @@ import ( // MockDataAvailabilityLayerClient is intended only for usage in tests. // It does actually ensures DA - it stores data in-memory. type MockDataAvailabilityLayerClient struct { - logger log.Logger - dalcKV store.KVStore + logger log.Logger + dalcKV store.KVStore + daHeight uint64 + config Config +} + +const DefaultBlockTime = 3 * time.Second + +type Config struct { + BlockTime time.Duration } var _ da.DataAvailabilityLayerClient = &MockDataAvailabilityLayerClient{} @@ -24,12 +34,28 @@ var _ da.BlockRetriever = &MockDataAvailabilityLayerClient{} func (m *MockDataAvailabilityLayerClient) Init(config []byte, dalcKV store.KVStore, logger log.Logger) error { m.logger = logger m.dalcKV = dalcKV + m.daHeight = 1 + if len(config) > 0 { + var err error + m.config.BlockTime, err = time.ParseDuration(string(config)) + if err != nil { + return err + } + } else { + m.config.BlockTime = DefaultBlockTime + } return nil } // Start implements DataAvailabilityLayerClient interface. func (m *MockDataAvailabilityLayerClient) Start() error { m.logger.Debug("Mock Data Availability Layer Client starting") + go func() { + for { + time.Sleep(m.config.BlockTime) + m.updateDAHeight() + } + }() return nil } @@ -43,7 +69,8 @@ func (m *MockDataAvailabilityLayerClient) Stop() error { // This should create a transaction which (potentially) // triggers a state transition in the DA layer. func (m *MockDataAvailabilityLayerClient) SubmitBlock(block *types.Block) da.ResultSubmitBlock { - m.logger.Debug("Submitting block to DA layer!", "height", block.Header.Height) + daHeight := atomic.LoadUint64(&m.daHeight) + m.logger.Debug("Submitting block to DA layer!", "height", block.Header.Height, "dataLayerHeight", daHeight) hash := block.Header.Hash() blob, err := block.MarshalBinary() @@ -51,7 +78,7 @@ func (m *MockDataAvailabilityLayerClient) SubmitBlock(block *types.Block) da.Res return da.ResultSubmitBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} } - err = m.dalcKV.Set(getKey(block.Header.Height), hash[:]) + err = m.dalcKV.Set(getKey(daHeight, block.Header.Height), hash[:]) if err != nil { return da.ResultSubmitBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} } @@ -62,47 +89,64 @@ func (m *MockDataAvailabilityLayerClient) SubmitBlock(block *types.Block) da.Res return da.ResultSubmitBlock{ DAResult: da.DAResult{ - Code: da.StatusSuccess, - Message: "OK", + Code: da.StatusSuccess, + Message: "OK", + DAHeight: daHeight, }, } } // CheckBlockAvailability queries DA layer to check data availability of block corresponding to given header. -func (m *MockDataAvailabilityLayerClient) CheckBlockAvailability(header *types.Header) da.ResultCheckBlock { - hash := header.Hash() - _, err := m.dalcKV.Get(hash[:]) - if errors.Is(err, store.ErrKeyNotFound) { - return da.ResultCheckBlock{DAResult: da.DAResult{Code: da.StatusSuccess}, DataAvailable: false} - } - if err != nil { - return da.ResultCheckBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}, DataAvailable: false} - } - return da.ResultCheckBlock{DAResult: da.DAResult{Code: da.StatusSuccess}, DataAvailable: true} +func (m *MockDataAvailabilityLayerClient) CheckBlockAvailability(dataLayerHeight uint64) da.ResultCheckBlock { + blocksRes := m.RetrieveBlocks(dataLayerHeight) + return da.ResultCheckBlock{DAResult: da.DAResult{Code: blocksRes.Code}, DataAvailable: len(blocksRes.Blocks) > 0} } -// RetrieveBlock returns block at given height from data availability layer. -func (m *MockDataAvailabilityLayerClient) RetrieveBlock(height uint64) da.ResultRetrieveBlock { - hash, err := m.dalcKV.Get(getKey(height)) - if err != nil { - return da.ResultRetrieveBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} - } - blob, err := m.dalcKV.Get(hash) - if err != nil { - return da.ResultRetrieveBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} +// RetrieveBlocks returns block at given height from data availability layer. +func (m *MockDataAvailabilityLayerClient) RetrieveBlocks(dataLayerHeight uint64) da.ResultRetrieveBlocks { + if dataLayerHeight >= atomic.LoadUint64(&m.daHeight) { + return da.ResultRetrieveBlocks{DAResult: da.DAResult{Code: da.StatusError, Message: "block not found"}} } - block := &types.Block{} - err = block.UnmarshalBinary(blob) - if err != nil { - return da.ResultRetrieveBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} + iter := m.dalcKV.PrefixIterator(getPrefix(dataLayerHeight)) + defer iter.Discard() + + var blocks []*types.Block + for iter.Valid() { + hash := iter.Value() + + blob, err := m.dalcKV.Get(hash) + if err != nil { + return da.ResultRetrieveBlocks{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} + } + + block := &types.Block{} + err = block.UnmarshalBinary(blob) + if err != nil { + return da.ResultRetrieveBlocks{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}} + } + blocks = append(blocks, block) + + iter.Next() } - return da.ResultRetrieveBlock{DAResult: da.DAResult{Code: da.StatusSuccess}, Block: block} + return da.ResultRetrieveBlocks{DAResult: da.DAResult{Code: da.StatusSuccess}, Blocks: blocks} } -func getKey(height uint64) []byte { +func getPrefix(daHeight uint64) []byte { b := make([]byte, 8) - binary.BigEndian.PutUint64(b, height) + binary.BigEndian.PutUint64(b, daHeight) return b } + +func getKey(daHeight uint64, height uint64) []byte { + b := make([]byte, 16) + binary.BigEndian.PutUint64(b, daHeight) + binary.BigEndian.PutUint64(b[8:], height) + return b +} + +func (m *MockDataAvailabilityLayerClient) updateDAHeight() { + blockStep := rand.Uint64()%10 + 1 + atomic.AddUint64(&m.daHeight, blockStep) +} diff --git a/da/test/da_test.go b/da/test/da_test.go index 70a92a80070..460ab41e40b 100644 --- a/da/test/da_test.go +++ b/da/test/da_test.go @@ -5,21 +5,24 @@ import ( "net" "strconv" "testing" - - grpcda "github.com/celestiaorg/optimint/da/grpc" - "github.com/celestiaorg/optimint/da/grpc/mockserv" - "github.com/celestiaorg/optimint/store" - "google.golang.org/grpc" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "google.golang.org/grpc" "github.com/celestiaorg/optimint/da" + grpcda "github.com/celestiaorg/optimint/da/grpc" + "github.com/celestiaorg/optimint/da/grpc/mockserv" + "github.com/celestiaorg/optimint/da/mock" "github.com/celestiaorg/optimint/da/registry" "github.com/celestiaorg/optimint/log/test" + "github.com/celestiaorg/optimint/store" "github.com/celestiaorg/optimint/types" ) +const mockDaBlockTime = 100 * time.Millisecond + func TestLifecycle(t *testing.T) { srv := startMockServ(t) defer srv.GracefulStop() @@ -33,7 +36,7 @@ func TestLifecycle(t *testing.T) { func doTestLifecycle(t *testing.T, dalc da.DataAvailabilityLayerClient) { require := require.New(t) - err := dalc.Init([]byte{}, nil, &test.TestLogger{T: t}) + err := dalc.Init([]byte{}, nil, test.NewTestLogger(t)) require.NoError(err) err = dalc.Start() @@ -57,33 +60,45 @@ func doTestDALC(t *testing.T, dalc da.DataAvailabilityLayerClient) { require := require.New(t) assert := assert.New(t) - err := dalc.Init([]byte{}, store.NewDefaultInMemoryKVStore(), &test.TestLogger{T: t}) + // mock DALC will advance block height every 100ms + conf := []byte{} + if _, ok := dalc.(*mock.MockDataAvailabilityLayerClient); ok { + conf = []byte(mockDaBlockTime.String()) + } + err := dalc.Init(conf, store.NewDefaultInMemoryKVStore(), test.NewTestLogger(t)) require.NoError(err) err = dalc.Start() require.NoError(err) + // wait a bit more than mockDaBlockTime, so mock can "produce" some blocks + time.Sleep(mockDaBlockTime + 20*time.Millisecond) + // only blocks b1 and b2 will be submitted to DA b1 := getRandomBlock(1, 10) b2 := getRandomBlock(2, 10) - b3 := getRandomBlock(1, 10) resp := dalc.SubmitBlock(b1) + h1 := resp.DAHeight assert.Equal(da.StatusSuccess, resp.Code) resp = dalc.SubmitBlock(b2) + h2 := resp.DAHeight assert.Equal(da.StatusSuccess, resp.Code) - check := dalc.CheckBlockAvailability(&b1.Header) + // wait a bit more than mockDaBlockTime, so optimint blocks can be "included" in mock block + time.Sleep(mockDaBlockTime + 20*time.Millisecond) + + check := dalc.CheckBlockAvailability(h1) assert.Equal(da.StatusSuccess, check.Code) assert.True(check.DataAvailable) - check = dalc.CheckBlockAvailability(&b2.Header) + check = dalc.CheckBlockAvailability(h2) assert.Equal(da.StatusSuccess, check.Code) assert.True(check.DataAvailable) - // this block was never submitted to DA - check = dalc.CheckBlockAvailability(&b3.Header) + // this height should not be used by DALC + check = dalc.CheckBlockAvailability(h1 - 1) assert.Equal(da.StatusSuccess, check.Code) assert.False(check.DataAvailable) } @@ -104,7 +119,7 @@ func TestRetrieve(t *testing.T) { func startMockServ(t *testing.T) *grpc.Server { conf := grpcda.DefaultConfig - srv := mockserv.GetServer(store.NewDefaultInMemoryKVStore(), conf) + srv := mockserv.GetServer(store.NewDefaultInMemoryKVStore(), conf, []byte(mockDaBlockTime.String())) lis, err := net.Listen("tcp", conf.Host+":"+strconv.Itoa(conf.Port)) if err != nil { t.Fatal(err) @@ -119,22 +134,49 @@ func doTestRetrieve(t *testing.T, dalc da.DataAvailabilityLayerClient) { require := require.New(t) assert := assert.New(t) - err := dalc.Init([]byte{}, store.NewDefaultInMemoryKVStore(), &test.TestLogger{T: t}) + // mock DALC will advance block height every 100ms + conf := []byte{} + if _, ok := dalc.(*mock.MockDataAvailabilityLayerClient); ok { + conf = []byte(mockDaBlockTime.String()) + } + err := dalc.Init(conf, store.NewDefaultInMemoryKVStore(), test.NewTestLogger(t)) require.NoError(err) err = dalc.Start() require.NoError(err) + // wait a bit more than mockDaBlockTime, so mock can "produce" some blocks + time.Sleep(mockDaBlockTime + 20*time.Millisecond) + retriever := dalc.(da.BlockRetriever) + countAtHeight := make(map[uint64]int) + blocks := make(map[*types.Block]uint64) for i := uint64(0); i < 100; i++ { b := getRandomBlock(i, rand.Int()%20) resp := dalc.SubmitBlock(b) assert.Equal(da.StatusSuccess, resp.Code) + time.Sleep(time.Duration(rand.Int63() % mockDaBlockTime.Milliseconds())) + + countAtHeight[resp.DAHeight]++ + blocks[b] = resp.DAHeight + } + + // wait a bit more than mockDaBlockTime, so mock can "produce" last blocks + time.Sleep(mockDaBlockTime + 20*time.Millisecond) + + for h, cnt := range countAtHeight { + ret := retriever.RetrieveBlocks(h) + assert.Equal(da.StatusSuccess, ret.Code) + require.NotEmpty(ret.Blocks) + assert.Len(ret.Blocks, cnt) + } - ret := retriever.RetrieveBlock(i) + for b, h := range blocks { + ret := retriever.RetrieveBlocks(h) assert.Equal(da.StatusSuccess, ret.Code) - assert.Equal(b, ret.Block) + require.NotEmpty(ret.Blocks) + assert.Contains(ret.Blocks, b) } } diff --git a/log/test/loggers.go b/log/test/loggers.go index 462fbd4a7d4..4eb305c90e3 100644 --- a/log/test/loggers.go +++ b/log/test/loggers.go @@ -8,10 +8,17 @@ import ( // TODO(tzdybal): move to some common place type TestLogger struct { - mtx sync.Mutex + mtx *sync.Mutex T *testing.T } +func NewTestLogger(t *testing.T) *TestLogger { + return &TestLogger{ + mtx: new(sync.Mutex), + T: t, + } +} + func (t *TestLogger) Debug(msg string, keyvals ...interface{}) { t.T.Helper() t.mtx.Lock() diff --git a/node/integration_test.go b/node/integration_test.go index 958dde9c13c..568f548dd43 100644 --- a/node/integration_test.go +++ b/node/integration_test.go @@ -103,7 +103,7 @@ func TestTxGossipingAndAggregation(t *testing.T) { require.NoError(nodes[i].P2P.GossipTx(context.TODO(), []byte(data))) } - timeout := time.NewTimer(time.Second * 5) + timeout := time.NewTimer(time.Second * 30) doneChan := make(chan struct{}) go func() { defer close(doneChan) diff --git a/p2p/client_test.go b/p2p/client_test.go index 437c30d96a1..49f9ee9a99f 100644 --- a/p2p/client_test.go +++ b/p2p/client_test.go @@ -20,7 +20,7 @@ import ( func TestClientStartup(t *testing.T) { privKey, _, _ := crypto.GenerateEd25519Key(rand.Reader) - client, err := NewClient(config.P2PConfig{}, privKey, "TestChain", &test.TestLogger{T: t}) + client, err := NewClient(config.P2PConfig{}, privKey, "TestChain", test.NewTestLogger(t)) assert := assert.New(t) assert.NoError(err) assert.NotNil(client) @@ -35,7 +35,7 @@ func TestBootstrapping(t *testing.T) { //log.SetDebugLogging() assert := assert.New(t) - logger := &test.TestLogger{T: t} + logger := test.NewTestLogger(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -55,7 +55,7 @@ func TestBootstrapping(t *testing.T) { func TestDiscovery(t *testing.T) { assert := assert.New(t) - logger := &test.TestLogger{T: t} + logger := test.NewTestLogger(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -75,7 +75,7 @@ func TestDiscovery(t *testing.T) { func TestGossiping(t *testing.T) { assert := assert.New(t) - logger := &test.TestLogger{T: t} + logger := test.NewTestLogger(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/proto/dalc/dalc.proto b/proto/dalc/dalc.proto index 56d5477d07c..cbe3f6e89fb 100644 --- a/proto/dalc/dalc.proto +++ b/proto/dalc/dalc.proto @@ -14,6 +14,7 @@ enum StatusCode { message DAResponse { StatusCode code = 1; string message = 2; + uint64 data_layer_height = 3; } message SubmitBlockRequest { @@ -25,7 +26,7 @@ message SubmitBlockResponse { } message CheckBlockAvailabilityRequest { - optimint.Header header = 1; + uint64 data_layer_height = 1; } message CheckBlockAvailabilityResponse { @@ -33,17 +34,17 @@ message CheckBlockAvailabilityResponse { bool data_available = 2; } -message RetrieveBlockRequest { - uint64 height = 1; +message RetrieveBlocksRequest { + uint64 data_layer_height = 1; } -message RetrieveBlockResponse { +message RetrieveBlocksResponse { DAResponse result = 1; - optimint.Block block = 2; + repeated optimint.Block blocks = 2; } service DALCService { rpc SubmitBlock(SubmitBlockRequest) returns (SubmitBlockResponse) {} rpc CheckBlockAvailability(CheckBlockAvailabilityRequest) returns (CheckBlockAvailabilityResponse) {} - rpc RetrieveBlock(RetrieveBlockRequest) returns (RetrieveBlockResponse) {} + rpc RetrieveBlocks(RetrieveBlocksRequest) returns (RetrieveBlocksResponse) {} } diff --git a/state/state.go b/state/state.go index c1c98b75712..a04ce28fca6 100644 --- a/state/state.go +++ b/state/state.go @@ -37,6 +37,8 @@ type State struct { LastBlockID types.BlockID LastBlockTime time.Time + DAHeight uint64 + // In the MVP implementation, there will be only one Validator NextValidators *types.ValidatorSet Validators *types.ValidatorSet @@ -80,6 +82,8 @@ func NewFromGenesisDoc(genDoc *types.GenesisDoc) (State, error) { ChainID: genDoc.ChainID, InitialHeight: genDoc.InitialHeight, + DAHeight: 1, + LastBlockHeight: 0, LastBlockID: types.BlockID{}, LastBlockTime: genDoc.GenesisTime, diff --git a/store/store.go b/store/store.go index a8ac1968ca0..6803a882f24 100644 --- a/store/store.go +++ b/store/store.go @@ -5,7 +5,7 @@ import ( "encoding/json" "errors" "fmt" - "sync" + "sync/atomic" tmstate "github.com/tendermint/tendermint/proto/tendermint/state" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" @@ -30,9 +30,6 @@ type DefaultStore struct { db KVStore height uint64 - - // mtx ensures that db is in sync with height - mtx sync.RWMutex } var _ Store = &DefaultStore{} @@ -46,9 +43,7 @@ func New(kv KVStore) Store { // Height returns height of the highest block saved in the Store. func (s *DefaultStore) Height() uint64 { - s.mtx.RLock() - defer s.mtx.RUnlock() - return s.height + return atomic.LoadUint64(&s.height) } // SaveBlock adds block to the store along with corresponding commit. @@ -65,9 +60,6 @@ func (s *DefaultStore) SaveBlock(block *types.Block, commit *types.Commit) error return err } - s.mtx.Lock() - defer s.mtx.Unlock() - bb := s.db.NewBatch() err = multierr.Append(err, bb.Set(getBlockKey(hash), blockBlob)) err = multierr.Append(err, bb.Set(getCommitKey(hash), commitBlob)) @@ -82,8 +74,8 @@ func (s *DefaultStore) SaveBlock(block *types.Block, commit *types.Commit) error return err } - if block.Header.Height > s.height { - s.height = block.Header.Height + if block.Header.Height > atomic.LoadUint64(&s.height) { + atomic.StoreUint64(&s.height, block.Header.Height) } return nil @@ -176,9 +168,7 @@ func (s *DefaultStore) LoadState() (state.State, error) { } err = json.Unmarshal(blob, &state) - s.mtx.Lock() - s.height = uint64(state.LastBlockHeight) - s.mtx.Unlock() + atomic.StoreUint64(&s.height, uint64(state.LastBlockHeight)) return state, err } diff --git a/types/pb/dalc/dalc.pb.go b/types/pb/dalc/dalc.pb.go index 809eab681f5..ffcad377cb6 100644 --- a/types/pb/dalc/dalc.pb.go +++ b/types/pb/dalc/dalc.pb.go @@ -13,22 +13,26 @@ SubmitBlockResponse CheckBlockAvailabilityRequest CheckBlockAvailabilityResponse - RetrieveBlockRequest - RetrieveBlockResponse + RetrieveBlocksRequest + RetrieveBlocksResponse */ package dalc -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import optimint "github.com/celestiaorg/optimint/types/pb/optimint" - import ( + fmt "fmt" + + proto "github.com/golang/protobuf/proto" + + math "math" + + optimint "github.com/celestiaorg/optimint/types/pb/optimint" + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" -) -import io "io" + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -69,8 +73,9 @@ func (x StatusCode) String() string { func (StatusCode) EnumDescriptor() ([]byte, []int) { return fileDescriptorDalc, []int{0} } type DAResponse struct { - Code StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=dalc.StatusCode" json:"code,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + Code StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=dalc.StatusCode" json:"code,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + DataLayerHeight uint64 `protobuf:"varint,3,opt,name=data_layer_height,json=dataLayerHeight,proto3" json:"data_layer_height,omitempty"` } func (m *DAResponse) Reset() { *m = DAResponse{} } @@ -92,6 +97,13 @@ func (m *DAResponse) GetMessage() string { return "" } +func (m *DAResponse) GetDataLayerHeight() uint64 { + if m != nil { + return m.DataLayerHeight + } + return 0 +} + type SubmitBlockRequest struct { Block *optimint.Block `protobuf:"bytes,1,opt,name=block" json:"block,omitempty"` } @@ -125,7 +137,7 @@ func (m *SubmitBlockResponse) GetResult() *DAResponse { } type CheckBlockAvailabilityRequest struct { - Header *optimint.Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + DataLayerHeight uint64 `protobuf:"varint,1,opt,name=data_layer_height,json=dataLayerHeight,proto3" json:"data_layer_height,omitempty"` } func (m *CheckBlockAvailabilityRequest) Reset() { *m = CheckBlockAvailabilityRequest{} } @@ -135,11 +147,11 @@ func (*CheckBlockAvailabilityRequest) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{3} } -func (m *CheckBlockAvailabilityRequest) GetHeader() *optimint.Header { +func (m *CheckBlockAvailabilityRequest) GetDataLayerHeight() uint64 { if m != nil { - return m.Header + return m.DataLayerHeight } - return nil + return 0 } type CheckBlockAvailabilityResponse struct { @@ -168,42 +180,42 @@ func (m *CheckBlockAvailabilityResponse) GetDataAvailable() bool { return false } -type RetrieveBlockRequest struct { - Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +type RetrieveBlocksRequest struct { + DataLayerHeight uint64 `protobuf:"varint,1,opt,name=data_layer_height,json=dataLayerHeight,proto3" json:"data_layer_height,omitempty"` } -func (m *RetrieveBlockRequest) Reset() { *m = RetrieveBlockRequest{} } -func (m *RetrieveBlockRequest) String() string { return proto.CompactTextString(m) } -func (*RetrieveBlockRequest) ProtoMessage() {} -func (*RetrieveBlockRequest) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{5} } +func (m *RetrieveBlocksRequest) Reset() { *m = RetrieveBlocksRequest{} } +func (m *RetrieveBlocksRequest) String() string { return proto.CompactTextString(m) } +func (*RetrieveBlocksRequest) ProtoMessage() {} +func (*RetrieveBlocksRequest) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{5} } -func (m *RetrieveBlockRequest) GetHeight() uint64 { +func (m *RetrieveBlocksRequest) GetDataLayerHeight() uint64 { if m != nil { - return m.Height + return m.DataLayerHeight } return 0 } -type RetrieveBlockResponse struct { - Result *DAResponse `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"` - Block *optimint.Block `protobuf:"bytes,2,opt,name=block" json:"block,omitempty"` +type RetrieveBlocksResponse struct { + Result *DAResponse `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"` + Blocks []*optimint.Block `protobuf:"bytes,2,rep,name=blocks" json:"blocks,omitempty"` } -func (m *RetrieveBlockResponse) Reset() { *m = RetrieveBlockResponse{} } -func (m *RetrieveBlockResponse) String() string { return proto.CompactTextString(m) } -func (*RetrieveBlockResponse) ProtoMessage() {} -func (*RetrieveBlockResponse) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{6} } +func (m *RetrieveBlocksResponse) Reset() { *m = RetrieveBlocksResponse{} } +func (m *RetrieveBlocksResponse) String() string { return proto.CompactTextString(m) } +func (*RetrieveBlocksResponse) ProtoMessage() {} +func (*RetrieveBlocksResponse) Descriptor() ([]byte, []int) { return fileDescriptorDalc, []int{6} } -func (m *RetrieveBlockResponse) GetResult() *DAResponse { +func (m *RetrieveBlocksResponse) GetResult() *DAResponse { if m != nil { return m.Result } return nil } -func (m *RetrieveBlockResponse) GetBlock() *optimint.Block { +func (m *RetrieveBlocksResponse) GetBlocks() []*optimint.Block { if m != nil { - return m.Block + return m.Blocks } return nil } @@ -214,8 +226,8 @@ func init() { proto.RegisterType((*SubmitBlockResponse)(nil), "dalc.SubmitBlockResponse") proto.RegisterType((*CheckBlockAvailabilityRequest)(nil), "dalc.CheckBlockAvailabilityRequest") proto.RegisterType((*CheckBlockAvailabilityResponse)(nil), "dalc.CheckBlockAvailabilityResponse") - proto.RegisterType((*RetrieveBlockRequest)(nil), "dalc.RetrieveBlockRequest") - proto.RegisterType((*RetrieveBlockResponse)(nil), "dalc.RetrieveBlockResponse") + proto.RegisterType((*RetrieveBlocksRequest)(nil), "dalc.RetrieveBlocksRequest") + proto.RegisterType((*RetrieveBlocksResponse)(nil), "dalc.RetrieveBlocksResponse") proto.RegisterEnum("dalc.StatusCode", StatusCode_name, StatusCode_value) } @@ -232,7 +244,7 @@ const _ = grpc.SupportPackageIsVersion4 type DALCServiceClient interface { SubmitBlock(ctx context.Context, in *SubmitBlockRequest, opts ...grpc.CallOption) (*SubmitBlockResponse, error) CheckBlockAvailability(ctx context.Context, in *CheckBlockAvailabilityRequest, opts ...grpc.CallOption) (*CheckBlockAvailabilityResponse, error) - RetrieveBlock(ctx context.Context, in *RetrieveBlockRequest, opts ...grpc.CallOption) (*RetrieveBlockResponse, error) + RetrieveBlocks(ctx context.Context, in *RetrieveBlocksRequest, opts ...grpc.CallOption) (*RetrieveBlocksResponse, error) } type dALCServiceClient struct { @@ -261,9 +273,9 @@ func (c *dALCServiceClient) CheckBlockAvailability(ctx context.Context, in *Chec return out, nil } -func (c *dALCServiceClient) RetrieveBlock(ctx context.Context, in *RetrieveBlockRequest, opts ...grpc.CallOption) (*RetrieveBlockResponse, error) { - out := new(RetrieveBlockResponse) - err := grpc.Invoke(ctx, "/dalc.DALCService/RetrieveBlock", in, out, c.cc, opts...) +func (c *dALCServiceClient) RetrieveBlocks(ctx context.Context, in *RetrieveBlocksRequest, opts ...grpc.CallOption) (*RetrieveBlocksResponse, error) { + out := new(RetrieveBlocksResponse) + err := grpc.Invoke(ctx, "/dalc.DALCService/RetrieveBlocks", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -275,7 +287,7 @@ func (c *dALCServiceClient) RetrieveBlock(ctx context.Context, in *RetrieveBlock type DALCServiceServer interface { SubmitBlock(context.Context, *SubmitBlockRequest) (*SubmitBlockResponse, error) CheckBlockAvailability(context.Context, *CheckBlockAvailabilityRequest) (*CheckBlockAvailabilityResponse, error) - RetrieveBlock(context.Context, *RetrieveBlockRequest) (*RetrieveBlockResponse, error) + RetrieveBlocks(context.Context, *RetrieveBlocksRequest) (*RetrieveBlocksResponse, error) } func RegisterDALCServiceServer(s *grpc.Server, srv DALCServiceServer) { @@ -318,20 +330,20 @@ func _DALCService_CheckBlockAvailability_Handler(srv interface{}, ctx context.Co return interceptor(ctx, in, info, handler) } -func _DALCService_RetrieveBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RetrieveBlockRequest) +func _DALCService_RetrieveBlocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RetrieveBlocksRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(DALCServiceServer).RetrieveBlock(ctx, in) + return srv.(DALCServiceServer).RetrieveBlocks(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/dalc.DALCService/RetrieveBlock", + FullMethod: "/dalc.DALCService/RetrieveBlocks", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DALCServiceServer).RetrieveBlock(ctx, req.(*RetrieveBlockRequest)) + return srv.(DALCServiceServer).RetrieveBlocks(ctx, req.(*RetrieveBlocksRequest)) } return interceptor(ctx, in, info, handler) } @@ -349,8 +361,8 @@ var _DALCService_serviceDesc = grpc.ServiceDesc{ Handler: _DALCService_CheckBlockAvailability_Handler, }, { - MethodName: "RetrieveBlock", - Handler: _DALCService_RetrieveBlock_Handler, + MethodName: "RetrieveBlocks", + Handler: _DALCService_RetrieveBlocks_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -383,6 +395,11 @@ func (m *DAResponse) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintDalc(dAtA, i, uint64(len(m.Message))) i += copy(dAtA[i:], m.Message) } + if m.DataLayerHeight != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintDalc(dAtA, i, uint64(m.DataLayerHeight)) + } return i, nil } @@ -457,15 +474,10 @@ func (m *CheckBlockAvailabilityRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa + if m.DataLayerHeight != 0 { + dAtA[i] = 0x8 i++ - i = encodeVarintDalc(dAtA, i, uint64(m.Header.Size())) - n3, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 + i = encodeVarintDalc(dAtA, i, uint64(m.DataLayerHeight)) } return i, nil } @@ -489,11 +501,11 @@ func (m *CheckBlockAvailabilityResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintDalc(dAtA, i, uint64(m.Result.Size())) - n4, err := m.Result.MarshalTo(dAtA[i:]) + n3, err := m.Result.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n4 + i += n3 } if m.DataAvailable { dAtA[i] = 0x10 @@ -508,7 +520,7 @@ func (m *CheckBlockAvailabilityResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *RetrieveBlockRequest) Marshal() (dAtA []byte, err error) { +func (m *RetrieveBlocksRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -518,20 +530,20 @@ func (m *RetrieveBlockRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RetrieveBlockRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *RetrieveBlocksRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l - if m.Height != 0 { + if m.DataLayerHeight != 0 { dAtA[i] = 0x8 i++ - i = encodeVarintDalc(dAtA, i, uint64(m.Height)) + i = encodeVarintDalc(dAtA, i, uint64(m.DataLayerHeight)) } return i, nil } -func (m *RetrieveBlockResponse) Marshal() (dAtA []byte, err error) { +func (m *RetrieveBlocksResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -541,7 +553,7 @@ func (m *RetrieveBlockResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RetrieveBlockResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *RetrieveBlocksResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -550,21 +562,23 @@ func (m *RetrieveBlockResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintDalc(dAtA, i, uint64(m.Result.Size())) - n5, err := m.Result.MarshalTo(dAtA[i:]) + n4, err := m.Result.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n5 + i += n4 } - if m.Block != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintDalc(dAtA, i, uint64(m.Block.Size())) - n6, err := m.Block.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Blocks) > 0 { + for _, msg := range m.Blocks { + dAtA[i] = 0x12 + i++ + i = encodeVarintDalc(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n } - i += n6 } return i, nil } @@ -606,6 +620,9 @@ func (m *DAResponse) Size() (n int) { if l > 0 { n += 1 + l + sovDalc(uint64(l)) } + if m.DataLayerHeight != 0 { + n += 1 + sovDalc(uint64(m.DataLayerHeight)) + } return n } @@ -632,9 +649,8 @@ func (m *SubmitBlockResponse) Size() (n int) { func (m *CheckBlockAvailabilityRequest) Size() (n int) { var l int _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovDalc(uint64(l)) + if m.DataLayerHeight != 0 { + n += 1 + sovDalc(uint64(m.DataLayerHeight)) } return n } @@ -652,25 +668,27 @@ func (m *CheckBlockAvailabilityResponse) Size() (n int) { return n } -func (m *RetrieveBlockRequest) Size() (n int) { +func (m *RetrieveBlocksRequest) Size() (n int) { var l int _ = l - if m.Height != 0 { - n += 1 + sovDalc(uint64(m.Height)) + if m.DataLayerHeight != 0 { + n += 1 + sovDalc(uint64(m.DataLayerHeight)) } return n } -func (m *RetrieveBlockResponse) Size() (n int) { +func (m *RetrieveBlocksResponse) Size() (n int) { var l int _ = l if m.Result != nil { l = m.Result.Size() n += 1 + l + sovDalc(uint64(l)) } - if m.Block != nil { - l = m.Block.Size() - n += 1 + l + sovDalc(uint64(l)) + if len(m.Blocks) > 0 { + for _, e := range m.Blocks { + l = e.Size() + n += 1 + l + sovDalc(uint64(l)) + } } return n } @@ -765,6 +783,25 @@ func (m *DAResponse) Unmarshal(dAtA []byte) error { } m.Message = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DataLayerHeight", wireType) + } + m.DataLayerHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDalc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DataLayerHeight |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipDalc(dAtA[iNdEx:]) @@ -982,10 +1019,10 @@ func (m *CheckBlockAvailabilityRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DataLayerHeight", wireType) } - var msglen int + m.DataLayerHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDalc @@ -995,25 +1032,11 @@ func (m *CheckBlockAvailabilityRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + m.DataLayerHeight |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthDalc - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &optimint.Header{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDalc(dAtA[iNdEx:]) @@ -1138,7 +1161,7 @@ func (m *CheckBlockAvailabilityResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *RetrieveBlockRequest) Unmarshal(dAtA []byte) error { +func (m *RetrieveBlocksRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1161,17 +1184,17 @@ func (m *RetrieveBlockRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RetrieveBlockRequest: wiretype end group for non-group") + return fmt.Errorf("proto: RetrieveBlocksRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RetrieveBlockRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RetrieveBlocksRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DataLayerHeight", wireType) } - m.Height = 0 + m.DataLayerHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDalc @@ -1181,7 +1204,7 @@ func (m *RetrieveBlockRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (uint64(b) & 0x7F) << shift + m.DataLayerHeight |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } @@ -1207,7 +1230,7 @@ func (m *RetrieveBlockRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *RetrieveBlockResponse) Unmarshal(dAtA []byte) error { +func (m *RetrieveBlocksResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1230,10 +1253,10 @@ func (m *RetrieveBlockResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RetrieveBlockResponse: wiretype end group for non-group") + return fmt.Errorf("proto: RetrieveBlocksResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RetrieveBlockResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RetrieveBlocksResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1271,7 +1294,7 @@ func (m *RetrieveBlockResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Block", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Blocks", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1295,10 +1318,8 @@ func (m *RetrieveBlockResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Block == nil { - m.Block = &optimint.Block{} - } - if err := m.Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Blocks = append(m.Blocks, &optimint.Block{}) + if err := m.Blocks[len(m.Blocks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1431,37 +1452,38 @@ var ( func init() { proto.RegisterFile("dalc/dalc.proto", fileDescriptorDalc) } var fileDescriptorDalc = []byte{ - // 501 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xae, 0x43, 0x08, 0x30, 0x51, 0xdb, 0xb0, 0xa5, 0x4d, 0x48, 0x45, 0x54, 0x99, 0x56, 0x8a, - 0x90, 0xb0,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xb7, - 0xe5, 0x1d, 0x82, 0x70, 0xb4, 0x79, 0xac, 0xe4, 0x65, 0xde, 0xb6, 0xd5, 0x3f, 0xdd, 0xd3, 0xed, - 0x45, 0xd5, 0x36, 0x1f, 0x60, 0x77, 0x6d, 0x34, 0xa4, 0x9b, 0x37, 0x6e, 0x9a, 0x6f, 0xf7, 0x78, - 0x23, 0x56, 0x72, 0x5d, 0x9c, 0x7f, 0x5f, 0xf6, 0xa4, 0x1f, 0xcb, 0x9e, 0xf4, 0x73, 0xd9, 0x93, - 0xbe, 0xfd, 0xea, 0xed, 0x7c, 0x79, 0x3d, 0xe3, 0xc2, 0x4b, 0x6c, 0xc5, 0x09, 0xe6, 0xaa, 0x83, - 0x3e, 0xc6, 0x82, 0xb3, 0x20, 0x9a, 0x55, 0x37, 0x5b, 0x15, 0xb7, 0x21, 0xc6, 0x6a, 0x68, 0x67, - 0xcf, 0x80, 0xdd, 0xc8, 0x2e, 0xfa, 0x9b, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb9, 0xb4, 0x5b, - 0xe6, 0x1a, 0x04, 0x00, 0x00, + // 518 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x51, 0x6f, 0x12, 0x41, + 0x10, 0xc7, 0x39, 0x40, 0xd4, 0x21, 0x02, 0xdd, 0xa6, 0xe5, 0xa4, 0x4a, 0xc8, 0xd9, 0x46, 0xd2, + 0x44, 0x48, 0xf0, 0xd1, 0x87, 0x86, 0x1e, 0x67, 0x24, 0xb6, 0x62, 0xf6, 0xe0, 0xc5, 0x17, 0xb2, + 0x77, 0x4c, 0x60, 0xc3, 0xd1, 0xa3, 0xb7, 0x0b, 0x91, 0x8f, 0xe0, 0x37, 0xf0, 0x23, 0xf9, 0xe8, + 0x47, 0x30, 0xf8, 0x45, 0xcc, 0xed, 0x1d, 0x94, 0xd6, 0xb3, 0x49, 0x7d, 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1d, 0x72, 0x14, 0x79, 0x26, 0x36, 0xbe, 0xf2, + 0x22, 0x19, 0x6e, 0xc2, 0x9d, 0x9f, 0xfd, 0x58, 0x57, 0xb5, 0x9f, 0xeb, 0xaa, 0xf6, 0x6b, 0x5d, + 0xd5, 0xbe, 0xff, 0xae, 0xa6, 0xbe, 0xbc, 0x19, 0x73, 0x39, 0x59, 0x38, 0x0d, 0xd7, 0x9f, 0x35, + 0x5d, 0xf4, 0x50, 0x48, 0xce, 0xfc, 0x60, 0xbc, 0x5d, 0x11, 0x4d, 0xb9, 0x9a, 0xa3, 0x68, 0xce, + 0x1d, 0xb5, 0x4f, 0x9c, 0x9c, 0xda, 0x18, 0x6f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x9a, 0xbe, + 0xc3, 0x8c, 0x63, 0x04, 0x00, 0x00, } diff --git a/types/pb/optimint/optimint.pb.go b/types/pb/optimint/optimint.pb.go index ba5c18fc41d..f50bda05aea 100644 --- a/types/pb/optimint/optimint.pb.go +++ b/types/pb/optimint/optimint.pb.go @@ -16,12 +16,17 @@ */ package optimint -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import tendermint_abci "github.com/tendermint/tendermint/abci/types" +import ( + fmt "fmt" -import io "io" + proto "github.com/golang/protobuf/proto" + + math "math" + + tendermint_abci "github.com/tendermint/tendermint/abci/types" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -91,7 +96,7 @@ type Header struct { // We keep this in case users choose another signature format where the // pubkey can't be recovered by the signature (e.g. ed25519). ProposerAddress []byte `protobuf:"bytes,11,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` - // Hash of block aggregator set, at a time of block creation. + // Hash of block aggregator set, at a time of block creation AggregatorsHash []byte `protobuf:"bytes,12,opt,name=aggregators_hash,json=aggregatorsHash,proto3" json:"aggregators_hash,omitempty"` }