Skip to content

Commit

Permalink
Merge branch 'v4.0.104' of github.com:ergoplatform/ergo into SIGTERM-…
Browse files Browse the repository at this point in the history
…signal-shouldbe-handled-as-remote-shutdown
  • Loading branch information
kushti committed Oct 1, 2022
2 parents 4e8e98e + 45e4788 commit 591b4dd
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/api/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: "3.0.2"

info:
version: "4.0.101"
version: "4.0.104"
title: Ergo Node API
description: API docs for Ergo Node. Models are shared between all Ergo products
contact:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ scorex {
nodeName = "ergo-node"

# Network protocol version to be sent in handshakes
appVersion = 4.0.101
appVersion = 4.0.104

# Network agent name. May contain information about client code
# stack, starting from core code-base up to the end graphical interface.
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/mainnet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ ergo {
}

voting {
6 = 2400 #vote for EIP-37
6 = 2400
}

}

scorex {
network {
magicBytes = [1, 0, 2, 4]
bindAddress = "0.0.0.0:9030"
nodeName = "ergo-mainnet-4.0.101"
nodeName = "ergo-mainnet-4.0.104"
nodeName = ${?NODENAME}
knownPeers = [
"213.239.193.208:9030",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ object ErgoStatsCollector {
"lastSeenMessageTime" -> ni.lastIncomingMessageTime.asJson,
"genesisBlockId" -> ni.genesisBlockIdOpt.asJson,
"parameters" -> ni.parameters.asJson,
"eip27Supported" -> ni.eip27Supported.asJson
"eip27Supported" -> ni.eip27Supported.asJson,
"eip37Supported" -> true.asJson
) ++ optionalFields).asJson
}
}
Expand Down
29 changes: 24 additions & 5 deletions src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ object CandidateGenerator extends ScorexLogging {
val voteForSoftFork = forkOrdered(ergoSettings, currentParams, header)

if (newHeight % votingSettings.votingLength == 0 && newHeight > 0) {
// new voting epoch
val (newParams, activatedUpdate) = currentParams.update(
newHeight,
voteForSoftFork,
Expand All @@ -494,13 +495,31 @@ object CandidateGenerator extends ScorexLogging {
newParams.blockVersion
)
} else {
val preVotes = currentParams.vote(
ergoSettings.votingTargets.targets,
stateContext.votingData.epochVotes,
voteForSoftFork
)
// we allow to put vote for parameter #6 (input cost) used for EIP-37 activation,
// even if epoch wasn't started with such a vote
val voteForEip37 = 2400 // 6 == 2400 in the config
val votes = if(newHeight > 843776 &&
newHeight < 844800 + 2048 &&
ergoSettings.votingTargets.targets.get(Parameters.InputCostIncrease).contains(voteForEip37) &&
!preVotes.contains(Parameters.InputCostIncrease)) {
val idx = preVotes.indexWhere(_ == Parameters.NoParameter)
if(idx != -1) {
preVotes.update(idx, Parameters.InputCostIncrease)
preVotes
} else {
preVotes
}
} else {
preVotes
}
(
interlinksExtension,
currentParams.vote(
ergoSettings.votingTargets.targets,
stateContext.votingData.epochVotes,
voteForSoftFork
),
votes,
currentParams.blockVersion
)
}
Expand Down
29 changes: 12 additions & 17 deletions src/main/scala/org/ergoplatform/nodeView/ErgoNodeViewHolder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -286,21 +286,16 @@ abstract class ErgoNodeViewHolder[State <: ErgoState[State]](settings: ErgoSetti
protected def processRemoteModifiers: Receive = {
case ModifiersFromRemote(mods: Seq[BlockSection]@unchecked) =>
@tailrec
def applyFromCacheLoop(cache: ErgoModifiersCache, limit: Int): Unit = {
if(limit <= 0 ){
()
} else {
val at0 = System.currentTimeMillis()
cache.popCandidate(history()) match {
case Some(mod) =>
pmodModify(mod, local = false)
val at = System.currentTimeMillis()
log.debug(s"Modifier application time for ${mod.id}: ${at - at0}")
val diff = (at - at0).toInt
applyFromCacheLoop(cache, limit - diff)
case None =>
()
}
def applyFromCacheLoop(cache: ErgoModifiersCache): Unit = {
val at0 = System.currentTimeMillis()
cache.popCandidate(history()) match {
case Some(mod) =>
pmodModify(mod, local = false)
val at = System.currentTimeMillis()
log.debug(s"Modifier application time for ${mod.id}: ${at - at0}")
applyFromCacheLoop(cache)
case None =>
()
}
}

Expand Down Expand Up @@ -328,7 +323,7 @@ abstract class ErgoNodeViewHolder[State <: ErgoState[State]](settings: ErgoSetti
sorted.foreach(h => headersCache.put(h.id, h))
}

applyFromCacheLoop(headersCache, 10000)
applyFromCacheLoop(headersCache)

val cleared = headersCache.cleanOverfull()
val upd = BlockSectionsProcessingCacheUpdate(
Expand All @@ -345,7 +340,7 @@ abstract class ErgoNodeViewHolder[State <: ErgoState[State]](settings: ErgoSetti
log.debug(s"Cache size before: ${modifiersCache.size}")

val at0 = System.currentTimeMillis()
applyFromCacheLoop(modifiersCache, 750)
applyFromCacheLoop(modifiersCache)
val at = System.currentTimeMillis()
log.debug(s"Application time: ${at-at0}")

Expand Down

0 comments on commit 591b4dd

Please sign in to comment.