diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4f8a732839..515e5fce30 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+**0.13.0**
+1. Enabling preimages configuration
+
**0.12.0**
1. Sparkz dependency updated to 2.4.0
* Updates in EON forger nodes connection policy (see release notes for further info)
diff --git a/doc/index.md b/doc/index.md
index b912501f7d..4624030e88 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -1,5 +1,6 @@
# Horizen Sidechain SDK Release Notes
+## Version [0.13.0](/doc/release/0.13.0.md)
## Version [0.12.0](/doc/release/0.12.0.md)
## Version [0.11.0](/doc/release/0.11.0.md)
## Version [0.10.1](/doc/release/0.10.1.md)
diff --git a/doc/release/0.13.0.md b/doc/release/0.13.0.md
new file mode 100644
index 0000000000..1ad48e7cba
--- /dev/null
+++ b/doc/release/0.13.0.md
@@ -0,0 +1,30 @@
+# Release notes - version 0.13.0
+
+---
+
+## Notes about new/updated Features
+
+### Preimages enabling
+A new property was added to the config file for enabling the storage of preimages. Preimages contain the account
+addresses that are not usually saved in the state trie. Enabling preimages is a pre-requirement for executing a state dump.
+
+How to specify it:
+- inside the config file, add a property like this inside the *evmStateDump* section:
+
+ enabled = "true"
+
+
+---
+## Bug Fixes
+
+---
+
+## Improvements
+
+---
+## Update test instructions from previous version
+
+
+---
+Full [Changelog](/CHANGELOG.md) file here
+
diff --git a/qa/SidechainTestFramework/sc_boostrap_info.py b/qa/SidechainTestFramework/sc_boostrap_info.py
index 7a7f28c438..0185bec19c 100644
--- a/qa/SidechainTestFramework/sc_boostrap_info.py
+++ b/qa/SidechainTestFramework/sc_boostrap_info.py
@@ -156,7 +156,8 @@ def __init__(self,
max_mempool_slots=DEFAULT_MAX_MEMPOOL_SLOTS,
max_nonexec_pool_slots=DEFAULT_MAX_NONEXEC_POOL_SLOTS,
tx_lifetime=DEFAULT_TX_LIFETIME,
- handling_txs_enabled=True
+ handling_txs_enabled=True,
+ evm_state_dump_enabled=True
):
if submitter_private_keys_indexes is None:
@@ -193,7 +194,8 @@ def __init__(self,
self.max_mempool_slots = max_mempool_slots
self.max_nonexec_pool_slots = max_nonexec_pool_slots
self.tx_lifetime = tx_lifetime
- self.handling_txs_enabled=handling_txs_enabled
+ self.handling_txs_enabled = handling_txs_enabled
+ self.evm_state_dump_enabled = evm_state_dump_enabled
def update_websocket_config(self, websocket_server_enabled, websocket_server_port):
diff --git a/qa/SidechainTestFramework/scutil.py b/qa/SidechainTestFramework/scutil.py
index aa311e4d94..bda7ba9ac0 100755
--- a/qa/SidechainTestFramework/scutil.py
+++ b/qa/SidechainTestFramework/scutil.py
@@ -551,7 +551,8 @@ def initialize_sc_datadir(dirname, n, model, bootstrap_info=SCBootstrapInfo, sc_
'MAX_NONEXEC_SLOTS': sc_node_config.max_nonexec_pool_slots,
'TX_LIFETIME': sc_node_config.tx_lifetime,
'HANDLING_TXS_ENABLED': ("true" if sc_node_config.handling_txs_enabled else "false"),
- 'FORGER_REWARD_ADDRESS': sc_node_config.forger_options.forger_reward_address
+ 'FORGER_REWARD_ADDRESS': sc_node_config.forger_options.forger_reward_address,
+ 'EVM_STATE_DUMP_ENABLED': ("true" if sc_node_config.evm_state_dump_enabled else "false"),
}
config = config.replace("'", "")
diff --git a/qa/resources/template.conf b/qa/resources/template.conf
index 3733aee26c..e0526a78bb 100644
--- a/qa/resources/template.conf
+++ b/qa/resources/template.conf
@@ -110,4 +110,8 @@ sparkz {
txLifetime = %(TX_LIFETIME)d seconds
allowUnprotectedTxs = %(ALLOW_UNPROTECTED_TXS)s
}
+
+ evmStateDump {
+ enabled = %(EVM_STATE_DUMP_ENABLED)s
+ }
}
diff --git a/sdk/pom.xml b/sdk/pom.xml
index 04d0668ef2..8b3b14515a 100644
--- a/sdk/pom.xml
+++ b/sdk/pom.xml
@@ -356,7 +356,7 @@
io.horizen
libevm
- 1.1.0
+ 1.2.0-snapshot
at.favre.lib
diff --git a/sdk/src/main/scala/io/horizen/AbstractSidechainNodeViewHolder.scala b/sdk/src/main/scala/io/horizen/AbstractSidechainNodeViewHolder.scala
index adb8146197..71af90a4eb 100644
--- a/sdk/src/main/scala/io/horizen/AbstractSidechainNodeViewHolder.scala
+++ b/sdk/src/main/scala/io/horizen/AbstractSidechainNodeViewHolder.scala
@@ -282,7 +282,8 @@ abstract class AbstractSidechainNodeViewHolder[
if (!history().contains(pmod.id)) {
context.system.eventStream.publish(StartingPersistentModifierApplication(pmod))
- log.info(s"Apply modifier ${pmod.encodedId} of type ${pmod.modifierTypeId} to nodeViewHolder")
+ log.info(s"Apply modifier ${pmod.encodedId} of type ${pmod.modifierTypeId} to nodeViewHolder" +
+ {if (sidechainSettings.evmStateDump.enabled) ", state dump enabled" else ""})
history().append(pmod) match {
case Success((historyBeforeStUpdate, progressInfo)) =>
diff --git a/sdk/src/main/scala/io/horizen/SidechainSettings.scala b/sdk/src/main/scala/io/horizen/SidechainSettings.scala
index 80ba224a9b..c614709139 100644
--- a/sdk/src/main/scala/io/horizen/SidechainSettings.scala
+++ b/sdk/src/main/scala/io/horizen/SidechainSettings.scala
@@ -160,12 +160,22 @@ case class HistorySettings(
resetModifiersStatus: Boolean = false,
)
+
case class MetricsApiSettings(
enabled: Boolean,
bindAddress: InetSocketAddress,
apiKeyHash: Option[String],
corsAllowedOrigin: Option[String],
timeout: FiniteDuration) extends ApiSettings
+
+case class EvmStateDump(
+
+ /**
+ * If true, enable collecting preimages, that is a pre-requirement for the state dump
+ */
+ enabled: Boolean = false,
+ )
+
case class SidechainSettings(
sparkzSettings: SparkzSettings,
metricsSettings: MetricsApiSettings,
@@ -182,7 +192,8 @@ case class SidechainSettings(
ethService: EthServiceSettings,
accountMempool: AccountMempoolSettings,
apiRateLimiter: ApiRateLimiterSettings,
- history: HistorySettings
+ history: HistorySettings,
+ evmStateDump: EvmStateDump
){
require(sparkzSettings.network.handlingTransactionsEnabled || !forger.automaticForging,
s"Node that does not support transaction handling cannot be a forger node: " +
diff --git a/sdk/src/main/scala/io/horizen/SidechainSettingsReader.scala b/sdk/src/main/scala/io/horizen/SidechainSettingsReader.scala
index ebd4bf7e78..98725362c6 100644
--- a/sdk/src/main/scala/io/horizen/SidechainSettingsReader.scala
+++ b/sdk/src/main/scala/io/horizen/SidechainSettingsReader.scala
@@ -50,10 +50,11 @@ object SidechainSettingsReader
val ethServiceSettings = config.as[EthServiceSettings]("sparkz.ethService")
val apiRateLimiterSettings = config.as[ApiRateLimiterSettings]("sparkz.apiRateLimiter")
val historySettings = config.as[HistorySettings]("sparkz.history")
+ val evmStateDumpSettings = config.as[EvmStateDump]("sparkz.evmStateDump")
SidechainSettings(sparkzSettings, metricsSettings, genesisSettings, webSocketClientSettings, webSocketServerSettings, certificateSettings,
remoteKeysManagerSettings, mempoolSettings, walletSettings, forgerSettings, cswSettings, logInfoSettings,
- ethServiceSettings, accountMempoolSettings, apiRateLimiterSettings, historySettings)
+ ethServiceSettings, accountMempoolSettings, apiRateLimiterSettings, historySettings, evmStateDumpSettings)
}
def readConfigFromPath(userConfigPath: String, applicationConfigPath: Option[String]): Config = {
diff --git a/sdk/src/main/scala/io/horizen/account/AccountSidechainApp.scala b/sdk/src/main/scala/io/horizen/account/AccountSidechainApp.scala
index ef0fa0ceaf..e7bc76137a 100644
--- a/sdk/src/main/scala/io/horizen/account/AccountSidechainApp.scala
+++ b/sdk/src/main/scala/io/horizen/account/AccountSidechainApp.scala
@@ -107,7 +107,8 @@ class AccountSidechainApp @Inject()
protected val stateMetadataStorage = new AccountStateMetadataStorage(
registerClosableResource(new VersionedLevelDbStorageAdapter(metaStateStore, params.maxHistoryRewritingLength * 2)))
- protected val stateDbStorage: LevelDBDatabase = registerClosableResource(new LevelDBDatabase(dataDirAbsolutePath + "/evm-state"))
+ protected val stateDbStorage: LevelDBDatabase = registerClosableResource(new LevelDBDatabase(dataDirAbsolutePath + "/evm-state",
+ sidechainSettings.evmStateDump.enabled))
protected val consensusDataStorage = new ConsensusDataStorage(
registerClosableResource(new VersionedLevelDbStorageAdapter(consensusStore, 5)))
diff --git a/sdk/src/main/scala/io/horizen/account/AccountSidechainNodeViewHolder.scala b/sdk/src/main/scala/io/horizen/account/AccountSidechainNodeViewHolder.scala
index 2c7f641ae0..6697552499 100644
--- a/sdk/src/main/scala/io/horizen/account/AccountSidechainNodeViewHolder.scala
+++ b/sdk/src/main/scala/io/horizen/account/AccountSidechainNodeViewHolder.scala
@@ -125,6 +125,7 @@ class AccountSidechainNodeViewHolder(sidechainSettings: SidechainSettings,
override def restoreState(): Option[(HIS, MS, VL, MP)] = {
log.info("Restoring persistent state from storage...")
+ log.info(s"restoreState - state dump enabled: ${sidechainSettings.evmStateDump.enabled}")
val restoredData = for {
history <- AccountHistory.restoreHistory(historyStorage, consensusDataStorage, params, semanticBlockValidators(params), historyBlockValidators(params))
@@ -141,6 +142,7 @@ class AccountSidechainNodeViewHolder(sidechainSettings: SidechainSettings,
}
override protected def genesisState: (HIS, MS, VL, MP) = {
+ log.info(s"genesisState - state dump enabled: ${sidechainSettings.evmStateDump.enabled}")
val result = for {
state <- AccountState.createGenesisState(stateMetadataStorage, stateDbStorage, messageProcessors(params), params, timeProvider, blockHashProvider, genesisBlock)
(_: ModifierId, consensusEpochInfo: ConsensusEpochInfo) <- Success(state.getCurrentConsensusEpochInfo)
diff --git a/sdk/src/test/scala/io/horizen/account/AccountSidechainNodeViewHolderEventTest.scala b/sdk/src/test/scala/io/horizen/account/AccountSidechainNodeViewHolderEventTest.scala
index 74119a2eca..bf4d2e2c17 100644
--- a/sdk/src/test/scala/io/horizen/account/AccountSidechainNodeViewHolderEventTest.scala
+++ b/sdk/src/test/scala/io/horizen/account/AccountSidechainNodeViewHolderEventTest.scala
@@ -20,7 +20,7 @@ import io.horizen.metrics.MetricsManager
import io.horizen.params.NetworkParams
import io.horizen.storage.SidechainSecretStorage
import io.horizen.utils.BytesUtils
-import io.horizen.{AccountMempoolSettings, SidechainSettings, SidechainTypes, WalletSettings}
+import io.horizen.{AccountMempoolSettings, EvmStateDump, SidechainSettings, SidechainTypes, WalletSettings}
import org.junit.Assert.{assertEquals, assertTrue}
import org.junit.{Before, Test}
import org.mockito.{ArgumentMatchers, Mockito}
@@ -176,6 +176,7 @@ class AccountSidechainNodeViewHolderEventTest
val mockWalletSettings: WalletSettings = mock[WalletSettings]
Mockito.when(mockWalletSettings.maxTxFee).thenReturn(100L)
Mockito.when(sidechainSettings.wallet).thenReturn(mockWalletSettings)
+ Mockito.when(sidechainSettings.evmStateDump).thenReturn(EvmStateDump(false))
val params: NetworkParams = mock[NetworkParams]
Mockito.when(params.chainId).thenReturn(1997)
Mockito.when(params.circuitType).thenReturn(NaiveThresholdSignatureCircuit)
diff --git a/sdk/src/test/scala/io/horizen/account/fixtures/MockedAccountSidechainNodeViewHolderFixture.scala b/sdk/src/test/scala/io/horizen/account/fixtures/MockedAccountSidechainNodeViewHolderFixture.scala
index 52fc35628e..06d0c4b4a8 100644
--- a/sdk/src/test/scala/io/horizen/account/fixtures/MockedAccountSidechainNodeViewHolderFixture.scala
+++ b/sdk/src/test/scala/io/horizen/account/fixtures/MockedAccountSidechainNodeViewHolderFixture.scala
@@ -68,6 +68,10 @@ trait MockedAccountSidechainNodeViewHolderFixture extends MockitoSugar {
.thenAnswer(_ => {
walletSettings
})
+ Mockito.when(sidechainSettings.evmStateDump)
+ .thenAnswer(_ => {
+ EvmStateDump(false)
+ })
actorSystem.actorOf(Props(new MockedAccountSidechainNodeViewHolder(sidechainSettings, history, state, wallet, mempool)))
}
diff --git a/sdk/src/test/scala/io/horizen/fixtures/MockedSidechainNodeViewHolderFixture.scala b/sdk/src/test/scala/io/horizen/fixtures/MockedSidechainNodeViewHolderFixture.scala
index 5025ea4d01..e80ea431d0 100644
--- a/sdk/src/test/scala/io/horizen/fixtures/MockedSidechainNodeViewHolderFixture.scala
+++ b/sdk/src/test/scala/io/horizen/fixtures/MockedSidechainNodeViewHolderFixture.scala
@@ -64,6 +64,10 @@ trait MockedSidechainNodeViewHolderFixture extends MockitoSugar {
.thenAnswer(answer => {
10000000L
})
+ Mockito.when(sidechainSettings.evmStateDump)
+ .thenAnswer(_ => {
+ EvmStateDump(false)
+ })
actorSystem.actorOf(Props(new MockedSidechainNodeViewHolder(sidechainSettings, history, state, wallet, mempool)))
}