Skip to content

Commit

Permalink
Merge pull request #2132 from ccellado/ergo-core-tests
Browse files Browse the repository at this point in the history
ergo core tests refactor
  • Loading branch information
kushti authored Mar 4, 2024
2 parents e7dbd1c + c56614b commit 85336b7
Show file tree
Hide file tree
Showing 166 changed files with 33,478 additions and 2,508 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ lazy val ergoCore = (project in file("ergo-core"))
),
scalacOptions in(Compile, compile) ++= (if (scalaBinaryVersion.value == "2.11") Seq() else Seq("-release", "8")),
scalacOptions in(Compile, compile) --= scalacOpts,
parallelExecution in Test := false,
)

lazy val ergoWallet = (project in file("ergo-wallet"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.ergoplatform.settings

import com.typesafe.config.ConfigFactory
import net.ceedubs.ficus.Ficus._
import net.ceedubs.ficus.readers.ArbitraryTypeReader._
import java.io.File

object ChainSettingsReader extends PowSchemeReaders with ModifierIdReader with SettingsReaders{
def read(path: String): Option[ChainSettings] = {
val file = new File(path)
if (file.exists) {
val cfg = ConfigFactory.parseFile(file)
val fallback = ConfigFactory.parseFile(new File("src/main/resources/application.conf"))
val network = ConfigFactory.parseFile(new File("src/main/resources/testnet.conf"))
val fullConfig = ConfigFactory
.defaultOverrides()
.withFallback(cfg) //order
.withFallback(network) //matters
.withFallback(fallback) //here
.resolve()

val chainSettings = fullConfig.as[ChainSettings]("ergo.chain")
Some(chainSettings)
} else None
}
}
209 changes: 209 additions & 0 deletions ergo-core/src/test/resources/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
ergo {
# Directory to keep data
directory = ${user.dir}"/.ergo_test/data"

networkType = "testnet"

# Settings for node view holder regime. See papers.yellow.ModifiersProcessing.md
node {
# State type. Possible options are:
# "utxo" - keep full utxo set, that allows to validate arbitrary block and generate ADProofs
# "digest" - keep state root hash only and validate transactions via ADProofs
stateType = "utxo"

# Download block transactions and verify them (requires BlocksToKeep == 0 if disabled)
verifyTransactions = true

# Number of last blocks to keep with transactions and ADproofs, for all other blocks only header will be stored.
# Keep all blocks from genesis if negative
blocksToKeep = 1000

# Download PoPoW proof on node bootstrap
popowBootstrap = false

# Minimal suffix size for PoPoW proof (may be pre-defined constant or settings parameter)
popowSuffix = 10

# Is the node is doing mining
mining = true

# maximum cost of transaction for it to not be considered malicious
maxTransactionCost = 1000000

useExternalMiner = false

# Public key mining rewards will be dedicated to
miningPubKeyHex = null

# If true, a node generates blocks being offline. The only really useful case for it probably is to start a new
# blockchain
offlineGeneration = false

# Interval of polling for a candidate
internalMinerPollingInterval = 1s

mempoolCapacity = 100000

mempoolCleanupDuration = 10s

mempoolSorting = "bySize"

# Number of transactions from mempool to be re-broadcasted at each epoch
rebroadcastCount = 3

# Minimal fee amount of transactions mempool accepts
minimalFeeAmount = 0

# A node is considering that the chain is synced if sees a block header with timestamp no more
# than headerChainDiff blocks on average from future
# for tests, the value is 100 (as in mainnet)
headerChainDiff = 100

# Dump ADProofs only for the suffix given during bootstrapping
adProofsSuffixLength = 114688 // 112k
}

cache {
history {
# Number of recently used block sections that will be kept in memory
blockSectionsCacheSize = 12

# Number of recently used headers that will be kept in memory
headersCacheSize = 100

# Number of recently used indexes that will be kept in memory
indexesCacheSize = 1000
}
network {
# Maximum number of invalid modifiers in bloom filters
invalidModifiersBloomFilterCapacity = 10000000

# Non-zero fraction of 1 as a rate of element expiration when capacity is full, the lower the more gradual expiration.
# example : 0.1 is represented as 10 bloom filters expiring one by one
invalidModifiersBloomFilterExpirationRate = 0.1

# Maximum number of invalid modifiers to keep in cache, following modifiers are kept in bloom filters
invalidModifiersCacheSize = 10000

# For how long to keep invalid modifiers in cache
invalidModifiersCacheExpiration = 6h
}
mempool {
# Maximum number of invalid modifiers in bloom filters
invalidModifiersBloomFilterCapacity = 10000000

# Non-zero fraction of 1 as a rate of element expiration when capacity is full, the lower the more gradual expiration.
# example : 0.1 is represented as 10 bloom filters expiring one by one
invalidModifiersBloomFilterExpirationRate = 0.1

# Maximum number of invalid modifiers to keep in cache, following modifiers are kept in bloom filters
invalidModifiersCacheSize = 10000

# For how long to keep invalid modifiers in cache
invalidModifiersCacheExpiration = 6h
}
}

#Chain-specific settings. Change only if you are going to launch a new chain!
chain {

genesisId = null

monetary {
# delay between the block mined and a time, when the reward can be spent. ~ 1 day.
minerRewardDelay = -1000
}

# Public keys of founders for tests. Two keys from defaultProver and one random one.
foundersPubkeys = [
"038b0f29a60fa8d7e1aeafbe512288a6c6bc696547bbf8247db23c95e83014513c",
"031ee1ab3b729f21e0dcee05642a63745286354d8e511e6376838e235a28078c01",
"0248502b73f35bb2b77eb5ad16f80f55beff178ccd104488edd2d8b69c192c109d"
]

# Base16 representation of genesis state roothash
genesisStateDigestHex = "93914ecff82cea3b53b32d0f0527069f7361ef3b426271235eb6f4d76337900202"

# Network address prefix, currently reserved values are 0x00 (money chain mainnet) and 0x10 (16 in decimal,
# money chain testnet)
addressPrefix = 16

# Desired time interval between blocks
blockInterval = 1m

# Difficulty network start with
initialDifficultyHex = "01"

# length of an epoch in difficulty recalculation
epochLength = 100

//Proof-of-Work algorithm and its parameters. Possible options are "fake" and "autolykos".
powScheme {
powType = "fake"
}

makeSnapshotEvery = 128
}

wallet {

secretStorage {

secretDir = ${ergo.directory}"/wallet/keystore"

encryption {

# Pseudo-random function with output of length `dkLen` (PBKDF2 param)
prf = "HmacSHA256"

# Number of PBKDF2 iterations (PBKDF2 param)
c = 128000

# Desired bit-length of the derived key (PBKDF2 param)
dkLen = 256
}

}

# Generating seed length in bits
# Options: 128, 160, 192, 224, 256
seedStrengthBits = 160

# Language to be used in mnemonic seed
# Options: "chinese_simplified", "chinese_traditional", "english", "french", "italian", "japanese", "korean", "spanish"
mnemonicPhraseLanguage = "english"

defaultTransactionFee = 10000

# Boxes with value smaller than dustLimit are disregarded in wallet scan logic
dustLimit = 999

# Save used boxes (may consume additinal disk space) or delete them immediately
keepSpentBoxes = false

# Mnemonic seed used in wallet for tests
testMnemonic = "ozone drill grab fiber curtain grace pudding thank cruise elder eight picnic"

# Number of keys to be generated for tests
testKeysQty = 5
}

}

scorex {
restApi {
apiKeyHash = null
publicUrl = "https://example.com:80"
}
}


akka {
test {
timefactor = 3 # duration scale factor to prevent spurious test failures on the heavily loaded CI servers
}
# Don't terminate ActorSystem via CoordinatedShutdown in tests
coordinated-shutdown.terminate-actor-system = off
coordinated-shutdown.run-by-actor-system-terminate = off
coordinated-shutdown.run-by-jvm-shutdown-hook = off
}
Loading

0 comments on commit 85336b7

Please sign in to comment.