Skip to content

Commit

Permalink
Version 1.5.0 (Stagenet) (#3889)
Browse files Browse the repository at this point in the history
  • Loading branch information
phearnot authored Oct 9, 2023
1 parent 2801f3b commit dbd8b10
Show file tree
Hide file tree
Showing 22 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ object BaseTargetChecker {
.genesis(
settings.blockchainSettings.genesisSettings,
blockchainUpdater.isFeatureActivated(BlockchainFeatures.RideV6),
blockchainUpdater.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot)
blockchainUpdater.isFeatureActivated(BlockchainFeatures.LightNode)
)
.explicitGet()
blockchainUpdater.processBlock(genesisBlock, genesisBlock.header.generationSignature, None)
Expand Down
2 changes: 1 addition & 1 deletion node-it/src/test/scala/com/wavesplatform/it/Docker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ object Docker {
.resolve()
.getAs[Map[Short, Int]]("waves.blockchain.custom.functionality.pre-activated-features")
val isRideV6Activated = features.exists(_.get(BlockchainFeatures.RideV6.id).contains(0))
val isTxStateSnapshotActivated = features.exists(_.get(BlockchainFeatures.TransactionStateSnapshot.id).contains(0))
val isTxStateSnapshotActivated = features.exists(_.get(BlockchainFeatures.LightNode.id).contains(0))

val genesisSignature = Block.genesis(gs, isRideV6Activated, isTxStateSnapshotActivated).explicitGet().id()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BlockChallengeSuite extends BaseFunSuite with TransferSending {
BlockchainFeatures.SynchronousCalls.id.toInt -> 0,
BlockchainFeatures.RideV6.id.toInt -> 0,
BlockchainFeatures.ConsensusImprovements.id.toInt -> 0,
BlockchainFeatures.TransactionStateSnapshot.id.toInt -> 0
BlockchainFeatures.LightNode.id.toInt -> 0
)
)
.withDefault(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object BlockchainFeatures {
val BlockRewardDistribution = BlockchainFeature(19, "Block Reward Distribution")
val CappedReward = BlockchainFeature(20, "Capped XTN buy-back & DAO amounts")
val CeaseXtnBuyback = BlockchainFeature(21, "Cease XTN buy-back")
val TransactionStateSnapshot = BlockchainFeature(22, "Transaction State Snapshot")
val LightNode = BlockchainFeature(22, "Light Node")

// Not exposed
val ContinuationTransaction = BlockchainFeature(23, "Continuation Transaction")
Expand Down Expand Up @@ -56,7 +56,7 @@ object BlockchainFeatures {
BlockRewardDistribution,
CappedReward,
CeaseXtnBuyback,
TransactionStateSnapshot
LightNode
).map(f => f.id -> f).toMap

val implemented: Set[Short] = dict.keySet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.wavesplatform.features

import com.wavesplatform.features.BlockchainFeatures.{BlockRewardDistribution, BlockV5, Ride4DApps, RideV6, SynchronousCalls, TransactionStateSnapshot}
import com.wavesplatform.features.BlockchainFeatures.{BlockRewardDistribution, BlockV5, Ride4DApps, RideV6, SynchronousCalls, LightNode}
import com.wavesplatform.lang.directives.DirectiveDictionary
import com.wavesplatform.lang.directives.values.*
import com.wavesplatform.state.Blockchain

object RideVersionProvider {
val actualVersionByFeature =
List(
TransactionStateSnapshot -> V8,
LightNode -> V8,
BlockRewardDistribution -> V7,
RideV6 -> V6,
SynchronousCalls -> V5,
Expand Down
2 changes: 1 addition & 1 deletion node/src/main/scala/com/wavesplatform/mining/Miner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class MinerImpl(
)
consensusData <- consensusData(height, account, lastBlockHeader, blockTime)
prevStateHash =
if (blockchainUpdater.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot, blockchainUpdater.height + 1))
if (blockchainUpdater.isFeatureActivated(BlockchainFeatures.LightNode, blockchainUpdater.height + 1))
Some(blockchainUpdater.lastStateHash(Some(reference)))
else None
(unconfirmed, totalConstraint, stateHash) = packTransactionsForKeyBlock(account.toAddress, reference, prevStateHash)
Expand Down
2 changes: 1 addition & 1 deletion node/src/main/scala/com/wavesplatform/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ package object wavesplatform {
.genesis(
settings.blockchainSettings.genesisSettings,
blockchainUpdater.isFeatureActivated(BlockchainFeatures.RideV6),
blockchainUpdater.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot)
blockchainUpdater.isFeatureActivated(BlockchainFeatures.LightNode)
)
.flatMap { genesis =>
logger.trace(s"Genesis block json: ${genesis.json()}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ package object appender {
private def validateChallengedHeader(block: Block, blockchain: Blockchain): Either[ValidationError, Unit] =
for {
_ <- Either.cond(
block.header.challengedHeader.isEmpty || blockchain.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot, blockchain.height + 1),
block.header.challengedHeader.isEmpty || blockchain.isFeatureActivated(BlockchainFeatures.LightNode, blockchain.height + 1),
(),
BlockAppendError("Challenged header is not supported yet", block)
)
Expand All @@ -193,7 +193,7 @@ package object appender {

private def validateStateHash(block: Block, blockchain: Blockchain): Either[ValidationError, Unit] =
Either.cond(
block.header.stateHash.isEmpty || blockchain.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot, blockchain.height + 1),
block.header.stateHash.isEmpty || blockchain.isFeatureActivated(BlockchainFeatures.LightNode, blockchain.height + 1),
(),
BlockAppendError("Block state hash is not supported yet", block)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ object BlockDiffer {
): TracedResult[ValidationError, Unit] =
TracedResult(
Either.cond(
!blockchain.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot) || blockStateHash.contains(computedStateHash),
!blockchain.isFeatureActivated(BlockchainFeatures.LightNode) || blockStateHash.contains(computedStateHash),
(),
InvalidStateHash(blockStateHash)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.wavesplatform.state.diffs
import cats.implicits.toBifunctorOps
import com.wavesplatform.account.{Address, AddressScheme}
import com.wavesplatform.database.patch.DisableHijackedAliases
import com.wavesplatform.features.BlockchainFeatures.TransactionStateSnapshot
import com.wavesplatform.features.BlockchainFeatures.LightNode
import com.wavesplatform.features.OverdraftValidationProvider.*
import com.wavesplatform.features.{BlockchainFeature, BlockchainFeatures, RideVersionProvider}
import com.wavesplatform.lang.ValidationError
Expand Down Expand Up @@ -146,8 +146,8 @@ object CommonValidation {
}

def oldScriptVersionDeactivation(sc: Script): Either[ActivationError, Unit] = sc.stdLibVersion match {
case V1 | V2 | V3 if blockchain.isFeatureActivated(TransactionStateSnapshot) =>
Left(ActivationError(s"Script version below V4 is not allowed after ${TransactionStateSnapshot.description} feature activation"))
case V1 | V2 | V3 if blockchain.isFeatureActivated(LightNode) =>
Left(ActivationError(s"Script version below V4 is not allowed after ${LightNode.description} feature activation"))
case _ =>
Right(())
}
Expand All @@ -172,7 +172,7 @@ object CommonValidation {
}

val versionsBarrier = tx match {
case v: VersionedTransaction if !TransactionParsers.versionIsCorrect(v) && blockchain.isFeatureActivated(TransactionStateSnapshot) =>
case v: VersionedTransaction if !TransactionParsers.versionIsCorrect(v) && blockchain.isFeatureActivated(LightNode) =>
Left(UnsupportedTypeAndVersion(v.tpe.id.toByte, v.version))

case p: PBSince if p.isProtobufVersion =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ object ExchangeTransactionDiff {
private def checkAttachment(order: Order, blockchain: Blockchain): Either[GenericError, Unit] =
for {
_ <- Either.cond(
order.attachment.isEmpty || blockchain.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot),
order.attachment.isEmpty || blockchain.isFeatureActivated(BlockchainFeatures.LightNode),
(),
GenericError("Attachment field for orders is not supported yet")
)
Expand Down
6 changes: 3 additions & 3 deletions node/src/test/scala/com/wavesplatform/db/WithState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.wavesplatform.database.{KeyTags, RDB, RocksDBWriter, TestStorageFacto
import com.wavesplatform.db.WithState.AddrWithBalance
import com.wavesplatform.events.BlockchainUpdateTriggers
import com.wavesplatform.features.BlockchainFeatures
import com.wavesplatform.features.BlockchainFeatures.TransactionStateSnapshot
import com.wavesplatform.features.BlockchainFeatures.LightNode
import com.wavesplatform.history.SnapshotOps.TransactionStateSnapshotExt
import com.wavesplatform.history.{Domain, SnapshotOps}
import com.wavesplatform.lagonaki.mocks.TestBlock
Expand Down Expand Up @@ -317,7 +317,7 @@ trait WithState extends BeforeAndAfterAll with DBCacheSettings with Matchers wit
signer: KeyPair,
blockchain: BlockchainUpdater & Blockchain
): TracedResult[ValidationError, Block] = {
(if (blockchain.isFeatureActivated(TransactionStateSnapshot, blockchain.height + 1)) {
(if (blockchain.isFeatureActivated(LightNode, blockchain.height + 1)) {
val compBlockchain =
SnapshotBlockchain(blockchain, StateSnapshot.empty, blockWithoutStateHash, ByteStr.empty, 0, blockchain.computeNextReward, None)
val prevStateHash = blockchain.lastStateHash(Some(blockWithoutStateHash.header.reference))
Expand Down Expand Up @@ -400,7 +400,7 @@ trait WithDomain extends WithState { _: Suite =>
domain.appendBlock(
createGenesisWithStateHash(
genesis,
bcu.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot, 1),
bcu.isFeatureActivated(BlockchainFeatures.LightNode, 1),
Some(settings.blockchainSettings.genesisSettings.initialBaseTarget)
)
)
Expand Down
8 changes: 4 additions & 4 deletions node/src/test/scala/com/wavesplatform/history/Domain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.wavesplatform.consensus.{PoSCalculator, PoSSelector}
import com.wavesplatform.database.{DBExt, Keys, RDB, RocksDBWriter}
import com.wavesplatform.events.BlockchainUpdateTriggers
import com.wavesplatform.features.BlockchainFeatures
import com.wavesplatform.features.BlockchainFeatures.{BlockV5, RideV6, TransactionStateSnapshot}
import com.wavesplatform.features.BlockchainFeatures.{BlockV5, RideV6, LightNode}
import com.wavesplatform.history.SnapshotOps.TransactionStateSnapshotExt
import com.wavesplatform.lagonaki.mocks.TestBlock
import com.wavesplatform.lang.ValidationError
Expand All @@ -30,7 +30,7 @@ import com.wavesplatform.state.reader.SnapshotBlockchain
import com.wavesplatform.test.TestTime
import com.wavesplatform.transaction.Asset.{IssuedAsset, Waves}
import com.wavesplatform.transaction.smart.script.trace.TracedResult
import com.wavesplatform.transaction.{BlockchainUpdater, *}
import com.wavesplatform.transaction.*
import com.wavesplatform.utils.{EthEncoding, SystemTime}
import com.wavesplatform.utx.UtxPoolImpl
import com.wavesplatform.wallet.Wallet
Expand Down Expand Up @@ -300,7 +300,7 @@ case class Domain(rdb: RDB, blockchainUpdater: BlockchainUpdaterImpl, rocksDBWri
): Either[ValidationError, MicroBlock] = {
val lastBlock = this.lastBlock
val blockSigner = signer.getOrElse(defaultSigner)
val stateHashE = if (blockchain.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot)) {
val stateHashE = if (blockchain.isFeatureActivated(BlockchainFeatures.LightNode)) {
stateHash
.map(Right(_))
.getOrElse(
Expand Down Expand Up @@ -447,7 +447,7 @@ case class Domain(rdb: RDB, blockchainUpdater: BlockchainUpdaterImpl, rocksDBWri
challengedHeader = challengedHeader
)
resultStateHash <- stateHash.map(Right(_)).getOrElse {
if (blockchain.isFeatureActivated(TransactionStateSnapshot, blockchain.height + 1)) {
if (blockchain.isFeatureActivated(LightNode, blockchain.height + 1)) {
val hitSource = posSelector.validateGenerationSignature(blockWithoutStateHash).getOrElse(blockWithoutStateHash.header.generationSignature)
val blockchainWithNewBlock =
SnapshotBlockchain(blockchain, StateSnapshot.empty, blockWithoutStateHash, hitSource, 0, blockchain.computeNextReward, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class BlockChallengeTest extends PropSpec with WithDomain with ScalatestRouteTes
}

property(
s"NODE-889. Block without challenge (before ${BlockchainFeatures.TransactionStateSnapshot} activation) should not contain ChallengedHeader"
s"NODE-889. Block without challenge (before ${BlockchainFeatures.LightNode} activation) should not contain ChallengedHeader"
) {
val sender = TxHelpers.signer(1)
val challengedMiner = TxHelpers.signer(2)
Expand Down Expand Up @@ -1032,19 +1032,19 @@ class BlockChallengeTest extends PropSpec with WithDomain with ScalatestRouteTes
}
}

property(s"NODE-910. Block at ${BlockchainFeatures.TransactionStateSnapshot} activation height can be challenged") {
property(s"NODE-910. Block at ${BlockchainFeatures.LightNode} activation height can be challenged") {
withDomain(
DomainPresets.BlockRewardDistribution
.addFeatures(BlockchainFeatures.SmallerMinimalGeneratingBalance)
.setFeaturesHeight(BlockchainFeatures.TransactionStateSnapshot -> 1003),
.setFeaturesHeight(BlockchainFeatures.LightNode -> 1003),
balances = AddrWithBalance.enoughBalances(defaultSigner)
) { d =>
val challengingMiner = d.wallet.generateNewAccount().get

d.appendBlock(TxHelpers.transfer(defaultSigner, challengingMiner.toAddress, 1000.waves))
(1 to 1000).foreach(_ => d.appendBlock())

d.blockchain.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot) shouldBe false
d.blockchain.isFeatureActivated(BlockchainFeatures.LightNode) shouldBe false

val originalBlock = d.createBlock(
Block.ProtoBlockVersion,
Expand Down Expand Up @@ -1107,7 +1107,7 @@ class BlockChallengeTest extends PropSpec with WithDomain with ScalatestRouteTes
withDomain(
DomainPresets.BlockRewardDistribution
.addFeatures(BlockchainFeatures.SmallerMinimalGeneratingBalance)
.setFeaturesHeight(BlockchainFeatures.TransactionStateSnapshot -> 1008),
.setFeaturesHeight(BlockchainFeatures.LightNode -> 1008),
balances = AddrWithBalance.enoughBalances(sender)
) { d =>
val challengingMiner = d.wallet.generateNewAccount().get
Expand Down Expand Up @@ -1975,7 +1975,7 @@ class BlockChallengeTest extends PropSpec with WithDomain with ScalatestRouteTes
private def rollbackActivationHeightScenario(d: Domain, challengedMiner: KeyPair, txs: Seq[Transaction]): Assertion = {
(1 to 6).foreach(_ => d.appendBlock())

d.blockchain.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot) shouldBe false
d.blockchain.isFeatureActivated(BlockchainFeatures.LightNode) shouldBe false

val originalBlock = d.createBlock(
Block.ProtoBlockVersion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1999,12 +1999,12 @@ class ExchangeTransactionDiffTest extends PropSpec with Inside with WithDomain w
}
}

property(s"NODE-970. Non-empty attachment field is allowed only after ${BlockchainFeatures.TransactionStateSnapshot.description} activation") {
property(s"NODE-970. Non-empty attachment field is allowed only after ${BlockchainFeatures.LightNode.description} activation") {
val matcher = TxHelpers.defaultSigner
val issuer = TxHelpers.secondSigner

withDomain(
ConsensusImprovements.setFeaturesHeight(BlockchainFeatures.TransactionStateSnapshot -> 4),
ConsensusImprovements.setFeaturesHeight(BlockchainFeatures.LightNode -> 4),
AddrWithBalance.enoughBalances(matcher, issuer)
) { d =>
val issue = TxHelpers.issue(issuer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RideVersionDeactivationTest extends PropSpec with WithDomain {

property(s"RIDE V1, V2, V3 are forbidden after TransactionStateSnapshot") {
withDomain(
TransactionStateSnapshot.setFeaturesHeight(BlockchainFeatures.TransactionStateSnapshot -> 4),
TransactionStateSnapshot.setFeaturesHeight(BlockchainFeatures.LightNode -> 4),
AddrWithBalance.enoughBalances(defaultSigner)
) { d =>
val issueTx = issue(script = Some(verifier(V7)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ class TransactionBindingsTest extends PropSpec with PathMockFactory with EitherV
}

property(
s"NODE-1039. Orders should contain attachment field in Ride version >= V8 after ${BlockchainFeatures.TransactionStateSnapshot} activation"
s"NODE-1039. Orders should contain attachment field in Ride version >= V8 after ${BlockchainFeatures.LightNode} activation"
) {
val issuer = TxHelpers.signer(1)
val buyer = TxHelpers.signer(2)
Expand Down Expand Up @@ -835,7 +835,7 @@ class TransactionBindingsTest extends PropSpec with PathMockFactory with EitherV
TestCompiler(v).compileExpressionE(script) should produce("Undefined field `attachment` of variable of type `Order`")

withDomain(
DomainPresets.BlockRewardDistribution.setFeaturesHeight(BlockchainFeatures.TransactionStateSnapshot -> Int.MaxValue),
DomainPresets.BlockRewardDistribution.setFeaturesHeight(BlockchainFeatures.LightNode -> Int.MaxValue),
AddrWithBalance.enoughBalances(issuer, matcher, buyer)
) { d =>
d.appendBlock(issue)
Expand All @@ -846,12 +846,12 @@ class TransactionBindingsTest extends PropSpec with PathMockFactory with EitherV
}

withDomain(
DomainPresets.BlockRewardDistribution.setFeaturesHeight(BlockchainFeatures.TransactionStateSnapshot -> 4),
DomainPresets.BlockRewardDistribution.setFeaturesHeight(BlockchainFeatures.LightNode -> 4),
AddrWithBalance.enoughBalances(issuer, matcher, buyer)
) { d =>
d.appendBlock(issue)

d.appendBlockE(TxHelpers.setScript(smartAcc, compiledScript)) should produce("Transaction State Snapshot feature has not been activated yet")
d.appendBlockE(TxHelpers.setScript(smartAcc, compiledScript)) should produce("Light Node feature has not been activated yet")
d.appendBlock()
d.appendBlockE(TxHelpers.setScript(smartAcc, compiledScript)) should beRight

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ object DomainPresets {
featuresSettings = RideV6.featuresSettings.copy(autoShutdownOnUnsupportedFeature = false)
)

val TransactionStateSnapshot: WavesSettings = BlockRewardDistribution.addFeatures(BlockchainFeatures.TransactionStateSnapshot)
val TransactionStateSnapshot: WavesSettings = BlockRewardDistribution.addFeatures(BlockchainFeatures.LightNode)

def settingsForRide(version: StdLibVersion): WavesSettings =
version match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class InvokeScriptComplexitySpec extends FreeSpec with WithDomain with NTPTime {
private[this] val settings = domainSettingsWithFS(
SettingsFromDefaultConfig.blockchainSettings.functionalitySettings.copy(preActivatedFeatures =
BlockchainFeatures.implemented
.excl(BlockchainFeatures.TransactionStateSnapshot.id)
.excl(BlockchainFeatures.LightNode.id)
.map {
case v @ BlockchainFeatures.FeeSponsorship.id =>
v -> -SettingsFromDefaultConfig.blockchainSettings.functionalitySettings.featureCheckBlocksPeriod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class UtxPoolSpecification extends FreeSpec with MockFactory with BlocksTransact
.genesis(
genesisSettings,
bcu.isFeatureActivated(BlockchainFeatures.RideV6),
bcu.isFeatureActivated(BlockchainFeatures.TransactionStateSnapshot)
bcu.isFeatureActivated(BlockchainFeatures.LightNode)
)
.explicitGet()
) should beRight
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sbt.{Def, _}
object Dependencies {
// Node protobuf schemas
private[this] val protoSchemasLib =
"com.wavesplatform" % "protobuf-schemas" % "1.5.0-SNAPSHOT" classifier "protobuf-src" intransitive ()
"com.wavesplatform" % "protobuf-schemas" % "1.5.0" classifier "protobuf-src" intransitive ()

def akkaModule(module: String): ModuleID = "com.typesafe.akka" %% s"akka-$module" % "2.6.20"

Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
git.baseVersion := "1.4.18"
git.baseVersion := "1.5.0"

0 comments on commit dbd8b10

Please sign in to comment.