Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions common/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SPDX-License-Identifier: Apache-2.0
package types

import (
"fmt"
"math"
)

Expand Down Expand Up @@ -66,3 +67,9 @@ type Batch interface {
BatchID
Requests() BatchedRequests
}

// OrderingInfo is an opaque object that provides extra information on the order of the batch attestation and
// metadata to be used in the construction of the block.
type OrderingInfo interface {
fmt.Stringer
}
Comment on lines +71 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is temporary, we can put the entire OrderingInformation here once we're done moving stuff

4 changes: 2 additions & 2 deletions core/abc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ func (s *bafSender) SendBAF(baf arma_types.BatchAttestationFragment) {
}

type naiveblock struct {
order core.OrderingInfo
order arma_types.OrderingInfo
batch arma_types.Batch
attestation arma_types.BatchAttestation
}

type naiveBlockLedger chan naiveblock

func (n naiveBlockLedger) Append(batch arma_types.Batch, orderingInfo core.OrderingInfo) {
func (n naiveBlockLedger) Append(batch arma_types.Batch, orderingInfo arma_types.OrderingInfo) {
n <- naiveblock{
order: orderingInfo,
batch: batch,
Expand Down
9 changes: 2 additions & 7 deletions core/assembler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package core
import (
"encoding/hex"
"errors"
"fmt"
"sync"
"time"

Expand All @@ -24,7 +23,7 @@ type OrderedBatchAttestation interface {
BatchAttestation() types.BatchAttestation
// OrderingInfo is an opaque object that provides extra information on the order of the batch attestation and
// metadata to be used in the construction of the block.
OrderingInfo() OrderingInfo
OrderingInfo() types.OrderingInfo
}

type BatchReplicator interface {
Expand All @@ -37,12 +36,8 @@ type AssemblerIndex interface {
Stop()
}

type OrderingInfo interface {
fmt.Stringer
}

type AssemblerLedgerWriter interface {
Append(batch types.Batch, orderingInfo OrderingInfo)
Append(batch types.Batch, orderingInfo types.OrderingInfo)
Close()
}

Expand Down
6 changes: 3 additions & 3 deletions core/assembler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,20 @@ func (noi *naiveOrderingInfo) String() string {

type naiveOrderedBatchAttestation struct {
ba types.BatchAttestation
orderingInfo core.OrderingInfo
orderingInfo types.OrderingInfo
}

func (noba *naiveOrderedBatchAttestation) BatchAttestation() types.BatchAttestation {
return noba.ba
}

func (noba *naiveOrderedBatchAttestation) OrderingInfo() core.OrderingInfo {
func (noba *naiveOrderedBatchAttestation) OrderingInfo() types.OrderingInfo {
return noba.orderingInfo
}

type naiveAssemblerLedger chan core.OrderedBatchAttestation

func (n naiveAssemblerLedger) Append(batch types.Batch, orderingInfo core.OrderingInfo) {
func (n naiveAssemblerLedger) Append(batch types.Batch, orderingInfo types.OrderingInfo) {
noba := &naiveOrderedBatchAttestation{
ba: &naiveBatchAttestation{
primary: batch.Primary(),
Expand Down
2 changes: 1 addition & 1 deletion node/assembler/assembler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func createLedgerMockWrappingRealLedger(logger types.Logger, ledgerPath string)
mock := &ledger_mocks.FakeAssemblerLedgerReaderWriter{}
ledger, err := node_ledger.NewAssemblerLedger(logger, ledgerPath)

mock.AppendCalls(func(b types.Batch, i core.OrderingInfo) {
mock.AppendCalls(func(b types.Batch, i types.OrderingInfo) {
ledger.Append(b, i)
})
mock.AppendConfigCalls(func(b *common.Block, dn types.DecisionNum) {
Expand Down
6 changes: 2 additions & 4 deletions node/consensus/state/available_batch_ordered.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ package state
import (
"fmt"

"github.com/hyperledger/fabric-x-orderer/common/types"
"github.com/hyperledger/fabric-x-orderer/core"

smartbft_types "github.com/hyperledger-labs/SmartBFT/pkg/types"
"github.com/hyperledger/fabric-x-orderer/common/types"
)

type OrderingInformation struct {
Expand Down Expand Up @@ -42,6 +40,6 @@ func (abo *AvailableBatchOrdered) BatchAttestation() types.BatchAttestation {

// OrderingInfo returns an opaque object that provides extra information on the order of the batch attestation and
// metadata to be used in the construction of the block.
func (abo *AvailableBatchOrdered) OrderingInfo() core.OrderingInfo {
func (abo *AvailableBatchOrdered) OrderingInfo() types.OrderingInfo {
return abo.OrderingInformation
}
10 changes: 4 additions & 6 deletions node/ledger/assembler_ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ import (
"sync/atomic"
"time"

"github.com/hyperledger/fabric-lib-go/common/metrics/disabled"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-x-orderer/common/ledger/blkstorage"
"github.com/hyperledger/fabric-x-orderer/common/ledger/blockledger"
"github.com/hyperledger/fabric-x-orderer/common/ledger/blockledger/fileledger"
"github.com/hyperledger/fabric-x-orderer/common/types"
"github.com/hyperledger/fabric-x-orderer/core"
"github.com/hyperledger/fabric-x-orderer/node/consensus/state"

"github.com/hyperledger/fabric-lib-go/common/metrics/disabled"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric/protoutil"
)

Expand All @@ -33,7 +31,7 @@ type (
//go:generate counterfeiter -o ./mocks/assembler_ledger.go . AssemblerLedgerReaderWriter
type AssemblerLedgerReaderWriter interface {
GetTxCount() uint64
Append(batch types.Batch, orderingInfo core.OrderingInfo)
Append(batch types.Batch, orderingInfo types.OrderingInfo)
AppendConfig(configBlock *common.Block, decisionNum types.DecisionNum)
LastOrderingInfo() (*state.OrderingInformation, error)
LedgerReader() blockledger.Reader
Expand Down Expand Up @@ -134,7 +132,7 @@ func (l *AssemblerLedger) GetTxCount() uint64 {
return c
}

func (l *AssemblerLedger) Append(batch types.Batch, orderingInfo core.OrderingInfo) {
func (l *AssemblerLedger) Append(batch types.Batch, orderingInfo types.OrderingInfo) {
ordInfo := orderingInfo.(*state.OrderingInformation)
t1 := time.Now()
defer func() {
Expand Down
13 changes: 6 additions & 7 deletions node/ledger/mocks/assembler_ledger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.