Skip to content

Commit 355c839

Browse files
committed
Merge tag 'v0.4.2' into event_trigger
riemann mainnet release
2 parents d5aa2ac + 757273c commit 355c839

File tree

136 files changed

+14512
-702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+14512
-702
lines changed

.github/workflows/build.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This matrix builds VSYS with various JDKs and will be expanded to cover many more cases.
2+
3+
name: Build VSYS
4+
on: [push,pull_request]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: install scala
12+
run: |
13+
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
14+
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
15+
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
16+
sudo apt-get update
17+
sudo apt-get install sbt
18+
19+
- uses: actions/checkout@v2
20+
21+
- name: Build and Package
22+
run: sbt packageAll
23+
24+
25+

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,9 @@ test/*/data/*
4848
src/test/**/.DS_Store
4949

5050
*.sublime-*
51+
52+
# metals
53+
.metals/
54+
.bloop/
55+
.ammonite/
56+
project/metals.sbt

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ enablePlugins(sbtdocker.DockerPlugin, JavaServerAppPackaging, JDebPackaging, Sys
77

88
name := "vsys"
99
organization := "systems.v"
10-
version := "0.3.1"
10+
version := "0.4.2"
1111
scalaVersion in ThisBuild := "2.12.6"
1212
crossPaths := false
1313
publishArtifact in (Compile, packageDoc) := false

project/Dependencies.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ object Dependencies {
4646
)
4747

4848
lazy val logging = Seq(
49-
"ch.qos.logback" % "logback-classic" % "1.2.3",
49+
"ch.qos.logback" % "logback-classic" % "1.2.9",
5050
"org.slf4j" % "slf4j-api" % "1.7.25",
5151
"org.slf4j" % "jul-to-slf4j" % "1.7.25",
5252
"net.logstash.logback" % "logstash-logback-encoder" % "4.11"

project/plugins.sbt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resolvers ++= Seq(
2-
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
3-
"Artima Maven Repository" at "http://repo.artima.com/releases",
2+
"Typesafe repository" at "https://repo.scala-sbt.org",
3+
"Artima Maven Repository" at "https://repo.artima.com/releases",
44
"JBoss" at "https://repository.jboss.org",
55
Resolver.sbtPluginRepo("releases")
66
)

src/main/resources/application.conf

+7-6
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ vsys {
2828
# In some cases, you may both set `decalred-address` and enable UPnP (e.g. when IGD can't reliably determine its
2929
# external IP address). In such cases the node will attempt to configure an IGD to pass traffic from external port
3030
# to `bind-address:port`. Please note, however, that this setup is not recommended.
31-
# declared-address = "1.2.3.4:9923"
31+
# declared-address = "1.2.3.4:9921"
3232

3333
# Network address
3434
bind-address = "0.0.0.0"
3535

3636
# Port number
37-
port = 9923
37+
port = 9921
3838

3939
# Node name to send during handshake. Comment this string out to set random node name.
4040
# node-name = "default-node-name"
@@ -43,7 +43,7 @@ vsys {
4343
# nonce = 0
4444

4545
# List of IP addresses of well known nodes.
46-
known-peers = []
46+
known-peers = ["gemmer.vcoin.systems:9921","vnode.vcoin.systems:9921","gemmer.vos.systems:9921","vnode.vos.systems:9921"]
4747

4848
# How long the information about peer stays in database after the last communication with it
4949
peers-data-residence-time = 1d
@@ -110,8 +110,8 @@ vsys {
110110
# Min buffer size. Fast rollback is possible up to this value.
111111
minimum-in-memory-diff-blocks = 3600
112112

113-
# Blockchain type. Could be TESTNET | MAINNET | CUSTOM. Default value is TESTNET.
114-
type = TESTNET
113+
# Blockchain type. Could be TESTNET | MAINNET | CUSTOM. Default value is MAINNET.
114+
type = MAINNET
115115

116116
# 'custom' section present only if CUSTOM blockchain type is set. It's impossible to overwrite predefined 'testnet' and 'mainnet' configurations.
117117
# custom {
@@ -159,7 +159,8 @@ vsys {
159159
# !IMPORTANT if you change the settings below in state, rebuilding of state is required, which means you need to clean the data and resync the block at current version
160160
state {
161161
# turn on/off the state of transactions grouped by address and transaction type
162-
tx-type-account-tx-ids = on
162+
tx-type-account-tx-ids = off
163+
tx-contract-tx-ids = off
163164
}
164165
}
165166

src/main/scala/vsys/Application.scala

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class Application(val actorSystem: ActorSystem, val settings: VsysSettings) exte
153153
// on unexpected shutdown
154154
sys.addShutdownHook {
155155
network.shutdown()
156+
peerDatabase.close()
156157
shutdown()
157158
}
158159

src/main/scala/vsys/api/http/BlocksApiRoute.scala

+33-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package vsys.api.http
22

33
import javax.ws.rs.Path
4-
54
import akka.http.scaladsl.marshalling.ToResponseMarshallable
65
import akka.http.scaladsl.server.Route
76
import io.netty.channel.group.ChannelGroup
@@ -13,7 +12,6 @@ import vsys.blockchain.state.ByteStr
1312
import vsys.blockchain.transaction.TransactionParser
1413
import vsys.network._
1514
import vsys.settings.{CheckpointsSettings, RestAPISettings}
16-
1715
import scala.concurrent.ExecutionContext.Implicits.global
1816
import scala.concurrent.Future
1917

@@ -31,7 +29,10 @@ case class BlocksApiRoute(settings: RestAPISettings, checkpointsSettings: Checkp
3129
}
3230

3331
@Path("/address/{address}/{from}/{to}")
34-
@ApiOperation(value = "Address", notes = "Get list of blocks generated by specified address", httpMethod = "GET")
32+
@ApiOperation(value = "Address", notes = "Get a block list generated by a specified `address` and a block height range (`from`/`to`)", httpMethod = "GET")
33+
@ApiResponses(Array(
34+
new ApiResponse(code = 200, message = "Json response of the block list or error")
35+
))
3536
@ApiImplicitParams(Array(
3637
new ApiImplicitParam(name = "from", value = "Start block height", required = true, dataType = "integer", paramType = "path"),
3738
new ApiImplicitParam(name = "to", value = "End block height", required = true, dataType = "integer", paramType = "path"),
@@ -52,10 +53,13 @@ case class BlocksApiRoute(settings: RestAPISettings, checkpointsSettings: Checkp
5253
}
5354

5455
@Path("/child/{signature}")
55-
@ApiOperation(value = "Child", notes = "Get children of specified block", httpMethod = "GET")
56+
@ApiOperation(value = "Child", notes = "Get children of a specified block by the base58-encoded `signature`", httpMethod = "GET")
5657
@ApiImplicitParams(Array(
5758
new ApiImplicitParam(name = "signature", value = "Base58-encoded signature", required = true, dataType = "string", paramType = "path")
5859
))
60+
@ApiResponses(Array(
61+
new ApiResponse(code = 200, message = "Json response of the child block information or error")
62+
))
5963
def child: Route = (path("child" / Segment) & get) { encodedSignature =>
6064
withBlock(history, encodedSignature) { block =>
6165
complete(history.child(block).map(_.json + ("transaction count" -> Json.toJson(block.transactionData.length))).getOrElse[JsObject](
@@ -65,7 +69,7 @@ case class BlocksApiRoute(settings: RestAPISettings, checkpointsSettings: Checkp
6569

6670
@Path("/delay/{signature}/{blockNum}")
6771
@ApiOperation(value = "Average delay",
68-
notes = "Average delay in milliseconds between last `blockNum` blocks starting from block with `signature`", httpMethod = "GET")
72+
notes = "Get the average delay in milliseconds between last `blockNum` blocks starting from block with `signature`", httpMethod = "GET", response = classOf[Long])
6973
@ApiImplicitParams(Array(
7074
new ApiImplicitParam(name = "signature", value = "Base58-encoded signature", required = true, dataType = "string", paramType = "path"),
7175
new ApiImplicitParam(name = "blockNum", value = "Number of blocks to count delay", required = true, dataType = "string", paramType = "path")
@@ -78,7 +82,7 @@ case class BlocksApiRoute(settings: RestAPISettings, checkpointsSettings: Checkp
7882
}
7983

8084
@Path("/height/{signature}")
81-
@ApiOperation(value = "Height", notes = "Get height of a block by its Base58-encoded signature", httpMethod = "GET")
85+
@ApiOperation(value = "Height", notes = "Get the **block height** by its Base58-encoded `signature`", httpMethod = "GET", response = classOf[Int])
8286
@ApiImplicitParams(Array(
8387
new ApiImplicitParam(name = "signature", value = "Base58-encoded signature", required = true, dataType = "string", paramType = "path")
8488
))
@@ -95,13 +99,16 @@ case class BlocksApiRoute(settings: RestAPISettings, checkpointsSettings: Checkp
9599
}
96100

97101
@Path("/height")
98-
@ApiOperation(value = "Height", notes = "Get blockchain height", httpMethod = "GET")
102+
@ApiOperation(value = "Height", notes = "Get blockchain height", httpMethod = "GET", response=classOf[Int])
99103
def height: Route = (path("height") & get) {
100104
complete(Json.obj("height" -> history.height()))
101105
}
102106

103107
@Path("/at/{height}")
104-
@ApiOperation(value = "At", notes = "Get block at specified height", httpMethod = "GET")
108+
@ApiOperation(value = "At", notes = "Get block at specified `height`", httpMethod = "GET")
109+
@ApiResponses(Array(
110+
new ApiResponse(code = 200, message = "Json response of a block details at a specified height or error")
111+
))
105112
@ApiImplicitParams(Array(
106113
new ApiImplicitParam(name = "height", value = "Block height", required = true, dataType = "integer", paramType = "path")
107114
))
@@ -113,7 +120,10 @@ case class BlocksApiRoute(settings: RestAPISettings, checkpointsSettings: Checkp
113120
}
114121

115122
@Path("/seq/{from}/{to}")
116-
@ApiOperation(value = "Seq", notes = "Get block at specified heights", httpMethod = "GET")
123+
@ApiOperation(value = "Seq", notes = "Get block at the specified height range (`from`/`to`)", httpMethod = "GET")
124+
@ApiResponses(Array(
125+
new ApiResponse(code = 200, message = "Json response of the block list or error")
126+
))
117127
@ApiImplicitParams(Array(
118128
new ApiImplicitParam(name = "from", value = "Start block height", required = true, dataType = "integer", paramType = "path"),
119129
new ApiImplicitParam(name = "to", value = "End block height", required = true, dataType = "integer", paramType = "path")
@@ -130,21 +140,30 @@ case class BlocksApiRoute(settings: RestAPISettings, checkpointsSettings: Checkp
130140

131141

132142
@Path("/last")
133-
@ApiOperation(value = "Last", notes = "Get last block data", httpMethod = "GET")
143+
@ApiOperation(value = "Last", notes = "Get the **last block** data", httpMethod = "GET")
144+
@ApiResponses(Array(
145+
new ApiResponse(code = 200, message = "Json response of the last block information or error")
146+
))
134147
def last: Route = (path("last") & get) {
135148
val height = history.height()
136149
val lastBlock = history.blockAt(height).get
137150
complete(lastBlock.json + ("height" -> Json.toJson(height)) + ("transaction count" -> Json.toJson(lastBlock.transactionData.length)))
138151
}
139152

140153
@Path("/first")
141-
@ApiOperation(value = "First", notes = "Get genesis block data", httpMethod = "GET")
154+
@ApiOperation(value = "First", notes = "Get the **genesis block** data", httpMethod = "GET")
155+
@ApiResponses(Array(
156+
new ApiResponse(code = 200, message = "Json response of the first block details or error")
157+
))
142158
def first: Route = (path("first") & get) {
143159
complete(history.genesis.json + ("height" -> Json.toJson(1)) + ("transaction count" -> Json.toJson(history.genesis.transactionData.length)))
144160
}
145161

146162
@Path("/signature/{signature}")
147-
@ApiOperation(value = "Signature", notes = "Get block by a specified Base58-encoded signature", httpMethod = "GET")
163+
@ApiOperation(value = "Signature", notes = "Get block by a specified Base58-encoded `signature`", httpMethod = "GET")
164+
@ApiResponses(Array(
165+
new ApiResponse(code = 200, message = "Json response of the block details or error")
166+
))
148167
@ApiImplicitParams(Array(
149168
new ApiImplicitParam(name = "signature", value = "Base58-encoded signature", required = true, dataType = "string", paramType = "path")
150169
))
@@ -159,13 +178,13 @@ case class BlocksApiRoute(settings: RestAPISettings, checkpointsSettings: Checkp
159178
}
160179

161180
@Path("/checkpoint")
162-
@ApiOperation(value = "Checkpoint", notes = "Broadcast checkpoint of blocks", httpMethod = "POST")
181+
@ApiOperation(value = "Checkpoint", notes = "Broadcast the checkpoint of blocks", httpMethod = "POST")
163182
@ApiImplicitParams(Array(
164183
new ApiImplicitParam(name = "message", value = "Checkpoint message", required = true, paramType = "body",
165184
dataType = "vsys.network.Checkpoint")
166185
))
167186
@ApiResponses(Array(
168-
new ApiResponse(code = 200, message = "Json with response or error")
187+
new ApiResponse(code = 200, message = "Successful Operation")
169188
))
170189
def checkpoint: Route = (path("checkpoint") & post) {
171190
json[Checkpoint] { checkpoint =>

src/main/scala/vsys/api/http/NodeApiRoute.scala

+9-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ case class NodeApiRoute(settings: RestAPISettings,
2424
}
2525

2626
@Path("/version")
27-
@ApiOperation(value = "Version", notes = "Get VSYS node version", httpMethod = "GET")
27+
@ApiOperation(value = "Version", notes = "Get VSYS node version", httpMethod = "GET", response = classOf[String])
2828
@ApiResponses(Array(
29-
new ApiResponse(code = 200, message = "Json VSYS node version")
29+
new ApiResponse(code = 200, message = "Json response of VSYS node version")
3030
))
3131
def version: Route = (get & path("version")) {
3232
complete(Json.obj("version" -> Constants.AgentName))
@@ -35,14 +35,20 @@ case class NodeApiRoute(settings: RestAPISettings,
3535
@Path("/stop")
3636
@ApiOperation(value = "Stop", notes = "Stop the node", httpMethod = "POST",
3737
authorizations = Array(new Authorization("api_key")))
38+
@ApiResponses(Array(
39+
new ApiResponse(code = 200, message = "Successful Operation")
40+
))
3841
def stop: Route = (post & path("stop") & withAuth) {
3942
log.info("Request to stop application")
4043
application.shutdown()
4144
complete(Json.obj("stopped" -> true))
4245
}
4346

4447
@Path("/status")
45-
@ApiOperation(value = "Status", notes = "Get status of the running core", httpMethod = "GET")
48+
@ApiOperation(value = "Status", notes = "Get **status** of the running core", httpMethod = "GET")
49+
@ApiResponses(Array(
50+
new ApiResponse(code = 200, message = "Json response of the node status or error")
51+
))
4652
def status: Route = (get & path("status")) {
4753
val lastUpdated = history.lastBlock.get.timestamp
4854
complete(

src/main/scala/vsys/api/http/PeersApiRoute.scala

+14-12
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ case class PeersApiRoute(
2929
}
3030

3131
@Path("/all")
32-
@ApiOperation(value = "Peer list", notes = "Peer list", httpMethod = "GET")
32+
@ApiOperation(value = "Peer list", notes = "Get the peer list", httpMethod = "GET")
3333
@ApiResponses(Array(
34-
new ApiResponse(code = 200, message = "Json with peer list or error")
34+
new ApiResponse(code = 200, message = "Json response of a peer list or error")
3535
))
3636
def allPeers: Route = (path("all") & get) {
3737
complete(Json.obj("peers" ->
@@ -44,9 +44,9 @@ case class PeersApiRoute(
4444
}
4545

4646
@Path("/connected")
47-
@ApiOperation(value = "Connected peers list", notes = "Connected peers list", httpMethod = "GET")
47+
@ApiOperation(value = "Connected peers list", notes = "Get the connected peers list", httpMethod = "GET")
4848
@ApiResponses(Array(
49-
new ApiResponse(code = 200, message = "Json with connected peers or error")
49+
new ApiResponse(code = 200, message = "Json response of a connected peers list or error")
5050
))
5151
def connectedPeers: Route = (path("connected") & get) {
5252
val peers = establishedConnections.values().stream().map[JsValue](pi => Json.obj(
@@ -64,14 +64,16 @@ case class PeersApiRoute(
6464
@Path("/connect")
6565
@ApiOperation(value = "Connect to peer", notes = "Connect to peer", httpMethod = "POST",
6666
authorizations = Array(new Authorization("api_key")))
67+
@ApiResponses(Array(
68+
new ApiResponse(code = 200, message = "Successful Operation")
69+
))
6770
@ApiImplicitParams(Array(
6871
new ApiImplicitParam(
6972
name = "body",
70-
value = "Json with data",
73+
value = "Peer host settings",
7174
required = true,
7275
paramType = "body",
73-
dataType = "string",
74-
defaultValue = "{\n\t\"host\":\"127.0.0.1\",\n\t\"port\":\"9084\"\n}"
76+
dataType = "vsys.network.PeerNetworkConnection",
7577
)
7678
))
7779
def connect: Route = (path("connect") & post & withAuth) {
@@ -84,10 +86,10 @@ case class PeersApiRoute(
8486
}
8587

8688
@Path("/blacklisted")
87-
@ApiOperation(value = "Blacklisted peers list", notes = "Blacklisted peers list", httpMethod = "GET")
89+
@ApiOperation(value = "Blacklisted peers list", notes = "Get the blacklisted peers list", httpMethod = "GET")
8890
@ApiResponses(
8991
Array(
90-
new ApiResponse(code = 200, message = "Json with blacklisted peers or error")
92+
new ApiResponse(code = 200, message = "Json response of the blacklisted peers or error")
9193
))
9294
def blacklistedPeers: Route = (path("blacklisted") & get) {
9395
complete(
@@ -99,10 +101,10 @@ case class PeersApiRoute(
99101
}
100102

101103
@Path("/suspended")
102-
@ApiOperation(value = "Suspended peers list", notes = "Suspended peers list", httpMethod = "GET")
104+
@ApiOperation(value = "Suspended peers list", notes = "Get the suspended peers list", httpMethod = "GET")
103105
@ApiResponses(
104106
Array(
105-
new ApiResponse(code = 200, message = "JSON with suspended peers or error")
107+
new ApiResponse(code = 200, message = "JSON response of a suspended peer list or error")
106108
))
107109
def suspendedPeers: Route = (path("suspended") & get) {
108110
complete(
@@ -115,7 +117,7 @@ case class PeersApiRoute(
115117
authorizations = Array(new Authorization("api_key")))
116118
@ApiResponses(
117119
Array(
118-
new ApiResponse(code = 200, message = "200")
120+
new ApiResponse(code = 200, message = "Successful Operation")
119121
))
120122
def clearBlacklist: Route = (path("clearblacklist") & post & withAuth) {
121123
peerDatabase.clearBlacklist()

0 commit comments

Comments
 (0)