Skip to content

Commit

Permalink
Merge pull request #1175 from iotaledger/develop
Browse files Browse the repository at this point in the history
Merge v0.5.6 into master
  • Loading branch information
capossele authored Apr 3, 2021
2 parents b2c2b86 + b01420d commit 08e9924
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 52 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v0.5.6 - 2021-04-03
* Fix childBranchType
* Fix FPC empty round increase
* Make reading of FPC statements less strict
* Fix aggregated branch diagnostic API and dashboard page
* **Breaking**: bumps network and database versions

# v0.5.5 - 2021-04-01
* Integrate Mana with FPC
* Integrate Mana with the Autopeering
Expand Down
6 changes: 3 additions & 3 deletions packages/ledgerstate/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,8 +1088,8 @@ func ChildBranchFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (childBran

// ChildBranchFromObjectStorage is a factory method that creates a new ChildBranch instance from a storage key of the
// object storage. It is used by the object storage, to create new instances of this entity.
func ChildBranchFromObjectStorage(key []byte, _ []byte) (result objectstorage.StorableObject, err error) {
if result, _, err = ChildBranchFromBytes(key); err != nil {
func ChildBranchFromObjectStorage(key, value []byte) (result objectstorage.StorableObject, err error) {
if result, _, err = ChildBranchFromBytes(byteutils.ConcatBytes(key, value)); err != nil {
err = xerrors.Errorf("failed to parse ChildBranch from bytes: %w", err)
return
}
Expand Down Expand Up @@ -1134,7 +1134,7 @@ func (c *ChildBranch) Update(objectstorage.StorableObject) {
// ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the
// StorableObject interface.
func (c *ChildBranch) ObjectStorageKey() (objectStorageKey []byte) {
return marshalutil.New(ConflictIDLength + BranchIDLength).
return marshalutil.New(BranchIDLength + BranchIDLength).
WriteBytes(c.parentBranchID.Bytes()).
WriteBytes(c.childBranchID.Bytes()).
Bytes()
Expand Down
10 changes: 10 additions & 0 deletions packages/ledgerstate/utxo_dag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ func TestExampleC(t *testing.T) {
utxoDAG.branchDAG.Branch(Tx3AggregatedBranch.ID()).Consume(func(branch Branch) {
assert.Equal(t, NewBranchIDs(NewBranchID(transactions["TX1"].ID()), NewBranchID(transactions["TX2"].ID())), branch.Parents())
})

time.Sleep(1 * time.Second)

utxoDAG.branchDAG.ChildBranches(NewBranchID(transactions["TX1"].ID())).Consume(func(childBranch *ChildBranch) {
assert.Equal(t, AggregatedBranchType, childBranch.ChildBranchType())
})

utxoDAG.branchDAG.ChildBranches(NewBranchID(transactions["TX2"].ID())).Consume(func(childBranch *ChildBranch) {
assert.Equal(t, AggregatedBranchType, childBranch.ChildBranchType())
})
}
}

Expand Down
12 changes: 9 additions & 3 deletions packages/vote/fpc/fpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ func (f *FPC) Round(rand float64) error {
// number of rounds and clear those who failed to be finalized in MaxRoundsPerVoteContext.
f.finalizeOpinions()
}

// mark a round being done, even though there's no opinion,
// so this voting context will be cleared eventually
f.ctxsMu.Lock()
for voteObjectID := range f.ctxs {
f.ctxs[voteObjectID].Rounds++
}
f.ctxsMu.Unlock()

// query for opinions on the current vote contexts
queriedOpinions, err := f.queryOpinions()
if err == nil {
Expand Down Expand Up @@ -305,9 +314,6 @@ func (f *FPC) queryOpinions() ([]opinion.QueriedOpinions, error) {
}
}

// mark a round being done, even though there's no opinion,
// so this voting context will be cleared eventually
f.ctxs[id].Rounds++
if votedCount < f.paras.MinOpinionsReceived {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkged.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions plugins/analysis/dashboard/frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7193,9 +7193,9 @@ xtend@^4.0.0, xtend@~4.0.1:
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==

y18n@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
version "4.0.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==

yallist@^2.1.2:
version "2.1.2"
Expand Down
2 changes: 1 addition & 1 deletion plugins/autopeering/discovery/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/iotaledger/hive.go/configuration"
// Parameters contains the configuration parameters used by the message layer.
var Parameters = struct {
// NetworkVersion defines the config flag of the network version.
NetworkVersion int `default:"23" usage:"autopeering network version"`
NetworkVersion int `default:"24" usage:"autopeering network version"`

// EntryNodes defines the config flag of the entry nodes.
EntryNodes []string `default:"[email protected]:15626,5EDH4uY78EA6wrBkHHAVBWBMDt7EcksRq6pjzipoW15B@entryshimmer.tanglebay.com:14646" usage:"list of trusted entry nodes for auto peering"`
Expand Down
2 changes: 1 addition & 1 deletion plugins/banner/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
once sync.Once

// AppVersion version number
AppVersion = "v0.5.5"
AppVersion = "v0.5.6"
// SimplifiedAppVersion is the version number without commit hash
SimplifiedAppVersion = simplifiedVersion(AppVersion)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ export class ExplorerBranchQueryResult extends React.Component<Props, any> {
{branch.parents.map((p,i) => <ListGroup.Item key={i}><a href={`/explorer/branch/${p}`}>{resolveBase58BranchID(p)}</a></ListGroup.Item>)}
</ListGroup>
</ListGroup.Item>
{branch.type !== "AggregatedBranchType" &&
<ListGroup.Item>Conflicts:
{branch.conflictIDs && <ListGroup>
{branch.conflictIDs.map((c,i) => <ListGroup.Item key={i}><a href={`/explorer/output/${c}`}>{c}</a></ListGroup.Item>)}
</ListGroup>}
</ListGroup.Item>
</ListGroup.Item>}
<ListGroup.Item>Finalized: {branch.finalized.toString()}</ListGroup.Item>
<ListGroup.Item>Monotonically Liked: {branch.monotonicallyLiked.toString()}</ListGroup.Item>
<ListGroup.Item>Inclusion State: {renderInclusionState(branch.inclusionState)}</ListGroup.Item>
Expand All @@ -86,18 +87,19 @@ export class ExplorerBranchQueryResult extends React.Component<Props, any> {
{branchChildren.childBranches.map((c,i) => <ListGroup.Item key={i}><a href={`/explorer/branch/${c.branchID}`}>{resolveBase58BranchID(c.branchID)}</a></ListGroup.Item>)}
</ListGroup> }
</ListGroup.Item>
<ListGroup.Item> Conflicts:
{branchConflicts && <ListGroup>
{branchConflicts.conflicts.map((c,i) => <div key={i}>
OutputID: <a href={`/explorer/output/${c.outputID.base58}`}>{c.outputID.base58}</a>
<ListGroup className={"mb-2"}>
{c.branchIDs.map((b,j) => <ListGroup.Item key={j}>
<a href={`/explorer/branch/${b}`}>{resolveBase58BranchID(b)}</a>
</ListGroup.Item>)}
</ListGroup>
</div>)}
</ListGroup> }
</ListGroup.Item>
{branch.type !== "AggregatedBranchType" &&
<ListGroup.Item> Conflicts:
{branchConflicts && <ListGroup>
{branchConflicts.conflicts.map((c,i) => <div key={i}>
OutputID: <a href={`/explorer/output/${c.outputID.base58}`}>{c.outputID.base58}</a>
<ListGroup className={"mb-2"}>
{c.branchIDs.map((b,j) => <ListGroup.Item key={j}>
<a href={`/explorer/branch/${b}`}>{resolveBase58BranchID(b)}</a>
</ListGroup.Item>)}
</ListGroup>
</div>)}
</ListGroup> }
</ListGroup.Item>}
</ListGroup>}
</Container>
)
Expand Down
6 changes: 3 additions & 3 deletions plugins/dashboard/frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7545,9 +7545,9 @@ xxhashjs@^0.2.1:
cuint "^0.2.2"

y18n@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
version "4.0.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==

yallist@^3.0.2:
version "3.1.1"
Expand Down
2 changes: 1 addition & 1 deletion plugins/database/versioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
const (
// DBVersion defines the version of the database schema this version of GoShimmer supports.
// Every time there's a breaking change regarding the stored data, this version flag should be adjusted.
DBVersion = 25
DBVersion = 26
)

var (
Expand Down
6 changes: 1 addition & 5 deletions plugins/messagelayer/consensus_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,7 @@ func (o *OpinionGiver) Query(ctx context.Context, conflictIDs []string, timestam
if o.view != nil {
// wait for statement(s) to arrive
time.Sleep(time.Duration(StatementParameters.WaitForStatement) * time.Second)
}
// query statement status only if any statement has been received within the last round interval.
// This is important. We do want to consider old statements IF the node has been active in the last round.
// otherwise node might be down and we don't want to look at old statements in subsequent rounds
if o.view != nil && o.view.LastStatementReceivedTimestamp.Add(time.Duration(FPCParameters.RoundInterval)*time.Second).After(clockPkg.SyncedTime()) {

opinions, err = o.view.Query(ctx, conflictIDs, timestampIDs)
if err == nil {
return opinions, nil
Expand Down
39 changes: 21 additions & 18 deletions plugins/webapi/tools/message/diagnostic_branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"strings"
"time"

"github.com/iotaledger/goshimmer/packages/tangle"
"github.com/labstack/echo"

"github.com/iotaledger/goshimmer/packages/ledgerstate"
"github.com/iotaledger/goshimmer/packages/tangle"
"github.com/iotaledger/goshimmer/plugins/messagelayer"
)

Expand Down Expand Up @@ -121,29 +121,32 @@ func getDiagnosticConflictsInfo(branchID ledgerstate.BranchID) DiagnosticBranchI
ID: branchID.Base58(),
}

transactionID := ledgerstate.TransactionID(branchID)
messagelayer.Tangle().LedgerState.BranchDAG.Branch(branchID).Consume(func(branch ledgerstate.Branch) {
conflictInfo.Liked = branch.Liked()
conflictInfo.MonotonicallyLiked = branch.MonotonicallyLiked()
conflictInfo.InclusionState = messagelayer.Tangle().LedgerState.BranchInclusionState(branchID).String()

conflictInfo.ConflictSet = messagelayer.Tangle().LedgerState.ConflictSet(transactionID).Strings()
if branch.Type() == ledgerstate.AggregatedBranchType {
return
}

messagelayer.Tangle().LedgerState.Transaction(transactionID).Consume(func(transaction *ledgerstate.Transaction) {
conflictInfo.IssuanceTimestamp = transaction.Essence().Timestamp()
messagelayer.Tangle().Storage.Attachments(transactionID).Consume(func(attachment *tangle.Attachment) {
conflictInfo.OpinionFormedTime = messagelayer.ConsensusMechanism().OpinionFormedTime(attachment.MessageID())
})
})
transactionID := ledgerstate.TransactionID(branchID)

messagelayer.Tangle().LedgerState.TransactionMetadata(transactionID).Consume(func(transactionMetadata *ledgerstate.TransactionMetadata) {
conflictInfo.SolidTime = transactionMetadata.SolidificationTime()
conflictInfo.ConflictSet = messagelayer.Tangle().LedgerState.ConflictSet(transactionID).Strings()

messagelayer.Tangle().LedgerState.BranchDAG.Branch(transactionMetadata.BranchID()).Consume(func(branch ledgerstate.Branch) {
conflictInfo.Liked = branch.Liked()
conflictInfo.MonotonicallyLiked = branch.MonotonicallyLiked()
messagelayer.Tangle().LedgerState.Transaction(transactionID).Consume(func(transaction *ledgerstate.Transaction) {
conflictInfo.IssuanceTimestamp = transaction.Essence().Timestamp()
messagelayer.Tangle().Storage.Attachments(transactionID).Consume(func(attachment *tangle.Attachment) {
conflictInfo.OpinionFormedTime = messagelayer.ConsensusMechanism().OpinionFormedTime(attachment.MessageID())
})
})

conflictInfo.Finalized = transactionMetadata.Finalized()
conflictInfo.LazyBooked = transactionMetadata.LazyBooked()
conflictInfo.InclusionState = messagelayer.Tangle().LedgerState.BranchInclusionState(transactionMetadata.BranchID()).String()
conflictInfo.TransactionLiked = messagelayer.ConsensusMechanism().TransactionLiked(transactionID)
messagelayer.Tangle().LedgerState.TransactionMetadata(transactionID).Consume(func(transactionMetadata *ledgerstate.TransactionMetadata) {
conflictInfo.SolidTime = transactionMetadata.SolidificationTime()
conflictInfo.Finalized = transactionMetadata.Finalized()
conflictInfo.LazyBooked = transactionMetadata.LazyBooked()
conflictInfo.TransactionLiked = messagelayer.ConsensusMechanism().TransactionLiked(transactionID)
})
})

return conflictInfo
Expand Down

0 comments on commit 08e9924

Please sign in to comment.