Skip to content

Commit a4518a0

Browse files
authored
Merge pull request #917 from iotaledger/develop
Merge v0.3.5 changes to master
2 parents 65349e3 + e72cd7a commit a4518a0

File tree

28 files changed

+252
-89
lines changed

28 files changed

+252
-89
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# v0.3.5 - 2021-01-13
2+
* Fix consensus statement bug
3+
* Fix deadlock in RandomMap
4+
* Fix several shutdown related issues
5+
* Load old messages in visualizer
6+
* Fix wrong Tips count in visualizer
7+
* Fix dashboard typos
8+
* Improve integration tests
9+
* Improve network delay analysis
10+
* Update hive.go
11+
* Update JS dependencies
12+
* **Breaking**: bumps network and database versions
113
# v0.3.4 - 2020-12-11
214
* Revert Pebble to Badger.
315
* **Breaking**: bumps network and database versions

dapps/valuetransfers/dapp.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ var (
7070

7171
valueObjectFactory *valuetangle.ValueObjectFactory
7272
valueObjectFactoryOnce sync.Once
73+
74+
receiveMessageClosure *events.Closure
7375
)
7476

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

151153
// subscribe to message-layer
152-
messagelayer.Tangle().Events.MessageSolid.Attach(events.NewClosure(onReceiveMessageFromMessageLayer))
154+
receiveMessageClosure = events.NewClosure(onReceiveMessageFromMessageLayer)
155+
messagelayer.Tangle().Events.MessageSolid.Attach(receiveMessageClosure)
153156
}
154157

