Skip to content

Commit

Permalink
Merge pull request #1935 from ergoplatform/v5.0.6
Browse files Browse the repository at this point in the history
Candidate for 5.0.6
  • Loading branch information
kushti authored Jan 16, 2023
2 parents 5d612b0 + 9dc8701 commit 1c53c89
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ scorex {
nodeName = "ergo-node"

# Network protocol version to be sent in handshakes
appVersion = 5.0.5
appVersion = 5.0.6

# Network agent name. May contain information about client code
# stack, starting from core code-base up to the end graphical interface.
Expand Down
28 changes: 1 addition & 27 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,9 @@
</encoder>
</appender>

<!-- default level should be lowest here, since DynamicThresholdFilter cannot change it *down* otherwise -->
<root level="TRACE">
<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>

<turboFilter class="ch.qos.logback.classic.turbo.DynamicThresholdFilter">
<Key>set-log-level</Key>
<DefaultThreshold>TRACE</DefaultThreshold>
<MDCValueLevelPair>
<value>ERROR</value>
<level>ERROR</level>
</MDCValueLevelPair>
<MDCValueLevelPair>
<value>WARN</value>
<level>WARN</level>
</MDCValueLevelPair>
<MDCValueLevelPair>
<value>INFO</value>
<level>INFO</level>
</MDCValueLevelPair>
<MDCValueLevelPair>
<value>DEBUG</value>
<level>DEBUG</level>
</MDCValueLevelPair>
<MDCValueLevelPair>
<value>TRACE</value>
<level>TRACE</level>
</MDCValueLevelPair>
</turboFilter>

</configuration>
2 changes: 1 addition & 1 deletion src/main/resources/mainnet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ scorex {
network {
magicBytes = [1, 0, 2, 4]
bindAddress = "0.0.0.0:9030"
nodeName = "ergo-mainnet-5.0.5"
nodeName = "ergo-mainnet-5.0.6"
nodeName = ${?NODENAME}
knownPeers = [
"213.239.193.208:9030",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ case class ErgoTransaction(override val inputs: IndexedSeq[Input],
// Before 5.0 soft-fork (v3 block version), we are checking only that
// creation height in outputs is not negative
// After, we are checking that it is not less that max creation height in inputs
val maxCreationHeightInInputs = if (blockVersion <= Header.HardeningVersion) {
def maxCreationHeightInInputs: Int = if (blockVersion <= Header.HardeningVersion) {
0
} else {
boxesToSpend.map(_.creationHeight).max
Expand All @@ -398,10 +398,6 @@ case class ErgoTransaction(override val inputs: IndexedSeq[Input],
.validate(txPositiveAssets,
outputCandidates.forall(_.additionalTokens.forall(_._2 > 0)),
InvalidModifier(s"$id: ${outputCandidates.map(_.additionalTokens)}", id, modifierTypeId))
// Check that outputs are not dust, and not created in future
.validateSeq(outputs) { case (validationState, out) =>
verifyOutput(validationState, out, stateContext, maxCreationHeightInInputs)
}
// Just to be sure, check that all the input boxes to spend (and to read) are presented.
// Normally, this check should always pass, if the client is implemented properly
// so it is not part of the protocol really.
Expand All @@ -423,6 +419,10 @@ case class ErgoTransaction(override val inputs: IndexedSeq[Input],
modifierTypeId
)
)
// Check that outputs are not dust, and not created in future
.validateSeq(outputs) { case (validationState, out) =>
verifyOutput(validationState, out, stateContext, maxCreationHeightInInputs)
}
// Check that there are no overflow in input and output values
.validate(txInputsSum, inputSumTry.isSuccess, InvalidModifier(s"$id as invalid Inputs Sum", id, modifierTypeId))
// Check that transaction is not creating money out of thin air.
Expand Down
8 changes: 5 additions & 3 deletions src/main/scala/org/ergoplatform/settings/ErgoSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package org.ergoplatform.settings

import java.io.{File, FileOutputStream}
import java.nio.channels.Channels
import ch.qos.logback.classic.{LoggerContext, Level}
import org.slf4j.{Logger, LoggerFactory}
import com.typesafe.config.{Config, ConfigFactory, ConfigValueFactory}
import net.ceedubs.ficus.Ficus._
import net.ceedubs.ficus.readers.ArbitraryTypeReader._
import org.ergoplatform.mining.groupElemFromBytes
import org.ergoplatform.nodeView.state.StateType.Digest
import org.ergoplatform.{ErgoAddressEncoder, ErgoApp, P2PKAddress}
import org.slf4j.MDC
import scorex.core.settings.{ScorexSettings, SettingsReaders}
import scorex.util.ScorexLogging
import scorex.util.encode.Base16
Expand Down Expand Up @@ -225,9 +226,10 @@ object ErgoSettings extends ScorexLogging
*/
private def overrideLogLevel(level: String) = level match {
case "TRACE" | "ERROR" | "INFO" | "WARN" | "DEBUG" =>
MDC.clear()
MDC.put("set-log-level", level)
log.info(s"Log level set to $level")
val loggerContext = LoggerFactory.getILoggerFactory.asInstanceOf[LoggerContext]
val root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME)
root.setLevel(Level.toLevel(level))
case _ => log.warn("No log level configuration provided")
}
}

0 comments on commit 1c53c89

Please sign in to comment.