Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec-555 #294

Merged
merged 56 commits into from Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
25c0600
initial
GusevTimofey Feb 21, 2019
fbfa370
proto files
GusevTimofey Feb 22, 2019
588bc5d
added full block-header-payload protobuf schema
GusevTimofey Feb 23, 2019
cf7c881
added to/from proto to header
GusevTimofey Feb 23, 2019
70c068c
added transactions proto serializers
GusevTimofey Feb 24, 2019
3f1db55
some additions
GusevTimofey Feb 25, 2019
4e0dd37
added tests for all added modifiers
GusevTimofey Feb 25, 2019
9e77a89
added boxes proto + test for it
GusevTimofey Feb 25, 2019
bbcf8ce
benches, tests, improvements
GusevTimofey Feb 25, 2019
9a5e9d3
added proto classes for the network message
GusevTimofey Feb 26, 2019
f84a73e
some additions
GusevTimofey Feb 26, 2019
629dfe6
some additions
GusevTimofey Feb 26, 2019
17bc010
reworked all network messages
GusevTimofey Feb 28, 2019
79c4153
some additions
GusevTimofey Feb 28, 2019
9ae326b
some additions
GusevTimofey Mar 1, 2019
d01c416
some additions
GusevTimofey Mar 1, 2019
af3632f
added completed tests for all proto serializers
GusevTimofey Mar 3, 2019
58dbada
fixed twice compilation error
GusevTimofey Mar 3, 2019
6ecc660
fixed twice compilation error
GusevTimofey Mar 3, 2019
887290e
some additions
GusevTimofey Mar 4, 2019
0acfd11
some additions
GusevTimofey Mar 4, 2019
1abbceb
loggers
GusevTimofey Mar 4, 2019
1844efe
loggers
GusevTimofey Mar 4, 2019
e002eef
loggers
GusevTimofey Mar 4, 2019
b69320e
loggers
GusevTimofey Mar 4, 2019
a6b8e11
loggers
GusevTimofey Mar 4, 2019
d181170
loggers
GusevTimofey Mar 4, 2019
ae8ee75
loggers
GusevTimofey Mar 4, 2019
87cf78a
loggers
GusevTimofey Mar 4, 2019
9aac38d
loggers
GusevTimofey Mar 4, 2019
567b2be
loggers
GusevTimofey Mar 4, 2019
2b93add
fix
GusevTimofey Mar 4, 2019
a03be3c
some additions
GusevTimofey Mar 4, 2019
0c87442
logging
GusevTimofey Mar 5, 2019
320b634
logging
GusevTimofey Mar 5, 2019
4df3294
fix docker
GusevTimofey Mar 5, 2019
571fc87
fix docker
GusevTimofey Mar 5, 2019
692ca30
code cleanup
GusevTimofey Mar 7, 2019
88da3a9
code cleanup
GusevTimofey Mar 7, 2019
70d1451
code cleanup
GusevTimofey Mar 7, 2019
302a56d
code cleanup
GusevTimofey Mar 7, 2019
695f24f
removed EQUIHASH from header's proto
GusevTimofey Mar 7, 2019
50df7e1
jenkins
GusevTimofey Mar 7, 2019
8f37e8d
jenkins!
GusevTimofey Mar 7, 2019
bd1b80e
JENKINS!!!!!!!!!!!!
GusevTimofey Mar 7, 2019
e630587
JENKINS
GusevTimofey Mar 7, 2019
f987db6
JENKINS
GusevTimofey Mar 7, 2019
d09b7bd
docker
GusevTimofey Mar 7, 2019
d75bef8
removed EQUIHASH from header's proto
GusevTimofey Mar 7, 2019
f5cb281
jenkins
GusevTimofey Mar 7, 2019
584e0fb
fix
GusevTimofey Mar 7, 2019
322d3a8
fix
GusevTimofey Mar 7, 2019
241f790
fix sync
GusevTimofey Mar 7, 2019
cc46d9e
code cleanup
GusevTimofey Mar 11, 2019
bc3e613
minor update
GusevTimofey Mar 11, 2019
622b3f8
cleanup tests
GusevTimofey Mar 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions benchmarks/src/main/resources/application.conf
Expand Up @@ -16,17 +16,17 @@ encry.benchmark {
bytesQty = 999
}
benchesSettings {
warmUpIterations = 1
measurementIterations = 1
warmUpIterations = 3
measurementIterations = 3
measurementTime = 500
warmUpTime = 500
}
stateBenchSettings {
totalBoxesNumber = 1000
totalBoxesNumber = 100000
blocksNumber = 10
transactionsNumberInEachBlock = 1
numberOfInputsInOneTransaction = 1
numberOfOutputsInOneTransaction = 1
transactionsNumberInEachBlock = 1000
numberOfInputsInOneTransaction = 10
numberOfOutputsInOneTransaction = 10
}
historyBenchSettings {
blocksNumber = 100
Expand Down
21 changes: 14 additions & 7 deletions build.sbt
@@ -1,12 +1,15 @@
import sbt._
import sbt.Def
import sbt.Keys.version

lazy val settings = Seq(
val settings: Seq[Def.Setting[String]] = Seq(
name := "EncryCore",
version := "0.9.3",
organization := "org.encryfoundation",
scalaVersion := "2.12.6"
)

val encry = (project in file(".")).settings(settings: _*)

val akkaVersion = "2.5.13"
val akkaHttpVersion = "10.0.9"
val doobieVersion = "0.5.2"
Expand Down Expand Up @@ -73,7 +76,7 @@ libraryDependencies ++= Seq(
"commons-net" % "commons-net" % "3.6",
"com.spotify" % "docker-client" % "8.11.0" % "test" classifier "shaded",
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-properties" % "2.9.6",
"com.fasterxml.jackson.core"% "jackson-databind" % "2.9.6",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.6",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.9.6",
"org.asynchttpclient" % "async-http-client" % "2.4.7",
"com.spotify" % "docker-client" % "8.11.3",
Expand All @@ -83,7 +86,8 @@ libraryDependencies ++= Seq(
"org.aspectj" % "aspectjweaver" % "1.9.2",
"org.typelevel" % "cats-core_2.12" % "1.0.1",
"org.typelevel" % "cats-kernel_2.12" % "1.0.1",
"org.typelevel" % "cats-macros_2.12" % "1.0.1"
"org.typelevel" % "cats-macros_2.12" % "1.0.1",
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
) ++ databaseDependencies ++ apiDependencies ++ loggingDependencies ++ testingDependencies ++ monitoringDependencies

resolvers ++= Seq("Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/",
Expand Down Expand Up @@ -124,7 +128,7 @@ assemblyJarName in assembly := "EncryCore.jar"

mainClass in assembly := Some("encry.EncryApp")

test in assembly := { }
test in assembly := {}

assemblyMergeStrategy in assembly := {
case "logback.xml" => MergeStrategy.first
Expand All @@ -151,8 +155,11 @@ sourceGenerators in Compile += Def.task {
Seq(versionFile)
}

val encry = (project in file(".")).settings(settings: _*)
lazy val it = project.dependsOn(encry)
lazy val benchmarks = (project in file("benchmarks"))
.dependsOn(encry % "compile->compile;test->test")
.enablePlugins(JmhPlugin)
.enablePlugins(JmhPlugin)

PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value / "protobuf"
)
87 changes: 36 additions & 51 deletions it/src/main/resources/template.conf
Expand Up @@ -16,7 +16,7 @@
# Is the node is doing mining
mining = true
# Number of threads should be used for mining
numberOfMiningWorkers = 1
numberOfMiningWorkers = 3
# If true, a node generates blocks being offline. The only really useful case for it probably is to start a new
# blockchain
offlineGeneration = false
Expand All @@ -28,33 +28,38 @@
useCli = true
loggingMode = "file"
}
// Set main db to node componet. Now avaliable iodb or LevelDb
storage {
state = "iodb"
auxHistory = "iodb"
history = "iodb"
}
wallet {
password = ""
seed = "index another island accuse valid aerobic little absurd bunker keep insect scissors"
password = "encry"
}
levelDb {
enableSave = true
enableRestore = false
batchSize = 1000
levelDB {
maxVersions = 100
}
network {
bindAddress = "0.0.0.0:9001"
networkChunkSize = 1000
nodeName = "node123"
localOnly = false
knownPeers = []
knownPeers = ["172.16.11.11:9001", "172.16.11.12:9001", "172.16.11.13:9001", "172.16.11.14:9001",
"172.16.11.15:9001", "172.16.11.16:9001", "172.16.11.17:9001", "172.16.11.18:9001",
"172.16.11.19:9001", "172.16.11.20:9001"]
maxConnections = 20
connectionTimeout = 1s
handshakeTimeout = 30s
connectOnlyWithKnownPeers = false
syncInterval = 15s
syncTimeout = 5s
syncPacketLength = 1000
deliveryTimeout = 5s
deliveryTimeout = 30s
maxDeliveryChecks = 5
appVersion = 0.9.3
maxInvObjects = 1000
modifierDeliverTimeCheck = 30s
modifierDeliverTimeCheck = 60s
updatePriorityTime = 10
}
restApi {
enabled = true
Expand All @@ -74,51 +79,23 @@
# Maximum number of transaction generated per one epoch, set to -1 to avoid limiting
limitPerEpoch = 100
}
monitoringSettings {
kamonEnabled = false
}
}
akka {
log-dead-letters = 0
log-dead-letters-during-shutdown = off
persistence.journal.plugin = akka.persistence.journal.leveldb
loggers = [ "akka.event.slf4j.Slf4jLogger" ]
logger-startup-timeout = 60s
actor.warn-about-java-serializer-usage = false
persistence {
journal.leveldb {
class = "akka.persistence.journal.leveldb.LeveldbJournal"
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
replay-dispatcher = "akka.persistence.dispatchers.default-replay-dispatcher"
dir = "leveldb/journal"
fsync = on
checksum = off
native = on
compaction-intervals {}
}
snapshot-store.local {
class = "akka.persistence.snapshot.local.LocalSnapshotStore"
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
stream-dispatcher = "akka.persistence.dispatchers.default-stream-dispatcher"
dir = "leveldb/snapshots"
max-load-attempts = 3
}
}
actor {
serializers {
tx = "encry.modifiers.serialization.EncryTxSerializer"
proofs = "encry.modifiers.serialization.EncryProofsSerializer"
payload = "encry.modifiers.serialization.EncryPayloadSerializer"
header = "encry.modifiers.serialization.EncryHeaderSerializer"
}
serialization-bindings {
"encry.modifiers.mempool.Transaction" = tx
"encry.modifiers.history.ADProofs" = proofs
"encry.modifiers.history.Payload" = payload
"encry.modifiers.history.Header" = header
}
}
}
mining-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor.fixed-pool-size = 1
throughput = 1
thread-pool-executor.fixed-pool-size = 4
throughput = 4
}
mining-mailbox {
mailbox-type = "akka.dispatch.NonBlockingBoundedMailbox"
Expand All @@ -136,14 +113,22 @@
thread-pool-executor.fixed-pool-size = 1
throughput = 1
}
nvh-mailbox {
mailbox-type = "akka.dispatch.NonBlockingBoundedMailbox"
mailbox-capacity = 100000
}
kafka-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor.fixed-pool-size = 1
throughput = 1
}
}
aux-history-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor.fixed-pool-size = 2
throughput = 1
}
block-listener-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor.fixed-pool-size = 2
throughput = 1
}
}
4 changes: 4 additions & 0 deletions it/src/test/scala/encry/it/MinerWalletBalanceTest.scala
Expand Up @@ -4,10 +4,12 @@ import com.typesafe.config.Config
import encry.consensus.EncrySupplyController
import encry.it.configs.Configs
import encry.it.docker.NodesFromDocker
import encry.modifiers.state.box.{AssetBox, EncryBaseBox}
import encry.settings.Constants._
import encry.view.history.History.Height
import org.encryfoundation.common.Algos
import org.scalatest.{AsyncFunSuite, Matchers}

