Skip to content

Commit

Permalink
Merge pull request #917 from iotaledger/develop
Browse files Browse the repository at this point in the history
Merge v0.3.5 changes to master
  • Loading branch information
capossele authored Jan 13, 2021
2 parents 65349e3 + e72cd7a commit a4518a0
Show file tree
Hide file tree
Showing 28 changed files with 252 additions and 89 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# v0.3.5 - 2021-01-13
* Fix consensus statement bug
* Fix deadlock in RandomMap
* Fix several shutdown related issues
* Load old messages in visualizer
* Fix wrong Tips count in visualizer
* Fix dashboard typos
* Improve integration tests
* Improve network delay analysis
* Update hive.go
* Update JS dependencies
* **Breaking**: bumps network and database versions
# v0.3.4 - 2020-12-11
* Revert Pebble to Badger.
* **Breaking**: bumps network and database versions
Expand Down
13 changes: 11 additions & 2 deletions dapps/valuetransfers/dapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ var (

valueObjectFactory *valuetangle.ValueObjectFactory
valueObjectFactoryOnce sync.Once

receiveMessageClosure *events.Closure
)

// App gets the plugin instance.
Expand Down Expand Up @@ -149,14 +151,21 @@ func configure(_ *node.Plugin) {
messagelayer.MessageParser().AddMessageFilter(valuetangle.NewSignatureFilter())

// subscribe to message-layer
messagelayer.Tangle().Events.MessageSolid.Attach(events.NewClosure(onReceiveMessageFromMessageLayer))
receiveMessageClosure = events.NewClosure(onReceiveMessageFromMessageLayer)
messagelayer.Tangle().Events.MessageSolid.Attach(receiveMessageClosure)
}