155158
func run(*node.Plugin) {
156159
if err := daemon.BackgroundWorker("ValueTangle", func(shutdownSignal <-chan struct{}) {
157160
<-shutdownSignal
158161
// TODO: make this better
159-
time.Sleep(12 * time.Second)
162+
// stop listening to stuff from the message tangle. By the time we are here, gossip and autopeering have already
163+
// been shutdown, so no new incoming messages should appear.
164+
messagelayer.Tangle().Events.MessageSolid.Detach(receiveMessageClosure)
165+
// wait one network delay to be sure that all scheduled setPreferred are triggered in fcob. Otherwise, we would
166+
// try to access an already shutdown objectstorage in fcob.
167+
cfgAvgNetworkDelay := config.Node().Int(CfgValueLayerFCOBAverageNetworkDelay)
168+
time.Sleep(time.Duration(cfgAvgNetworkDelay) * time.Second)
160169
_tangle.Shutdown()
161170
}, shutdown.PriorityTangle); err != nil {
162171
log.Panicf("Failed to start as daemon: %s", err)

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/go-ole/go-ole v1.2.4 // indirect
1313
github.com/golang/protobuf v1.4.3
1414
github.com/gorilla/websocket v1.4.2
15-
github.com/iotaledger/hive.go v0.0.0-20201203130604-bd82d648670e
15+
github.com/iotaledger/hive.go v0.0.0-20210107100912-23832b944f60
1616
github.com/labstack/echo v3.3.10+incompatible
1717
github.com/labstack/gommon v0.3.0
1818
github.com/magiconair/properties v1.8.1

go.sum

+4-2
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,10 @@ github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:q
402402
github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
403403
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
404404
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
405-
github.com/iotaledger/hive.go v0.0.0-20201203130604-bd82d648670e h1:ZfkyczJhHUdhfnLiF0WKg9jR7412jLcvmgb9sm3ztcs=
406-
github.com/iotaledger/hive.go v0.0.0-20201203130604-bd82d648670e/go.mod h1:dFt9vuTF3FdDPx7ve+uSDiNrX2PW2eV8sq7N06jeaFw=
405+
github.com/iotaledger/hive.go v0.0.0-20201227184142-db5fe673cf03 h1:Rp09uTVNT8PXwotXsEu9rNHEq6j3+7tmIXJ/+ypyrVA=
406+
github.com/iotaledger/hive.go v0.0.0-20201227184142-db5fe673cf03/go.mod h1:dFt9vuTF3FdDPx7ve+uSDiNrX2PW2eV8sq7N06jeaFw=
407+
github.com/iotaledger/hive.go v0.0.0-20210107100912-23832b944f60 h1:hL9q5ANv6las2s/bZrA7/7UVhl8oADs+WWepkK++6v4=
408+
github.com/iotaledger/hive.go v0.0.0-20210107100912-23832b944f60/go.mod h1:dFt9vuTF3FdDPx7ve+uSDiNrX2PW2eV8sq7N06jeaFw=
407409
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
408410
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
409411
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=

pkged.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/analysis/dashboard/frontend/yarn.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -3395,9 +3395,9 @@ [email protected]:
33953395
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
33963396

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

34023402
inquirer@^0.12.0:
34033403
version "0.12.0"

plugins/autopeering/parameters.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ const (
1313

1414
func init() {
1515
flag.StringSlice(CfgEntryNodes, []string{"[email protected]:15626", "5EDH4uY78EA6wrBkHHAVBWBMDt7EcksRq6pjzipoW15B@entrynode.alphanet.tanglebay.org:14656"}, "list of trusted entry nodes for auto peering")
16-
flag.Int(CfgNetworkVersion, 12, "autopeering network version")
16+
flag.Int(CfgNetworkVersion, 13, "autopeering network version")
1717
}

plugins/banner/plugin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var (
1717
once sync.Once
1818

1919
// AppVersion version number
20-
AppVersion = "v0.3.4"
20+
AppVersion = "v0.3.5"
2121
// SimplifiedAppVersion is the version number without commit hash
2222
SimplifiedAppVersion = simplifiedVersion(AppVersion)
2323
)

plugins/consensus/opiniongiver.go

+7-10
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ type OpinionGivers map[identity.ID]OpinionGiver
3434
// Query retrievs the opinions about the given conflicts and timestamps.
3535
func (o *OpinionGiver) Query(ctx context.Context, conflictIDs []string, timestampIDs []string) (opinions vote.Opinions, err error) {
3636
for i := 0; i < waitForStatement; i++ {
37-
opinions, err = o.view.Query(ctx, conflictIDs, timestampIDs)
38-
if err == nil {
39-
return opinions, nil
37+
if o.view != nil {
38+
opinions, err = o.view.Query(ctx, conflictIDs, timestampIDs)
39+
if err == nil {
40+
return opinions, nil
41+
}
4042
}
4143
time.Sleep(time.Second)
4244
}
@@ -67,21 +69,16 @@ func OpinionGiverFunc() (givers []vote.OpinionGiver, err error) {
6769
continue
6870
}
6971
if _, ok := opinionGiversMap[p.ID()]; !ok {
70-
v := Registry().NodeView(p.ID())
7172
opinionGiversMap[p.ID()] = &OpinionGiver{
7273
id: p.ID(),
73-
view: v,
74+
view: nil,
7475
}
7576
}
7677
opinionGiversMap[p.ID()].pog = &PeerOpinionGiver{p: p}
7778
}
7879

7980
for _, v := range opinionGiversMap {
80-
opinionGivers = append(opinionGivers, &OpinionGiver{
81-
id: v.id,
82-
view: v.view,
83-
pog: v.pog,
84-
})
81+
opinionGivers = append(opinionGivers, v)
8582
}
8683

8784
return opinionGivers, nil

plugins/dashboard/frontend/src/app/components/ExplorerAddressResult.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class ExplorerAddressQueryResult extends React.Component<Props, any> {
133133
}
134134
return (
135135
<Container>
136-
<h3>Address {addr !== null && <span>({addr.output_ids.length} Ouputs)</span>}</h3>
136+
<h3>Address {addr !== null && <span>({addr.output_ids.length} Outputs)</span>}</h3>
137137
<p>
138138
{id} {' '}
139139
</p>

plugins/dashboard/frontend/src/app/components/Root.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export class Root extends React.Component<Props, any> {
9090
<Route exact path="/drng" component={Drng}/>
9191
<Route exact path="/explorer" component={Explorer}/>
9292
<Route exact path="/visualizer" component={Visualizer}/>
93+
<Route exact path="/visualizer/history" component={Visualizer}/>
9394
<Route exact path="/faucet" component={Faucet}/>
9495
<Redirect to="/dashboard"/>
9596
</Switch>

plugins/dashboard/frontend/src/app/stores/VisualizerStore.ts

+39-35
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export class TipInfo {
1616
is_tip: boolean;
1717
}
1818

19+
class history {
20+
vertices: Array<Vertex>;
21+
}
22+
1923
const vertexSize = 20;
2024

2125
export class VisualizerStore {
@@ -24,7 +28,7 @@ export class VisualizerStore {
2428
@observable solid_count = 0;
2529
@observable tips_count = 0;
2630
verticesIncomingOrder = [];
27-
collect: boolean = false;
31+
draw: boolean = false;
2832
routerStore: RouterStore;
2933

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

4650
constructor(routerStore: RouterStore) {
4751
this.routerStore = routerStore;
52+
this.fetchHistory();
4853
registerHandler(WSMsgType.Vertex, this.addVertex);
49-
registerHandler(WSMsgType.TipInfo, this.addTipInfo);
54+
registerHandler(WSMsgType.TipInfo, this.addTipInfo);
55+
}
56+
57+
fetchHistory = async () => {
58+
try {
59+
let res = await fetch(`/api/visualizer/history`);
60+
let history: history = await res.json();
61+
history.vertices.forEach(v => {
62+
this.addVertex(v);
63+
});
64+
} catch (err) {
65+
console.log("Fail to fetch history in visualizer", err);
66+
}
67+
return
5068
}
5169

5270
@action
@@ -87,9 +105,7 @@ export class VisualizerStore {
87105
}
88106

89107
@action
90-
addVertex = (vert: Vertex) => {
91-
if (!this.collect) return;
92-
108+
addVertex = (vert: Vertex) => {
93109
let existing = this.vertices.get(vert.id);
94110
if (existing) {
95111
// can only go from unsolid to solid
@@ -108,35 +124,16 @@ export class VisualizerStore {
108124
}
109125
this.verticesIncomingOrder.push(vert.id);
110126
this.checkLimit();
111-
112-
if (vert.strongParentIDs) {
113-
// clear tip status of strong and weak parents
114-
vert.strongParentIDs.forEach((value, index) => {
115-
let strongParentVert = this.vertices.get(value);
116-
if (strongParentVert) {
117-
strongParentVert.is_tip = false;
118-
this.vertices.set(strongParentVert.id, strongParentVert)
119-
}
120-
});
121-
}
122-
if (vert.weakParentIDs) {
123-
vert.weakParentIDs.forEach((value, index) => {
124-
let weakParentVert = this.vertices.get(value);
125-
if (weakParentVert) {
126-
weakParentVert.is_tip = false;
127-
this.vertices.set(weakParentVert.id, weakParentVert)
128-
}
129-
});
130-
}
131127
}
132128

133129
this.vertices.set(vert.id, vert);
134-
this.drawVertex(vert);
130+
if (this.draw) {
131+
this.drawVertex(vert);
132+
}
135133
};
136134

137135
@action
138136
addTipInfo = (tipInfo: TipInfo) => {
139-
if (!this.collect) return;
140137
let vert = this.vertices.get(tipInfo.id);
141138
if (!vert) {
142139
// create a new empty one for now
@@ -148,7 +145,9 @@ export class VisualizerStore {
148145
this.tips_count += tipInfo.is_tip ? 1 : vert.is_tip ? -1 : 0;
149146
vert.is_tip = tipInfo.is_tip;
150147
this.vertices.set(vert.id, vert);
151-
this.drawVertex(vert);
148+
if (this.draw) {
149+
this.drawVertex(vert);
150+
}
152151
};
153152

154153
@action
@@ -161,7 +160,9 @@ export class VisualizerStore {
161160
this.clearSelected();
162161
}
163162
this.vertices.delete(deleteId);
164-
this.graph.removeNode(deleteId);
163+
if (this.draw) {
164+
this.graph.removeNode(deleteId);
165+
}
165166
if (!vert) {
166167
continue;
167168
}
@@ -198,7 +199,9 @@ export class VisualizerStore {
198199
}
199200
this.vertices.delete(approveeId);
200201
}
201-
this.graph.removeNode(approveeId);
202+
if (this.draw) {
203+
this.graph.removeNode(approveeId);
204+
}
202205
}
203206

204207
drawVertex = (vert: Vertex) => {
@@ -243,7 +246,7 @@ export class VisualizerStore {
243246
}
244247

245248
start = () => {
246-
this.collect = true;
249+
this.draw = true;
247250
this.graph = Viva.Graph.graph();
248251

249252
let graphics: any = Viva.Graph.View.webglGraphics();
@@ -280,17 +283,18 @@ export class VisualizerStore {
280283
});
281284
this.graphics = graphics;
282285
this.renderer.run();
286+
287+
this.vertices.forEach((vertex) => {
288+
this.drawVertex(vertex)
289+
})
283290
}
284291

285292
stop = () => {
286-
this.collect = false;
293+
this.draw = false;
287294
this.renderer.dispose();
288295
this.graph = null;
289296
this.paused = false;
290297
this.selected = null;
291-
this.solid_count = 0;
292-
this.tips_count = 0;
293-
this.vertices.clear();
294298
}
295299

296300
@action

plugins/dashboard/frontend/yarn.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -3580,9 +3580,9 @@ [email protected]:
35803580
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
35813581

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

35873587
internal-ip@^4.3.0:
35883588
version "4.3.0"

plugins/dashboard/routes.go

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func setupRoutes(e *echo.Echo) {
8989

9090
setupExplorerRoutes(apiRoutes)
9191
setupFaucetRoutes(apiRoutes)
92+
setupVisualizerRoutes(apiRoutes)
9293

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

0 commit comments

Comments
 (0)