import scala.concurrent.Await
import scala.concurrent.duration._

Expand All @@ -26,6 +28,8 @@ class MinerWalletBalanceTest extends AsyncFunSuite with Matchers with NodesFromD

val height = dockerNodes().head.waitForHeadersHeight(heightToCheck)
Await.result(height, 30.minutes)
val boxes: Seq[EncryBaseBox] = Await.result(dockerNodes().head.outputs, 30.minutes)
val oneBox: AssetBox = boxes.collect { case ab: AssetBox => ab }.head
Copy link
Contributor

Choose a reason for hiding this comment

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

This val is not used anywhere (same as one above)

height map { _ =>
val res = Await.result(dockerNodes().head.balances, 30.minutes)
.find(_._1 == Algos.encode(IntrinsicTokenId))
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=1.1.1
sbt.version=1.1.2
3 changes: 3 additions & 0 deletions project/scalapb.sbt
@@ -0,0 +1,3 @@
addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.19")

libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.8.2"
15 changes: 15 additions & 0 deletions src/main/protobuf/BlockProto.proto
@@ -0,0 +1,15 @@
syntax = "proto3";
import "HeaderProto.proto";
import "PayloadProto.proto";

message BlockProtoMessage {

message AdProofsProtoMessage {
bytes headerId = 1;
bytes proofBytes = 2;
}

HeaderProtoMessage header = 1;
PayloadProtoMessage payload = 2;
AdProofsProtoMessage adProofsOpt = 3;
}
34 changes: 34 additions & 0 deletions src/main/protobuf/BoxesProto.proto
@@ -0,0 +1,34 @@
syntax = "proto3";

message BoxProtoMessage {

message TokenIdProto {
bytes tokenId = 1;
}

message AssetBoxProtoMessage {
bytes propositionProtoMessage = 1;
uint64 nonce = 2;
uint64 amount = 3;
TokenIdProto tokenId = 4;
}

message DataBoxProtoMessage {
bytes propositionProtoMessage = 1;
uint64 nonce = 2;
bytes data = 3;
}

message TokenIssuingBoxProtoMessage {
bytes propositionProtoMessage = 1;
uint64 nonce = 2;
uint64 amount = 3;
bytes tokenId = 4;
}

oneof box {
AssetBoxProtoMessage assetBox = 1;
DataBoxProtoMessage dataBox = 2;
TokenIssuingBoxProtoMessage tokenIssuingBox = 3;
}
}
15 changes: 15 additions & 0 deletions src/main/protobuf/HeaderProto.proto
@@ -0,0 +1,15 @@
syntax = "proto3";

message HeaderProtoMessage {

bytes version = 1;
bytes parentId = 2;
bytes adProofsRoot = 3;
bytes stateRoot = 4;
bytes transactionsRoot = 5;
uint64 timestamp = 6;
uint32 height = 7;
uint64 nonce = 8;
uint64 difficulty = 9;
repeated uint32 ints = 10;
}
55 changes: 55 additions & 0 deletions src/main/protobuf/NetworkMessagesProto.proto
@@ -0,0 +1,55 @@
syntax = "proto3";
import "SyntaxMessageProto.proto";

message GeneralizedNetworkProtoMessage {

message SyncInfoProtoMessage {
repeated bytes lastHeaderIds = 1;
}

message InvProtoMessage {
bytes modifierTypeId = 1;
repeated bytes modifiers = 2;
}

message RequestModifiersProtoMessage {
bytes modifierTypeId = 1;
repeated bytes modifiers = 2;
}

message ModifiersProtoMessage {

message MapFieldEntry {
bytes key = 1;
bytes value = 2;
}

bytes modifierTypeId = 1;
repeated MapFieldEntry map = 2;
}

message GetPeersProtoMessage { }

message PeersProtoMessage {
repeated InetSocketAddressProtoMessage peers = 1;
}

message HandshakeProtoMessage {
bytes protocolVersion = 1;
string nodeName = 2;
InetSocketAddressProtoMessage declaredAddress = 3;
uint64 time = 4;
}

bytes magic = 1;
bytes checksum = 2;
oneof innerMessage {
SyncInfoProtoMessage syncInfoProtoMessage = 3;
InvProtoMessage invProtoMessage = 4;
RequestModifiersProtoMessage requestModifiersProtoMessage = 5;
ModifiersProtoMessage modifiersProtoMessage = 6;
GetPeersProtoMessage getPeersProtoMessage = 7;
PeersProtoMessage peersProtoMessage = 8;
HandshakeProtoMessage handshakeProtoMessage = 9;
}
}
7 changes: 7 additions & 0 deletions src/main/protobuf/PayloadProto.proto
@@ -0,0 +1,7 @@
syntax = "proto3";
import "TransactionProto.proto";

message PayloadProtoMessage {
bytes headerId = 1;
repeated TransactionProtoMessage txs = 2;
}