diff --git a/build.sbt b/build.sbt index 9084c7d76c..d7ae213662 100644 --- a/build.sbt +++ b/build.sbt @@ -7,8 +7,6 @@ val commonSettings = Seq( testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-l", "EthashMinerSpec") // miner tests disabled by default ) -// Temp resolver for LevelDB fork -resolvers += "stepsoft" at "http://nexus.mcsherrylabs.com/repository/releases/" // Resolver for rocksDb resolvers += "rocksDb" at "https://dl.bintray.com/ethereum/maven/" @@ -16,7 +14,6 @@ val dep = { val akkaVersion = "2.5.12" val akkaHttpVersion = "10.1.1" val circeVersion = "0.9.3" - val levelDb = "0.12" val rocksDb = "5.9.2" Seq( @@ -29,8 +26,6 @@ val dep = { "de.heikoseeberger" %% "akka-http-json4s" % "1.21.0", "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % "it,test", "io.suzaku" %% "boopickle" % "1.3.0", - "org.iq80.leveldb" % "leveldb-api" % levelDb, - "org.iq80.leveldb" % "leveldb" % levelDb, "org.ethereum" % "rocksdbjni" % rocksDb, "org.scorexfoundation" %% "iodb" % "0.3.0", "org.scalatest" %% "scalatest" % "3.0.5" % "it,test", diff --git a/src/benchmark/scala/io/iohk/ethereum/mpt/MerklePatriciaTreeSpeedSpec.scala b/src/benchmark/scala/io/iohk/ethereum/mpt/MerklePatriciaTreeSpeedSpec.scala index b01c402d1d..6b60c07648 100644 --- a/src/benchmark/scala/io/iohk/ethereum/mpt/MerklePatriciaTreeSpeedSpec.scala +++ b/src/benchmark/scala/io/iohk/ethereum/mpt/MerklePatriciaTreeSpeedSpec.scala @@ -48,12 +48,6 @@ class MerklePatriciaTreeSpeedSpec extends FunSuite } } - test("MPT benchmark with LevelDb") { - withLevelDbNodeStorage { ns => - mptBenchmarkTest(ns) - } - } - def mptBenchmarkTest(ns: MptStorage): MerklePatriciaTrie[Array[Byte], Array[Byte]] = { val hashFn = crypto.kec256(_: Array[Byte]) diff --git a/src/ets/scala/io/iohk/ethereum/ets/blockchain/BlockchainTestConfig.scala b/src/ets/scala/io/iohk/ethereum/ets/blockchain/BlockchainTestConfig.scala index 08233e4eb5..54472f3ffb 100644 --- a/src/ets/scala/io/iohk/ethereum/ets/blockchain/BlockchainTestConfig.scala +++ b/src/ets/scala/io/iohk/ethereum/ets/blockchain/BlockchainTestConfig.scala @@ -36,6 +36,9 @@ trait BlockchainTestConfig extends BlockchainConfig { // TODO: only place where this was supposed to be used but now it seems it's not, remove? Issue: EC-312 val gasTieBreaker: Boolean = false val ethCompatibleStorage: Boolean = true + override val atlantisBlockNumber: BigInt = Long.MaxValue + override val aghartaBlockNumber: BigInt = Long.MaxValue + override val phoenixBlockNumber: BigInt = Long.MaxValue } object FrontierConfig extends BlockchainTestConfig { diff --git a/src/it/scala/io/iohk/ethereum/db/LevelDbDataSourceIntegrationSuite.scala b/src/it/scala/io/iohk/ethereum/db/LevelDbDataSourceIntegrationSuite.scala deleted file mode 100644 index 8c7254291d..0000000000 --- a/src/it/scala/io/iohk/ethereum/db/LevelDbDataSourceIntegrationSuite.scala +++ /dev/null @@ -1,16 +0,0 @@ -package io.iohk.ethereum.db - -import io.iohk.ethereum.db.dataSource.{ LevelDBDataSource, LevelDbConfig } -import org.scalatest.FlatSpec - -class LevelDbDataSourceIntegrationSuite extends FlatSpec with DataSourceIntegrationTestBehavior { - - private def createDataSource(dataSourcePath: String) = LevelDBDataSource(new LevelDbConfig { - override val verifyChecksums: Boolean = true - override val paranoidChecks: Boolean = true - override val createIfMissing: Boolean = true - override val path: String = dataSourcePath - }) - - it should behave like dataSource(createDataSource) -} diff --git a/src/it/scala/io/iohk/ethereum/txExecTest/ECIP1017Test.scala b/src/it/scala/io/iohk/ethereum/txExecTest/ECIP1017Test.scala index 8d3afae59d..c87ab0fbb4 100644 --- a/src/it/scala/io/iohk/ethereum/txExecTest/ECIP1017Test.scala +++ b/src/it/scala/io/iohk/ethereum/txExecTest/ECIP1017Test.scala @@ -42,6 +42,9 @@ class ECIP1017Test extends FlatSpec with Matchers { override val ethCompatibleStorage: Boolean = true val gasTieBreaker: Boolean = false + override val atlantisBlockNumber: BigInt = Long.MaxValue + override val aghartaBlockNumber: BigInt = Long.MaxValue + override val phoenixBlockNumber: BigInt = Long.MaxValue } val ec = ExecutionContext.fromExecutor(Executors.newFixedThreadPool(4)) diff --git a/src/it/scala/io/iohk/ethereum/txExecTest/ForksTest.scala b/src/it/scala/io/iohk/ethereum/txExecTest/ForksTest.scala index 0eabe57b10..4d352463f5 100644 --- a/src/it/scala/io/iohk/ethereum/txExecTest/ForksTest.scala +++ b/src/it/scala/io/iohk/ethereum/txExecTest/ForksTest.scala @@ -39,6 +39,9 @@ class ForksTest extends FlatSpec with Matchers { override val daoForkConfig: Option[DaoForkConfig] = None override val gasTieBreaker: Boolean = false override val ethCompatibleStorage: Boolean = true + override val atlantisBlockNumber: BigInt = Long.MaxValue + override val aghartaBlockNumber: BigInt = Long.MaxValue + override val phoenixBlockNumber: BigInt = Long.MaxValue } val noErrors = a[Right[_, Seq[Receipt]]] diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index becb55c78b..468908e062 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -474,20 +474,6 @@ mantis { path = ${mantis.datadir}"/iodb/" } - leveldb { - # LevelDB data directory - path = ${mantis.datadir}"/leveldb/" - - # Create DB data directory if it's missing - create-if-missing = true - - # Should the DB raise an error as soon as it detects an internal corruption - paranoid-checks = true - - # Force checksum verification of all data that is read from the file system on behalf of a particular read - verify-checksums = true - } - rocksdb { # RocksDB data directory path = ${mantis.datadir}"/rocksdb/" @@ -518,7 +504,7 @@ mantis { block-cache-size = 33554432 } - # Define which database to use [leveldb, rocksdb], iodb is not currently used + # Define which database to use [rocksdb], iodb is not currently used data-source = "rocksdb" } diff --git a/src/main/resources/chains/base.conf b/src/main/resources/chains/base.conf index 71b963dfd6..61f54beb26 100644 --- a/src/main/resources/chains/base.conf +++ b/src/main/resources/chains/base.conf @@ -53,6 +53,18 @@ # https://github.com/ethereum/EIPs/blob/master/EIPS/eip-609.md byzantium-block-number = "1000000000000000000" + # Atlantis fork block number (ETC only) + # https://ecips.ethereumclassic.org/ECIPs/ecip-1054 + atlantis-block-number = "8772000" + + # Agharta fork block number (ETC only) + # https://ecips.ethereumclassic.org/ECIPs/ecip-1056 + agharta-block-number = "9573000" + + # Phoenix fork block number (ETC only) + # https://ecips.ethereumclassic.org/ECIPs/ecip-1088 + phoenix-block-number = "10500839" + # Constantinople fork block number (ETH only) # https://github.com/ethereum/pm/issues/53 constantinople-block-number = "1000000000000000000" @@ -120,25 +132,13 @@ # Set of initial nodes bootstrap-nodes = [ - "enode://e809c4a2fec7daed400e5e28564e23693b23b2cc5a019b612505631bbe7b9ccf709c1796d2a3d29ef2b045f210caf51e3c4f5b6d3587d43ad5d6397526fa6179@174.112.32.157:30303", - "enode://6e538e7c1280f0a31ff08b382db5302480f775480b8e68f8febca0ceff81e4b19153c6f8bf60313b93bef2cc34d34e1df41317de0ce613a201d1660a788a03e2@52.206.67.235:30303", - "enode://5fbfb426fbb46f8b8c1bd3dd140f5b511da558cd37d60844b525909ab82e13a25ee722293c829e52cb65c2305b1637fa9a2ea4d6634a224d5f400bfe244ac0de@162.243.55.45:30303", - "enode://42d8f29d1db5f4b2947cd5c3d76c6d0d3697e6b9b3430c3d41e46b4bb77655433aeedc25d4b4ea9d8214b6a43008ba67199374a9b53633301bca0cd20c6928ab@104.155.176.151:30303", - "enode://814920f1ec9510aa9ea1c8f79d8b6e6a462045f09caa2ae4055b0f34f7416fca6facd3dd45f1cf1673c0209e0503f02776b8ff94020e98b6679a0dc561b4eba0@104.154.136.117:30303", - "enode://72e445f4e89c0f476d404bc40478b0df83a5b500d2d2e850e08eb1af0cd464ab86db6160d0fde64bd77d5f0d33507ae19035671b3c74fec126d6e28787669740@104.198.71.200:30303", - "enode://5cd218959f8263bc3721d7789070806b0adff1a0ed3f95ec886fb469f9362c7507e3b32b256550b9a7964a23a938e8d42d45a0c34b332bfebc54b29081e83b93@35.187.57.94:30303", - "enode://39abab9d2a41f53298c0c9dc6bbca57b0840c3ba9dccf42aa27316addc1b7e56ade32a0a9f7f52d6c5db4fe74d8824bcedfeaecf1a4e533cacb71cf8100a9442@144.76.238.49:30303", - "enode://f50e675a34f471af2438b921914b5f06499c7438f3146f6b8936f1faeb50b8a91d0d0c24fb05a66f05865cd58c24da3e664d0def806172ddd0d4c5bdbf37747e@144.76.238.49:30306", - "enode://95636c71626ead0ee8dee7ba7cd3bb30f2beb6c25736366c570b072b820a28e5bcf16f06cbe93a912879be98aff93450b04dc1ad6b36dac0b43d8d4959303340@34.202.158.155:30304", - "enode://fa3e2ebfdea1d38c8eca9b55b21aa4332646ddbc4f3c581cd50d320aebab05efed7f05ea7aa4b2a559aaaf91f19fc8766b87bf9d2aabb3fa2dee6e99ab15db1f@45.56.112.78:30304", - "enode://a9705294408fc4374f7782be4304bafcffc8fb5da1c9469107c6f23f01ac8e7413a3501f33099636e336ac7ecf3a2d4175e79f6b12f29f9c8e3106b342973a12@94.130.140.225:30304", - "enode://6960dd938eeb38deecfd5c960d14b07135977f3162f284ba416b7b463ccb15799a23efb462645c3b4db8a0d466e25378e3019ad6a10c1cd2dcdef9a30ed9396e@94.23.45.111:30303", - "enode://4f6233f9371432e33b1536b9a03d9623eb1fd7988fd6497d21f13abda1ef99e0971b08d1e82aa484c26443813367f99f6ee185c930622ddb25a473ce07f59734@151.80.42.214:34703", - "enode://4c560ce2e8293df3d0bce936f7d2a59baec583f43ddffb83e6ee61f7e6193cfa5c8d945df2db016e9e0a1e5613fb98c337a4e26f471ead972675ba847b36a3a6@45.32.155.170:30303", - "enode://88e512d85ad930f3845a9daa910f7cff47e7d2556329d670d9428a84b9b066b19bb6838557056bc7c57a418b97b706c1fad106a2bd135ed478d086dfc0bfc4f9@80.211.156.224:30304", - "enode://b7eff3b8c349835bf6b7ab869ddcf17e7445e1e8ce33f3356afb4b4c8a1fc97009f864636cc359267eccf5170404c2596d6d3502758f0705f0a27e08568d7185@37.19.7.83:30303", - "enode://4bafe073023f2fe2791f5d2e7b408b673f8e0cf0f5118911e221ca7070ed0de87c567dbf6afdfc21154f3fe9b132aaaf3ceff5169fc8669bcbbfa4ba1a08cd83@37.19.7.86:30303", - "enode://5a105e4b17ea0e5ece607841a183a259a0ccc3bea7f4811b23927dd20ee0f7fc033826d902a7ee1fab4e904722188b61891bed3dd28c380257c4c4681f873683@172.104.106.83:30304", - "enode://21beff7f1fc241c60bf0e14f41bda370ef7442d544e203fbc4c9a50793e3b66ce151726851b105f76b578fbe11c56a80b0c64fd5a3482f1370174ebb70d920fd@106.14.186.127:50505" + "enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303", // bootnode-aws-ap-southeast-1-001 + "enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303", // bootnode-aws-us-east-1-001 + "enode://ca6de62fce278f96aea6ec5a2daadb877e51651247cb96ee310a318def462913b653963c155a0ef6c7d50048bba6e6cea881130857413d9f50a621546b590758@34.255.23.113:30303", // bootnode-aws-eu-west-1-001 + "enode://279944d8dcd428dffaa7436f25ca0ca43ae19e7bcf94a8fb7d1641651f92d121e972ac2e8f381414b80cc8e5555811c2ec6e1a99bb009b3f53c4c69923e11bd8@35.158.244.151:30303", // bootnode-aws-eu-central-1-001 + "enode://8499da03c47d637b20eee24eec3c356c9a2e6148d6fe25ca195c7949ab8ec2c03e3556126b0d7ed644675e78c4318b08691b7b57de10e5f0d40d05b09238fa0a@52.187.207.27:30303", // bootnode-azure-australiaeast-001 + "enode://103858bdb88756c71f15e9b5e09b56dc1be52f0a5021d46301dbbfb7e130029cc9d0d6f73f693bc29b665770fff7da4d34f3c6379fe12721b5d7a0bcb5ca1fc1@191.234.162.198:30303", // bootnode-azure-brazilsouth-001 + "enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303", // bootnode-azure-koreasouth-001 + "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303" // bootnode-azure-westus-001 ] } diff --git a/src/main/resources/chains/eth.conf b/src/main/resources/chains/eth.conf index b865dd0480..4f20c207dd 100644 --- a/src/main/resources/chains/eth.conf +++ b/src/main/resources/chains/eth.conf @@ -25,6 +25,18 @@ chain-id = "1" + # Atlantis fork block number (ETC only) + # https://ecips.ethereumclassic.org/ECIPs/ecip-1054 + atlantis-block-number = "1000000000000000000" + + # Agharta fork block number (ETC only) + # https://ecips.ethereumclassic.org/ECIPs/ecip-1056 + agharta-block-number = "1000000000000000000" + + # Phoenix fork block number (ETC only) + # https://ecips.ethereumclassic.org/ECIPs/ecip-1088 + phoenix-block-number = "1000000000000000000" + monetary-policy { # Setting era-duration for eth and ropsten chain to big number is necessery to ensure diff --git a/src/main/resources/chains/morden.conf b/src/main/resources/chains/morden.conf index c5b3c6aef7..5fffe5232c 100644 --- a/src/main/resources/chains/morden.conf +++ b/src/main/resources/chains/morden.conf @@ -20,6 +20,14 @@ custom-genesis-file = "chains/morden.json" + # Atlantis fork block number (ETC only) + # https://ecips.ethereumclassic.org/ECIPs/ecip-1054 + atlantis-block-number = "4729274" + + # Agharta fork block number (ETC only) + # https://ecips.ethereumclassic.org/ECIPs/ecip-1056 + agharta-block-number = "5000381" + bootstrap-nodes = [ "enode://fb28713820e718066a2f5df6250ae9d07cff22f672dbf26be6c75d088f821a9ad230138ba492c533a80407d054b1436ef18e951bb65e6901553516c8dffe8ff0@104.155.176.151:30304", "enode://afdc6076b9bf3e7d3d01442d6841071e84c76c73a7016cb4f35c0437df219db38565766234448f1592a07ba5295a867f0ce87b359bf50311ed0b830a2361392d@104.154.136.117:30403", diff --git a/src/main/scala/io/iohk/ethereum/App.scala b/src/main/scala/io/iohk/ethereum/App.scala index 0d12451ad8..7d52f7cac4 100644 --- a/src/main/scala/io/iohk/ethereum/App.scala +++ b/src/main/scala/io/iohk/ethereum/App.scala @@ -26,7 +26,6 @@ object App extends Logger { case Some(`downloadBootstrap`) => { Config.Db.dataSource match { case "rocksdb" => BootstrapDownload.main(args.tail :+ Config.Db.RocksDb.path) - case "leveldb" => BootstrapDownload.main(args.tail :+ Config.Db.LevelDb.path) } } case Some(`vmServer`) => VmServerApp.main(args.tail) diff --git a/src/main/scala/io/iohk/ethereum/db/components/SharedLevelDBDataSources.scala b/src/main/scala/io/iohk/ethereum/db/components/SharedLevelDBDataSources.scala deleted file mode 100644 index 650170707f..0000000000 --- a/src/main/scala/io/iohk/ethereum/db/components/SharedLevelDBDataSources.scala +++ /dev/null @@ -1,36 +0,0 @@ -package io.iohk.ethereum.db.components - -import io.iohk.ethereum.db.dataSource.{DataSource, LevelDBDataSource} -import io.iohk.ethereum.utils.Config - -trait SharedLevelDBDataSources extends DataSourcesComponent { - - lazy val dataSource = LevelDBDataSource(Config.Db.LevelDb) - - lazy val dataSources = new DataSources { - - override val blockBodiesDataSource: DataSource = dataSource - - override val blockHeightsHashesDataSource: DataSource = dataSource - - override val blockHeadersDataSource: DataSource = dataSource - - override val evmCodeDataSource: DataSource = dataSource - - override val mptDataSource: DataSource = dataSource - - override val fastSyncStateDataSource: DataSource = dataSource - - override val receiptsDataSource: DataSource = dataSource - - override val totalDifficultyDataSource: DataSource = dataSource - - override val appStateDataSource: DataSource = dataSource - - override val transactionMappingDataSource: DataSource = dataSource - - override val knownNodesDataSource: DataSource = dataSource - - override def closeAll(): Unit = dataSource.close() - } -} diff --git a/src/main/scala/io/iohk/ethereum/db/dataSource/LevelDBDataSource.scala b/src/main/scala/io/iohk/ethereum/db/dataSource/LevelDBDataSource.scala deleted file mode 100644 index 55e425f543..0000000000 --- a/src/main/scala/io/iohk/ethereum/db/dataSource/LevelDBDataSource.scala +++ /dev/null @@ -1,116 +0,0 @@ -package io.iohk.ethereum.db.dataSource - -import java.io.File - -import org.iq80.leveldb.impl.Iq80DBFactory -import org.iq80.leveldb.{ DB, Options } -import io.iohk.ethereum.db.dataSource.DataSource._ -class LevelDBDataSource(private var db: DB, private val levelDbConfig: LevelDbConfig) extends DataSource { - - /** - * This function obtains the associated value to a key, if there exists one. - * - * @param namespace which will be searched for the key. - * @param key the key retrieve the value. - * @return the value associated with the passed key. - */ - override def get(namespace: Namespace, key: Key): Option[Value] = Option(db.get((namespace ++ key).toArray)) - - /** - * This function obtains the associated value to a key, if there exists one. It assumes that - * caller already properly serialized key. Useful when caller knows some pattern in data to - * avoid generic serialization. - * - * @param key the key retrieve the value. - * @return the value associated with the passed key. - */ - override def getOptimized(key: Array[Byte]): Option[Array[Byte]] = Option(db.get(key)) - - /** - * This function updates the DataSource by deleting, updating and inserting new (key-value) pairs. - * - * @param namespace from which the (key-value) pairs will be removed and inserted. - * @param toRemove which includes all the keys to be removed from the DataSource. - * @param toUpsert which includes all the (key-value) pairs to be inserted into the DataSource. - * If a key is already in the DataSource its value will be updated. - * @return the new DataSource after the removals and insertions were done. - */ - override def update(namespace: Namespace, toRemove: Seq[Key], toUpsert: Seq[(Key, Value)]): DataSource = { - val batch = db.createWriteBatch() - - toRemove.foreach{ key => batch.delete((namespace ++ key).toArray) } - toUpsert.foreach{ case (k, v) => batch.put((namespace ++ k).toArray, v.toArray) } - - db.write(batch) - batch.close() - - this - } - - override def updateOptimized(toRemove: Seq[Array[Byte]], toUpsert: Seq[(Array[Byte], Array[Byte])]): DataSource = { - val batch = db.createWriteBatch() - - toRemove.foreach{ key => batch.delete(key) } - toUpsert.foreach{ case (k, v) => batch.put(k, v) } - - db.write(batch) - batch.close() - - this - } - - /** - * This function updates the DataSource by deleting all the (key-value) pairs in it. - * - * @return the new DataSource after all the data was removed. - */ - override def clear: DataSource = { - destroy() - this.db = LevelDBDataSource.createDB(levelDbConfig) - this - } - - /** - * This function closes the DataSource, without deleting the files used by it. - */ - override def close(): Unit = db.close() - - /** - * This function closes the DataSource, if it is not yet closed, and deletes all the files used by it. - */ - override def destroy(): Unit = { - try { - close() - } finally { - import levelDbConfig._ - - Iq80DBFactory.factory.destroy(new File(path), null) // options are not used here - } - } -} - -trait LevelDbConfig { - val createIfMissing: Boolean - val paranoidChecks: Boolean - val verifyChecksums: Boolean - val path: String -} - -object LevelDBDataSource { - - private def createDB(levelDbConfig: LevelDbConfig): DB = { - import levelDbConfig._ - - val options = new Options() - .createIfMissing(createIfMissing) - .paranoidChecks(paranoidChecks) // raise an error as soon as it detects an internal corruption - .verifyChecksums(verifyChecksums) // force checksum verification of all data that is read from the file system on behalf of a particular read - - Iq80DBFactory.factory.open(new File(path), options) - - } - - def apply(levelDbConfig: LevelDbConfig): LevelDBDataSource = { - new LevelDBDataSource(createDB(levelDbConfig), levelDbConfig) - } -} diff --git a/src/main/scala/io/iohk/ethereum/jsonrpc/TestService.scala b/src/main/scala/io/iohk/ethereum/jsonrpc/TestService.scala index 4e4fda07c0..27dd23edd5 100644 --- a/src/main/scala/io/iohk/ethereum/jsonrpc/TestService.scala +++ b/src/main/scala/io/iohk/ethereum/jsonrpc/TestService.scala @@ -85,6 +85,9 @@ class TestService( override val gasTieBreaker: Boolean = testLedgerWrapper.blockchainConfig.gasTieBreaker override val ethCompatibleStorage: Boolean = testLedgerWrapper.blockchainConfig.ethCompatibleStorage override val bootstrapNodes: Set[String] = Set() + override val atlantisBlockNumber: BigInt = testLedgerWrapper.blockchainConfig.atlantisBlockNumber + override val aghartaBlockNumber: BigInt = testLedgerWrapper.blockchainConfig.aghartaBlockNumber + override val phoenixBlockNumber: BigInt = testLedgerWrapper.blockchainConfig.phoenixBlockNumber } val genesisData = GenesisData( diff --git a/src/main/scala/io/iohk/ethereum/nodebuilder/NodeBuilder.scala b/src/main/scala/io/iohk/ethereum/nodebuilder/NodeBuilder.scala index a64838a266..572d9a4e80 100644 --- a/src/main/scala/io/iohk/ethereum/nodebuilder/NodeBuilder.scala +++ b/src/main/scala/io/iohk/ethereum/nodebuilder/NodeBuilder.scala @@ -81,7 +81,6 @@ trait StorageBuilder { lazy val storagesInstance: DataSourcesComponent with StoragesComponent with PruningModeComponent = Config.Db.dataSource match { case "rocksdb" => new SharedRocksDbDataSources with PruningConfigBuilder with Storages.DefaultStorages - case "leveldb" => new SharedLevelDBDataSources with PruningConfigBuilder with Storages.DefaultStorages } } diff --git a/src/main/scala/io/iohk/ethereum/utils/Config.scala b/src/main/scala/io/iohk/ethereum/utils/Config.scala index 846ce82bcc..8aab11fe84 100644 --- a/src/main/scala/io/iohk/ethereum/utils/Config.scala +++ b/src/main/scala/io/iohk/ethereum/utils/Config.scala @@ -4,7 +4,7 @@ import java.net.InetSocketAddress import akka.util.ByteString import com.typesafe.config.{ConfigFactory, Config => TypesafeConfig} -import io.iohk.ethereum.db.dataSource.{LevelDbConfig, RocksDbConfig} +import io.iohk.ethereum.db.dataSource.RocksDbConfig import io.iohk.ethereum.db.storage.pruning.{ArchivePruning, BasicPruning, InMemoryPruning, PruningMode} import io.iohk.ethereum.domain.{Address, UInt256} import io.iohk.ethereum.network.PeerManagerActor.{FastSyncHostConfiguration, PeerConfiguration} @@ -183,7 +183,6 @@ object Config { private val dbConfig = config.getConfig("db") private val iodbConfig = dbConfig.getConfig("iodb") - private val levelDbConfig = dbConfig.getConfig("leveldb") private val rocksDbConfig = dbConfig.getConfig("rocksdb") val dataSource: String = dbConfig.getString("data-source") @@ -192,13 +191,6 @@ object Config { val path: String = iodbConfig.getString("path") } - object LevelDb extends LevelDbConfig { - override val createIfMissing: Boolean = levelDbConfig.getBoolean("create-if-missing") - override val paranoidChecks: Boolean = levelDbConfig.getBoolean("paranoid-checks") - override val verifyChecksums: Boolean = levelDbConfig.getBoolean("verify-checksums") - override val path: String = levelDbConfig.getString("path") - } - object RocksDb extends RocksDbConfig { override val createIfMissing: Boolean = rocksDbConfig.getBoolean("create-if-missing") override val paranoidChecks: Boolean = rocksDbConfig.getBoolean("paranoid-checks") @@ -377,6 +369,10 @@ trait BlockchainConfig { val ethCompatibleStorage: Boolean val bootstrapNodes: Set[String] + + val atlantisBlockNumber: BigInt + val aghartaBlockNumber: BigInt + val phoenixBlockNumber: BigInt } object BlockchainConfig { @@ -417,6 +413,12 @@ object BlockchainConfig { val ethCompatibleStorage: Boolean = blockchainConfig.getBoolean("eth-compatible-storage") val bootstrapNodes: Set[String] = blockchainConfig.getStringList("bootstrap-nodes").asScala.toSet + + override val atlantisBlockNumber: BigInt = BigInt(blockchainConfig.getString("atlantis-block-number")) + + override val aghartaBlockNumber: BigInt = BigInt(blockchainConfig.getString("agharta-block-number")) + + override val phoenixBlockNumber: BigInt = BigInt(blockchainConfig.getString("phoenix-block-number")) } } } diff --git a/src/main/scala/io/iohk/ethereum/vm/OpCode.scala b/src/main/scala/io/iohk/ethereum/vm/OpCode.scala index f175d8c4ad..f47e54fc5f 100644 --- a/src/main/scala/io/iohk/ethereum/vm/OpCode.scala +++ b/src/main/scala/io/iohk/ethereum/vm/OpCode.scala @@ -165,7 +165,6 @@ object OpCodes { List(REVERT, STATICCALL, RETURNDATACOPY, RETURNDATASIZE) ++ HomesteadOpCodes val ConstantinopleOpCodes: List[OpCode] = - List(EXTCODEHASH, CREATE2, SHL, SHR, SAR) ++ ByzantiumOpCodes } diff --git a/src/snappy/resources/example.conf b/src/snappy/resources/example.conf index 0a603b6365..f01a915da6 100644 --- a/src/snappy/resources/example.conf +++ b/src/snappy/resources/example.conf @@ -15,7 +15,7 @@ snappy { # Path to the DB snapshot that contains all the blocks to be executed (and state for single-db) source-db-path = "path/to/source-db" - # Data source that should be used [rocksdb, leveldb], iodb is not currently used + # Data source that should be used [rocksdb], iodb is not currently used data-source = "rocksdb" # Path to the DB where the state resulting from execution is saved (for single-db this is ignored) diff --git a/src/snappy/scala/io/iohk/ethereum/snappy/Prerequisites.scala b/src/snappy/scala/io/iohk/ethereum/snappy/Prerequisites.scala index bf134a19e7..7aa4c1ff27 100644 --- a/src/snappy/scala/io/iohk/ethereum/snappy/Prerequisites.scala +++ b/src/snappy/scala/io/iohk/ethereum/snappy/Prerequisites.scala @@ -5,7 +5,7 @@ import java.util.concurrent.Executors import io.iohk.ethereum.blockchain.data.GenesisDataLoader import io.iohk.ethereum.consensus.StdTestConsensusBuilder import io.iohk.ethereum.db.components.Storages.PruningModeComponent -import io.iohk.ethereum.db.components.{ DataSourcesComponent, SharedLevelDBDataSources, SharedRocksDbDataSources, Storages } +import io.iohk.ethereum.db.components.{ DataSourcesComponent, SharedRocksDbDataSources, Storages } import io.iohk.ethereum.db.dataSource._ import io.iohk.ethereum.db.storage.Namespaces import io.iohk.ethereum.db.storage.pruning.{ ArchivePruning, PruningMode } @@ -14,7 +14,7 @@ import io.iohk.ethereum.ledger.Ledger.VMImpl import io.iohk.ethereum.ledger.{ Ledger, LedgerImpl } import io.iohk.ethereum.nodebuilder._ import io.iohk.ethereum.snappy.Config.{ DualDB, SingleDB } -import io.iohk.ethereum.snappy.Prerequisites.{ LevelDbStorages, RocksDbStorages, Storages } +import io.iohk.ethereum.snappy.Prerequisites.{RocksDbStorages, Storages } import scala.concurrent.ExecutionContext @@ -28,24 +28,11 @@ object Prerequisites { } trait RocksDbStorages extends SharedRocksDbDataSources with Storages - - trait LevelDbStorages extends SharedLevelDBDataSources with Storages - } class Prerequisites(config: Config) { val ec = ExecutionContext.fromExecutor(Executors.newFixedThreadPool(4)) - private def levelDb(dbPath: String): LevelDBDataSource = - LevelDBDataSource ( - new LevelDbConfig { - override val verifyChecksums: Boolean = true - override val paranoidChecks: Boolean = true - override val createIfMissing: Boolean = true - override val path: String = dbPath - } - ) - private def rocksDb(dbPath: String): RocksDbDataSource = RocksDbDataSource(new RocksDbConfig { override val createIfMissing: Boolean = true @@ -64,10 +51,6 @@ class Prerequisites(config: Config) { case "rocksdb" => new RocksDbStorages { override lazy val dataSource: RocksDbDataSource = rocksDb(dbPath) } - - case "leveldb" => new LevelDbStorages { - override lazy val dataSource: LevelDBDataSource = levelDb(dbPath) - } } } diff --git a/src/test/scala/io/iohk/ethereum/consensus/BlockGeneratorSpec.scala b/src/test/scala/io/iohk/ethereum/consensus/BlockGeneratorSpec.scala index e07a721589..7c0b231965 100644 --- a/src/test/scala/io/iohk/ethereum/consensus/BlockGeneratorSpec.scala +++ b/src/test/scala/io/iohk/ethereum/consensus/BlockGeneratorSpec.scala @@ -166,6 +166,9 @@ class BlockGeneratorSpec extends FlatSpec with Matchers with PropertyChecks with override val bootstrapNodes: Set[String] = Set() val gasTieBreaker: Boolean = false val ethCompatibleStorage: Boolean = true + override val atlantisBlockNumber: BigInt = Long.MaxValue + override val aghartaBlockNumber: BigInt = Long.MaxValue + override val phoenixBlockNumber: BigInt = Long.MaxValue } override lazy val blockExecution = new BlockExecution(blockchain, blockchainConfig, consensus.blockPreparator, blockValidation) @@ -333,6 +336,9 @@ class BlockGeneratorSpec extends FlatSpec with Matchers with PropertyChecks with override val bootstrapNodes: Set[String] = Set() val gasTieBreaker: Boolean = false val ethCompatibleStorage: Boolean = true + override val atlantisBlockNumber: BigInt = Long.MaxValue + override val aghartaBlockNumber: BigInt = Long.MaxValue + override val phoenixBlockNumber: BigInt = Long.MaxValue } val genesisDataLoader = new GenesisDataLoader(blockchain, blockchainConfig) diff --git a/src/test/scala/io/iohk/ethereum/consensus/validators/BlockHeaderValidatorSpec.scala b/src/test/scala/io/iohk/ethereum/consensus/validators/BlockHeaderValidatorSpec.scala index 2c924f3fd7..55daf69fd9 100644 --- a/src/test/scala/io/iohk/ethereum/consensus/validators/BlockHeaderValidatorSpec.scala +++ b/src/test/scala/io/iohk/ethereum/consensus/validators/BlockHeaderValidatorSpec.scala @@ -384,6 +384,9 @@ class BlockHeaderValidatorSpec override val bootstrapNodes: Set[String] = Set() val gasTieBreaker: Boolean = false override val ethCompatibleStorage: Boolean = true + override val atlantisBlockNumber: BigInt = Long.MaxValue + override val aghartaBlockNumber: BigInt = Long.MaxValue + override val phoenixBlockNumber: BigInt = Long.MaxValue } val ProDaoBlock1920008Header = BlockHeader( diff --git a/src/test/scala/io/iohk/ethereum/db/dataSource/LevelDbDataSourceTest.scala b/src/test/scala/io/iohk/ethereum/db/dataSource/LevelDbDataSourceTest.scala deleted file mode 100644 index b27b1e35c4..0000000000 --- a/src/test/scala/io/iohk/ethereum/db/dataSource/LevelDbDataSourceTest.scala +++ /dev/null @@ -1,22 +0,0 @@ -package io.iohk.ethereum.db.dataSource - -import java.nio.file.Files - -import org.scalatest.FlatSpec - -class LevelDbDataSourceTest extends FlatSpec with DataSourceTestBehavior { - - private def createDataSource(path: String): LevelDBDataSource = { - val dbPath: String = Files.createTempDirectory("temp-test-leveldb").toAbsolutePath.toString - - LevelDBDataSource(new LevelDbConfig { - override val verifyChecksums: Boolean = true - override val paranoidChecks: Boolean = true - override val createIfMissing: Boolean = true - override val path: String = dbPath - }) - } - - it should behave like dataSource(createDataSource) - -} diff --git a/src/test/scala/io/iohk/ethereum/jsonrpc/EthServiceSpec.scala b/src/test/scala/io/iohk/ethereum/jsonrpc/EthServiceSpec.scala index afbf3bca09..4a795727da 100644 --- a/src/test/scala/io/iohk/ethereum/jsonrpc/EthServiceSpec.scala +++ b/src/test/scala/io/iohk/ethereum/jsonrpc/EthServiceSpec.scala @@ -893,6 +893,9 @@ class EthServiceSpec extends FlatSpec with Matchers with ScalaFutures with MockF override val daoForkConfig: Option[DaoForkConfig] = None override val bootstrapNodes: Set[String] = Set() val gasTieBreaker: Boolean = false + override val atlantisBlockNumber: BigInt = 0 + override val aghartaBlockNumber: BigInt = 0 + override val phoenixBlockNumber: BigInt = 0 } override lazy val consensus: TestConsensus = buildTestConsensus().withBlockGenerator(blockGenerator) diff --git a/src/test/scala/io/iohk/ethereum/jsonrpc/PersonalServiceSpec.scala b/src/test/scala/io/iohk/ethereum/jsonrpc/PersonalServiceSpec.scala index b2039b83a6..c755339651 100644 --- a/src/test/scala/io/iohk/ethereum/jsonrpc/PersonalServiceSpec.scala +++ b/src/test/scala/io/iohk/ethereum/jsonrpc/PersonalServiceSpec.scala @@ -441,6 +441,9 @@ class PersonalServiceSpec extends FlatSpec with Matchers with MockFactory with S override val bootstrapNodes: Set[String] = Set() val gasTieBreaker: Boolean = false val ethCompatibleStorage: Boolean = true + override val atlantisBlockNumber: BigInt = 0 + override val aghartaBlockNumber: BigInt = 0 + override val phoenixBlockNumber: BigInt = 0 } val wallet = Wallet(address, prvKey) diff --git a/src/test/scala/io/iohk/ethereum/ledger/LedgerTestSetup.scala b/src/test/scala/io/iohk/ethereum/ledger/LedgerTestSetup.scala index 8bab50a204..d293afb290 100644 --- a/src/test/scala/io/iohk/ethereum/ledger/LedgerTestSetup.scala +++ b/src/test/scala/io/iohk/ethereum/ledger/LedgerTestSetup.scala @@ -211,6 +211,9 @@ trait DaoForkTestSetup extends TestSetup with MockFactory { override val bootstrapNodes: Set[String] = Set() val gasTieBreaker: Boolean = false val ethCompatibleStorage: Boolean = true + override val atlantisBlockNumber: BigInt = Long.MaxValue + override val aghartaBlockNumber: BigInt = Long.MaxValue + override val phoenixBlockNumber: BigInt = Long.MaxValue } (testBlockchain.getBlockHeaderByHash _).expects(proDaoBlock.header.parentHash).returning(Some(Fixtures.Blocks.DaoParentBlock.header)) diff --git a/src/test/scala/io/iohk/ethereum/ledger/StxLedgerSpec.scala b/src/test/scala/io/iohk/ethereum/ledger/StxLedgerSpec.scala index 613b5364cc..f0bd74383e 100644 --- a/src/test/scala/io/iohk/ethereum/ledger/StxLedgerSpec.scala +++ b/src/test/scala/io/iohk/ethereum/ledger/StxLedgerSpec.scala @@ -124,6 +124,9 @@ trait ScenarioSetup extends EphemBlockchainTestSetup { override val gasTieBreaker: Boolean = false override val ethCompatibleStorage: Boolean = true override val bootstrapNodes: Set[String] = Set() + override val atlantisBlockNumber: BigInt = 0 + override val aghartaBlockNumber: BigInt = 0 + override val phoenixBlockNumber: BigInt = 0 } override lazy val stxLedger = new StxLedger(blockchain, blockchainConfig, consensus.blockPreparator) diff --git a/src/test/scala/io/iohk/ethereum/mpt/PersistentStorage.scala b/src/test/scala/io/iohk/ethereum/mpt/PersistentStorage.scala index ce3f8c7e1f..9c9aba5313 100644 --- a/src/test/scala/io/iohk/ethereum/mpt/PersistentStorage.scala +++ b/src/test/scala/io/iohk/ethereum/mpt/PersistentStorage.scala @@ -35,17 +35,4 @@ trait PersistentStorage { } } - def withLevelDbNodeStorage(testCode: MptStorage => Unit): Unit = { - val dbPath = Files.createTempDirectory("leveldb").toAbsolutePath.toString - val dataSource = LevelDBDataSource(new LevelDbConfig { - override val verifyChecksums: Boolean = true - override val paranoidChecks: Boolean = true - override val createIfMissing: Boolean = true - override val path: String = dbPath - }) - - testExecution(testCode, dbPath, dataSource) - dataSource.destroy() - } - } diff --git a/src/test/scala/io/iohk/ethereum/network/handshaker/EtcHandshakerSpec.scala b/src/test/scala/io/iohk/ethereum/network/handshaker/EtcHandshakerSpec.scala index 38eba69de2..5be52e39d4 100644 --- a/src/test/scala/io/iohk/ethereum/network/handshaker/EtcHandshakerSpec.scala +++ b/src/test/scala/io/iohk/ethereum/network/handshaker/EtcHandshakerSpec.scala @@ -203,6 +203,9 @@ class EtcHandshakerSpec extends FlatSpec with Matchers { override val bootstrapNodes: Set[String] = Set() val gasTieBreaker: Boolean = false val ethCompatibleStorage: Boolean = true + override val atlantisBlockNumber: BigInt = 0 + override val aghartaBlockNumber: BigInt = 0 + override val phoenixBlockNumber: BigInt = 0 } val etcHandshakerConfigurationWithResolver = new MockEtcHandshakerConfiguration { diff --git a/src/universal/conf/storage.conf b/src/universal/conf/storage.conf index 6aafc692c8..6d4be3f54f 100644 --- a/src/universal/conf/storage.conf +++ b/src/universal/conf/storage.conf @@ -20,11 +20,6 @@ mantis { } db { - leveldb { - # LevelDB data directory - # path = ${mantis.datadir}"/leveldb/" - } - rocksdb { # RocksDb data directory # path = ${mantis.datadir}"/rocksdb/" diff --git a/verify.sbt b/verify.sbt index 1a0258fc14..1c694a3764 100644 --- a/verify.sbt +++ b/verify.sbt @@ -29,8 +29,6 @@ verifyDependencies in verify ++= Seq( "com.typesafe" % "ssl-config-core" sha1 "c1fdf6c0e7af6b5dd1df14e38062f917320413b4", "org.scala-lang.modules" % "scala-parser-combinators" sha1 "bbce493f8bf61b56623624ff96ac3865f7f6999a", "io.suzaku" % "boopickle" sha1 "a1cd66dfb24325d11cb38c340b7663e1ee4ed70e", - "org.iq80.leveldb" % "leveldb-api" sha1 "d71173b159a38acd8036d9694f1243afe6be9108", - "org.iq80.leveldb" % "leveldb" sha1 "e9b071b63a7b40f7d01ae01e99259a2de72426f6", "org.ethereum" % "rocksdbjni" sha1 "63e2b8b137c967ec15049f1f66b9d987e8f4beb7", "org.scorexfoundation" % "iodb" sha1 "0d4b86fe17008bfc5ec0fe4317d6d9c39a81dc85", "net.jpountz.lz4" % "lz4" sha1 "c708bb2590c0652a642236ef45d9f99ff842a2ce",