func run(*node.Plugin) {
if err := daemon.BackgroundWorker("ValueTangle", func(shutdownSignal <-chan struct{}) {
<-shutdownSignal
// TODO: make this better
time.Sleep(12 * time.Second)
// stop listening to stuff from the message tangle. By the time we are here, gossip and autopeering have already
// been shutdown, so no new incoming messages should appear.
messagelayer.Tangle().Events.MessageSolid.Detach(receiveMessageClosure)
// wait one network delay to be sure that all scheduled setPreferred are triggered in fcob. Otherwise, we would
// try to access an already shutdown objectstorage in fcob.
cfgAvgNetworkDelay := config.Node().Int(CfgValueLayerFCOBAverageNetworkDelay)
time.Sleep(time.Duration(cfgAvgNetworkDelay) * time.Second)
_tangle.Shutdown()
}, shutdown.PriorityTangle); err != nil {
log.Panicf("Failed to start as daemon: %s", err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/golang/protobuf v1.4.3
github.com/gorilla/websocket v1.4.2
github.com/iotaledger/hive.go v0.0.0-20201203130604-bd82d648670e
github.com/iotaledger/hive.go v0.0.0-20210107100912-23832b944f60
github.com/labstack/echo v3.3.10+incompatible
github.com/labstack/gommon v0.3.0
github.com/magiconair/properties v1.8.1
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,10 @@ github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:q
github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/iotaledger/hive.go v0.0.0-20201203130604-bd82d648670e h1:ZfkyczJhHUdhfnLiF0WKg9jR7412jLcvmgb9sm3ztcs=
github.com/iotaledger/hive.go v0.0.0-20201203130604-bd82d648670e/go.mod h1:dFt9vuTF3FdDPx7ve+uSDiNrX2PW2eV8sq7N06jeaFw=
github.com/iotaledger/hive.go v0.0.0-20201227184142-db5fe673cf03 h1:Rp09uTVNT8PXwotXsEu9rNHEq6j3+7tmIXJ/+ypyrVA=
github.com/iotaledger/hive.go v0.0.0-20201227184142-db5fe673cf03/go.mod h1:dFt9vuTF3FdDPx7ve+uSDiNrX2PW2eV8sq7N06jeaFw=
github.com/iotaledger/hive.go v0.0.0-20210107100912-23832b944f60 h1:hL9q5ANv6las2s/bZrA7/7UVhl8oADs+WWepkK++6v4=
github.com/iotaledger/hive.go v0.0.0-20210107100912-23832b944f60/go.mod h1:dFt9vuTF3FdDPx7ve+uSDiNrX2PW2eV8sq7N06jeaFw=
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
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 @@ -3395,9 +3395,9 @@ inherits@2.0.3:
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=

ini@^1.3.4, ini@^1.3.5:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
version "1.3.8"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==

inquirer@^0.12.0:
version "0.12.0"
Expand Down
2 changes: 1 addition & 1 deletion plugins/autopeering/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ const (

func init() {
flag.StringSlice(CfgEntryNodes, []string{"2PV5487xMw5rasGBXXWeqSi4hLz7r19YBt8Y1TGAsQbj@ressims.iota.cafe:15626", "5EDH4uY78EA6wrBkHHAVBWBMDt7EcksRq6pjzipoW15B@entrynode.alphanet.tanglebay.org:14656"}, "list of trusted entry nodes for auto peering")
flag.Int(CfgNetworkVersion, 12, "autopeering network version")
flag.Int(CfgNetworkVersion, 13, "autopeering network version")
}
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.3.4"
AppVersion = "v0.3.5"
// SimplifiedAppVersion is the version number without commit hash
SimplifiedAppVersion = simplifiedVersion(AppVersion)
)
Expand Down
17 changes: 7 additions & 10 deletions plugins/consensus/opiniongiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ type OpinionGivers map[identity.ID]OpinionGiver
// Query retrievs the opinions about the given conflicts and timestamps.
func (o *OpinionGiver) Query(ctx context.Context, conflictIDs []string, timestampIDs []string) (opinions vote.Opinions, err error) {
for i := 0; i < waitForStatement; i++ {
opinions, err = o.view.Query(ctx, conflictIDs, timestampIDs)
if err == nil {
return opinions, nil
if o.view != nil {
opinions, err = o.view.Query(ctx, conflictIDs, timestampIDs)
if err == nil {
return opinions, nil
}
}
time.Sleep(time.Second)
}
Expand Down Expand Up @@ -67,21 +69,16 @@ func OpinionGiverFunc() (givers []vote.OpinionGiver, err error) {
continue
}
if _, ok := opinionGiversMap[p.ID()]; !ok {
v := Registry().NodeView(p.ID())
opinionGiversMap[p.ID()] = &OpinionGiver{
id: p.ID(),
view: v,
view: nil,
}
}
opinionGiversMap[p.ID()].pog = &PeerOpinionGiver{p: p}
}

for _, v := range opinionGiversMap {
opinionGivers = append(opinionGivers, &OpinionGiver{
id: v.id,
view: v.view,
pog: v.pog,
})
opinionGivers = append(opinionGivers, v)
}

return opinionGivers, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class ExplorerAddressQueryResult extends React.Component<Props, any> {
}
return (
<Container>
<h3>Address {addr !== null && <span>({addr.output_ids.length} Ouputs)</span>}</h3>
<h3>Address {addr !== null && <span>({addr.output_ids.length} Outputs)</span>}</h3>
<p>
{id} {' '}
</p>
Expand Down
1 change: 1 addition & 0 deletions plugins/dashboard/frontend/src/app/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class Root extends React.Component<Props, any> {
<Route exact path="/drng" component={Drng}/>
<Route exact path="/explorer" component={Explorer}/>
<Route exact path="/visualizer" component={Visualizer}/>
<Route exact path="/visualizer/history" component={Visualizer}/>
<Route exact path="/faucet" component={Faucet}/>
<Redirect to="/dashboard"/>
</Switch>
Expand Down
74 changes: 39 additions & 35 deletions plugins/dashboard/frontend/src/app/stores/VisualizerStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export class TipInfo {
is_tip: boolean;
}

class history {
vertices: Array<Vertex>;
}

const vertexSize = 20;

export class VisualizerStore {
Expand All @@ -24,7 +28,7 @@ export class VisualizerStore {
@observable solid_count = 0;
@observable tips_count = 0;
verticesIncomingOrder = [];
collect: boolean = false;
draw: boolean = false;
routerStore: RouterStore;

// the currently selected vertex via hover
Expand All @@ -45,8 +49,22 @@ export class VisualizerStore {

constructor(routerStore: RouterStore) {
this.routerStore = routerStore;
this.fetchHistory();
registerHandler(WSMsgType.Vertex, this.addVertex);
registerHandler(WSMsgType.TipInfo, this.addTipInfo);
registerHandler(WSMsgType.TipInfo, this.addTipInfo);
}

fetchHistory = async () => {
try {
let res = await fetch(`/api/visualizer/history`);
let history: history = await res.json();
history.vertices.forEach(v => {
this.addVertex(v);
});
} catch (err) {
console.log("Fail to fetch history in visualizer", err);
}
return
}

@action
Expand Down Expand Up @@ -87,9 +105,7 @@ export class VisualizerStore {
}

@action
addVertex = (vert: Vertex) => {
if (!this.collect) return;

addVertex = (vert: Vertex) => {
let existing = this.vertices.get(vert.id);
if (existing) {
// can only go from unsolid to solid
Expand All @@ -108,35 +124,16 @@ export class VisualizerStore {
}
this.verticesIncomingOrder.push(vert.id);
this.checkLimit();

if (vert.strongParentIDs) {
// clear tip status of strong and weak parents
vert.strongParentIDs.forEach((value, index) => {
let strongParentVert = this.vertices.get(value);
if (strongParentVert) {
strongParentVert.is_tip = false;
this.vertices.set(strongParentVert.id, strongParentVert)
}
});
}
if (vert.weakParentIDs) {
vert.weakParentIDs.forEach((value, index) => {
let weakParentVert = this.vertices.get(value);
if (weakParentVert) {
weakParentVert.is_tip = false;
this.vertices.set(weakParentVert.id, weakParentVert)
}
});
}
}

this.vertices.set(vert.id, vert);
this.drawVertex(vert);
if (this.draw) {
this.drawVertex(vert);
}
};

@action
addTipInfo = (tipInfo: TipInfo) => {
if (!this.collect) return;
let vert = this.vertices.get(tipInfo.id);
if (!vert) {
// create a new empty one for now
Expand All @@ -148,7 +145,9 @@ export class VisualizerStore {
this.tips_count += tipInfo.is_tip ? 1 : vert.is_tip ? -1 : 0;
vert.is_tip = tipInfo.is_tip;
this.vertices.set(vert.id, vert);
this.drawVertex(vert);
if (this.draw) {
this.drawVertex(vert);
}
};

@action
Expand All @@ -161,7 +160,9 @@ export class VisualizerStore {
this.clearSelected();
}
this.vertices.delete(deleteId);
this.graph.removeNode(deleteId);
if (this.draw) {
this.graph.removeNode(deleteId);
}
if (!vert) {
continue;
}
Expand Down Expand Up @@ -198,7 +199,9 @@ export class VisualizerStore {
}
this.vertices.delete(approveeId);
}
this.graph.removeNode(approveeId);
if (this.draw) {
this.graph.removeNode(approveeId);
}
}

drawVertex = (vert: Vertex) => {
Expand Down Expand Up @@ -243,7 +246,7 @@ export class VisualizerStore {
}

start = () => {
this.collect = true;
this.draw = true;
this.graph = Viva.Graph.graph();

let graphics: any = Viva.Graph.View.webglGraphics();
Expand Down Expand Up @@ -280,17 +283,18 @@ export class VisualizerStore {
});
this.graphics = graphics;
this.renderer.run();

this.vertices.forEach((vertex) => {
this.drawVertex(vertex)
})
}

stop = () => {
this.collect = false;
this.draw = false;
this.renderer.dispose();
this.graph = null;
this.paused = false;
this.selected = null;
this.solid_count = 0;
this.tips_count = 0;
this.vertices.clear();
}

@action
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 @@ -3580,9 +3580,9 @@ inherits@2.0.3:
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=

ini@^1.3.4, ini@^1.3.5, ini@~1.3.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
version "1.3.8"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==

internal-ip@^4.3.0:
version "4.3.0"
Expand Down
1 change: 1 addition & 0 deletions plugins/dashboard/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func setupRoutes(e *echo.Echo) {

setupExplorerRoutes(apiRoutes)
setupFaucetRoutes(apiRoutes)
setupVisualizerRoutes(apiRoutes)

e.HTTPErrorHandler = func(err error, c echo.Context) {
log.Warnf("Request failed: %s", err)
Expand Down
Loading

0 comments on commit a4518a0

Please sign in to comment.