diff --git a/consensus-client-it/src/test/scala/com/wavesplatform/api/NodeHttpApi.scala b/consensus-client-it/src/test/scala/com/wavesplatform/api/NodeHttpApi.scala index 72d1652f..20fb5703 100644 --- a/consensus-client-it/src/test/scala/com/wavesplatform/api/NodeHttpApi.scala +++ b/consensus-client-it/src/test/scala/com/wavesplatform/api/NodeHttpApi.scala @@ -18,6 +18,7 @@ import play.api.libs.json.* import sttp.client3.* import sttp.client3.playJson.* import sttp.model.{StatusCode, Uri} +import units.test.HasRetry import scala.concurrent.duration.DurationInt import scala.util.chaining.scalaUtilChainingOps diff --git a/consensus-client-it/src/test/scala/units/Accounts.scala b/consensus-client-it/src/test/scala/units/Accounts.scala new file mode 100644 index 00000000..50b1486d --- /dev/null +++ b/consensus-client-it/src/test/scala/units/Accounts.scala @@ -0,0 +1,28 @@ +package units + +import com.google.common.primitives.{Bytes, Ints} +import com.wavesplatform.account.{KeyPair, SeedKeyPair} +import com.wavesplatform.crypto +import org.web3j.crypto.Credentials +import units.eth.EthAddress + +import java.nio.charset.StandardCharsets + +trait Accounts { + val chainContractAccount: KeyPair = mkKeyPair("devnet cc 1", 0) + + val miner1Account = mkKeyPair("devnet-1", 0) + val miner1RewardAddress = EthAddress.unsafeFrom("0x7dbcf9c6c3583b76669100f9be3caf6d722bc9f9") + + val miner2Account = mkKeyPair("devnet-2", 0) + val miner2RewardAddress = EthAddress.unsafeFrom("0xcf0b9e13fdd593f4ca26d36afcaa44dd3fdccbed") + + val clRichAccount1 = mkKeyPair("devnet rich", 0) + val clRichAccount2 = mkKeyPair("devnet rich", 1) + + val elRichAccount1 = Credentials.create("8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63") + val elRichAccount2 = Credentials.create("ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f") + + protected def mkKeyPair(seed: String, nonce: Int): SeedKeyPair = + SeedKeyPair(crypto.secureHash(Bytes.concat(Ints.toByteArray(nonce), seed.getBytes(StandardCharsets.UTF_8)))) +} diff --git a/consensus-client-it/src/test/scala/units/BaseItTestSuite.scala b/consensus-client-it/src/test/scala/units/BaseItTestSuite.scala index 6bf2062d..ce9e673a 100644 --- a/consensus-client-it/src/test/scala/units/BaseItTestSuite.scala +++ b/consensus-client-it/src/test/scala/units/BaseItTestSuite.scala @@ -1,26 +1,22 @@ package units -import com.google.common.primitives.{Bytes, Ints} import com.typesafe.config.ConfigFactory -import com.wavesplatform.account.{AddressScheme, KeyPair, SeedKeyPair} -import com.wavesplatform.api.HasRetry +import com.wavesplatform.GenesisBlockGenerator +import com.wavesplatform.account.AddressScheme import com.wavesplatform.common.state.ByteStr import com.wavesplatform.utils.ScorexLogging -import com.wavesplatform.{GenesisBlockGenerator, crypto} import monix.execution.atomic.AtomicBoolean import org.scalatest.freespec.AnyFreeSpec import org.scalatest.matchers.should.Matchers import org.scalatest.{BeforeAndAfterAll, EitherValues, OptionValues} -import org.web3j.crypto.Credentials import units.BaseItTestSuite.generateWavesGenesisConfig import units.client.contract.HasConsensusLayerDappTxHelpers import units.docker.BaseContainer.{ConfigsDir, DefaultLogsDir} import units.docker.Networks -import units.eth.{EthAddress, Gwei} -import units.test.CustomMatchers +import units.eth.Gwei +import units.test.{CustomMatchers, HasRetry} import java.io.PrintStream -import java.nio.charset.StandardCharsets import java.nio.file.{Files, Path} import scala.concurrent.duration.DurationInt @@ -34,31 +30,17 @@ trait BaseItTestSuite with OptionValues with ReportingTestName with HasRetry + with Accounts with HasConsensusLayerDappTxHelpers { - override val currentHitSource: ByteStr = ByteStr.empty - override val chainContractAccount: KeyPair = mkKeyPair("devnet-1", 2) - protected val rewardAmount: Gwei = Gwei.ofRawGwei(2_000_000_000L) + override val currentHitSource: ByteStr = ByteStr.empty + protected val rewardAmount: Gwei = Gwei.ofRawGwei(2_000_000_000L) protected lazy val network = Networks.network - protected val miner1Account = mkKeyPair("devnet-1", 0) - protected val miner1RewardAddress = EthAddress.unsafeFrom("0x7dbcf9c6c3583b76669100f9be3caf6d722bc9f9") - - protected val miner2Account = mkKeyPair("devnet-2", 0) - protected val miner2RewardAddress = EthAddress.unsafeFrom("0xcf0b9e13fdd593f4ca26d36afcaa44dd3fdccbed") - - protected val clRichAccount1 = mkKeyPair("devnet-0", 0) - protected val clRichAccount2 = mkKeyPair("devnet-0", 1) - - protected val elRichAccount1 = Credentials.create("8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63") - protected val elRichAccount2 = Credentials.create("ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f") - protected lazy val wavesGenesisConfigPath = generateWavesGenesisConfig() protected def startNodes(): Unit - protected def stopNodes(): Unit - protected def setupNetwork(): Unit override def beforeAll(): Unit = { @@ -75,9 +57,6 @@ trait BaseItTestSuite network.close() super.afterAll() } - - protected def mkKeyPair(seed: String, nonce: Int): SeedKeyPair = - SeedKeyPair(crypto.secureHash(Bytes.concat(Ints.toByteArray(nonce), seed.getBytes(StandardCharsets.UTF_8)))) } object BaseItTestSuite { diff --git a/consensus-client-it/src/test/scala/units/BridgeE2CTestSuite.scala b/consensus-client-it/src/test/scala/units/BridgeE2CTestSuite.scala index 726466ec..dd39fb8e 100644 --- a/consensus-client-it/src/test/scala/units/BridgeE2CTestSuite.scala +++ b/consensus-client-it/src/test/scala/units/BridgeE2CTestSuite.scala @@ -10,7 +10,7 @@ import org.web3j.protocol.exceptions.TransactionException import org.web3j.utils.Convert import units.el.ElBridgeClient -class BridgeE2CTestSuite extends TwoNodesTestSuite { +class BridgeE2CTestSuite extends OneNodeTestSuite { protected val elSender = elRichAccount1 protected val clRecipient = clRichAccount1 protected val userAmount = 1 @@ -19,38 +19,39 @@ class BridgeE2CTestSuite extends TwoNodesTestSuite { protected def sendNative(amount: BigInt = UnitsConvert.toWei(userAmount)): TransactionReceipt = ec1.elBridge.sendNative(elSender, clRecipient.toAddress, amount) - private val tenGwei = BigInt(Convert.toWei("10", Convert.Unit.GWEI).toBigIntegerExact) + protected val tenGwei = BigInt(Convert.toWei("10", Convert.Unit.GWEI).toBigIntegerExact) - "L2-264 Amount should % 10 Gwei" in { - try sendNative(tenGwei + 1) - catch { - case e: TransactionException => - val encodedRevertReason = e.getTransactionReceipt.get().getRevertReason - val revertReason = ElBridgeClient.decodeRevertReason(encodedRevertReason) - revertReason shouldBe "Sent value 10000000001 must be a multiple of 10000000000" + "Negative" - { + def sendNativeInvalid(amount: BigInt): TransactionException = + try { + sendNative(amount) + fail(s"Expected sendNative($amount) to fail") + } catch { + case e: TransactionException => e + } + + "L2-264 Amount should % 10 Gwei" in { + val e = sendNativeInvalid(tenGwei + 1) + val encodedRevertReason = e.getTransactionReceipt.get().getRevertReason + val revertReason = ElBridgeClient.decodeRevertReason(encodedRevertReason) + revertReason shouldBe "Sent value 10000000001 must be a multiple of 10000000000" } - } - "L2-265 Amount should be between 10 and MAX_AMOUNT_IN_WEI Gwei" in { - withClue("1. Less than 10 Gwei: ") { - try sendNative(1) - catch { - case e: TransactionException => - val encodedRevertReason = e.getTransactionReceipt.get().getRevertReason - val revertReason = ElBridgeClient.decodeRevertReason(encodedRevertReason) - revertReason shouldBe "Sent value 1 must be greater or equal to 10000000000" + "L2-265 Amount should be between 10 and MAX_AMOUNT_IN_WEI Gwei" in { + withClue("1. Less than 10 Gwei: ") { + val e = sendNativeInvalid(1) + val encodedRevertReason = e.getTransactionReceipt.get().getRevertReason + val revertReason = ElBridgeClient.decodeRevertReason(encodedRevertReason) + revertReason shouldBe "Sent value 1 must be greater or equal to 10000000000" } - } - withClue("2. More than MAX_AMOUNT_IN_WEI: ") { - val maxAmountInWei = BigInt(Long.MaxValue) - val biggerAmount = (maxAmountInWei / tenGwei + 1) * tenGwei - try sendNative(biggerAmount) - catch { - case e: TransactionException => - val encodedRevertReason = e.getTransactionReceipt.get().getRevertReason - val revertReason = ElBridgeClient.decodeRevertReason(encodedRevertReason) - revertReason shouldBe s"Sent value $biggerAmount must be less or equal to $maxAmountInWei" + withClue("2. More than MAX_AMOUNT_IN_WEI: ") { + val maxAmountInWei = BigInt(Long.MaxValue) + val biggerAmount = (maxAmountInWei / tenGwei + 1) * tenGwei + val e = sendNativeInvalid(biggerAmount) + val encodedRevertReason = e.getTransactionReceipt.get().getRevertReason + val revertReason = ElBridgeClient.decodeRevertReason(encodedRevertReason) + revertReason shouldBe s"Sent value $biggerAmount must be less or equal to $maxAmountInWei" } } } diff --git a/consensus-client-it/src/test/scala/units/OneNodeTestSuite.scala b/consensus-client-it/src/test/scala/units/OneNodeTestSuite.scala index 334ba7cc..3a74d0ed 100644 --- a/consensus-client-it/src/test/scala/units/OneNodeTestSuite.scala +++ b/consensus-client-it/src/test/scala/units/OneNodeTestSuite.scala @@ -16,6 +16,7 @@ trait OneNodeTestSuite extends BaseItTestSuite { number = 1, ip = Networks.ipForNode(3), baseSeed = "devnet-1", + clMinerKeyPair = mkKeyPair("devnet-1", 0), chainContractAddress = chainContractAddress, ecEngineApiUrl = s"http://${ec1.hostName}:${EcContainer.EnginePort}", genesisConfigPath = wavesGenesisConfigPath diff --git a/consensus-client-it/src/test/scala/units/TwoNodesTestSuite.scala b/consensus-client-it/src/test/scala/units/TwoNodesTestSuite.scala index 9606b1c5..2b0e4aff 100644 --- a/consensus-client-it/src/test/scala/units/TwoNodesTestSuite.scala +++ b/consensus-client-it/src/test/scala/units/TwoNodesTestSuite.scala @@ -22,6 +22,7 @@ trait TwoNodesTestSuite extends BaseItTestSuite { number = 1, ip = Networks.ipForNode(4), baseSeed = "devnet-1", + clMinerKeyPair = mkKeyPair("devnet-1", 0), chainContractAddress = chainContractAddress, ecEngineApiUrl = s"http://${ec1.hostName}:${EcContainer.EnginePort}", genesisConfigPath = wavesGenesisConfigPath @@ -32,6 +33,7 @@ trait TwoNodesTestSuite extends BaseItTestSuite { number = 2, ip = Networks.ipForNode(5), baseSeed = "devnet-2", + clMinerKeyPair = mkKeyPair("devnet-2", 0), chainContractAddress = chainContractAddress, ecEngineApiUrl = s"http://${ec2.hostName}:${EcContainer.EnginePort}", genesisConfigPath = wavesGenesisConfigPath diff --git a/consensus-client-it/src/test/scala/units/docker/WavesNodeContainer.scala b/consensus-client-it/src/test/scala/units/docker/WavesNodeContainer.scala index 7cce10c9..31f6d3f0 100644 --- a/consensus-client-it/src/test/scala/units/docker/WavesNodeContainer.scala +++ b/consensus-client-it/src/test/scala/units/docker/WavesNodeContainer.scala @@ -1,9 +1,11 @@ package units.docker import com.google.common.io.Files as GFiles -import com.wavesplatform.account.Address +import com.google.common.primitives.{Bytes, Ints} +import com.wavesplatform.account.{Address, KeyPair, SeedKeyPair} import com.wavesplatform.api.{LoggingBackend, NodeHttpApi} import com.wavesplatform.common.utils.Base58 +import com.wavesplatform.crypto import org.testcontainers.containers.BindMode import org.testcontainers.containers.Network.NetworkImpl import org.testcontainers.utility.DockerImageName @@ -22,6 +24,7 @@ class WavesNodeContainer( number: Int, ip: String, baseSeed: String, + clMinerKeyPair: KeyPair, // Force CL miner chainContractAddress: Address, ecEngineApiUrl: String, genesisConfigPath: Path @@ -37,6 +40,7 @@ class WavesNodeContainer( "NODE_NUMBER" -> s"$number", "WAVES_WALLET_SEED" -> Base58.encode(baseSeed.getBytes(StandardCharsets.UTF_8)), "JAVA_OPTS" -> List( + s"-Dwaves.miner.private-keys.0=${Base58.encode(clMinerKeyPair.privateKey.arr)}", s"-Dunits.defaults.chain-contract=$chainContractAddress", s"-Dunits.defaults.execution-client-address=$ecEngineApiUrl", "-Dlogback.file.level=TRACE", @@ -78,4 +82,6 @@ class WavesNodeContainer( object WavesNodeContainer { val ApiPort = 6869 + def mkKeyPair(seed: String, nonce: Int): SeedKeyPair = + SeedKeyPair(crypto.secureHash(Bytes.concat(Ints.toByteArray(nonce), seed.getBytes(StandardCharsets.UTF_8)))) } diff --git a/consensus-client-it/src/test/scala/units/el/ElBridgeClient.scala b/consensus-client-it/src/test/scala/units/el/ElBridgeClient.scala index ac084d42..4a3bcf6c 100644 --- a/consensus-client-it/src/test/scala/units/el/ElBridgeClient.scala +++ b/consensus-client-it/src/test/scala/units/el/ElBridgeClient.scala @@ -1,7 +1,6 @@ package units.el import com.wavesplatform.account.Address -import com.wavesplatform.api.HasRetry import com.wavesplatform.utils.ScorexLogging import org.web3j.abi.datatypes.{AbiTypes, Type} import org.web3j.abi.{FunctionReturnDecoder, TypeReference} @@ -11,6 +10,7 @@ import org.web3j.protocol.core.methods.response.TransactionReceipt import org.web3j.tx.gas.DefaultGasProvider import units.bridge.BridgeContract import units.eth.EthAddress +import units.test.HasRetry import java.util.Collections diff --git a/consensus-client-it/src/test/scala/com/wavesplatform/api/HasRetry.scala b/consensus-client-it/src/test/scala/units/test/HasRetry.scala similarity index 97% rename from consensus-client-it/src/test/scala/com/wavesplatform/api/HasRetry.scala rename to consensus-client-it/src/test/scala/units/test/HasRetry.scala index 35be1f74..e23ce329 100644 --- a/consensus-client-it/src/test/scala/com/wavesplatform/api/HasRetry.scala +++ b/consensus-client-it/src/test/scala/units/test/HasRetry.scala @@ -1,4 +1,4 @@ -package com.wavesplatform.api +package units.test import org.scalatest.concurrent.Eventually.PatienceConfig diff --git a/local-network/README.md b/local-network/README.md index 8f506d9a..8c307ea5 100644 --- a/local-network/README.md +++ b/local-network/README.md @@ -41,7 +41,7 @@ See [./deploy](./deploy/). * Node wallet seed: * wavesnode-1: `devnet-1` * wavesnode-2: `devnet-2` - * Chain contract: `3FdaanzgX4roVgHevhq8L8q42E7EZL9XTQr` + * Chain contract: `3FZyX72BjuE6s5PMTVQN9mJTN4jEJto95nv` * EL mining reward accounts: * Reward account for **Miner 1** (`wavesnode-1`, `besu-1`): * Address: `0x7dBcf9c6C3583b76669100f9BE3CaF6d722bc9f9` diff --git a/local-network/configs/wavesnode/genesis-template.conf b/local-network/configs/wavesnode/genesis-template.conf index 20c172c9..3fb29846 100644 --- a/local-network/configs/wavesnode/genesis-template.conf +++ b/local-network/configs/wavesnode/genesis-template.conf @@ -8,58 +8,71 @@ genesis-generator { # seed text -> share # the sum of shares should be <= initial-balance distributions = [ - # CL miner on wavesnode-1 + # Miner on wavesnode-1 # Seed text: devnet-1 # Nonce: 0 # Seed: HnyGuCEnV1A # Private key: DwPvPGEp3LPg5gVRz7Pqd8mHa6dWK9dXtP4XDmKTz6ga # Public key: Atej9hrXKQS6cLjuhjEnKyF5boyYGSp5VBZvfcmF9FqY # Address: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e + # Usage: local-network, consensus-client-it { seed-text = "devnet-1", nonce = 0, amount = 998036000000000 } - # Chain contract on wavesnode-1 + # Miner on wavesnode-1 # Seed text: devnet-1 - # Nonce: 2 + # Nonce: 1 # Seed: HnyGuCEnV1A - # Private key: 7TzN4c2XgvSN28gEbvW5wmUecfa4SrPRLXjgr5DRfQMG - # Public key: 5yxSxDhB2ZL5agYnU6WRtEqPg3T3FfUY3zouKrMpnTX6 - # Address: 3FdaanzgX4roVgHevhq8L8q42E7EZL9XTQr - { seed-text = "devnet-1", nonce = 2, amount = 20000000000 } - - # DAO Address - # Seed text: devnet dao 1 - # Nonce: 0 - # Seed: 2ttKSSq2o7VU6kFwN - # Private key: EXC4wafzVus3tmesKEouuewZHGNzEG5qxNHMN66XAiG4 - # Public key: 7S2iCGvRcx3bJA3y8R9k6sJdVATg3ss8r4RuW1S8VriA - # Address: 3FYp54DX9Np9uouxBtnnCFPYWzz7K3kvSD2 - { seed-text = "devnet dao 1", nonce = 0, amount = 100000000 } + # Private key: 5r7KpS3MNXxRcz9jMbpjZKhaZVxDxF74H4VLW6ydi4aT + # Public key: 2JYMTjUK7tC8NQi6TD6oWgy41YbrnXuoLzZydrFKTKt6 + # Address: 3FSgXpgbT6m1speWgVx3cVxAZKmdr4barHU + # Usage: consensus-client-it + { seed-text = "devnet-1", nonce = 1, amount = 998036000000000 } - # CL miner on wavesnode-2 + # Miner on wavesnode-2 # Seed text: devnet-2 # Nonce: 0 # Seed: HnyGuCEnV1B # Private key: F17jrRWmrR7en6eY6ptvnUTNqc9W8RSP34hpX7bNhbht # Public key: FuibB1rJ1uHVvvY6FNmhLqnbvQBNtziWbh7zh5c1CQCG # Address: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU + # Usage: local-network, consensus-client-it { seed-text = "devnet-2", nonce = 0, amount = 998036000000000 } # Additional addresses - # Seed text: devnet-0 + # Seed text: devnet rich # Nonce: 0 - # Seed: HnyGuCEnV19 - # Private key: 8aYKVCJVYfcSQeSH1kM4D2e4Fcj5cAQzMh8uZ5hW2tB9 - # Public key: GRKksNikCNXYT7HqxCnqzjP5pf4NctgtTnmCvCMDEhAT - # Address: 3Ffcu52v7ETMAFhNAqQvHsv4JuQjEVP9q6E - { seed-text = "devnet-0", nonce = 0, amount = 2305842994213693951 } + # Seed: RtxP5VZ8GyepM8T + # Private key: 5Kn5nRo6piCWg4cwoHWj41L8YnASfYSRt9RkwXxfCjQx + # Public key: HWVpTRztoFNwbCsJ1PxtneNSVywkwD8PzMwagDM1YoE6 + # Address: 3FiaGiTaJ57qLpw5zmdxSejnUYCK2R9E2DV + { seed-text = "devnet rich", nonce = 0, amount = 2305842994213693951 } - # Seed text: devnet-0 + # Seed text: devnet rich # Nonce: 1 - # Seed: HnyGuCEnV19 - # Private key: 5tE8jwZ3B4eLTvdz7LqEBMcmspoqXD9nPCEfcZgh2BeV - # Public key: BArfnBGQ9gkNHC2EftXf42uJuBioSffZiJoyYCTtwxof - # Address: 3FQFFWxMCDmyZhkRzKA7QiAZL4RKMhJvFnu - { seed-text = "devnet-0", nonce = 1, amount = 2305842994213693952 } + # Seed: RtxP5VZ8GyepM8T + # Private key: HkHtYtTVyUy2hcjNLowuEBTrjvCcuq4vGSaWac6Q5gLi + # Public key: AhbKXvrNikp2iynszNxAAzoE7hgzaaZpV9jyVpi5D1jS + # Address: 3FfXrt2RZCBQm7AKjeRhQjR9vGwu8Cb3RjN + { seed-text = "devnet rich", nonce = 1, amount = 2305842994213693952 } + + # DAO Address + # Seed text: devnet dao 1 + # Nonce: 0 + # Seed: 2ttKSSq2o7VU6kFwN + # Private key: EXC4wafzVus3tmesKEouuewZHGNzEG5qxNHMN66XAiG4 + # Public key: 7S2iCGvRcx3bJA3y8R9k6sJdVATg3ss8r4RuW1S8VriA + # Address: 3FYp54DX9Np9uouxBtnnCFPYWzz7K3kvSD2 + { seed-text = "devnet dao 1", nonce = 0, amount = 100000000 } + + # Chain contract on wavesnode-1 + # Seed text: devnet cc 1 + # Nonce: 0 + # Seed: RtxP5VZ8GyGYRu2 + # Private key: GckEsHqD68uYq6J92gQCBpaAR3U7qGnAoJ7rQVcFHqzN + # Public key: HeUYUuLfr8Vzig5FasjdKHJC4hq8T2izN2ktizcKnBDZ + # Address: 3FZyX72BjuE6s5PMTVQN9mJTN4jEJto95nv + # Address: 3FdaanzgX4roVgHevhq8L8q42E7EZL9XTQr + { seed-text = "devnet cc 1", nonce = 0, amount = 20000000000 } ] } diff --git a/local-network/configs/wavesnode/units.conf b/local-network/configs/wavesnode/units.conf index 6781dfbc..158347f9 100644 --- a/local-network/configs/wavesnode/units.conf +++ b/local-network/configs/wavesnode/units.conf @@ -1,6 +1,6 @@ units { defaults { - chain-contract = "3FdaanzgX4roVgHevhq8L8q42E7EZL9XTQr" + chain-contract = "3FZyX72BjuE6s5PMTVQN9mJTN4jEJto95nv" execution-client-address = "http://ec-"${NODE_NUMBER}":8551" network { port = 6865 diff --git a/local-network/deploy/deploy.py b/local-network/deploy/deploy.py index 4e10f9b6..90eef034 100644 --- a/local-network/deploy/deploy.py +++ b/local-network/deploy/deploy.py @@ -45,7 +45,7 @@ r = network.cl_chain_contract.setup( el_genesis_block_hash, - daoAddress = '3FYp54DX9Np9uouxBtnnCFPYWzz7K3kvSD2' + daoAddress = network.cl_dao.address ) waves.force_success(log, r, "Can not setup the chain contract") diff --git a/local-network/deploy/local/network.py b/local-network/deploy/local/network.py index c66e1412..eb7820aa 100644 --- a/local-network/deploy/local/network.py +++ b/local-network/deploy/local/network.py @@ -27,9 +27,13 @@ class Miner: class ExtendedNetwork(Network): + @cached_property + def cl_dao(self) -> ChainContract: + return pw.Address(seed="devnet dao 1", nonce=0) + @cached_property def cl_chain_contract(self) -> ChainContract: - return ChainContract(seed="devnet-1", nonce=2) + return ChainContract(seed="devnet cc 1", nonce=0) @cached_property def cl_miners(self) -> List[Miner]: @@ -56,7 +60,7 @@ def cl_miners(self) -> List[Miner]: @cached_property def cl_rich_accounts(self) -> List[pw.Address]: - return [pw.Address(seed="devnet-0", nonce=n) for n in range(0, 2)] + return [pw.Address(seed="devnet rich", nonce=n) for n in range(0, 2)] @cached_property def el_rich_accounts(self) -> List[LocalAccount]: @@ -75,7 +79,7 @@ def el_rich_accounts(self) -> List[LocalAccount]: chain_id_str="D", cl_node_api_url=get_waves_api_url(1), el_node_api_url=get_ec_api_url(1), - chain_contract_address="3FdaanzgX4roVgHevhq8L8q42E7EZL9XTQr", + chain_contract_address="3FZyX72BjuE6s5PMTVQN9mJTN4jEJto95nv", ) diff --git a/local-network/deploy/standard.json b/local-network/deploy/standard.json deleted file mode 100644 index 8fd62b7a..00000000 --- a/local-network/deploy/standard.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "contracts/bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.26;\n\ncontract Bridge {\n address public constant BURN_ADDRESS = address(0);\n\n // 1 UNIT0(EL) = 1 UNIT0(CL)\n // 10^18 units in 1 UNIT0(EL)\n // 10^8 units in 1 UNIT0(CL)\n // 10^(18-8) = UNIT0(EL) / UNIT0(CL) = ratio\n // Conversion: N UNIT0(CL) = UNIT0(EL) / ratio\n uint256 public constant EL_TO_CL_RATIO = 10 ** 10; // 10 * 1 Gwei = 10 Gwei\n\n uint256 public constant MIN_AMOUNT_IN_WEI = 1 * EL_TO_CL_RATIO;\n uint256 public constant MAX_AMOUNT_IN_WEI = uint256(uint64(type(int64).max)) * EL_TO_CL_RATIO;\n\n uint16 public constant MAX_TRANSFERS_IN_BLOCK = 1024;\n\n mapping(uint => uint16) public transfersPerBlock;\n\n // wavesRecipient is a public key hash of recipient account.\n // effectively is it Waves address without 2 first bytes (version and chain id) and last 4 bytes (checksum).\n event SentNative(bytes20 wavesRecipient, int64 amount);\n\n function sendNative(bytes20 wavesRecipient) external payable {\n require(msg.value >= MIN_AMOUNT_IN_WEI, string.concat(\"Sent value \", uint2str(msg.value), \" must be greater or equal to \", uint2str(MIN_AMOUNT_IN_WEI)));\n require(msg.value <= MAX_AMOUNT_IN_WEI, string.concat(\"Sent value \", uint2str(msg.value), \" must be less or equal to \", uint2str(MAX_AMOUNT_IN_WEI)));\n\n uint blockNumber = block.number;\n require(transfersPerBlock[blockNumber] < MAX_TRANSFERS_IN_BLOCK, string.concat(\"Max transfers limit of \", uint2str(uint(MAX_TRANSFERS_IN_BLOCK)), \" reached in this block. Try to send transfers again\"));\n transfersPerBlock[blockNumber]++;\n\n uint256 ccAmount = msg.value / EL_TO_CL_RATIO;\n require(ccAmount * EL_TO_CL_RATIO == msg.value, string.concat(\"Sent value \", uint2str(msg.value), \" must be a multiple of \", uint2str(EL_TO_CL_RATIO)));\n\n (bool success,) = BURN_ADDRESS.call{value: msg.value}(\"\");\n require(success, \"Failed to send to burn address\");\n\n emit SentNative(wavesRecipient, int64(uint64(ccAmount)));\n }\n\n function uint2str(uint _i) internal pure returns (string memory _uintAsString) {\n if (_i == 0) {\n return \"0\";\n }\n uint j = _i;\n uint len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint k = len;\n while (_i != 0) {\n k = k - 1;\n uint8 temp = (48 + uint8(_i - _i / 10 * 10));\n bytes1 b1 = bytes1(temp);\n bstr[k] = b1;\n _i /= 10;\n }\n return string(bstr);\n }\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 200 - }, - "evmVersion": "cancun", - "metadata": { - "useLiteralContent": true - }, - "outputSelection": { - "*": { - "*": [ - "metadata", - "evm.deployedBytecode.*" - ] - } - } - } -} \ No newline at end of file