From ba146f66edf88375a24eb9c58ac56bc09019f691 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Thu, 5 Sep 2024 17:17:21 +0400 Subject: [PATCH 01/31] One EC client instead of two --- build.sbt | 2 + src/main/scala/units/Bridge.scala | 2 +- src/main/scala/units/ConsensusClient.scala | 7 +-- src/main/scala/units/ELUpdater.scala | 27 +++++------ src/main/scala/units/NetworkL2Block.scala | 7 ++- .../units/client/engine/EngineApiClient.scala | 15 +++++- .../client/engine/HttpEngineApiClient.scala | 46 ++++++++++++++++-- .../{http => engine}/model/BlockNumber.scala | 2 +- .../{http => engine}/model/EcBlock.scala | 11 ++--- .../model/GetBlockByHashRequest.scala | 2 +- .../model/GetBlockByNumberRequest.scala | 2 +- .../model/GetLogsRequest.scala | 2 +- .../model/GetLogsResponseEntry.scala | 2 +- .../scala/units/client/http/EcApiClient.scala | 19 -------- .../units/client/http/HttpEcApiClient.scala | 48 ------------------- src/main/scala/units/eth/EmptyL2Block.scala | 6 +-- .../scala/units/network/HistoryReplier.scala | 14 ++---- .../units/BaseIntegrationTestSuite.scala | 2 +- .../units/BlockFullValidationTestSuite.scala | 2 +- .../units/BlockIssuesForgingTestSuite.scala | 2 +- src/test/scala/units/ExtensionDomain.scala | 3 +- src/test/scala/units/TestEcBlockBuilder.scala | 3 +- .../scala/units/client/TestEcClients.scala | 10 +--- .../client/engine/LoggedEngineApiClient.scala | 16 ++++++- .../{http => engine}/model/TestEcBlocks.scala | 2 +- .../units/client/http/LoggedEcApiClient.scala | 25 ---------- .../units/eth/EmptyL2BlockTestSuite.scala | 2 +- 27 files changed, 117 insertions(+), 164 deletions(-) rename src/main/scala/units/client/{http => engine}/model/BlockNumber.scala (87%) rename src/main/scala/units/client/{http => engine}/model/EcBlock.scala (95%) rename src/main/scala/units/client/{http => engine}/model/GetBlockByHashRequest.scala (92%) rename src/main/scala/units/client/{http => engine}/model/GetBlockByNumberRequest.scala (91%) rename src/main/scala/units/client/{http => engine}/model/GetLogsRequest.scala (94%) rename src/main/scala/units/client/{http => engine}/model/GetLogsResponseEntry.scala (91%) delete mode 100644 src/main/scala/units/client/http/EcApiClient.scala delete mode 100644 src/main/scala/units/client/http/HttpEcApiClient.scala rename src/test/scala/units/client/{http => engine}/model/TestEcBlocks.scala (96%) delete mode 100644 src/test/scala/units/client/http/LoggedEcApiClient.scala diff --git a/build.sbt b/build.sbt index d0bf068b..499d53ad 100644 --- a/build.sbt +++ b/build.sbt @@ -80,3 +80,5 @@ buildTarballsForDocker := { baseDirectory.value / "docker" / "target" / "consensus-client.tgz" ) } + +Test / unmanagedJars += file("src/test/lib/waves-all.jar") diff --git a/src/main/scala/units/Bridge.scala b/src/main/scala/units/Bridge.scala index d040f2f7..5760258c 100644 --- a/src/main/scala/units/Bridge.scala +++ b/src/main/scala/units/Bridge.scala @@ -7,7 +7,7 @@ import com.wavesplatform.utils.EthEncoding import org.web3j.abi.datatypes.Event import org.web3j.abi.datatypes.generated.{Bytes20, Int64} import org.web3j.abi.{FunctionReturnDecoder, TypeEncoder, TypeReference} -import units.client.http.model.GetLogsResponseEntry +import units.client.engine.model.GetLogsResponseEntry import units.eth.Gwei import java.math.BigInteger diff --git a/src/main/scala/units/ConsensusClient.scala b/src/main/scala/units/ConsensusClient.scala index 4177ea8c..38f0ce9f 100644 --- a/src/main/scala/units/ConsensusClient.scala +++ b/src/main/scala/units/ConsensusClient.scala @@ -16,7 +16,6 @@ import net.ceedubs.ficus.Ficus.* import org.slf4j.LoggerFactory import sttp.client3.HttpClientSyncBackend import units.client.engine.{EngineApiClient, HttpEngineApiClient} -import units.client.http.{EcApiClient, HttpEcApiClient} import units.client.{JwtAuthenticationBackend, LoggingBackend} import units.network.* @@ -28,7 +27,6 @@ class ConsensusClient( config: ClientConfig, context: ExtensionContext, engineApiClient: EngineApiClient, - httpApiClient: EcApiClient, blockObserver: BlocksObserver, allChannels: DefaultChannelGroup, globalScheduler: Scheduler, @@ -42,7 +40,6 @@ class ConsensusClient( deps.config, context, deps.engineApiClient, - deps.httpApiClient, deps.blockObserver, deps.allChannels, deps.globalScheduler, @@ -54,7 +51,6 @@ class ConsensusClient( private[units] val elu = new ELUpdater( - httpApiClient, engineApiClient, context.blockchain, context.utx, @@ -123,14 +119,13 @@ class ConsensusClientDependencies(context: ExtensionContext) extends AutoCloseab httpClientBackend } ) - val httpApiClient = new HttpEcApiClient(config, httpClientBackend) val allChannels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE) val peerDatabase = new PeerDatabaseImpl(config.network) val messageObserver = new MessageObserver() private val networkServer = NetworkServer( config, - new HistoryReplier(httpApiClient, engineApiClient)(globalScheduler), + new HistoryReplier(engineApiClient)(globalScheduler), peerDatabase, messageObserver, allChannels, diff --git a/src/main/scala/units/ELUpdater.scala b/src/main/scala/units/ELUpdater.scala index eb98944d..3c342df4 100644 --- a/src/main/scala/units/ELUpdater.scala +++ b/src/main/scala/units/ELUpdater.scala @@ -33,8 +33,6 @@ import units.client.engine.EngineApiClient import units.client.engine.EngineApiClient.PayloadId import units.client.engine.model.* import units.client.engine.model.Withdrawal.WithdrawalIndex -import units.client.http.EcApiClient -import units.client.http.model.EcBlock import units.eth.{EmptyL2Block, EthAddress, EthereumConstants} import units.network.BlocksObserverImpl.BlockWithChannel import units.util.HexBytesConverter @@ -45,7 +43,6 @@ import scala.concurrent.duration.* import scala.util.* class ELUpdater( - httpApiClient: EcApiClient, engineApiClient: EngineApiClient, blockchain: Blockchain, utx: UtxPool, @@ -265,7 +262,7 @@ class ELUpdater( fixedFinalizedBlock = if (finalizedBlock.height > rollbackBlock.parentBlock.height) rollbackBlock.parentBlock else finalizedBlock _ <- confirmBlock(rollbackBlock.hash, fixedFinalizedBlock.hash) _ <- confirmBlock(target, fixedFinalizedBlock) - lastEcBlock <- httpApiClient.getLastExecutionBlock + lastEcBlock <- engineApiClient.getLastExecutionBlock _ <- Either.cond( targetHash == lastEcBlock.hash, (), @@ -451,14 +448,14 @@ class ELUpdater( else { val finalizedBlock = chainContractClient.getFinalizedBlock logger.debug(s"Finalized block is ${finalizedBlock.hash}") - httpApiClient.getBlockByHash(finalizedBlock.hash) match { + engineApiClient.getBlockByHash(finalizedBlock.hash) match { case Left(error) => logger.error(s"Could not load finalized block", error) case Right(Some(finalizedEcBlock)) => logger.trace(s"Finalized block ${finalizedBlock.hash} is at height ${finalizedEcBlock.height}") (for { newEpochInfo <- calculateEpochInfo mainChainInfo <- chainContractClient.getMainChainInfo.toRight("Can't get main chain info") - lastEcBlock <- httpApiClient.getLastExecutionBlock.leftMap(_.message) + lastEcBlock <- engineApiClient.getLastExecutionBlock.leftMap(_.message) } yield { logger.trace(s"Following main chain ${mainChainInfo.id}") val fullValidationStatus = FullValidationStatus( @@ -620,7 +617,7 @@ class ELUpdater( val finalizedBlock = chainContractClient.getFinalizedBlock val options = chainContractClient.getOptions logger.debug(s"Finalized block is ${finalizedBlock.hash}") - httpApiClient.getBlockByHash(finalizedBlock.hash) match { + engineApiClient.getBlockByHash(finalizedBlock.hash) match { case Left(error) => logger.error(s"Could not load finalized block", error) case Right(Some(finalizedEcBlock)) => logger.trace(s"Finalized block ${finalizedBlock.hash} is at height ${finalizedEcBlock.height}") @@ -722,7 +719,7 @@ class ELUpdater( private def requestBlock(hash: BlockHash): BlockRequestResult = { logger.debug(s"Requesting block $hash") - httpApiClient.getBlockByHash(hash) match { + engineApiClient.getBlockByHash(hash) match { case Right(Some(block)) => BlockRequestResult.BlockExists(block) case Right(None) => requestAndProcessBlock(hash) @@ -788,7 +785,7 @@ class ELUpdater( ): Option[Working[FollowingChain]] = { @tailrec def findLastEcBlock(curBlock: ContractBlock): EcBlock = { - httpApiClient.getBlockByHash(curBlock.hash) match { + engineApiClient.getBlockByHash(curBlock.hash) match { case Right(Some(block)) => block case Right(_) => chainContractClient.getBlock(curBlock.parentHash) match { @@ -877,7 +874,7 @@ class ELUpdater( private def waitForSyncCompletion(target: ContractBlock): Unit = scheduler.scheduleOnce(5.seconds)(state match { case SyncingToFinalizedBlock(finalizedBlockHash) if finalizedBlockHash == target.hash => logger.debug(s"Checking if EL has synced to ${target.hash} on height ${target.height}") - httpApiClient.getLastExecutionBlock match { + engineApiClient.getLastExecutionBlock match { case Left(error) => logger.error(s"Sync to ${target.hash} was not completed, error=${error.message}") setState("23", Starting) @@ -1209,11 +1206,11 @@ class ELUpdater( private def mkRollbackBlock(rollbackTargetBlockId: BlockHash): Job[RollbackBlock] = for { targetBlockFromContract <- Right(chainContractClient.getBlock(rollbackTargetBlockId)) targetBlockOpt <- targetBlockFromContract match { - case None => httpApiClient.getBlockByHash(rollbackTargetBlockId) + case None => engineApiClient.getBlockByHash(rollbackTargetBlockId) case x => Right(x) } targetBlock <- Either.fromOption(targetBlockOpt, ClientError(s"Can't find block $rollbackTargetBlockId neither on a contract, nor in EC")) - parentBlock <- httpApiClient.getBlockByHash(targetBlock.parentHash) + parentBlock <- engineApiClient.getBlockByHash(targetBlock.parentHash) parentBlock <- Either.fromOption(parentBlock, ClientError(s"Can't find parent block $rollbackTargetBlockId in execution client")) rollbackBlockOpt <- engineApiClient.applyNewPayload(EmptyL2Block.mkExecutionPayload(parentBlock)) rollbackBlock <- Either.fromOption(rollbackBlockOpt, ClientError("Rollback block hash is not defined as latest valid hash")) @@ -1226,7 +1223,7 @@ class ELUpdater( } private def getLastWithdrawalIndex(hash: BlockHash): Job[WithdrawalIndex] = - httpApiClient.getBlockByHash(hash).flatMap { + engineApiClient.getBlockByHash(hash).flatMap { case None => Left(ClientError(s"Can't find $hash block on EC during withdrawal search")) case Some(ecBlock) => ecBlock.withdrawals.lastOption match { @@ -1239,7 +1236,7 @@ class ELUpdater( private def getElToClTransfersRootHash(hash: BlockHash, elBridgeAddress: EthAddress): Job[Digest] = for { - elRawLogs <- httpApiClient.getLogs(hash, Bridge.ElSentNativeEventTopic) + elRawLogs <- engineApiClient.getLogs(hash, Bridge.ElSentNativeEventTopic) rootHash <- { val relatedElRawLogs = elRawLogs.filter(x => x.address == elBridgeAddress && x.topics.contains(Bridge.ElSentNativeEventTopic)) Bridge @@ -1413,7 +1410,7 @@ class ELUpdater( if (fullValidationStatus.validated.contains(lastContractBlock.hash)) Right(BlockForValidation.NotFound) else if (lastContractBlock.height <= finalizedBlock.height) Right(BlockForValidation.SkippedFinalized(lastContractBlock)) else - httpApiClient + engineApiClient .getBlockByHash(lastContractBlock.hash) .map { case Some(ecBlock) => BlockForValidation.Found(lastContractBlock, ecBlock) diff --git a/src/main/scala/units/NetworkL2Block.scala b/src/main/scala/units/NetworkL2Block.scala index c8ae1a9c..3e6cdf45 100644 --- a/src/main/scala/units/NetworkL2Block.scala +++ b/src/main/scala/units/NetworkL2Block.scala @@ -5,13 +5,12 @@ import com.wavesplatform.account.PrivateKey import com.wavesplatform.common.state.ByteStr import com.wavesplatform.crypto import com.wavesplatform.crypto.{DigestLength, SignatureLength} +import org.web3j.abi.datatypes.generated.Uint256 +import play.api.libs.json.{JsObject, Json} import units.client.L2BlockLike -import units.client.engine.model.Withdrawal -import units.client.http.model.EcBlock +import units.client.engine.model.{EcBlock, Withdrawal} import units.eth.EthAddress import units.util.HexBytesConverter.* -import org.web3j.abi.datatypes.generated.Uint256 -import play.api.libs.json.{JsObject, Json} // TODO Refactor to eliminate a manual deserialization, e.g. (raw: JsonObject, parsed: ParsedBlockL2) class NetworkL2Block private ( diff --git a/src/main/scala/units/client/engine/EngineApiClient.scala b/src/main/scala/units/client/engine/EngineApiClient.scala index 25444b9d..ba9f5b09 100644 --- a/src/main/scala/units/client/engine/EngineApiClient.scala +++ b/src/main/scala/units/client/engine/EngineApiClient.scala @@ -1,13 +1,12 @@ package units.client.engine +import play.api.libs.json.* import units.client.engine.EngineApiClient.PayloadId import units.client.engine.model.* import units.eth.EthAddress import units.{BlockHash, Job} -import play.api.libs.json.* trait EngineApiClient { - def forkChoiceUpdate(blockHash: BlockHash, finalizedBlockHash: BlockHash): Job[String] // TODO Replace String with an appropriate type def forkChoiceUpdateWithPayloadId( @@ -24,6 +23,18 @@ trait EngineApiClient { def applyNewPayload(payload: JsObject): Job[Option[BlockHash]] def getPayloadBodyByHash(hash: BlockHash): Job[Option[JsObject]] + + def getBlockByNumber(number: BlockNumber): Job[Option[EcBlock]] + + def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] + + def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean = false): Job[Option[JsObject]] + + def getLastExecutionBlock: Job[EcBlock] + + def blockExists(hash: BlockHash): Job[Boolean] + + def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] } object EngineApiClient { diff --git a/src/main/scala/units/client/engine/HttpEngineApiClient.scala b/src/main/scala/units/client/engine/HttpEngineApiClient.scala index d1fadc95..440b496f 100644 --- a/src/main/scala/units/client/engine/HttpEngineApiClient.scala +++ b/src/main/scala/units/client/engine/HttpEngineApiClient.scala @@ -1,5 +1,9 @@ package units.client.engine +import cats.syntax.either.* +import cats.syntax.traverse.* +import play.api.libs.json.* +import sttp.client3.* import units.client.JsonRpcClient import units.client.engine.EngineApiClient.PayloadId import units.client.engine.HttpEngineApiClient.* @@ -7,8 +11,6 @@ import units.client.engine.model.* import units.client.engine.model.ForkChoiceUpdatedRequest.ForkChoiceAttributes import units.eth.EthAddress import units.{BlockHash, ClientConfig, ClientError, Job} -import play.api.libs.json.* -import sttp.client3.* import scala.concurrent.duration.{DurationInt, FiniteDuration} @@ -17,7 +19,10 @@ class HttpEngineApiClient(val config: ClientConfig, val backend: SttpBackend[Ide val apiUrl = uri"http://${config.executionClientAddress}:${config.engineApiPort}" def forkChoiceUpdate(blockHash: BlockHash, finalizedBlockHash: BlockHash): Job[String] = { - sendEngineRequest[ForkChoiceUpdatedRequest, ForkChoiceUpdatedResponse](ForkChoiceUpdatedRequest(blockHash, finalizedBlockHash, None), BlockExecutionTimeout) + sendEngineRequest[ForkChoiceUpdatedRequest, ForkChoiceUpdatedResponse]( + ForkChoiceUpdatedRequest(blockHash, finalizedBlockHash, None), + BlockExecutionTimeout + ) .flatMap { case ForkChoiceUpdatedResponse(PayloadStatus(status, _, _), None) if status == "SYNCING" || status == "VALID" => Right(status) case ForkChoiceUpdatedResponse(PayloadStatus(_, _, Some(validationError)), _) => @@ -72,6 +77,41 @@ class HttpEngineApiClient(val config: ClientConfig, val backend: SttpBackend[Ide .map(_.value.headOption.flatMap(_.asOpt[JsObject])) } + def getBlockByNumber(number: BlockNumber): Job[Option[EcBlock]] = { + for { + json <- getBlockByNumberJson(number.str) + blockMeta <- json.traverse(parseJson[EcBlock](_)) + } yield blockMeta + } + + def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] = { + sendRequest[GetBlockByHashRequest, EcBlock](GetBlockByHashRequest(hash, fullTxs = false)) + .leftMap(err => ClientError(s"Error getting block by hash $hash: $err")) + } + + def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean = false): Job[Option[JsObject]] = { + sendRequest[GetBlockByHashRequest, JsObject](GetBlockByHashRequest(hash, fullTxs)) + .leftMap(err => ClientError(s"Error getting block json by hash $hash: $err")) + } + + def getLastExecutionBlock: Job[EcBlock] = for { + lastEcBlockOpt <- getBlockByNumber(BlockNumber.Latest) + lastEcBlock <- Either.fromOption(lastEcBlockOpt, ClientError("Impossible: EC doesn't have blocks")) + } yield lastEcBlock + + def blockExists(hash: BlockHash): Job[Boolean] = + getBlockByHash(hash).map(_.isDefined) + + private def getBlockByNumberJson(number: String): Job[Option[JsObject]] = { + sendRequest[GetBlockByNumberRequest, JsObject](GetBlockByNumberRequest(number)) + .leftMap(err => ClientError(s"Error getting block by number $number: $err")) + } + + override def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] = + sendRequest[GetLogsRequest, List[GetLogsResponseEntry]](GetLogsRequest(hash, List(topic))) + .leftMap(err => ClientError(s"Error getting block logs by hash $hash: $err")) + .map(_.getOrElse(List.empty)) + private def sendEngineRequest[A: Writes, B: Reads](request: A, timeout: FiniteDuration): Job[B] = { sendRequest(request, timeout) match { case Right(response) => response.toRight(ClientError(s"Unexpected engine API empty response")) diff --git a/src/main/scala/units/client/http/model/BlockNumber.scala b/src/main/scala/units/client/engine/model/BlockNumber.scala similarity index 87% rename from src/main/scala/units/client/http/model/BlockNumber.scala rename to src/main/scala/units/client/engine/model/BlockNumber.scala index aba476cb..d70c603e 100644 --- a/src/main/scala/units/client/http/model/BlockNumber.scala +++ b/src/main/scala/units/client/engine/model/BlockNumber.scala @@ -1,4 +1,4 @@ -package units.client.http.model +package units.client.engine.model import units.util.HexBytesConverter diff --git a/src/main/scala/units/client/http/model/EcBlock.scala b/src/main/scala/units/client/engine/model/EcBlock.scala similarity index 95% rename from src/main/scala/units/client/http/model/EcBlock.scala rename to src/main/scala/units/client/engine/model/EcBlock.scala index fff78809..595e611f 100644 --- a/src/main/scala/units/client/http/model/EcBlock.scala +++ b/src/main/scala/units/client/engine/model/EcBlock.scala @@ -1,14 +1,13 @@ -package units.client.http.model +package units.client.engine.model -import units.BlockHash -import units.client.L2BlockLike -import units.client.engine.model.Withdrawal -import units.eth.EthAddress -import units.util.HexBytesConverter.* import org.web3j.abi.datatypes.generated.Uint256 import play.api.libs.functional.syntax.* import play.api.libs.json.* import play.api.libs.json.Format.GenericFormat +import units.BlockHash +import units.client.L2BlockLike +import units.eth.EthAddress +import units.util.HexBytesConverter.* /** Block in EC API, not a payload of Engine API! See BlockHeader in besu. * @param timestamp diff --git a/src/main/scala/units/client/http/model/GetBlockByHashRequest.scala b/src/main/scala/units/client/engine/model/GetBlockByHashRequest.scala similarity index 92% rename from src/main/scala/units/client/http/model/GetBlockByHashRequest.scala rename to src/main/scala/units/client/engine/model/GetBlockByHashRequest.scala index 236a385d..913dc896 100644 --- a/src/main/scala/units/client/http/model/GetBlockByHashRequest.scala +++ b/src/main/scala/units/client/engine/model/GetBlockByHashRequest.scala @@ -1,4 +1,4 @@ -package units.client.http.model +package units.client.engine.model import units.BlockHash import play.api.libs.json.{Json, Writes} diff --git a/src/main/scala/units/client/http/model/GetBlockByNumberRequest.scala b/src/main/scala/units/client/engine/model/GetBlockByNumberRequest.scala similarity index 91% rename from src/main/scala/units/client/http/model/GetBlockByNumberRequest.scala rename to src/main/scala/units/client/engine/model/GetBlockByNumberRequest.scala index 5be68cc9..f3fedd61 100644 --- a/src/main/scala/units/client/http/model/GetBlockByNumberRequest.scala +++ b/src/main/scala/units/client/engine/model/GetBlockByNumberRequest.scala @@ -1,4 +1,4 @@ -package units.client.http.model +package units.client.engine.model import play.api.libs.json.{Json, Writes} diff --git a/src/main/scala/units/client/http/model/GetLogsRequest.scala b/src/main/scala/units/client/engine/model/GetLogsRequest.scala similarity index 94% rename from src/main/scala/units/client/http/model/GetLogsRequest.scala rename to src/main/scala/units/client/engine/model/GetLogsRequest.scala index f10461a3..23feea7a 100644 --- a/src/main/scala/units/client/http/model/GetLogsRequest.scala +++ b/src/main/scala/units/client/engine/model/GetLogsRequest.scala @@ -1,4 +1,4 @@ -package units.client.http.model +package units.client.engine.model import units.BlockHash import play.api.libs.json.{Json, Writes} diff --git a/src/main/scala/units/client/http/model/GetLogsResponseEntry.scala b/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala similarity index 91% rename from src/main/scala/units/client/http/model/GetLogsResponseEntry.scala rename to src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala index 03c04041..247eddbf 100644 --- a/src/main/scala/units/client/http/model/GetLogsResponseEntry.scala +++ b/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala @@ -1,4 +1,4 @@ -package units.client.http.model +package units.client.engine.model import units.eth.EthAddress import play.api.libs.json.{Json, Reads} diff --git a/src/main/scala/units/client/http/EcApiClient.scala b/src/main/scala/units/client/http/EcApiClient.scala deleted file mode 100644 index 0ef612bd..00000000 --- a/src/main/scala/units/client/http/EcApiClient.scala +++ /dev/null @@ -1,19 +0,0 @@ -package units.client.http - -import units.client.http.model.* -import units.{BlockHash, Job} -import play.api.libs.json.JsObject - -trait EcApiClient { - def getBlockByNumber(number: BlockNumber): Job[Option[EcBlock]] - - def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] - - def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean = false): Job[Option[JsObject]] - - def getLastExecutionBlock: Job[EcBlock] - - def blockExists(hash: BlockHash): Job[Boolean] - - def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] -} diff --git a/src/main/scala/units/client/http/HttpEcApiClient.scala b/src/main/scala/units/client/http/HttpEcApiClient.scala deleted file mode 100644 index 52ceb3ee..00000000 --- a/src/main/scala/units/client/http/HttpEcApiClient.scala +++ /dev/null @@ -1,48 +0,0 @@ -package units.client.http - -import cats.syntax.either.* -import cats.syntax.traverse.* -import units.client.JsonRpcClient -import units.client.http.model.* -import units.{BlockHash, ClientConfig, ClientError, Job} -import play.api.libs.json.JsObject -import sttp.client3.* - -class HttpEcApiClient(val config: ClientConfig, val backend: SttpBackend[Identity, ?]) extends EcApiClient with JsonRpcClient { - - val apiUrl = uri"http://${config.executionClientAddress}:${config.httpApiPort}" - - def getBlockByNumber(number: BlockNumber): Job[Option[EcBlock]] = { - for { - json <- getBlockByNumberJson(number.str) - blockMeta <- json.traverse(parseJson[EcBlock](_)) - } yield blockMeta - } - - def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] = { - sendRequest[GetBlockByHashRequest, EcBlock](GetBlockByHashRequest(hash, fullTxs = false)) - .leftMap(err => ClientError(s"Error getting block by hash $hash: $err")) - } - - def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean = false): Job[Option[JsObject]] = { - sendRequest[GetBlockByHashRequest, JsObject](GetBlockByHashRequest(hash, fullTxs)) - .leftMap(err => ClientError(s"Error getting block json by hash $hash: $err")) - } - - def getLastExecutionBlock: Job[EcBlock] = for { - lastEcBlockOpt <- getBlockByNumber(BlockNumber.Latest) - lastEcBlock <- Either.fromOption(lastEcBlockOpt, ClientError("Impossible: EC doesn't have blocks")) - } yield lastEcBlock - - def blockExists(hash: BlockHash): Job[Boolean] = - getBlockByHash(hash).map(_.isDefined) - - private def getBlockByNumberJson(number: String): Job[Option[JsObject]] = { - sendRequest[GetBlockByNumberRequest, JsObject](GetBlockByNumberRequest(number)) - .leftMap(err => ClientError(s"Error getting block by number $number: $err")) - } - override def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] = - sendRequest[GetLogsRequest, List[GetLogsResponseEntry]](GetLogsRequest(hash, List(topic))) - .leftMap(err => ClientError(s"Error getting block logs by hash $hash: $err")) - .map(_.getOrElse(List.empty)) -} diff --git a/src/main/scala/units/eth/EmptyL2Block.scala b/src/main/scala/units/eth/EmptyL2Block.scala index dcdee6e4..f0165c66 100644 --- a/src/main/scala/units/eth/EmptyL2Block.scala +++ b/src/main/scala/units/eth/EmptyL2Block.scala @@ -1,11 +1,11 @@ package units.eth -import units.BlockHash -import units.client.http.model.EcBlock -import units.util.HexBytesConverter import org.web3j.abi.datatypes.generated.Uint256 import org.web3j.rlp.{RlpEncoder, RlpList, RlpString} import play.api.libs.json.{JsObject, Json} +import units.BlockHash +import units.client.engine.model.EcBlock +import units.util.HexBytesConverter object EmptyL2Block { case class Params( diff --git a/src/main/scala/units/network/HistoryReplier.scala b/src/main/scala/units/network/HistoryReplier.scala index 8758df44..04db98ba 100644 --- a/src/main/scala/units/network/HistoryReplier.scala +++ b/src/main/scala/units/network/HistoryReplier.scala @@ -1,24 +1,20 @@ package units.network import cats.syntax.either.* -import units.client.engine.EngineApiClient -import units.client.http.EcApiClient -import units.util.BlockToPayloadMapper -import units.{BlockHash, ClientError, NetworkL2Block} import com.wavesplatform.network.id import com.wavesplatform.utils.ScorexLogging import io.netty.channel.ChannelHandler.Sharable import io.netty.channel.{ChannelHandlerContext, ChannelInboundHandlerAdapter} import monix.execution.Scheduler +import units.client.engine.EngineApiClient +import units.util.BlockToPayloadMapper +import units.{BlockHash, ClientError, NetworkL2Block} import scala.concurrent.Future import scala.util.{Failure, Success} @Sharable -class HistoryReplier(httpApiClient: EcApiClient, engineApiClient: EngineApiClient)(implicit sc: Scheduler) - extends ChannelInboundHandlerAdapter - with ScorexLogging { - +class HistoryReplier(engineApiClient: EngineApiClient)(implicit sc: Scheduler) extends ChannelInboundHandlerAdapter with ScorexLogging { private def respondWith(ctx: ChannelHandlerContext, value: Future[Message]): Unit = value.onComplete { case Failure(e) => log.debug(s"${id(ctx)} Error processing request", e) @@ -46,7 +42,7 @@ class HistoryReplier(httpApiClient: EcApiClient, engineApiClient: EngineApiClien private def loadBlockL2(hash: BlockHash): Future[Either[ClientError, NetworkL2Block]] = Future { for { - blockJsonOpt <- httpApiClient.getBlockByHashJson(hash) + blockJsonOpt <- engineApiClient.getBlockByHashJson(hash) blockJson <- Either.fromOption(blockJsonOpt, ClientError("block not found")) payloadBodyJsonOpt <- engineApiClient.getPayloadBodyByHash(hash) payloadBodyJson <- Either.fromOption(payloadBodyJsonOpt, ClientError("payload body not found")) diff --git a/src/test/scala/units/BaseIntegrationTestSuite.scala b/src/test/scala/units/BaseIntegrationTestSuite.scala index 1cc382c4..af0122c3 100644 --- a/src/test/scala/units/BaseIntegrationTestSuite.scala +++ b/src/test/scala/units/BaseIntegrationTestSuite.scala @@ -11,7 +11,7 @@ import com.wavesplatform.utils.ScorexLogging import org.scalatest.freespec.AnyFreeSpec import org.scalatest.{BeforeAndAfterAll, EitherValues, OptionValues} import units.Bridge.ElSentNativeEvent -import units.client.http.model.GetLogsResponseEntry +import units.client.engine.model.GetLogsResponseEntry import units.eth.{EthAddress, Gwei} import units.test.CustomMatchers import units.util.HexBytesConverter diff --git a/src/test/scala/units/BlockFullValidationTestSuite.scala b/src/test/scala/units/BlockFullValidationTestSuite.scala index 69b3c164..9aff63b0 100644 --- a/src/test/scala/units/BlockFullValidationTestSuite.scala +++ b/src/test/scala/units/BlockFullValidationTestSuite.scala @@ -4,7 +4,7 @@ import com.wavesplatform.common.utils.EitherExt2 import com.wavesplatform.transaction.TxHelpers import units.ELUpdater.State.ChainStatus.{FollowingChain, WaitForNewChain} import units.client.contract.HasConsensusLayerDappTxHelpers.EmptyE2CTransfersRootHashHex -import units.client.http.model.{EcBlock, GetLogsResponseEntry} +import units.client.engine.model.{EcBlock, GetLogsResponseEntry} import units.eth.EthAddress import units.util.HexBytesConverter diff --git a/src/test/scala/units/BlockIssuesForgingTestSuite.scala b/src/test/scala/units/BlockIssuesForgingTestSuite.scala index a1cec3b2..d17cfb10 100644 --- a/src/test/scala/units/BlockIssuesForgingTestSuite.scala +++ b/src/test/scala/units/BlockIssuesForgingTestSuite.scala @@ -6,7 +6,7 @@ import com.wavesplatform.wallet.Wallet import units.ELUpdater.State.ChainStatus.{FollowingChain, Mining, WaitForNewChain} import units.ELUpdater.WaitRequestedBlockTimeout import units.client.contract.HasConsensusLayerDappTxHelpers.defaultFees -import units.client.http.model.EcBlock +import units.client.engine.model.EcBlock import scala.concurrent.duration.DurationInt diff --git a/src/test/scala/units/ExtensionDomain.scala b/src/test/scala/units/ExtensionDomain.scala index 9c969969..75d4b432 100644 --- a/src/test/scala/units/ExtensionDomain.scala +++ b/src/test/scala/units/ExtensionDomain.scala @@ -41,7 +41,7 @@ import units.ELUpdater.State.{ChainStatus, Working} import units.ExtensionDomain.* import units.client.contract.HasConsensusLayerDappTxHelpers import units.client.contract.HasConsensusLayerDappTxHelpers.EmptyE2CTransfersRootHashHex -import units.client.http.model.{EcBlock, TestEcBlocks} +import units.client.engine.model.{EcBlock, TestEcBlocks} import units.client.{L2BlockLike, TestEcClients} import units.eth.{EthAddress, EthereumConstants, Gwei} import units.network.TestBlocksObserver @@ -122,7 +122,6 @@ class ExtensionDomain( l2Config, extensionContext, ecClients.engineApi, - ecClients.ecApi, blockObserver, allChannels, globalScheduler, diff --git a/src/test/scala/units/TestEcBlockBuilder.scala b/src/test/scala/units/TestEcBlockBuilder.scala index 817d6453..d8d6e899 100644 --- a/src/test/scala/units/TestEcBlockBuilder.scala +++ b/src/test/scala/units/TestEcBlockBuilder.scala @@ -2,8 +2,7 @@ package units import org.web3j.abi.datatypes.generated.Uint256 import units.client.TestEcClients -import units.client.engine.model.Withdrawal -import units.client.http.model.{EcBlock, GetLogsResponseEntry} +import units.client.engine.model.{EcBlock, GetLogsResponseEntry, Withdrawal} import units.eth.{EthAddress, EthereumConstants, Gwei} import java.nio.charset.StandardCharsets diff --git a/src/test/scala/units/client/TestEcClients.scala b/src/test/scala/units/client/TestEcClients.scala index 01004425..8c00ce77 100644 --- a/src/test/scala/units/client/TestEcClients.scala +++ b/src/test/scala/units/client/TestEcClients.scala @@ -9,10 +9,8 @@ import play.api.libs.json.JsObject import units.ELUpdater.calculateRandao import units.client.TestEcClients.* import units.client.engine.EngineApiClient.PayloadId -import units.client.engine.model.Withdrawal +import units.client.engine.model.* import units.client.engine.{EngineApiClient, LoggedEngineApiClient} -import units.client.http.model.* -import units.client.http.{EcApiClient, LoggedEcApiClient} import units.collections.ListOps.* import units.eth.{EthAddress, EthereumConstants} import units.{BlockHash, Job, NetworkL2Block} @@ -143,12 +141,8 @@ class TestEcClients private ( }.asRight override def getPayloadBodyByHash(hash: BlockHash): Job[Option[JsObject]] = - ecApi.getBlockByHashJson(hash) - } - } + getBlockByHashJson(hash) - val ecApi = LoggedEcApiClient { - new EcApiClient { override def getBlockByNumber(number: BlockNumber): Job[Option[EcBlock]] = number match { case BlockNumber.Latest => currChain.headOption.asRight diff --git a/src/test/scala/units/client/engine/LoggedEngineApiClient.scala b/src/test/scala/units/client/engine/LoggedEngineApiClient.scala index 21100cf9..138dbce7 100644 --- a/src/test/scala/units/client/engine/LoggedEngineApiClient.scala +++ b/src/test/scala/units/client/engine/LoggedEngineApiClient.scala @@ -2,7 +2,7 @@ package units.client.engine import play.api.libs.json.JsObject import units.client.engine.EngineApiClient.PayloadId -import units.client.engine.model.Withdrawal +import units.client.engine.model.* import units.eth.EthAddress import units.{BlockHash, HasJobLogging, Job} @@ -29,6 +29,20 @@ class LoggedEngineApiClient(underlying: EngineApiClient) extends EngineApiClient override def getPayloadBodyByHash(hash: BlockHash): Job[Option[JsObject]] = wrap(s"getPayloadBodyByHash($hash)", underlying.getPayloadBodyByHash(hash)) + + override def getBlockByNumber(number: BlockNumber): Job[Option[EcBlock]] = wrap(s"getBlockByNumber($number)", underlying.getBlockByNumber(number)) + + override def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] = wrap(s"getBlockByHash($hash)", underlying.getBlockByHash(hash)) + + override def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean): Job[Option[JsObject]] = + wrap(s"getBlockByHashJson($hash, fullTxs=$fullTxs)", underlying.getBlockByHashJson(hash, fullTxs)) + + override def getLastExecutionBlock: Job[EcBlock] = wrap("getLastExecutionBlock", underlying.getLastExecutionBlock) + + override def blockExists(hash: BlockHash): Job[Boolean] = wrap(s"blockExists($hash)", underlying.blockExists(hash)) + + override def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] = + wrap(s"getLogs($hash, $topic)", underlying.getLogs(hash, topic)) } object LoggedEngineApiClient { diff --git a/src/test/scala/units/client/http/model/TestEcBlocks.scala b/src/test/scala/units/client/engine/model/TestEcBlocks.scala similarity index 96% rename from src/test/scala/units/client/http/model/TestEcBlocks.scala rename to src/test/scala/units/client/engine/model/TestEcBlocks.scala index d0fe70aa..389f9d91 100644 --- a/src/test/scala/units/client/http/model/TestEcBlocks.scala +++ b/src/test/scala/units/client/engine/model/TestEcBlocks.scala @@ -1,4 +1,4 @@ -package units.client.http.model +package units.client.engine.model import com.wavesplatform.account.SeedKeyPair import com.wavesplatform.common.utils.EitherExt2 diff --git a/src/test/scala/units/client/http/LoggedEcApiClient.scala b/src/test/scala/units/client/http/LoggedEcApiClient.scala deleted file mode 100644 index e1b340c1..00000000 --- a/src/test/scala/units/client/http/LoggedEcApiClient.scala +++ /dev/null @@ -1,25 +0,0 @@ -package units.client.http - -import play.api.libs.json.JsObject -import units.client.http.model.{BlockNumber, EcBlock, GetLogsResponseEntry} -import units.{BlockHash, HasJobLogging, Job} - -class LoggedEcApiClient(underlying: EcApiClient) extends EcApiClient with HasJobLogging { - override def getBlockByNumber(number: BlockNumber): Job[Option[EcBlock]] = wrap(s"getBlockByNumber($number)", underlying.getBlockByNumber(number)) - - override def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] = wrap(s"getBlockByHash($hash)", underlying.getBlockByHash(hash)) - - override def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean): Job[Option[JsObject]] = - wrap(s"getBlockByHashJson($hash, fullTxs=$fullTxs)", underlying.getBlockByHashJson(hash, fullTxs)) - - override def getLastExecutionBlock: Job[EcBlock] = wrap("getLastExecutionBlock", underlying.getLastExecutionBlock) - - override def blockExists(hash: BlockHash): Job[Boolean] = wrap(s"blockExists($hash)", underlying.blockExists(hash)) - - override def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] = - wrap(s"getLogs($hash, $topic)", underlying.getLogs(hash, topic)) -} - -object LoggedEcApiClient { - def apply(underlying: EcApiClient): EcApiClient = new LoggedEcApiClient(underlying) -} diff --git a/src/test/scala/units/eth/EmptyL2BlockTestSuite.scala b/src/test/scala/units/eth/EmptyL2BlockTestSuite.scala index ae3de91c..c965af99 100644 --- a/src/test/scala/units/eth/EmptyL2BlockTestSuite.scala +++ b/src/test/scala/units/eth/EmptyL2BlockTestSuite.scala @@ -5,7 +5,7 @@ import org.scalatest.freespec.AnyFreeSpec import org.web3j.abi.datatypes.generated.Uint256 import play.api.libs.json.Json import units.BlockHash -import units.client.http.model.EcBlock +import units.client.engine.model.EcBlock import units.eth.EmptyL2Block.Params class EmptyL2BlockTestSuite extends AnyFreeSpec with BaseSuite { From 31b0f3677d75a199219d05c5f5fe804b2f8030ef Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Fri, 6 Sep 2024 08:11:25 +0400 Subject: [PATCH 02/31] Logging decorator instead of LoggingBackend, filtering logs --- src/main/scala/units/ConsensusClient.scala | 30 +++---- .../scala/units/client/LoggingBackend.scala | 27 ------- .../units/client/engine/EngineApiClient.scala | 2 +- .../client/engine/HttpEngineApiClient.scala | 6 +- .../client/engine/LoggedEngineApiClient.scala | 79 +++++++++++++++++++ .../units/client/engine/model/EcBlock.scala | 5 +- .../engine/model/GetBlockByHashRequest.scala | 6 +- .../engine/model/GetLogsResponseEntry.scala | 6 +- .../scala/units/client/TestEcClients.scala | 6 +- .../client/engine/LoggedEngineApiClient.scala | 50 ------------ 10 files changed, 113 insertions(+), 104 deletions(-) delete mode 100644 src/main/scala/units/client/LoggingBackend.scala create mode 100644 src/main/scala/units/client/engine/LoggedEngineApiClient.scala delete mode 100644 src/test/scala/units/client/engine/LoggedEngineApiClient.scala diff --git a/src/main/scala/units/ConsensusClient.scala b/src/main/scala/units/ConsensusClient.scala index 38f0ce9f..7ec5d614 100644 --- a/src/main/scala/units/ConsensusClient.scala +++ b/src/main/scala/units/ConsensusClient.scala @@ -15,8 +15,8 @@ import monix.execution.{CancelableFuture, Scheduler} import net.ceedubs.ficus.Ficus.* import org.slf4j.LoggerFactory import sttp.client3.HttpClientSyncBackend -import units.client.engine.{EngineApiClient, HttpEngineApiClient} -import units.client.{JwtAuthenticationBackend, LoggingBackend} +import units.client.JwtAuthenticationBackend +import units.client.engine.{EngineApiClient, HttpEngineApiClient, LoggedEngineApiClient} import units.network.* import java.util.concurrent.ConcurrentHashMap @@ -106,18 +106,20 @@ class ConsensusClientDependencies(context: ExtensionContext) extends AutoCloseab val globalScheduler: Scheduler = monix.execution.Scheduler.global val eluScheduler: SchedulerService = Scheduler.singleThread("el-updater", reporter = { e => log.warn("Exception in ELUpdater", e) }) - private val httpClientBackend = new LoggingBackend(HttpClientSyncBackend()) - val engineApiClient = new HttpEngineApiClient( - config, - config.jwtSecretFile match { - case Some(secretFile) => - val src = Source.fromFile(secretFile) - try new JwtAuthenticationBackend(src.getLines().next(), httpClientBackend) - finally src.close() - case _ => - log.warn("JWT secret is not set") - httpClientBackend - } + private val httpClientBackend = HttpClientSyncBackend() + val engineApiClient = new LoggedEngineApiClient( + new HttpEngineApiClient( + config, + config.jwtSecretFile match { + case Some(secretFile) => + val src = Source.fromFile(secretFile) + try new JwtAuthenticationBackend(src.getLines().next(), httpClientBackend) + finally src.close() + case _ => + log.warn("JWT secret is not set") + httpClientBackend + } + ) ) val allChannels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE) diff --git a/src/main/scala/units/client/LoggingBackend.scala b/src/main/scala/units/client/LoggingBackend.scala deleted file mode 100644 index d720a3f2..00000000 --- a/src/main/scala/units/client/LoggingBackend.scala +++ /dev/null @@ -1,27 +0,0 @@ -package units.client - -import com.wavesplatform.utils.ScorexLogging -import sttp.capabilities.Effect -import sttp.client3.* - -class LoggingBackend[F[_], P](delegate: SttpBackend[F, P]) extends DelegateSttpBackend[F, P](delegate) with ScorexLogging { - override def send[T, R >: P & Effect[F]](request: Request[T, R]): F[Response[T]] = { - val prefix = request.tag(RequestIdTag).fold("")(id => s"[$id] ") - val requestWithRawJson = request.response(asBothOption(request.response, asStringAlways)) - - log.trace(request.tag(RetriesLeftTag) match { - case Some(retriesLeft) => s"${prefix}Retry, retries left: $retriesLeft" - case None => s"${prefix}Request: ${request.uri}, body=${request.body.show}" - }) - - val withErrorLog = responseMonad.handleError(requestWithRawJson.send(delegate)) { x => - log.trace(s"$prefix${x.getMessage}", x) - responseMonad.error(x) - } - - responseMonad.flatMap(withErrorLog) { response => - log.trace(s"${prefix}Response: ${response.code}, body=${response.body._2.getOrElse("empty")}") - responseMonad.unit(response.copy(body = response.body._1)) - } - } -} diff --git a/src/main/scala/units/client/engine/EngineApiClient.scala b/src/main/scala/units/client/engine/EngineApiClient.scala index ba9f5b09..95d57295 100644 --- a/src/main/scala/units/client/engine/EngineApiClient.scala +++ b/src/main/scala/units/client/engine/EngineApiClient.scala @@ -28,7 +28,7 @@ trait EngineApiClient { def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] - def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean = false): Job[Option[JsObject]] + def getBlockByHashJson(hash: BlockHash): Job[Option[JsObject]] def getLastExecutionBlock: Job[EcBlock] diff --git a/src/main/scala/units/client/engine/HttpEngineApiClient.scala b/src/main/scala/units/client/engine/HttpEngineApiClient.scala index 440b496f..ae43b6f8 100644 --- a/src/main/scala/units/client/engine/HttpEngineApiClient.scala +++ b/src/main/scala/units/client/engine/HttpEngineApiClient.scala @@ -85,12 +85,12 @@ class HttpEngineApiClient(val config: ClientConfig, val backend: SttpBackend[Ide } def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] = { - sendRequest[GetBlockByHashRequest, EcBlock](GetBlockByHashRequest(hash, fullTxs = false)) + sendRequest[GetBlockByHashRequest, EcBlock](GetBlockByHashRequest(hash)) .leftMap(err => ClientError(s"Error getting block by hash $hash: $err")) } - def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean = false): Job[Option[JsObject]] = { - sendRequest[GetBlockByHashRequest, JsObject](GetBlockByHashRequest(hash, fullTxs)) + def getBlockByHashJson(hash: BlockHash): Job[Option[JsObject]] = { + sendRequest[GetBlockByHashRequest, JsObject](GetBlockByHashRequest(hash)) .leftMap(err => ClientError(s"Error getting block json by hash $hash: $err")) } diff --git a/src/main/scala/units/client/engine/LoggedEngineApiClient.scala b/src/main/scala/units/client/engine/LoggedEngineApiClient.scala new file mode 100644 index 00000000..dd56cb57 --- /dev/null +++ b/src/main/scala/units/client/engine/LoggedEngineApiClient.scala @@ -0,0 +1,79 @@ +package units.client.engine + +import com.wavesplatform.utils.LoggerFacade +import org.slf4j.LoggerFactory +import play.api.libs.json.JsObject +import units.client.engine.EngineApiClient.PayloadId +import units.client.engine.LoggedEngineApiClient.excludedJsonFields +import units.client.engine.model.* +import units.eth.EthAddress +import units.{BlockHash, Job} + +import java.util.concurrent.ThreadLocalRandom +import scala.util.chaining.scalaUtilChainingOps + +class LoggedEngineApiClient(underlying: EngineApiClient) extends EngineApiClient { + protected val log = LoggerFacade(LoggerFactory.getLogger(underlying.getClass)) + + override def forkChoiceUpdate(blockHash: BlockHash, finalizedBlockHash: BlockHash): Job[String] = + wrap(s"forkChoiceUpdate($blockHash, f=$finalizedBlockHash)", underlying.forkChoiceUpdate(blockHash, finalizedBlockHash)) + + override def forkChoiceUpdateWithPayloadId( + lastBlockHash: BlockHash, + finalizedBlockHash: BlockHash, + unixEpochSeconds: Long, + suggestedFeeRecipient: EthAddress, + prevRandao: String, + withdrawals: Vector[Withdrawal] + ): Job[PayloadId] = wrap( + s"forkChoiceUpdateWithPayloadId(l=$lastBlockHash, f=$finalizedBlockHash, ts=$unixEpochSeconds, m=$suggestedFeeRecipient, " + + s"r=$prevRandao, w={${withdrawals.mkString(", ")}}", + underlying.forkChoiceUpdateWithPayloadId(lastBlockHash, finalizedBlockHash, unixEpochSeconds, suggestedFeeRecipient, prevRandao, withdrawals) + ) + + override def getPayload(payloadId: PayloadId): Job[JsObject] = + wrap(s"getPayload($payloadId)", underlying.getPayload(payloadId), filteredJson) + + override def applyNewPayload(payload: JsObject): Job[Option[BlockHash]] = + wrap(s"applyNewPayload(${filteredJson(payload)})", underlying.applyNewPayload(payload), _.fold("None")(_.toString)) + + override def getPayloadBodyByHash(hash: BlockHash): Job[Option[JsObject]] = + wrap(s"getPayloadBodyByHash($hash)", underlying.getPayloadBodyByHash(hash), _.fold("None")(filteredJson)) + + override def getBlockByNumber(number: BlockNumber): Job[Option[EcBlock]] = + wrap(s"getBlockByNumber($number)", underlying.getBlockByNumber(number), _.fold("None")(_.toString)) + + override def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] = + wrap(s"getBlockByHash($hash)", underlying.getBlockByHash(hash), _.fold("None")(_.toString)) + + override def getBlockByHashJson(hash: BlockHash): Job[Option[JsObject]] = + wrap(s"getBlockByHashJson($hash)", underlying.getBlockByHashJson(hash), _.fold("None")(filteredJson)) + + override def getLastExecutionBlock: Job[EcBlock] = + wrap("getLastExecutionBlock", underlying.getLastExecutionBlock) + + override def blockExists(hash: BlockHash): Job[Boolean] = + wrap(s"blockExists($hash)", underlying.blockExists(hash)) + + override def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] = + wrap(s"getLogs($hash, t=$topic)", underlying.getLogs(hash, topic), _.mkString("{", ", ", "}")) + + protected def wrap[R](method: String, f: => Job[R], toMsg: R => String = (_: R).toString): Job[R] = { + val currRequestId = ThreadLocalRandom.current().nextInt(10000, 100000).toString + log.debug(s"[$currRequestId] $method") + + f.tap { + case Left(e) => log.debug(s"[$currRequestId] Error: ${e.message}") + case Right(r) => log.debug(s"[$currRequestId] Success: ${toMsg(r)}") + } + } + + private def filteredJson(jsObject: JsObject): String = JsObject( + jsObject.fields.filterNot { case (k, _) => excludedJsonFields.contains(k) } + ).toString() +} + +object LoggedEngineApiClient { + private val excludedJsonFields = + Set("transactions", "logsBloom", "stateRoot", "gasLimit", "gasUsed", "baseFeePerGas", "excessBlobGas") +} diff --git a/src/main/scala/units/client/engine/model/EcBlock.scala b/src/main/scala/units/client/engine/model/EcBlock.scala index 595e611f..587e87b3 100644 --- a/src/main/scala/units/client/engine/model/EcBlock.scala +++ b/src/main/scala/units/client/engine/model/EcBlock.scala @@ -25,7 +25,10 @@ case class EcBlock( gasLimit: Long, gasUsed: Long, withdrawals: Vector[Withdrawal] -) extends L2BlockLike +) extends L2BlockLike { + override def toString: String = + s"EcBlock($hash, p=$parentHash, h=$height, t=$timestamp, m=$minerRewardL2Address, w={${withdrawals.mkString(", ")}})" +} object EcBlock { implicit val reads: Reads[EcBlock] = ( diff --git a/src/main/scala/units/client/engine/model/GetBlockByHashRequest.scala b/src/main/scala/units/client/engine/model/GetBlockByHashRequest.scala index 913dc896..c341e4ba 100644 --- a/src/main/scala/units/client/engine/model/GetBlockByHashRequest.scala +++ b/src/main/scala/units/client/engine/model/GetBlockByHashRequest.scala @@ -1,15 +1,15 @@ package units.client.engine.model -import units.BlockHash import play.api.libs.json.{Json, Writes} +import units.BlockHash -case class GetBlockByHashRequest(hash: BlockHash, fullTxs: Boolean) +case class GetBlockByHashRequest(hash: BlockHash) object GetBlockByHashRequest { implicit val writes: Writes[GetBlockByHashRequest] = (o: GetBlockByHashRequest) => { Json.obj( "jsonrpc" -> "2.0", "method" -> "eth_getBlockByHash", - "params" -> Json.arr(o.hash, o.fullTxs), + "params" -> Json.arr(o.hash, false), "id" -> 1 ) } diff --git a/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala b/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala index 247eddbf..71ef3bc1 100644 --- a/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala +++ b/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala @@ -1,7 +1,7 @@ package units.client.engine.model -import units.eth.EthAddress import play.api.libs.json.{Json, Reads} +import units.eth.EthAddress /** @param topics * List of hex values @@ -10,7 +10,9 @@ case class GetLogsResponseEntry( address: EthAddress, data: String, // Bytes topics: List[String] // TODO type -) +) { + override def toString: String = s"Log($data)" +} object GetLogsResponseEntry { implicit val getLogsResponseEntryReads: Reads[GetLogsResponseEntry] = Json.reads diff --git a/src/test/scala/units/client/TestEcClients.scala b/src/test/scala/units/client/TestEcClients.scala index 8c00ce77..4a3095b1 100644 --- a/src/test/scala/units/client/TestEcClients.scala +++ b/src/test/scala/units/client/TestEcClients.scala @@ -73,7 +73,7 @@ class TestEcClients private ( */ def fullValidatedBlocks: Set[BlockHash] = getLogsCalls.get() - val engineApi = LoggedEngineApiClient { + val engineApi = new LoggedEngineApiClient( new EngineApiClient { override def forkChoiceUpdate(blockHash: BlockHash, finalizedBlockHash: BlockHash): Job[String] = { knownBlocks.get().get(blockHash) match { @@ -157,7 +157,7 @@ class TestEcClients private ( } yield b.ecBlock }.asRight - override def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean): Job[Option[JsObject]] = + override def getBlockByHashJson(hash: BlockHash): Job[Option[JsObject]] = notImplementedMethodJob("getBlockByHashJson") override def getLastExecutionBlock: Job[EcBlock] = currChain.head.asRight @@ -170,7 +170,7 @@ class TestEcClients private ( logs.get().getOrElse(request, throw notImplementedCase("call setBlockLogs")) }.asRight } - } + ) protected def notImplementedMethodJob[A](text: String): Job[A] = throw new NotImplementedMethod(text) protected def notImplementedCase(text: String): Throwable = new NotImplementedCase(text) diff --git a/src/test/scala/units/client/engine/LoggedEngineApiClient.scala b/src/test/scala/units/client/engine/LoggedEngineApiClient.scala deleted file mode 100644 index 138dbce7..00000000 --- a/src/test/scala/units/client/engine/LoggedEngineApiClient.scala +++ /dev/null @@ -1,50 +0,0 @@ -package units.client.engine - -import play.api.libs.json.JsObject -import units.client.engine.EngineApiClient.PayloadId -import units.client.engine.model.* -import units.eth.EthAddress -import units.{BlockHash, HasJobLogging, Job} - -class LoggedEngineApiClient(underlying: EngineApiClient) extends EngineApiClient with HasJobLogging { - override def forkChoiceUpdate(blockHash: BlockHash, finalizedBlockHash: BlockHash): Job[String] = - wrap(s"forkChoiceUpdate($blockHash, f=$finalizedBlockHash)", underlying.forkChoiceUpdate(blockHash, finalizedBlockHash)) - - override def forkChoiceUpdateWithPayloadId( - lastBlockHash: BlockHash, - finalizedBlockHash: BlockHash, - unixEpochSeconds: Long, - suggestedFeeRecipient: EthAddress, - prevRandao: String, - withdrawals: Vector[Withdrawal] - ): Job[PayloadId] = wrap( - s"forkChoiceUpdateWithPayloadId(lastBlockHash=$lastBlockHash, f=$finalizedBlockHash, ts=$unixEpochSeconds, feeRecipient=$suggestedFeeRecipient, " + - s"prd=$prevRandao, w={${withdrawals.mkString(", ")}}", - underlying.forkChoiceUpdateWithPayloadId(lastBlockHash, finalizedBlockHash, unixEpochSeconds, suggestedFeeRecipient, prevRandao, withdrawals) - ) - - override def getPayload(payloadId: PayloadId): Job[JsObject] = wrap(s"getPayload($payloadId)", underlying.getPayload(payloadId)) - - override def applyNewPayload(payload: JsObject): Job[Option[BlockHash]] = wrap(s"applyNewPayload($payload)", underlying.applyNewPayload(payload)) - - override def getPayloadBodyByHash(hash: BlockHash): Job[Option[JsObject]] = - wrap(s"getPayloadBodyByHash($hash)", underlying.getPayloadBodyByHash(hash)) - - override def getBlockByNumber(number: BlockNumber): Job[Option[EcBlock]] = wrap(s"getBlockByNumber($number)", underlying.getBlockByNumber(number)) - - override def getBlockByHash(hash: BlockHash): Job[Option[EcBlock]] = wrap(s"getBlockByHash($hash)", underlying.getBlockByHash(hash)) - - override def getBlockByHashJson(hash: BlockHash, fullTxs: Boolean): Job[Option[JsObject]] = - wrap(s"getBlockByHashJson($hash, fullTxs=$fullTxs)", underlying.getBlockByHashJson(hash, fullTxs)) - - override def getLastExecutionBlock: Job[EcBlock] = wrap("getLastExecutionBlock", underlying.getLastExecutionBlock) - - override def blockExists(hash: BlockHash): Job[Boolean] = wrap(s"blockExists($hash)", underlying.blockExists(hash)) - - override def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] = - wrap(s"getLogs($hash, $topic)", underlying.getLogs(hash, topic)) -} - -object LoggedEngineApiClient { - def apply(underlying: EngineApiClient): EngineApiClient = new LoggedEngineApiClient(underlying) -} From d24ccd649a22b68a177913a412941a902b55de1e Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Fri, 6 Sep 2024 11:38:12 +0400 Subject: [PATCH 03/31] ContractBlock.toString --- build.sbt | 2 -- src/main/scala/units/client/contract/ContractBlock.scala | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 499d53ad..d0bf068b 100644 --- a/build.sbt +++ b/build.sbt @@ -80,5 +80,3 @@ buildTarballsForDocker := { baseDirectory.value / "docker" / "target" / "consensus-client.tgz" ) } - -Test / unmanagedJars += file("src/test/lib/waves-all.jar") diff --git a/src/main/scala/units/client/contract/ContractBlock.scala b/src/main/scala/units/client/contract/ContractBlock.scala index 6299fdcd..a1ea7858 100644 --- a/src/main/scala/units/client/contract/ContractBlock.scala +++ b/src/main/scala/units/client/contract/ContractBlock.scala @@ -5,6 +5,7 @@ import com.wavesplatform.common.state.ByteStr import units.BlockHash import units.client.L2BlockLike import units.eth.EthAddress +import units.util.HexBytesConverter.toHex case class ContractBlock( hash: BlockHash, @@ -16,7 +17,11 @@ case class ContractBlock( chainId: Long, elToClTransfersRootHash: Digest, lastClToElTransferIndex: Long -) extends L2BlockLike +) extends L2BlockLike { + override def toString: String = + s"ContractBlock($hash, p=$parentHash, e=$epoch, h=$height, m=$minerRewardL2Address ($generator), c=$chainId, " + + s"e2c=${if (elToClTransfersRootHash.isEmpty) "" else toHex(elToClTransfersRootHash)}, c2e=$lastClToElTransferIndex)" +} object ContractBlock { val ElToClTransfersRootHashLength = 32 // bytes From 648e906ef5ce71162809bf485f3be956004a9cf7 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Fri, 6 Sep 2024 12:14:18 +0400 Subject: [PATCH 04/31] Additional filtration for eth_getLogs --- src/main/scala/units/ELUpdater.scala | 2 +- src/main/scala/units/client/engine/EngineApiClient.scala | 2 +- .../scala/units/client/engine/HttpEngineApiClient.scala | 4 ++-- .../scala/units/client/engine/LoggedEngineApiClient.scala | 4 ++-- .../scala/units/client/engine/model/GetLogsRequest.scala | 4 +++- src/test/scala/units/BaseIntegrationTestSuite.scala | 3 ++- src/test/scala/units/ExtensionDomain.scala | 3 ++- src/test/scala/units/TestEcBlockBuilder.scala | 5 ++++- src/test/scala/units/client/TestEcClients.scala | 8 ++++---- .../client/contract/HasConsensusLayerDappTxHelpers.scala | 4 +++- 10 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/main/scala/units/ELUpdater.scala b/src/main/scala/units/ELUpdater.scala index 3c342df4..48e64ad6 100644 --- a/src/main/scala/units/ELUpdater.scala +++ b/src/main/scala/units/ELUpdater.scala @@ -1236,7 +1236,7 @@ class ELUpdater( private def getElToClTransfersRootHash(hash: BlockHash, elBridgeAddress: EthAddress): Job[Digest] = for { - elRawLogs <- engineApiClient.getLogs(hash, Bridge.ElSentNativeEventTopic) + elRawLogs <- engineApiClient.getLogs(hash, elBridgeAddress, Bridge.ElSentNativeEventTopic) rootHash <- { val relatedElRawLogs = elRawLogs.filter(x => x.address == elBridgeAddress && x.topics.contains(Bridge.ElSentNativeEventTopic)) Bridge diff --git a/src/main/scala/units/client/engine/EngineApiClient.scala b/src/main/scala/units/client/engine/EngineApiClient.scala index 95d57295..200b7e4e 100644 --- a/src/main/scala/units/client/engine/EngineApiClient.scala +++ b/src/main/scala/units/client/engine/EngineApiClient.scala @@ -34,7 +34,7 @@ trait EngineApiClient { def blockExists(hash: BlockHash): Job[Boolean] - def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] + def getLogs(hash: BlockHash, address: EthAddress, topic: String): Job[List[GetLogsResponseEntry]] } object EngineApiClient { diff --git a/src/main/scala/units/client/engine/HttpEngineApiClient.scala b/src/main/scala/units/client/engine/HttpEngineApiClient.scala index ae43b6f8..d2496842 100644 --- a/src/main/scala/units/client/engine/HttpEngineApiClient.scala +++ b/src/main/scala/units/client/engine/HttpEngineApiClient.scala @@ -107,8 +107,8 @@ class HttpEngineApiClient(val config: ClientConfig, val backend: SttpBackend[Ide .leftMap(err => ClientError(s"Error getting block by number $number: $err")) } - override def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] = - sendRequest[GetLogsRequest, List[GetLogsResponseEntry]](GetLogsRequest(hash, List(topic))) + override def getLogs(hash: BlockHash, address: EthAddress, topic: String): Job[List[GetLogsResponseEntry]] = + sendRequest[GetLogsRequest, List[GetLogsResponseEntry]](GetLogsRequest(hash, address, List(topic))) .leftMap(err => ClientError(s"Error getting block logs by hash $hash: $err")) .map(_.getOrElse(List.empty)) diff --git a/src/main/scala/units/client/engine/LoggedEngineApiClient.scala b/src/main/scala/units/client/engine/LoggedEngineApiClient.scala index dd56cb57..87232daf 100644 --- a/src/main/scala/units/client/engine/LoggedEngineApiClient.scala +++ b/src/main/scala/units/client/engine/LoggedEngineApiClient.scala @@ -55,8 +55,8 @@ class LoggedEngineApiClient(underlying: EngineApiClient) extends EngineApiClient override def blockExists(hash: BlockHash): Job[Boolean] = wrap(s"blockExists($hash)", underlying.blockExists(hash)) - override def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] = - wrap(s"getLogs($hash, t=$topic)", underlying.getLogs(hash, topic), _.mkString("{", ", ", "}")) + override def getLogs(hash: BlockHash, address: EthAddress, topic: String): Job[List[GetLogsResponseEntry]] = + wrap(s"getLogs($hash, a=$address, t=$topic)", underlying.getLogs(hash, address, topic), _.mkString("{", ", ", "}")) protected def wrap[R](method: String, f: => Job[R], toMsg: R => String = (_: R).toString): Job[R] = { val currRequestId = ThreadLocalRandom.current().nextInt(10000, 100000).toString diff --git a/src/main/scala/units/client/engine/model/GetLogsRequest.scala b/src/main/scala/units/client/engine/model/GetLogsRequest.scala index 23feea7a..1d7fc759 100644 --- a/src/main/scala/units/client/engine/model/GetLogsRequest.scala +++ b/src/main/scala/units/client/engine/model/GetLogsRequest.scala @@ -2,13 +2,14 @@ package units.client.engine.model import units.BlockHash import play.api.libs.json.{Json, Writes} +import units.eth.EthAddress /** @param topics * Event signature hash and indexed event parameters * @see * https://besu.hyperledger.org/stable/public-networks/reference/api#eth_getlogs */ -case class GetLogsRequest(hash: BlockHash, topics: List[String]) +case class GetLogsRequest(hash: BlockHash, address: EthAddress, topics: List[String]) object GetLogsRequest { implicit val writes: Writes[GetLogsRequest] = (o: GetLogsRequest) => { Json.obj( @@ -17,6 +18,7 @@ object GetLogsRequest { "params" -> Json.arr( Json.obj( "blockHash" -> o.hash, + "address" -> o.address, "topics" -> o.topics ) ), diff --git a/src/test/scala/units/BaseIntegrationTestSuite.scala b/src/test/scala/units/BaseIntegrationTestSuite.scala index af0122c3..aff7d105 100644 --- a/src/test/scala/units/BaseIntegrationTestSuite.scala +++ b/src/test/scala/units/BaseIntegrationTestSuite.scala @@ -37,7 +37,7 @@ trait BaseIntegrationTestSuite val txs = List( d.chainContract.setScript(), - d.chainContract.setup(d.ecGenesisBlock, elMinerDefaultReward.amount.longValue(), elBridgeAddress) + d.chainContract.setup(d.ecGenesisBlock, elMinerDefaultReward.amount.longValue()) ) ++ settings.initialMiners .flatMap { x => @@ -69,6 +69,7 @@ trait BaseIntegrationTestSuite blockchainUpdater = bcu, rocksDBWriter = blockchain, settings = settings.wavesSettings, + elBridgeAddress = elBridgeAddress, elMinerDefaultReward = elMinerDefaultReward ) diff --git a/src/test/scala/units/ExtensionDomain.scala b/src/test/scala/units/ExtensionDomain.scala index 75d4b432..5c264fb4 100644 --- a/src/test/scala/units/ExtensionDomain.scala +++ b/src/test/scala/units/ExtensionDomain.scala @@ -58,6 +58,7 @@ class ExtensionDomain( blockchainUpdater: BlockchainUpdaterImpl, rocksDBWriter: RocksDBWriter, settings: WavesSettings, + override val elBridgeAddress: EthAddress, elMinerDefaultReward: Gwei ) extends Domain(rdb, blockchainUpdater, rocksDBWriter, settings) with HasConsensusLayerDappTxHelpers @@ -345,7 +346,7 @@ class ExtensionDomain( createEcBlockBuilder(hashPath, miner.elRewardAddress, parent) def createEcBlockBuilder(hashPath: String, minerRewardL2Address: EthAddress, parent: EcBlock): TestEcBlockBuilder = - TestEcBlockBuilder(ecClients, elMinerDefaultReward, l2Config.blockDelay, parent = parent).updateBlock( + TestEcBlockBuilder(ecClients, elBridgeAddress, elMinerDefaultReward, l2Config.blockDelay, parent = parent).updateBlock( _.copy( hash = TestEcBlockBuilder.createBlockHash(hashPath), minerRewardL2Address = minerRewardL2Address diff --git a/src/test/scala/units/TestEcBlockBuilder.scala b/src/test/scala/units/TestEcBlockBuilder.scala index d8d6e899..ca451a3d 100644 --- a/src/test/scala/units/TestEcBlockBuilder.scala +++ b/src/test/scala/units/TestEcBlockBuilder.scala @@ -10,6 +10,7 @@ import scala.concurrent.duration.FiniteDuration class TestEcBlockBuilder private ( testEcClients: TestEcClients, + elBridgeAddress: EthAddress, elMinerDefaultReward: Gwei, private var block: EcBlock, parentBlock: EcBlock @@ -28,7 +29,7 @@ class TestEcBlockBuilder private ( def build(): EcBlock = block def buildAndSetLogs(logs: List[GetLogsResponseEntry] = Nil): EcBlock = { - testEcClients.setBlockLogs(block.hash, Bridge.ElSentNativeEventTopic, logs) + testEcClients.setBlockLogs(block.hash, elBridgeAddress, Bridge.ElSentNativeEventTopic, logs) block } } @@ -36,12 +37,14 @@ class TestEcBlockBuilder private ( object TestEcBlockBuilder { def apply( testEcClients: TestEcClients, + elBridgeAddress: EthAddress, elMinerDefaultReward: Gwei, blockDelay: FiniteDuration, parent: EcBlock ): TestEcBlockBuilder = new TestEcBlockBuilder( testEcClients, + elBridgeAddress, elMinerDefaultReward, EcBlock( hash = createBlockHash("???"), diff --git a/src/test/scala/units/client/TestEcClients.scala b/src/test/scala/units/client/TestEcClients.scala index 4a3095b1..ed33382d 100644 --- a/src/test/scala/units/client/TestEcClients.scala +++ b/src/test/scala/units/client/TestEcClients.scala @@ -62,8 +62,8 @@ class TestEcClients private ( forgingBlocks.transform(ForgingBlock(mkTestEcBlock(ecBlock, epochNumber)) :: _) private val logs = Atomic(Map.empty[GetLogsRequest, List[GetLogsResponseEntry]]) - def setBlockLogs(hash: BlockHash, topic: String, blockLogs: List[GetLogsResponseEntry]): Unit = { - val request = GetLogsRequest(hash, List(topic)) + def setBlockLogs(hash: BlockHash, address: EthAddress, topic: String, blockLogs: List[GetLogsResponseEntry]): Unit = { + val request = GetLogsRequest(hash, address, List(topic)) logs.transform(_.updated(request, blockLogs)) } @@ -164,8 +164,8 @@ class TestEcClients private ( override def blockExists(hash: BlockHash): Job[Boolean] = notImplementedMethodJob("blockExists") - override def getLogs(hash: BlockHash, topic: String): Job[List[GetLogsResponseEntry]] = { - val request = GetLogsRequest(hash, List(topic)) + override def getLogs(hash: BlockHash, address: EthAddress, topic: String): Job[List[GetLogsResponseEntry]] = { + val request = GetLogsRequest(hash, address, List(topic)) getLogsCalls.transform(_ + hash) logs.get().getOrElse(request, throw notImplementedCase("call setBlockLogs")) }.asRight diff --git a/src/test/scala/units/client/contract/HasConsensusLayerDappTxHelpers.scala b/src/test/scala/units/client/contract/HasConsensusLayerDappTxHelpers.scala index 3ee53431..8e7a8061 100644 --- a/src/test/scala/units/client/contract/HasConsensusLayerDappTxHelpers.scala +++ b/src/test/scala/units/client/contract/HasConsensusLayerDappTxHelpers.scala @@ -17,6 +17,8 @@ import units.eth.{EthAddress, EthereumConstants} import units.util.HexBytesConverter trait HasConsensusLayerDappTxHelpers { + def elBridgeAddress: EthAddress + def currentHitSource: ByteStr def stakingContractAccount: KeyPair @@ -44,7 +46,7 @@ trait HasConsensusLayerDappTxHelpers { object chainContract { def setScript(): SetScriptTransaction = TxHelpers.setScript(chainContractAccount, CompiledChainContract.script, fee = setScriptFee) - def setup(genesisBlock: L2BlockLike, elMinerReward: Long, elBridgeAddress: EthAddress): InvokeScriptTransaction = TxHelpers.invoke( + def setup(genesisBlock: L2BlockLike, elMinerReward: Long): InvokeScriptTransaction = TxHelpers.invoke( dApp = chainContractAddress, func = "setup".some, args = List( From c5d18cd5a5688289cd964887f2691d5af27c21a6 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Fri, 6 Sep 2024 12:23:58 +0400 Subject: [PATCH 05/31] local-network: better start --- local-network/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index c46159b2..b58a5a74 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -97,6 +97,8 @@ services: - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro - ./configs/wavesnode/waves-2.conf:/etc/waves/waves.conf:ro depends_on: + wavesnode-1: # To reduce possible forks at start + condition: service_started besu-2-check: condition: service_completed_successfully From 631e59b83455f23141e9424890f66e159cc4769d Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Fri, 6 Sep 2024 12:25:33 +0400 Subject: [PATCH 06/31] Less logs for getLogs --- .../scala/units/client/engine/LoggedEngineApiClient.scala | 2 +- .../units/client/engine/model/GetLogsResponseEntry.scala | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/scala/units/client/engine/LoggedEngineApiClient.scala b/src/main/scala/units/client/engine/LoggedEngineApiClient.scala index 87232daf..0a183309 100644 --- a/src/main/scala/units/client/engine/LoggedEngineApiClient.scala +++ b/src/main/scala/units/client/engine/LoggedEngineApiClient.scala @@ -56,7 +56,7 @@ class LoggedEngineApiClient(underlying: EngineApiClient) extends EngineApiClient wrap(s"blockExists($hash)", underlying.blockExists(hash)) override def getLogs(hash: BlockHash, address: EthAddress, topic: String): Job[List[GetLogsResponseEntry]] = - wrap(s"getLogs($hash, a=$address, t=$topic)", underlying.getLogs(hash, address, topic), _.mkString("{", ", ", "}")) + wrap(s"getLogs($hash, a=$address, t=$topic)", underlying.getLogs(hash, address, topic), _.view.map(_.data).mkString("{", ", ", "}")) protected def wrap[R](method: String, f: => Job[R], toMsg: R => String = (_: R).toString): Job[R] = { val currRequestId = ThreadLocalRandom.current().nextInt(10000, 100000).toString diff --git a/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala b/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala index 71ef3bc1..0cc0290d 100644 --- a/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala +++ b/src/main/scala/units/client/engine/model/GetLogsResponseEntry.scala @@ -10,9 +10,7 @@ case class GetLogsResponseEntry( address: EthAddress, data: String, // Bytes topics: List[String] // TODO type -) { - override def toString: String = s"Log($data)" -} +) object GetLogsResponseEntry { implicit val getLogsResponseEntryReads: Reads[GetLogsResponseEntry] = Json.reads From 4accec6a46840ba21ab3d92fb4703296719f1fbf Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Fri, 6 Sep 2024 12:55:59 +0400 Subject: [PATCH 07/31] local-network: prepare for geth --- local-network/configs/besu/besu-1.conf | 4 +- local-network/configs/besu/besu-2.conf | 4 +- .../configs/blockscout/backend/bs-backend.env | 4 +- local-network/configs/blockscout/enabled.yml | 2 +- .../configs/blockscout/nginx/nginx.yml | 4 +- local-network/configs/wavesnode/waves-1.conf | 2 +- local-network/configs/wavesnode/waves-2.conf | 2 +- local-network/deploy/src/nodes.ts | 2 +- local-network/deploy/src/waves.ts | 15 +------ local-network/docker-compose.yml | 40 +++++++++---------- 10 files changed, 32 insertions(+), 47 deletions(-) diff --git a/local-network/configs/besu/besu-1.conf b/local-network/configs/besu/besu-1.conf index 33b55801..12b805d4 100644 --- a/local-network/configs/besu/besu-1.conf +++ b/local-network/configs/besu/besu-1.conf @@ -36,8 +36,8 @@ nat-method = "NONE" Xdns-enabled = true Xdns-update-enabled = true bootnodes = [ - "enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@besu-1:30303", - "enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@besu-2:30303" + "enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303", + "enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303" ] tx-pool-max-future-by-sender = "1250" diff --git a/local-network/configs/besu/besu-2.conf b/local-network/configs/besu/besu-2.conf index edafcbab..fdf2fc47 100644 --- a/local-network/configs/besu/besu-2.conf +++ b/local-network/configs/besu/besu-2.conf @@ -34,8 +34,8 @@ nat-method = "NONE" Xdns-enabled = true Xdns-update-enabled = true bootnodes = [ - "enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@besu-1:30303", - "enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@besu-1:30303" + "enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303", + "enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-1:30303" ] tx-pool-max-future-by-sender = "1250" diff --git a/local-network/configs/blockscout/backend/bs-backend.env b/local-network/configs/blockscout/backend/bs-backend.env index 277f3c07..d71ccbea 100644 --- a/local-network/configs/blockscout/backend/bs-backend.env +++ b/local-network/configs/blockscout/backend/bs-backend.env @@ -1,5 +1,5 @@ ETHEREUM_JSONRPC_VARIANT=besu -ETHEREUM_JSONRPC_HTTP_URL=http://besu-1:8545/ +ETHEREUM_JSONRPC_HTTP_URL=http://ec-1:8545/ # ETHEREUM_JSONRPC_FALLBACK_HTTP_URL= DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout # DATABASE_QUEUE_TARGET @@ -11,7 +11,7 @@ ETHEREUM_JSONRPC_TRACE_URL=http://besu:8545/ NETWORK= SUBNETWORK=Awesome chain LOGO=/images/blockscout_logo.svg -ETHEREUM_JSONRPC_WS_URL=ws://besu-1:8546/ +ETHEREUM_JSONRPC_WS_URL=ws://ec-1:8546/ ETHEREUM_JSONRPC_TRANSPORT=http ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES=false # ETHEREUM_JSONRPC_ARCHIVE_BALANCES_WINDOW=200 diff --git a/local-network/configs/blockscout/enabled.yml b/local-network/configs/blockscout/enabled.yml index 8253b2e4..732b18a5 100644 --- a/local-network/configs/blockscout/enabled.yml +++ b/local-network/configs/blockscout/enabled.yml @@ -21,7 +21,7 @@ services: depends_on: - db - redis - - besu-1 + - ec-1 extends: file: ./backend/backend.yml service: backend diff --git a/local-network/configs/blockscout/nginx/nginx.yml b/local-network/configs/blockscout/nginx/nginx.yml index 7dcfd0f8..2e852744 100644 --- a/local-network/configs/blockscout/nginx/nginx.yml +++ b/local-network/configs/blockscout/nginx/nginx.yml @@ -10,8 +10,8 @@ services: environment: BACK_PROXY_PASS: ${BACK_PROXY_PASS:-http://bs-backend:4000} FRONT_PROXY_PASS: ${FRONT_PROXY_PASS:-http://bs-frontend:3000} - BESU_RPC_PROXY_PASS: ${BESU_RPC_PROXY_PASS:-http://besu-1:8545} - BESU_WS_PROXY_PASS: ${BESU_WS_PROXY_PASS:-http://besu-1:8546} + BESU_RPC_PROXY_PASS: ${BESU_RPC_PROXY_PASS:-http://ec-1:8545} + BESU_WS_PROXY_PASS: ${BESU_WS_PROXY_PASS:-http://ec-1:8546} WAVES_PROXY_PASS: ${WAVES_PROXY_PASS:-http://wavesnode-1:6869} ports: - '0.0.0.0:3000:3000' diff --git a/local-network/configs/wavesnode/waves-1.conf b/local-network/configs/wavesnode/waves-1.conf index 281684eb..b9f30a9d 100644 --- a/local-network/configs/wavesnode/waves-1.conf +++ b/local-network/configs/wavesnode/waves-1.conf @@ -3,7 +3,7 @@ include "common/waves-common.conf" waves { network.node-name = waves-1 - l2.execution-client-address = besu-1 + l2.execution-client-address = ec-1 wallet.seed = HnyGuCEnV1A # devnet-1 , addr: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e } diff --git a/local-network/configs/wavesnode/waves-2.conf b/local-network/configs/wavesnode/waves-2.conf index 1b2aa31b..07419969 100644 --- a/local-network/configs/wavesnode/waves-2.conf +++ b/local-network/configs/wavesnode/waves-2.conf @@ -3,7 +3,7 @@ include "common/waves-common.conf" waves { network.node-name = "waves-2" - l2.execution-client-address = besu-2 + l2.execution-client-address = ec-2 wallet.seed = HnyGuCEnV1B # devnet-2 , addr: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU } diff --git a/local-network/deploy/src/nodes.ts b/local-network/deploy/src/nodes.ts index 6b0a845e..4565caf5 100644 --- a/local-network/deploy/src/nodes.ts +++ b/local-network/deploy/src/nodes.ts @@ -11,7 +11,7 @@ function getWavesApiUrl(insideDocker: boolean, i: number): string { } function getEcApiUrl(insideDocker: boolean, i: number): string { - return insideDocker ? `http://besu-${i}:8545` : `http://127.0.0.1:${i}8545`; + return insideDocker ? `http://ec-${i}:8545` : `http://127.0.0.1:${i}8545`; } function mkWeb3(ecRpcUrl: string): Web3 { diff --git a/local-network/deploy/src/waves.ts b/local-network/deploy/src/waves.ts index f87867a1..6dfa0faf 100644 --- a/local-network/deploy/src/waves.ts +++ b/local-network/deploy/src/waves.ts @@ -9,7 +9,7 @@ import * as logger from './logger'; import * as wavesTxs from './waves-txs'; import * as wavesUtils from './waves-utils'; import { ExtendedWavesApi } from './waves-utils'; -import { ec1Rpc } from './nodes'; +import { wavesApi1, wavesApi2, ec1Rpc } from './nodes'; const chainContractAddress = s.chainContract.address; @@ -21,19 +21,9 @@ export interface SetupResult { utils: typeof wavesUtils; } -function getWavesApiUrl(insideDocker: boolean, i: number): string { - return insideDocker ? `http://wavesnode-${i}:6869` : `http://127.0.0.1:${i}6869`; -} - export async function setup(force: boolean): Promise { logger.info('Set up CL'); - const insideDocker = await common.isInsideDocker(); - const wavesApi1Url = getWavesApiUrl(insideDocker, 1); - const wavesApi2Url = getWavesApiUrl(insideDocker, 2); - - logger.info(`Waves Node HTTP API: ${wavesApi1Url}, ${wavesApi2Url}`); - const scSetBalances = async (): Promise => { const tx = wavesTxs.scSetBalances; const dAppAddress = wt.libs.crypto.address({ publicKey: tx.senderPublicKey }, s.chainId); @@ -95,9 +85,6 @@ export async function setup(force: boolean): Promise { } }; - let wavesApi1: ExtendedWavesApi = { ...waves.create(wavesApi1Url), base: wavesApi1Url }; - let wavesApi2: ExtendedWavesApi = { ...waves.create(wavesApi2Url), base: wavesApi2Url }; - logger.info('Wait Waves 1 node'); await wavesUtils.waitForUp(wavesApi1); diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index b58a5a74..b9c994bf 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -2,9 +2,9 @@ name: l2 include: - ./configs/blockscout/${BS-enabled}.yml services: - besu-1: - container_name: besu-1 - hostname: besu-1 + ec-1: + container_name: ec-1 + hostname: ec-1 # To update use: docker pull hyperledger/besu:latest image: hyperledger/besu:latest # Debug version: besu-debug:latest , see _debug/ ports: @@ -12,51 +12,51 @@ services: - "0.0.0.0:18545:8545" # RPC port, for Metamask e.g. - "0.0.0.0:18546:8546" # WebSocket volumes: - - ./logs/besu-1:/opt/besu/logs + - ./logs/ec-1:/opt/besu/logs - ./configs/besu:/config:ro environment: - LOG4J_CONFIGURATION_FILE=/config/log4j2.xml command: - '--config-file=/config/besu-1.conf' - besu-1-check: - container_name: besu-1-check + ec-1-check: + container_name: ec-1-check image: curlimages/curl:8.8.0 command: > --retry 20 --retry-all-errors --retry-max-time 60 -d '{"jsonrpc":"2.0","method":"engine_exchangeCapabilities","params":[[]],"id":1}' - http://besu-1:8551 + http://ec-1:8551 depends_on: - - besu-1 + - ec-1 - besu-2: - container_name: besu-2 - hostname: besu-2 + ec-2: + container_name: ec-2 + hostname: ec-2 image: hyperledger/besu:latest ports: - "0.0.0.0:28551:8551" # Engine port - "0.0.0.0:28545:8545" # RPC port volumes: - - ./logs/besu-2:/opt/besu/logs + - ./logs/ec-2:/opt/besu/logs - ./configs/besu:/config:ro environment: - LOG4J_CONFIGURATION_FILE=/config/log4j2.xml command: - '--config-file=/config/besu-2.conf' - besu-2-check: - container_name: besu-2-check + ec-2-check: + container_name: ec-2-check image: curlimages/curl:8.8.0 command: > --retry 20 --retry-all-errors --retry-max-time 60 -d '{"jsonrpc":"2.0","method":"engine_exchangeCapabilities","params":[[]],"id":1}' - http://besu-2:8551 + http://ec-2:8551 depends_on: - - besu-2 + - ec-2 wavesnode-1: container_name: wavesnode-1 @@ -76,7 +76,7 @@ services: - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro - ./configs/wavesnode/waves-1.conf:/etc/waves/waves.conf:ro depends_on: - besu-1-check: + ec-1-check: condition: service_completed_successfully wavesnode-2: @@ -99,7 +99,7 @@ services: depends_on: wavesnode-1: # To reduce possible forks at start condition: service_started - besu-2-check: + ec-2-check: condition: service_completed_successfully deploy: @@ -117,6 +117,4 @@ services: - /home/node/app/node_modules # Ignore this subdirectory depends_on: - wavesnode-1 - - wavesnode-2 - - besu-1 - - besu-2 + - ec-1 From f53b8bc265a12309f81d53af334485343b4cdc2a Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 9 Sep 2024 08:58:14 +0400 Subject: [PATCH 08/31] geth as the second EC (WIP) --- local-network/configs/besu/besu-1.conf | 1 + .../configs/besu/generated/genesis.json | 38 ++++++++++-------- local-network/configs/geth/geth.yml | 39 +++++++++++++++++++ local-network/configs/geth/init.sh | 6 +++ local-network/configs/wavesnode/waves-2.conf | 7 +++- local-network/docker-compose.yml | 34 ++++++++++++---- 6 files changed, 98 insertions(+), 27 deletions(-) create mode 100644 local-network/configs/geth/geth.yml create mode 100755 local-network/configs/geth/init.sh diff --git a/local-network/configs/besu/besu-1.conf b/local-network/configs/besu/besu-1.conf index 12b805d4..a2369b17 100644 --- a/local-network/configs/besu/besu-1.conf +++ b/local-network/configs/besu/besu-1.conf @@ -30,6 +30,7 @@ rpc-ws-enabled = true rpc-http-api = ["ADMIN", "CLIQUE", "DEBUG", "EEA", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "PRIV", "QBFT", "TRACE", "TXPOOL", "WEB3"] p2p-enabled = true +# p2p-host = "ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 p2p-port = 30303 discovery-enabled = true nat-method = "NONE" diff --git a/local-network/configs/besu/generated/genesis.json b/local-network/configs/besu/generated/genesis.json index e0ac1620..6e586158 100644 --- a/local-network/configs/besu/generated/genesis.json +++ b/local-network/configs/besu/generated/genesis.json @@ -1,42 +1,46 @@ { "config": { - "terminalTotalDifficulty": 0, - "homesteadBlock": 0, + "chainID": 1337, + "arrowGlacierBlock": 0, + "berlinBlock": 0, + "byzantiumBlock": 0, + "cancunTime": 0, + "constantinopleBlock": 0, "daoForkBlock": 0, "eip150Block": 0, + "eip155Block": 0, "eip158Block": 0, - "byzantiumBlock": 0, - "petersburgBlock": 0, + "ethash": {}, + "grayGlacierBlock": 0, + "homesteadBlock": 0, "istanbulBlock": 0, - "muirGlacierBlock": 0, - "berlinBlock": 0, "londonBlock": 0, - "arrowGlacierBlock": 0, - "grayGlacierBlock": 0, + "muirGlacierBlock": 0, + "petersburgBlock": 0, "shanghaiTime": 0, - "cancunTime": 0, - "ethash": {}, - "chainID": 1337 + "terminalTotalDifficulty": 0, + "terminalTotalDifficultyPassed": true }, "nonce": "0x42", "gasLimit": "0x1000000", "difficulty": "0x0", "coinbase": "0x0000000000000000000000000000000000000000", "alloc": { - "fe3b557e8fb62b89f4916b721be55ceb828dbd73": { - "privateKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63", + "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": { + "privateKey": "0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63", "//": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", "balance": "0xad78ebc5ac6200000" }, - "f17f52151EbEF6C7334FAD080c5704D77216b732": { - "privateKey": "ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f", + "0xf17f52151EbEF6C7334FAD080c5704D77216b732": { + "privateKey": "0xae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f", "//": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", "balance": "90000000000000000000000" }, - "1000000000000000000000000000000000000000": { + "0x1000000000000000000000000000000000000000": { "//1": "Bridge contract. To get new code, run: bridge-compile.sh", "//2": "To update get storage, see the storage layout and setup primitive fields. Or use 0xweb: https://stackoverflow.com/a/76490163", - "code": "60806040526004361061006e575f3560e01c806396f396c31161004c57806396f396c3146100e3578063c4a4326d14610105578063e984df0e1461011d578063fccc281314610131575f80fd5b806339dd5d1b146100725780637157405a146100b957806378338413146100ce575b5f80fd5b34801561007d575f80fd5b506100a161008c36600461059e565b5f6020819052908152604090205461ffff1681565b60405161ffff90911681526020015b60405180910390f35b3480156100c4575f80fd5b506100a161040081565b6100e16100dc3660046105b5565b61015c565b005b3480156100ee575f80fd5b506100f761044e565b6040519081526020016100b0565b348015610110575f80fd5b506100f76402540be40081565b348015610128575f80fd5b506100f7610468565b34801561013c575f80fd5b506101445f81565b6040516001600160a01b0390911681526020016100b0565b61016c6402540be40060016105fc565b34101561017834610478565b61019061018b6402540be40060016105fc565b610478565b6040516020016101a1929190610630565b604051602081830303815290604052906101d75760405162461bcd60e51b81526004016101ce9190610688565b60405180910390fd5b506101ef6402540be400677fffffffffffffff6105fc565b3411156101fb34610478565b61021561018b6402540be400677fffffffffffffff6105fc565b6040516020016102269291906106bd565b604051602081830303815290604052906102535760405162461bcd60e51b81526004016101ce9190610688565b50435f8181526020819052604090205461ffff166104009081119061027790610478565b604051602001610287919061070c565b604051602081830303815290604052906102b45760405162461bcd60e51b81526004016101ce9190610688565b505f818152602081905260408120805461ffff16916102d283610786565b91906101000a81548161ffff021916908361ffff160217905550505f6402540be400346102ff91906107a6565b9050346103116402540be400836105fc565b1461031b34610478565b6103296402540be400610478565b60405160200161033a9291906107c5565b604051602081830303815290604052906103675760405162461bcd60e51b81526004016101ce9190610688565b506040515f90819034908281818185825af1925050503d805f81146103a7576040519150601f19603f3d011682016040523d82523d5f602084013e6103ac565b606091505b50509050806103fd5760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f2073656e6420746f206275726e2061646472657373000060448201526064016101ce565b604080516bffffffffffffffffffffffff1986168152600784900b60208201527ffeadaf04de8d7c2594453835b9a93b747e20e7a09a7fdb9280579a6dbaf131a8910160405180910390a150505050565b6104656402540be400677fffffffffffffff6105fc565b81565b6104656402540be40060016105fc565b6060815f0361049e5750506040805180820190915260018152600360fc1b602082015290565b815f5b81156104c757806104b181610814565b91506104c09050600a836107a6565b91506104a1565b5f8167ffffffffffffffff8111156104e1576104e161082c565b6040519080825280601f01601f19166020018201604052801561050b576020820181803683370190505b509050815b851561059557610521600182610840565b90505f61052f600a886107a6565b61053a90600a6105fc565b6105449088610840565b61054f906030610853565b90505f8160f81b90508084848151811061056b5761056b61086c565b60200101906001600160f81b03191690815f1a90535061058c600a896107a6565b97505050610510565b50949350505050565b5f602082840312156105ae575f80fd5b5035919050565b5f602082840312156105c5575f80fd5b81356bffffffffffffffffffffffff19811681146105e1575f80fd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610613576106136105e8565b92915050565b5f81518060208401855e5f93019283525090919050565b6a029b2b73a103b30b63ab2960ad1b81525f61064f600b830185610619565b7f206d7573742062652067726561746572206f7220657175616c20746f20000000815261067f601d820185610619565b95945050505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6a029b2b73a103b30b63ab2960ad1b81525f6106dc600b830185610619565b7f206d757374206265206c657373206f7220657175616c20746f20000000000000815261067f601a820185610619565b7f4d6178207472616e7366657273206c696d6974206f662000000000000000000081525f61073d6017830184610619565b7f207265616368656420696e207468697320626c6f636b2e2054727920746f207381527232b732103a3930b739b332b9399030b3b0b4b760691b60208201526033019392505050565b5f61ffff821661ffff810361079d5761079d6105e8565b60010192915050565b5f826107c057634e487b7160e01b5f52601260045260245ffd5b500490565b6a029b2b73a103b30b63ab2960ad1b81525f6107e4600b830185610619565b7f206d7573742062652061206d756c7469706c65206f6620000000000000000000815261067f6017820185610619565b5f60018201610825576108256105e8565b5060010190565b634e487b7160e01b5f52604160045260245ffd5b81810381811115610613576106136105e8565b60ff8181168382160190811115610613576106136105e8565b634e487b7160e01b5f52603260045260245ffdfea2646970667358221220106399f534da089226c14e2f183f8421d059a924c65c97d7e4f3e931c54fe1bb64736f6c634300081a0033" + "code": "0x60806040526004361061006e575f3560e01c806396f396c31161004c57806396f396c3146100e3578063c4a4326d14610105578063e984df0e1461011d578063fccc281314610131575f80fd5b806339dd5d1b146100725780637157405a146100b957806378338413146100ce575b5f80fd5b34801561007d575f80fd5b506100a161008c36600461059e565b5f6020819052908152604090205461ffff1681565b60405161ffff90911681526020015b60405180910390f35b3480156100c4575f80fd5b506100a161040081565b6100e16100dc3660046105b5565b61015c565b005b3480156100ee575f80fd5b506100f761044e565b6040519081526020016100b0565b348015610110575f80fd5b506100f76402540be40081565b348015610128575f80fd5b506100f7610468565b34801561013c575f80fd5b506101445f81565b6040516001600160a01b0390911681526020016100b0565b61016c6402540be40060016105fc565b34101561017834610478565b61019061018b6402540be40060016105fc565b610478565b6040516020016101a1929190610630565b604051602081830303815290604052906101d75760405162461bcd60e51b81526004016101ce9190610688565b60405180910390fd5b506101ef6402540be400677fffffffffffffff6105fc565b3411156101fb34610478565b61021561018b6402540be400677fffffffffffffff6105fc565b6040516020016102269291906106bd565b604051602081830303815290604052906102535760405162461bcd60e51b81526004016101ce9190610688565b50435f8181526020819052604090205461ffff166104009081119061027790610478565b604051602001610287919061070c565b604051602081830303815290604052906102b45760405162461bcd60e51b81526004016101ce9190610688565b505f818152602081905260408120805461ffff16916102d283610786565b91906101000a81548161ffff021916908361ffff160217905550505f6402540be400346102ff91906107a6565b9050346103116402540be400836105fc565b1461031b34610478565b6103296402540be400610478565b60405160200161033a9291906107c5565b604051602081830303815290604052906103675760405162461bcd60e51b81526004016101ce9190610688565b506040515f90819034908281818185825af1925050503d805f81146103a7576040519150601f19603f3d011682016040523d82523d5f602084013e6103ac565b606091505b50509050806103fd5760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f2073656e6420746f206275726e2061646472657373000060448201526064016101ce565b604080516bffffffffffffffffffffffff1986168152600784900b60208201527ffeadaf04de8d7c2594453835b9a93b747e20e7a09a7fdb9280579a6dbaf131a8910160405180910390a150505050565b6104656402540be400677fffffffffffffff6105fc565b81565b6104656402540be40060016105fc565b6060815f0361049e5750506040805180820190915260018152600360fc1b602082015290565b815f5b81156104c757806104b181610814565b91506104c09050600a836107a6565b91506104a1565b5f8167ffffffffffffffff8111156104e1576104e161082c565b6040519080825280601f01601f19166020018201604052801561050b576020820181803683370190505b509050815b851561059557610521600182610840565b90505f61052f600a886107a6565b61053a90600a6105fc565b6105449088610840565b61054f906030610853565b90505f8160f81b90508084848151811061056b5761056b61086c565b60200101906001600160f81b03191690815f1a90535061058c600a896107a6565b97505050610510565b50949350505050565b5f602082840312156105ae575f80fd5b5035919050565b5f602082840312156105c5575f80fd5b81356bffffffffffffffffffffffff19811681146105e1575f80fd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610613576106136105e8565b92915050565b5f81518060208401855e5f93019283525090919050565b6a029b2b73a103b30b63ab2960ad1b81525f61064f600b830185610619565b7f206d7573742062652067726561746572206f7220657175616c20746f20000000815261067f601d820185610619565b95945050505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6a029b2b73a103b30b63ab2960ad1b81525f6106dc600b830185610619565b7f206d757374206265206c657373206f7220657175616c20746f20000000000000815261067f601a820185610619565b7f4d6178207472616e7366657273206c696d6974206f662000000000000000000081525f61073d6017830184610619565b7f207265616368656420696e207468697320626c6f636b2e2054727920746f207381527232b732103a3930b739b332b9399030b3b0b4b760691b60208201526033019392505050565b5f61ffff821661ffff810361079d5761079d6105e8565b60010192915050565b5f826107c057634e487b7160e01b5f52601260045260245ffd5b500490565b6a029b2b73a103b30b63ab2960ad1b81525f6107e4600b830185610619565b7f206d7573742062652061206d756c7469706c65206f6620000000000000000000815261067f6017820185610619565b5f60018201610825576108256105e8565b5060010190565b634e487b7160e01b5f52604160045260245ffd5b81810381811115610613576106136105e8565b60ff8181168382160190811115610613576106136105e8565b634e487b7160e01b5f52603260045260245ffdfea2646970667358221220106399f534da089226c14e2f183f8421d059a924c65c97d7e4f3e931c54fe1bb64736f6c634300081a0033", + "balance": "0x0" } } } diff --git a/local-network/configs/geth/geth.yml b/local-network/configs/geth/geth.yml new file mode 100644 index 00000000..f097bfb6 --- /dev/null +++ b/local-network/configs/geth/geth.yml @@ -0,0 +1,39 @@ +services: + geth-init: + image: ethereum/client-go:stable + entrypoint: /tmp/init.sh + geth: + image: ethereum/client-go:stable + stop_grace_period: 30s + command: + - --networkid=1337 # TODO remove: https://ethereum.stackexchange.com/a/56118 Commented, because both besu and geth uses genesis.json + - --verbosity=4 + - --http + - --http.addr=0.0.0.0 + - --http.vhosts=* + - --http.api=eth,web3,txpool,net,debug,engine + - --http.corsdomain=* + - --ws + - --ws.addr=0.0.0.0 + - --ws.api=eth,web3,txpool,net,debug + - --ws.rpcprefix=/ + - --ws.origins=* + - --authrpc.addr=0.0.0.0 + - --authrpc.vhosts=* + - --authrpc.jwtsecret=/etc/secrets/jwtsecret + - --nodekey=/etc/secrets/p2p-key + - --bootnodes=enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303,enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303 + logging: + driver: local + options: + max-size: 1g + max-file: 5 + # volumes: + # # TODO + # # - ../besu/generated/genesis.json:/tmp/genesis.json # do we need? + # - ../data/secrets:/etc/secrets:ro + healthcheck: + test: 'wget -qO /dev/null --header "content-type: application/json" --post-data {\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1} http://127.0.0.1:8545' + interval: 5s + timeout: 1s + retries: 10 diff --git a/local-network/configs/geth/init.sh b/local-network/configs/geth/init.sh new file mode 100755 index 00000000..4341514b --- /dev/null +++ b/local-network/configs/geth/init.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +if [ ! -d /root/.ethereum/geth ] ; then + geth init /tmp/genesis.json +else + echo geth already initialized +fi diff --git a/local-network/configs/wavesnode/waves-2.conf b/local-network/configs/wavesnode/waves-2.conf index 07419969..46ed1571 100644 --- a/local-network/configs/wavesnode/waves-2.conf +++ b/local-network/configs/wavesnode/waves-2.conf @@ -1,9 +1,12 @@ include "common/waves-common.conf" waves { - network.node-name = "waves-2" + network.node-name = waves-2 - l2.execution-client-address = ec-2 + l2 { + execution-client-address = ec-2 + jwt-secret-file = /etc/secrets/jwtsecret + } wallet.seed = HnyGuCEnV1B # devnet-2 , addr: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU } diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index b9c994bf..9e7a0eca 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -31,20 +31,37 @@ services: depends_on: - ec-1 + ec-2-init: + container_name: ec-2-init + extends: + file: ./configs/geth/geth.yml + service: geth-init + volumes: + - ./data/geth:/root/.ethereum + - ./configs/besu/generated/genesis.json:/tmp/genesis.json:ro + - ./configs/geth/init.sh:/tmp/init.sh + ec-2: + extends: + file: ./configs/geth/geth.yml + service: geth container_name: ec-2 hostname: ec-2 - image: hyperledger/besu:latest ports: - "0.0.0.0:28551:8551" # Engine port - "0.0.0.0:28545:8545" # RPC port volumes: - - ./logs/ec-2:/opt/besu/logs - - ./configs/besu:/config:ro - environment: - - LOG4J_CONFIGURATION_FILE=/config/log4j2.xml - command: - - '--config-file=/config/besu-2.conf' + - ./data/geth:/root/.ethereum + # - ./configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key:/etc/secrets/p2p-key + - ./configs/geth/key:/etc/secrets/p2p-key:ro + - ./configs/geth/jwtsecret:/etc/secrets/jwtsecret:ro + # - ./logs/ec-2:/opt/besu/logs # TODO logging driver + grep + # - ./configs/besu:/config:ro + depends_on: + ec-1-check: + condition: service_completed_successfully + ec-2-init: + condition: service_completed_successfully ec-2-check: container_name: ec-2-check @@ -77,7 +94,7 @@ services: - ./configs/wavesnode/waves-1.conf:/etc/waves/waves.conf:ro depends_on: ec-1-check: - condition: service_completed_successfully + condition: service_completed_successfully # TODO ec-1: healthy wavesnode-2: container_name: wavesnode-2 @@ -96,6 +113,7 @@ services: - ./configs/wavesnode/common:/etc/waves/common:ro - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro - ./configs/wavesnode/waves-2.conf:/etc/waves/waves.conf:ro + - ./configs/geth/jwtsecret:/etc/secrets/jwtsecret:ro depends_on: wavesnode-1: # To reduce possible forks at start condition: service_started From 12c1ae20dc7caeceb302bc2c96b5052ca1d00603 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 9 Sep 2024 12:38:19 +0400 Subject: [PATCH 09/31] besu.yml, better directory structure, removed old files --- local-network/README.md | 2 +- local-network/configs/besu/README.md | 3 - local-network/configs/besu/besu-2.conf | 41 ------------- .../configs/besu/{besu-1.conf => besu.conf} | 4 +- local-network/configs/besu/besu.yml | 18 ++++++ .../configs/besu/generate-configs.sh | 10 ---- .../key.pub | 1 - .../key | 1 - .../key.pub | 1 - .../configs/besu/network-config.json | 50 ---------------- .../generated => ec-common}/genesis.json | 0 local-network/configs/ec-common/jwtsecret-2 | 1 + .../key => ec-common/p2p-key-1} | 0 local-network/configs/ec-common/p2p-key-2 | 1 + local-network/configs/geth/geth.yml | 7 +-- local-network/docker-compose.yml | 57 ++++++------------- 16 files changed, 43 insertions(+), 154 deletions(-) delete mode 100644 local-network/configs/besu/besu-2.conf rename local-network/configs/besu/{besu-1.conf => besu.conf} (90%) create mode 100644 local-network/configs/besu/besu.yml delete mode 100755 local-network/configs/besu/generate-configs.sh delete mode 100644 local-network/configs/besu/generated/keys/0x71b67256532de0cb71609d1cf107744b7d0ed1bb/key.pub delete mode 100644 local-network/configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key delete mode 100644 local-network/configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key.pub delete mode 100644 local-network/configs/besu/network-config.json rename local-network/configs/{besu/generated => ec-common}/genesis.json (100%) create mode 100644 local-network/configs/ec-common/jwtsecret-2 rename local-network/configs/{besu/generated/keys/0x71b67256532de0cb71609d1cf107744b7d0ed1bb/key => ec-common/p2p-key-1} (100%) create mode 100644 local-network/configs/ec-common/p2p-key-2 diff --git a/local-network/README.md b/local-network/README.md index 392002fb..c87e3a29 100644 --- a/local-network/README.md +++ b/local-network/README.md @@ -43,7 +43,7 @@ See [./deploy](./deploy/). * Address: `0xcF0b9E13FDd593f4Ca26D36aFCaA44dd3FDCCbeD` * Private key: `ab49fee4fc326ecbc7abc7f2e5870bf1f86076eb0979c524e20c843f2a73f647` * To see all information, run `npx tsx common-settings-show.ts` from [./deploy](./deploy/) directory. -* Ethereum addresses and private keys for `besu` nodes in [config](./configs/besu/generated/genesis.json): +* Ethereum addresses and private keys for `besu` nodes in [config](configs/ec-common/genesis.json): * `fe3b557e8fb62b89f4916b721be55ceb828dbd73`: `8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63` * `f17f52151EbEF6C7334FAD080c5704D77216b732`: `ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f` diff --git a/local-network/configs/besu/README.md b/local-network/configs/besu/README.md index 038dc6d6..73dfe46c 100644 --- a/local-network/configs/besu/README.md +++ b/local-network/configs/besu/README.md @@ -1,8 +1,5 @@ # Besu configs -Use [./generate-configs.sh](generate-configs.sh) to generate `genesis.json` and keys for nodes. -Note: it always generates new keys! So, don't use it if you don't need to add nodes. - ## Manual connecting Follow [https://besu.hyperledger.org/stable/private-networks/tutorials/permissioning](instructions): diff --git a/local-network/configs/besu/besu-2.conf b/local-network/configs/besu/besu-2.conf deleted file mode 100644 index fdf2fc47..00000000 --- a/local-network/configs/besu/besu-2.conf +++ /dev/null @@ -1,41 +0,0 @@ -data-path = "/opt/besu/data" -genesis-file = "/config/generated/genesis.json" -node-private-key-file = "/config/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key" - -sync-mode = "FULL" -host-allowlist = ["*"] -logging = "ALL" -auto-log-bloom-caching-enabled = true -data-storage-format = "BONSAI" -bonsai-limit-trie-logs-enabled = false - -# json-pretty-print-enabled = true # Use jq instead - -graphql-http-enabled = true -revert-reason-enabled = true - -rpc-http-enabled = true -rpc-http-host = "0.0.0.0" -rpc-http-port = 8545 -rpc-http-cors-origins = ["*"] - -engine-rpc-enabled = true -engine-rpc-port = 8551 -engine-host-allowlist = ["*"] -engine-jwt-disabled = true - -rpc-ws-enabled = true -rpc-http-api = ["ADMIN", "CLIQUE", "DEBUG", "EEA", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "PRIV", "QBFT", "TRACE", "TXPOOL", "WEB3"] - -p2p-enabled = true -p2p-port = 30303 -discovery-enabled = true -nat-method = "NONE" -Xdns-enabled = true -Xdns-update-enabled = true -bootnodes = [ - "enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303", - "enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-1:30303" -] - -tx-pool-max-future-by-sender = "1250" diff --git a/local-network/configs/besu/besu-1.conf b/local-network/configs/besu/besu.conf similarity index 90% rename from local-network/configs/besu/besu-1.conf rename to local-network/configs/besu/besu.conf index a2369b17..4f37aee7 100644 --- a/local-network/configs/besu/besu-1.conf +++ b/local-network/configs/besu/besu.conf @@ -1,8 +1,8 @@ # /opt/besu belongs to besu user: https://github.com/hyperledger/besu/blob/main/docker/openjdk-17/Dockerfile # so it is the only writable path data-path = "/opt/besu/data" -genesis-file = "/config/generated/genesis.json" -node-private-key-file = "/config/generated/keys/0x71b67256532de0cb71609d1cf107744b7d0ed1bb/key" +genesis-file = "/genesis.json" +node-private-key-file = "/etc/secrets/p2p-key" sync-mode = "FULL" host-allowlist = ["*"] diff --git a/local-network/configs/besu/besu.yml b/local-network/configs/besu/besu.yml new file mode 100644 index 00000000..100d2334 --- /dev/null +++ b/local-network/configs/besu/besu.yml @@ -0,0 +1,18 @@ +services: + besu: + image: hyperledger/besu:latest # Debug version: besu-debug:latest , see _debug/ + volumes: + - ../ec-common/genesis.json:/genesis.json:ro + - .:/config:ro + environment: + - LOG4J_CONFIGURATION_FILE=/config/log4j2.xml + command: + - --config-file=/config/besu.conf + besu-check: + image: curlimages/curl:8.8.0 + command: > + --retry 20 + --retry-all-errors + --retry-max-time 60 + -d '{"jsonrpc":"2.0","method":"engine_exchangeCapabilities","params":[[]],"id":1}' + http://ec-1:8551 diff --git a/local-network/configs/besu/generate-configs.sh b/local-network/configs/besu/generate-configs.sh deleted file mode 100755 index 2e3712fc..00000000 --- a/local-network/configs/besu/generate-configs.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -DIR="$(cd "$(dirname "$0")" && pwd)" -cd "${DIR}" || exit - -docker run -it --rm -v ${DIR}:/result hyperledger/besu:latest \ - operator generate-blockchain-config \ - --config-file=/result/network-config.json \ - --to=/result/generated \ - --private-key-file-name=key diff --git a/local-network/configs/besu/generated/keys/0x71b67256532de0cb71609d1cf107744b7d0ed1bb/key.pub b/local-network/configs/besu/generated/keys/0x71b67256532de0cb71609d1cf107744b7d0ed1bb/key.pub deleted file mode 100644 index 4c68b29e..00000000 --- a/local-network/configs/besu/generated/keys/0x71b67256532de0cb71609d1cf107744b7d0ed1bb/key.pub +++ /dev/null @@ -1 +0,0 @@ -0xb2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8 \ No newline at end of file diff --git a/local-network/configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key b/local-network/configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key deleted file mode 100644 index def476c5..00000000 --- a/local-network/configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key +++ /dev/null @@ -1 +0,0 @@ -0x93ce9a6ca2750272f118afef441fa0d9943f543118a7a51fe6104e651a88207c \ No newline at end of file diff --git a/local-network/configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key.pub b/local-network/configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key.pub deleted file mode 100644 index 274a3491..00000000 --- a/local-network/configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key.pub +++ /dev/null @@ -1 +0,0 @@ -0x4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c \ No newline at end of file diff --git a/local-network/configs/besu/network-config.json b/local-network/configs/besu/network-config.json deleted file mode 100644 index 4a836549..00000000 --- a/local-network/configs/besu/network-config.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "genesis": { - "config": { - "terminalTotalDifficulty": 0, - "homesteadBlock": 0, - "daoForkBlock": 0, - "eip150Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "petersburgBlock": 0, - "istanbulBlock": 0, - "muirGlacierBlock": 0, - "berlinBlock": 0, - "londonBlock": 0, - "arrowGlacierBlock": 0, - "grayGlacierBlock": 0, - "shanghaiTime": 0, - "cancunTime": 0, - "ethash": {}, - "chainID": 1337 - }, - "nonce": "0x42", - "gasLimit": "0x1000000", - "difficulty": "0x0", - "coinbase": "0x0000000000000000000000000000000000000000", - "alloc": { - "fe3b557e8fb62b89f4916b721be55ceb828dbd73": { - "privateKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63", - "//": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", - "balance": "0xad78ebc5ac6200000" - }, - "f17f52151EbEF6C7334FAD080c5704D77216b732": { - "privateKey": "ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f", - "//": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", - "balance": "90000000000000000000000" - }, - "1000000000000000000000000000000000000000": { - "//1": "Bridge contract. To get new code, run: bridge-compile.sh", - "//2": "To update get storage, see the storage layout and setup primitive fields. Or use 0xweb: https://stackoverflow.com/a/76490163", - "code": "60806040526004361061006e575f3560e01c806396f396c31161004c57806396f396c3146100e3578063c4a4326d14610105578063e984df0e1461011d578063fccc281314610131575f80fd5b806339dd5d1b146100725780637157405a146100b957806378338413146100ce575b5f80fd5b34801561007d575f80fd5b506100a161008c36600461059e565b5f6020819052908152604090205461ffff1681565b60405161ffff90911681526020015b60405180910390f35b3480156100c4575f80fd5b506100a161040081565b6100e16100dc3660046105b5565b61015c565b005b3480156100ee575f80fd5b506100f761044e565b6040519081526020016100b0565b348015610110575f80fd5b506100f76402540be40081565b348015610128575f80fd5b506100f7610468565b34801561013c575f80fd5b506101445f81565b6040516001600160a01b0390911681526020016100b0565b61016c6402540be40060016105fc565b34101561017834610478565b61019061018b6402540be40060016105fc565b610478565b6040516020016101a1929190610630565b604051602081830303815290604052906101d75760405162461bcd60e51b81526004016101ce9190610688565b60405180910390fd5b506101ef6402540be400677fffffffffffffff6105fc565b3411156101fb34610478565b61021561018b6402540be400677fffffffffffffff6105fc565b6040516020016102269291906106bd565b604051602081830303815290604052906102535760405162461bcd60e51b81526004016101ce9190610688565b50435f8181526020819052604090205461ffff166104009081119061027790610478565b604051602001610287919061070c565b604051602081830303815290604052906102b45760405162461bcd60e51b81526004016101ce9190610688565b505f818152602081905260408120805461ffff16916102d283610786565b91906101000a81548161ffff021916908361ffff160217905550505f6402540be400346102ff91906107a6565b9050346103116402540be400836105fc565b1461031b34610478565b6103296402540be400610478565b60405160200161033a9291906107c5565b604051602081830303815290604052906103675760405162461bcd60e51b81526004016101ce9190610688565b506040515f90819034908281818185825af1925050503d805f81146103a7576040519150601f19603f3d011682016040523d82523d5f602084013e6103ac565b606091505b50509050806103fd5760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f2073656e6420746f206275726e2061646472657373000060448201526064016101ce565b604080516bffffffffffffffffffffffff1986168152600784900b60208201527ffeadaf04de8d7c2594453835b9a93b747e20e7a09a7fdb9280579a6dbaf131a8910160405180910390a150505050565b6104656402540be400677fffffffffffffff6105fc565b81565b6104656402540be40060016105fc565b6060815f0361049e5750506040805180820190915260018152600360fc1b602082015290565b815f5b81156104c757806104b181610814565b91506104c09050600a836107a6565b91506104a1565b5f8167ffffffffffffffff8111156104e1576104e161082c565b6040519080825280601f01601f19166020018201604052801561050b576020820181803683370190505b509050815b851561059557610521600182610840565b90505f61052f600a886107a6565b61053a90600a6105fc565b6105449088610840565b61054f906030610853565b90505f8160f81b90508084848151811061056b5761056b61086c565b60200101906001600160f81b03191690815f1a90535061058c600a896107a6565b97505050610510565b50949350505050565b5f602082840312156105ae575f80fd5b5035919050565b5f602082840312156105c5575f80fd5b81356bffffffffffffffffffffffff19811681146105e1575f80fd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610613576106136105e8565b92915050565b5f81518060208401855e5f93019283525090919050565b6a029b2b73a103b30b63ab2960ad1b81525f61064f600b830185610619565b7f206d7573742062652067726561746572206f7220657175616c20746f20000000815261067f601d820185610619565b95945050505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6a029b2b73a103b30b63ab2960ad1b81525f6106dc600b830185610619565b7f206d757374206265206c657373206f7220657175616c20746f20000000000000815261067f601a820185610619565b7f4d6178207472616e7366657273206c696d6974206f662000000000000000000081525f61073d6017830184610619565b7f207265616368656420696e207468697320626c6f636b2e2054727920746f207381527232b732103a3930b739b332b9399030b3b0b4b760691b60208201526033019392505050565b5f61ffff821661ffff810361079d5761079d6105e8565b60010192915050565b5f826107c057634e487b7160e01b5f52601260045260245ffd5b500490565b6a029b2b73a103b30b63ab2960ad1b81525f6107e4600b830185610619565b7f206d7573742062652061206d756c7469706c65206f6620000000000000000000815261067f6017820185610619565b5f60018201610825576108256105e8565b5060010190565b634e487b7160e01b5f52604160045260245ffd5b81810381811115610613576106136105e8565b60ff8181168382160190811115610613576106136105e8565b634e487b7160e01b5f52603260045260245ffdfea2646970667358221220106399f534da089226c14e2f183f8421d059a924c65c97d7e4f3e931c54fe1bb64736f6c634300081a0033" - } - } - }, - "blockchain": { - "nodes": { - "generate": true, - "count": 2 - } - } -} diff --git a/local-network/configs/besu/generated/genesis.json b/local-network/configs/ec-common/genesis.json similarity index 100% rename from local-network/configs/besu/generated/genesis.json rename to local-network/configs/ec-common/genesis.json diff --git a/local-network/configs/ec-common/jwtsecret-2 b/local-network/configs/ec-common/jwtsecret-2 new file mode 100644 index 00000000..377cb928 --- /dev/null +++ b/local-network/configs/ec-common/jwtsecret-2 @@ -0,0 +1 @@ +a59c7150d727e228fceabfc4497c21d6acbdd083e0063dadcb20e2be661cefb2 diff --git a/local-network/configs/besu/generated/keys/0x71b67256532de0cb71609d1cf107744b7d0ed1bb/key b/local-network/configs/ec-common/p2p-key-1 similarity index 100% rename from local-network/configs/besu/generated/keys/0x71b67256532de0cb71609d1cf107744b7d0ed1bb/key rename to local-network/configs/ec-common/p2p-key-1 diff --git a/local-network/configs/ec-common/p2p-key-2 b/local-network/configs/ec-common/p2p-key-2 new file mode 100644 index 00000000..231d0f0e --- /dev/null +++ b/local-network/configs/ec-common/p2p-key-2 @@ -0,0 +1 @@ +93ce9a6ca2750272f118afef441fa0d9943f543118a7a51fe6104e651a88207c \ No newline at end of file diff --git a/local-network/configs/geth/geth.yml b/local-network/configs/geth/geth.yml index f097bfb6..47a6e524 100644 --- a/local-network/configs/geth/geth.yml +++ b/local-network/configs/geth/geth.yml @@ -2,6 +2,9 @@ services: geth-init: image: ethereum/client-go:stable entrypoint: /tmp/init.sh + volumes: + - ./init.sh:/tmp/init.sh + - ../ec-common/genesis.json:/tmp/genesis.json:ro geth: image: ethereum/client-go:stable stop_grace_period: 30s @@ -28,10 +31,6 @@ services: options: max-size: 1g max-file: 5 - # volumes: - # # TODO - # # - ../besu/generated/genesis.json:/tmp/genesis.json # do we need? - # - ../data/secrets:/etc/secrets:ro healthcheck: test: 'wget -qO /dev/null --header "content-type: application/json" --post-data {\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1} http://127.0.0.1:8545' interval: 5s diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index 9e7a0eca..c5ec0152 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -5,29 +5,23 @@ services: ec-1: container_name: ec-1 hostname: ec-1 - # To update use: docker pull hyperledger/besu:latest - image: hyperledger/besu:latest # Debug version: besu-debug:latest , see _debug/ + extends: + file: ./configs/besu/besu.yml + service: besu ports: - "0.0.0.0:18551:8551" # Engine port - "0.0.0.0:18545:8545" # RPC port, for Metamask e.g. - "0.0.0.0:18546:8546" # WebSocket volumes: + - ./configs/ec-common/p2p-key-1:/etc/secrets/p2p-key:ro - ./logs/ec-1:/opt/besu/logs - - ./configs/besu:/config:ro - environment: - - LOG4J_CONFIGURATION_FILE=/config/log4j2.xml - command: - - '--config-file=/config/besu-1.conf' + # TODO remove ec-1-check: container_name: ec-1-check - image: curlimages/curl:8.8.0 - command: > - --retry 20 - --retry-all-errors - --retry-max-time 60 - -d '{"jsonrpc":"2.0","method":"engine_exchangeCapabilities","params":[[]],"id":1}' - http://ec-1:8551 + extends: + file: ./configs/besu/besu.yml + service: besu-check depends_on: - ec-1 @@ -38,43 +32,26 @@ services: service: geth-init volumes: - ./data/geth:/root/.ethereum - - ./configs/besu/generated/genesis.json:/tmp/genesis.json:ro - - ./configs/geth/init.sh:/tmp/init.sh ec-2: + container_name: ec-2 + hostname: ec-2 extends: file: ./configs/geth/geth.yml service: geth - container_name: ec-2 - hostname: ec-2 ports: - "0.0.0.0:28551:8551" # Engine port - "0.0.0.0:28545:8545" # RPC port volumes: + - ./configs/ec-common/p2p-key-2:/etc/secrets/p2p-key:ro + - ./configs/ec-common/jwtsecret-2:/etc/secrets/jwtsecret:ro - ./data/geth:/root/.ethereum - # - ./configs/besu/generated/keys/0xcfff36559885b5541258c3de97b63dc59a60a583/key:/etc/secrets/p2p-key - - ./configs/geth/key:/etc/secrets/p2p-key:ro - - ./configs/geth/jwtsecret:/etc/secrets/jwtsecret:ro - # - ./logs/ec-2:/opt/besu/logs # TODO logging driver + grep - # - ./configs/besu:/config:ro depends_on: ec-1-check: condition: service_completed_successfully ec-2-init: condition: service_completed_successfully - ec-2-check: - container_name: ec-2-check - image: curlimages/curl:8.8.0 - command: > - --retry 20 - --retry-all-errors - --retry-max-time 60 - -d '{"jsonrpc":"2.0","method":"engine_exchangeCapabilities","params":[[]],"id":1}' - http://ec-2:8551 - depends_on: - - ec-2 - wavesnode-1: container_name: wavesnode-1 hostname: wavesnode-1 @@ -108,17 +85,17 @@ services: - JAVA_OPTS=-Dwaves.config.directory=/etc/waves -Dlogback.file.level=TRACE - NODE_NUMBER=2 volumes: - - ./data/wavesnode-2:/var/lib/waves - - ./logs/wavesnode-2:/var/log/waves - ./configs/wavesnode/common:/etc/waves/common:ro - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro - ./configs/wavesnode/waves-2.conf:/etc/waves/waves.conf:ro - - ./configs/geth/jwtsecret:/etc/secrets/jwtsecret:ro + - ./configs/ec-common/jwtsecret-2:/etc/secrets/jwtsecret:ro + - ./data/wavesnode-2:/var/lib/waves + - ./logs/wavesnode-2:/var/log/waves depends_on: wavesnode-1: # To reduce possible forks at start condition: service_started - ec-2-check: - condition: service_completed_successfully + ec-2: + condition: service_healthy deploy: container_name: deploy From e9bf8a051a56e4a19cbcab7cbdc1c56f5916debb Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 9 Sep 2024 12:51:50 +0400 Subject: [PATCH 10/31] Additional keys for custom configurations --- local-network/configs/ec-common/generate.sh | 23 +++++++++++++++++++++ local-network/configs/ec-common/jwtsecret-1 | 1 + local-network/configs/ec-common/jwtsecret-3 | 1 + local-network/configs/ec-common/jwtsecret-4 | 1 + local-network/configs/ec-common/jwtsecret-5 | 1 + local-network/configs/ec-common/p2p-key-1 | 2 +- local-network/configs/ec-common/p2p-key-3 | 1 + local-network/configs/ec-common/p2p-key-4 | 1 + local-network/configs/ec-common/p2p-key-5 | 1 + 9 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 local-network/configs/ec-common/generate.sh create mode 100644 local-network/configs/ec-common/jwtsecret-1 create mode 100644 local-network/configs/ec-common/jwtsecret-3 create mode 100644 local-network/configs/ec-common/jwtsecret-4 create mode 100644 local-network/configs/ec-common/jwtsecret-5 create mode 100644 local-network/configs/ec-common/p2p-key-3 create mode 100644 local-network/configs/ec-common/p2p-key-4 create mode 100644 local-network/configs/ec-common/p2p-key-5 diff --git a/local-network/configs/ec-common/generate.sh b/local-network/configs/ec-common/generate.sh new file mode 100755 index 00000000..fbb9903c --- /dev/null +++ b/local-network/configs/ec-common/generate.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +DIR="$(cd "$(dirname "$0")" && pwd)" +cd "${DIR}" || exit + +for N in {1..5}; do + p2p_file="p2p-key-${N}" + jwt_file="jwtsecret-${N}" + + if [ ! -f "$p2p_file" ]; then + openssl rand 32 | xxd -p -c 32 > "$p2p_file" + echo "Created $p2p_file" + else + echo "$p2p_file already exists, skipping..." + fi + + if [ ! -f "$jwt_file" ]; then + openssl rand 32 | xxd -p -c 32 > "$jwt_file" + echo "Created $jwt_file" + else + echo "$jwt_file already exists, skipping..." + fi +done diff --git a/local-network/configs/ec-common/jwtsecret-1 b/local-network/configs/ec-common/jwtsecret-1 new file mode 100644 index 00000000..3dde3fc3 --- /dev/null +++ b/local-network/configs/ec-common/jwtsecret-1 @@ -0,0 +1 @@ +ed292c1b8df420f0fed62f9e83e3ca176b88e5723218b83d9e1b36df375e4ac4 diff --git a/local-network/configs/ec-common/jwtsecret-3 b/local-network/configs/ec-common/jwtsecret-3 new file mode 100644 index 00000000..f5ab60a2 --- /dev/null +++ b/local-network/configs/ec-common/jwtsecret-3 @@ -0,0 +1 @@ +2703dcfc67b9a772756c4d354e2943fd7e3d8a2cb95b2129faa497b09662780d diff --git a/local-network/configs/ec-common/jwtsecret-4 b/local-network/configs/ec-common/jwtsecret-4 new file mode 100644 index 00000000..f6799e31 --- /dev/null +++ b/local-network/configs/ec-common/jwtsecret-4 @@ -0,0 +1 @@ +e6cba16eb245df8f057f5a3690ce57ed29f39b30d04a07e7de34d1b3b01c4d7e diff --git a/local-network/configs/ec-common/jwtsecret-5 b/local-network/configs/ec-common/jwtsecret-5 new file mode 100644 index 00000000..a9c3b88d --- /dev/null +++ b/local-network/configs/ec-common/jwtsecret-5 @@ -0,0 +1 @@ +cd5d2407415cb16bbad23e2f30a430b79a7b561be90fef333763fa8451d322fd diff --git a/local-network/configs/ec-common/p2p-key-1 b/local-network/configs/ec-common/p2p-key-1 index 8519dea0..0ba0c55e 100644 --- a/local-network/configs/ec-common/p2p-key-1 +++ b/local-network/configs/ec-common/p2p-key-1 @@ -1 +1 @@ -0xc69c6f46a2bf7024c3805bb38b2e96d2bbacd065a4951d1bd2d2d5957838eb65 \ No newline at end of file +c69c6f46a2bf7024c3805bb38b2e96d2bbacd065a4951d1bd2d2d5957838eb65 \ No newline at end of file diff --git a/local-network/configs/ec-common/p2p-key-3 b/local-network/configs/ec-common/p2p-key-3 new file mode 100644 index 00000000..fb351098 --- /dev/null +++ b/local-network/configs/ec-common/p2p-key-3 @@ -0,0 +1 @@ +244bb704084d2a49b4fc2da3b27a1c1c76329d7cac6fbadfd8c1a615730d6f77 diff --git a/local-network/configs/ec-common/p2p-key-4 b/local-network/configs/ec-common/p2p-key-4 new file mode 100644 index 00000000..8841a0e0 --- /dev/null +++ b/local-network/configs/ec-common/p2p-key-4 @@ -0,0 +1 @@ +7c2d9d0bb13ac806701462ab2e1bbcc54eb7b5e8f6658610a6e06dcc30e0aa47 diff --git a/local-network/configs/ec-common/p2p-key-5 b/local-network/configs/ec-common/p2p-key-5 new file mode 100644 index 00000000..c27d77e7 --- /dev/null +++ b/local-network/configs/ec-common/p2p-key-5 @@ -0,0 +1 @@ +dc51ae50601364b0d9354bad516acd16261447f89bde416399fa4ae5f2cbe8ab From 3e2c8b65594ebc1394975e0e6d7009aaec68dbc3 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 9 Sep 2024 12:59:32 +0400 Subject: [PATCH 11/31] Removed old unnecessary service --- local-network/configs/besu/besu.yml | 8 -------- local-network/docker-compose.yml | 21 ++++++--------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/local-network/configs/besu/besu.yml b/local-network/configs/besu/besu.yml index 100d2334..768f5ac0 100644 --- a/local-network/configs/besu/besu.yml +++ b/local-network/configs/besu/besu.yml @@ -8,11 +8,3 @@ services: - LOG4J_CONFIGURATION_FILE=/config/log4j2.xml command: - --config-file=/config/besu.conf - besu-check: - image: curlimages/curl:8.8.0 - command: > - --retry 20 - --retry-all-errors - --retry-max-time 60 - -d '{"jsonrpc":"2.0","method":"engine_exchangeCapabilities","params":[[]],"id":1}' - http://ec-1:8551 diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index c5ec0152..680f5d0a 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -16,15 +16,6 @@ services: - ./configs/ec-common/p2p-key-1:/etc/secrets/p2p-key:ro - ./logs/ec-1:/opt/besu/logs - # TODO remove - ec-1-check: - container_name: ec-1-check - extends: - file: ./configs/besu/besu.yml - service: besu-check - depends_on: - - ec-1 - ec-2-init: container_name: ec-2-init extends: @@ -47,10 +38,10 @@ services: - ./configs/ec-common/jwtsecret-2:/etc/secrets/jwtsecret:ro - ./data/geth:/root/.ethereum depends_on: - ec-1-check: - condition: service_completed_successfully ec-2-init: condition: service_completed_successfully + ec-1: # TODO issues with connections + condition: service_healthy wavesnode-1: container_name: wavesnode-1 @@ -70,8 +61,8 @@ services: - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro - ./configs/wavesnode/waves-1.conf:/etc/waves/waves.conf:ro depends_on: - ec-1-check: - condition: service_completed_successfully # TODO ec-1: healthy + ec-1: + condition: service_healthy wavesnode-2: container_name: wavesnode-2 @@ -92,10 +83,10 @@ services: - ./data/wavesnode-2:/var/lib/waves - ./logs/wavesnode-2:/var/log/waves depends_on: - wavesnode-1: # To reduce possible forks at start - condition: service_started ec-2: condition: service_healthy + wavesnode-1: # To reduce possible forks at start + condition: service_started deploy: container_name: deploy From d71bdaf2f058a7b504908d22dd40fae96ed729ec Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 9 Sep 2024 16:10:01 +0400 Subject: [PATCH 12/31] Updated dependencies --- local-network/deploy/package-lock.json | 958 ++++++++++++++++++------- local-network/deploy/package.json | 17 +- 2 files changed, 724 insertions(+), 251 deletions(-) diff --git a/local-network/deploy/package-lock.json b/local-network/deploy/package-lock.json index ded79620..42c2a2cb 100644 --- a/local-network/deploy/package-lock.json +++ b/local-network/deploy/package-lock.json @@ -6,22 +6,23 @@ "": { "name": "l1-deploy-scripts", "dependencies": { - "@types/node": "^20.12.12", + "@types/node": "^22.5", "@waves/node-api-js": "^1.3.11-beta.1", "@waves/ts-lib-crypto": "^1.4.4-beta.1", - "@waves/waves-transactions": "^4.3.11", - "merkletreejs": "^0.3.11", - "solc": "0.8.25", - "tsx": "^4.10.2", - "typescript": "^4.9.5", - "web3": "^4.7.0", - "winston": "^3.13.0" + "@waves/waves-transactions": "^4.3", + "merkletreejs": "^0.4", + "solc": "0.8.27", + "tsx": "^4.19", + "typescript": "^5.5", + "web3": "^4.12", + "winston": "^3.14" } }, "node_modules/@adraffy/ens-normalize": { "version": "1.10.1", "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", - "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==", + "license": "MIT" }, "node_modules/@colors/colors": { "version": "1.6.0", @@ -41,19 +42,388 @@ "kuler": "^2.0.0" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", - "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", "cpu": [ "arm64" ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" } }, "node_modules/@ethereumjs/rlp": { @@ -200,11 +570,12 @@ "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==" }, "node_modules/@types/node": { - "version": "20.12.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz", - "integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==", + "version": "22.5.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", + "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", + "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.19.2" } }, "node_modules/@types/node-fetch": { @@ -225,6 +596,7 @@ "version": "8.5.3", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -336,6 +708,7 @@ "version": "0.7.1", "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.7.1.tgz", "integrity": "sha512-VBkRHTDZf9Myaek/dO3yMmOzB/y2s3Zo6nVU7yaw1G+TvCHAjwaJzNGN9yo4K5D8bU/VZXKP1EJpRhFr862PlQ==", + "license": "MIT", "peerDependencies": { "typescript": ">=4.9.4", "zod": "^3 >=3.19.1" @@ -502,6 +875,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "license": "Apache-2.0", "bin": { "crc32": "bin/crc32.njs" }, @@ -513,6 +887,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "license": "MIT", "dependencies": { "node-fetch": "^2.6.12" } @@ -579,40 +954,42 @@ } }, "node_modules/esbuild": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", - "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, "engines": { - "node": ">=12" + "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.20.2", - "@esbuild/android-arm": "0.20.2", - "@esbuild/android-arm64": "0.20.2", - "@esbuild/android-x64": "0.20.2", - "@esbuild/darwin-arm64": "0.20.2", - "@esbuild/darwin-x64": "0.20.2", - "@esbuild/freebsd-arm64": "0.20.2", - "@esbuild/freebsd-x64": "0.20.2", - "@esbuild/linux-arm": "0.20.2", - "@esbuild/linux-arm64": "0.20.2", - "@esbuild/linux-ia32": "0.20.2", - "@esbuild/linux-loong64": "0.20.2", - "@esbuild/linux-mips64el": "0.20.2", - "@esbuild/linux-ppc64": "0.20.2", - "@esbuild/linux-riscv64": "0.20.2", - "@esbuild/linux-s390x": "0.20.2", - "@esbuild/linux-x64": "0.20.2", - "@esbuild/netbsd-x64": "0.20.2", - "@esbuild/openbsd-x64": "0.20.2", - "@esbuild/sunos-x64": "0.20.2", - "@esbuild/win32-arm64": "0.20.2", - "@esbuild/win32-ia32": "0.20.2", - "@esbuild/win32-x64": "0.20.2" + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" } }, "node_modules/ethereum-bloom-filters": { @@ -710,6 +1087,20 @@ "node": ">= 6" } }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -904,6 +1295,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", + "license": "MIT", "peerDependencies": { "ws": "*" } @@ -953,9 +1345,10 @@ } }, "node_modules/merkletreejs": { - "version": "0.3.11", - "resolved": "https://registry.npmjs.org/merkletreejs/-/merkletreejs-0.3.11.tgz", - "integrity": "sha512-LJKTl4iVNTndhL+3Uz/tfkjD0klIWsHlUzgtuNnNrsf7bAlXR30m+xYB7lHr5Z/l6e/yAIsr26Dabx6Buo4VGQ==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/merkletreejs/-/merkletreejs-0.4.0.tgz", + "integrity": "sha512-a48Ta5kWiVNBgeEbZVMm6FB1hBlp6vEuou/XnZdlkmd2zq6NZR6Sh2j+kR1B0iOZIXrTMcigBYzZ39MLdYhm1g==", + "license": "MIT", "dependencies": { "bignumber.js": "^9.0.1", "buffer-reverse": "^1.0.1", @@ -1184,9 +1577,10 @@ } }, "node_modules/solc": { - "version": "0.8.25", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.25.tgz", - "integrity": "sha512-7P0TF8gPeudl1Ko3RGkyY6XVCxe2SdD/qQhtns1vl3yAbK/PDifKDLHGtx1t7mX3LgR7ojV7Fg/Kc6Q9D2T8UQ==", + "version": "0.8.27", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.27.tgz", + "integrity": "sha512-BNxMol2tUAbkH7HKlXBcBqrGi2aqgv+uMHz26mJyTtlVgWmBA4ktiw0qVKHfkjf2oaHbwtbtaSeE2dhn/gTAKw==", + "license": "MIT", "dependencies": { "command-exists": "^1.2.8", "commander": "^8.1.0", @@ -1288,12 +1682,13 @@ } }, "node_modules/tsx": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.10.2.tgz", - "integrity": "sha512-gOfACgv1ElsIjvt7Fp0rMJKGnMGjox0JfGOfX3kmZCV/yZumaNqtHGKBXt1KgaYS9KjDOmqGeI8gHk/W7kWVZg==", + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.0.tgz", + "integrity": "sha512-bV30kM7bsLZKZIOCHeMNVMJ32/LuJzLVajkQI/qf92J2Qr08ueLQvW00PUZGiuLPP760UINwupgUj8qrSCPUKg==", + "license": "MIT", "dependencies": { - "esbuild": "~0.20.2", - "get-tsconfig": "^4.7.3" + "esbuild": "~0.23.0", + "get-tsconfig": "^4.7.5" }, "bin": { "tsx": "dist/cli.mjs" @@ -1311,21 +1706,23 @@ "integrity": "sha512-+Fy9cqWA/Kv1QX0k6m5ZflGcG2jQSZQGr+jLGXYUM22yihhkHs243LEXvY4cs54lAVyj5gokm0TbgkmL4qDsTg==" }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "license": "MIT" }, "node_modules/utf8": { "version": "3.0.0", @@ -1350,26 +1747,28 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/web3": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/web3/-/web3-4.8.0.tgz", - "integrity": "sha512-kQSF2NlHk8yjS3SRiJW3S+U5ibkEmVRhB4/GYsVwGvdAkFC2b+EIE1Ob7J56OmqW9VBZgkx1+SuWqo5JTIJSYQ==", - "dependencies": { - "web3-core": "^4.3.2", - "web3-errors": "^1.1.4", - "web3-eth": "^4.6.0", - "web3-eth-abi": "^4.2.1", - "web3-eth-accounts": "^4.1.2", - "web3-eth-contract": "^4.4.0", - "web3-eth-ens": "^4.2.0", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/web3/-/web3-4.12.1.tgz", + "integrity": "sha512-zIFUPdgo2uG5Vbl7C4KrTv8dmWKN3sGnY/GundbiJzcaJZDxaCyu3a5HXAcgUM1VvvsVb1zaUQAFPceq05/q/Q==", + "license": "LGPL-3.0", + "dependencies": { + "web3-core": "^4.5.1", + "web3-errors": "^1.3.0", + "web3-eth": "^4.8.2", + "web3-eth-abi": "^4.2.3", + "web3-eth-accounts": "^4.2.1", + "web3-eth-contract": "^4.7.0", + "web3-eth-ens": "^4.4.0", "web3-eth-iban": "^4.0.7", "web3-eth-personal": "^4.0.8", - "web3-net": "^4.0.7", - "web3-providers-http": "^4.1.0", - "web3-providers-ws": "^4.0.7", - "web3-rpc-methods": "^1.2.0", - "web3-types": "^1.6.0", - "web3-utils": "^4.2.3", - "web3-validator": "^2.0.5" + "web3-net": "^4.1.0", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-rpc-providers": "^1.0.0-rc.2", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14.0.0", @@ -1377,18 +1776,19 @@ } }, "node_modules/web3-core": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-4.3.2.tgz", - "integrity": "sha512-uIMVd/j4BgOnwfpY8ZT+QKubOyM4xohEhFZXz9xB8wimXWMMlYVlIK/TbfHqFolS9uOerdSGhsMbcK9lETae8g==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-4.5.1.tgz", + "integrity": "sha512-mFMOO/IWdKsLL1o2whh3oJ0LCG9P3l5c4lpiMoVsVln3QXh/B0Gf8gW3aY8S+Ixm0OHyzFDXJVc2CodxqmI4Gw==", + "license": "LGPL-3.0", "dependencies": { - "web3-errors": "^1.1.4", - "web3-eth-accounts": "^4.1.0", + "web3-errors": "^1.3.0", + "web3-eth-accounts": "^4.2.0", "web3-eth-iban": "^4.0.7", - "web3-providers-http": "^4.1.0", - "web3-providers-ws": "^4.0.7", - "web3-types": "^1.3.1", - "web3-utils": "^4.1.0", - "web3-validator": "^2.0.3" + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1399,15 +1799,16 @@ } }, "node_modules/web3-core/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1415,11 +1816,12 @@ } }, "node_modules/web3-errors": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.1.4.tgz", - "integrity": "sha512-WahtszSqILez+83AxGecVroyZsMuuRT+KmQp4Si5P4Rnqbczno1k748PCrZTS1J4UCPmXMG2/Vt+0Bz2zwXkwQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.3.0.tgz", + "integrity": "sha512-j5JkAKCtuVMbY3F5PYXBqg1vWrtF4jcyyMY1rlw8a4PV67AkqlepjGgpzWJZd56Mt+TvHy6DA1F/3Id8LatDSQ==", + "license": "LGPL-3.0", "dependencies": { - "web3-types": "^1.3.1" + "web3-types": "^1.7.0" }, "engines": { "node": ">=14", @@ -1427,21 +1829,22 @@ } }, "node_modules/web3-eth": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-4.6.0.tgz", - "integrity": "sha512-8KtxlGsomovoFULqEpfixgmCpaJ2YIJGxbXUfezh2coXHjVgEopQhARYtKGClyV5kkdCIqwHS8Gvsm6TVNqH6Q==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-4.8.2.tgz", + "integrity": "sha512-DLV/fIMG6gBp/B0gv0+G4FzxZ4YCDQsY3lzqqv7avwh3uU7/O27aifCUcFd7Ye+3ixTqCjAvLEl9wYSeyG3zQw==", + "license": "LGPL-3.0", "dependencies": { "setimmediate": "^1.0.5", - "web3-core": "^4.3.2", - "web3-errors": "^1.1.4", - "web3-eth-abi": "^4.2.1", - "web3-eth-accounts": "^4.1.2", - "web3-net": "^4.0.7", - "web3-providers-ws": "^4.0.7", - "web3-rpc-methods": "^1.2.0", - "web3-types": "^1.6.0", - "web3-utils": "^4.2.3", - "web3-validator": "^2.0.5" + "web3-core": "^4.5.0", + "web3-errors": "^1.2.1", + "web3-eth-abi": "^4.2.3", + "web3-eth-accounts": "^4.1.3", + "web3-net": "^4.1.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1449,15 +1852,16 @@ } }, "node_modules/web3-eth-abi": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.2.1.tgz", - "integrity": "sha512-IE91WUhhiDpBtbkl/DHUoZz7z7T5FXvl3zPLkrxT+dNlOT+wni+US/67jQCLvJRbqf9ApQ26lVYry0bovFgyqA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.2.3.tgz", + "integrity": "sha512-rPVwTn0O1CzbtfXwEfIjUP0W5Y7u1OFjugwKpSqJzPQE6+REBg6OELjomTGZBu+GThxHnv0rp15SOxvqp+tyXA==", + "license": "LGPL-3.0", "dependencies": { "abitype": "0.7.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-utils": "^4.2.3", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1465,15 +1869,16 @@ } }, "node_modules/web3-eth-abi/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1481,17 +1886,18 @@ } }, "node_modules/web3-eth-accounts": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-4.1.2.tgz", - "integrity": "sha512-y0JynDeTDnclyuE9mShXLeEj+BCrPHxPHOyPCgTchUBQsALF9+0OhP7WiS3IqUuu0Hle5bjG2f5ddeiPtNEuLg==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-4.2.1.tgz", + "integrity": "sha512-aOlEZFzqAgKprKs7+DGArU4r9b+ILBjThpeq42aY7LAQcP+mSpsWcQgbIRK3r/n3OwTYZ3aLPk0Ih70O/LwnYA==", + "license": "LGPL-3.0", "dependencies": { "@ethereumjs/rlp": "^4.0.1", "crc-32": "^1.2.2", "ethereum-cryptography": "^2.0.0", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-utils": "^4.2.3", - "web3-validator": "^2.0.5" + "web3-errors": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1499,15 +1905,16 @@ } }, "node_modules/web3-eth-accounts/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1515,33 +1922,48 @@ } }, "node_modules/web3-eth-contract": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-4.4.0.tgz", - "integrity": "sha512-pZ/w6Lb6ZDUUs7f5GCKXiHDAGGvt2tdwiHkvgmQTRnq9b0MEsUpteDyPYspHxKzQWLgbeK37jPb8zbQe4kE/Hg==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-4.7.0.tgz", + "integrity": "sha512-fdStoBOjFyMHwlyJmSUt/BTDL1ATwKGmG3zDXQ/zTKlkkW/F/074ut0Vry4GuwSBg9acMHc0ycOiZx9ZKjNHsw==", + "license": "LGPL-3.0", "dependencies": { - "web3-core": "^4.3.2", - "web3-errors": "^1.1.4", - "web3-eth": "^4.6.0", - "web3-eth-abi": "^4.2.1", - "web3-types": "^1.6.0", - "web3-utils": "^4.2.3", - "web3-validator": "^2.0.5" + "@ethereumjs/rlp": "^5.0.2", + "web3-core": "^4.5.1", + "web3-errors": "^1.3.0", + "web3-eth": "^4.8.2", + "web3-eth-abi": "^4.2.3", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", "npm": ">=6.12.0" } }, + "node_modules/web3-eth-contract/node_modules/@ethereumjs/rlp": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-5.0.2.tgz", + "integrity": "sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA==", + "license": "MPL-2.0", + "bin": { + "rlp": "bin/rlp.cjs" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/web3-eth-contract/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1549,19 +1971,20 @@ } }, "node_modules/web3-eth-ens": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-4.2.0.tgz", - "integrity": "sha512-qYj34te2UctoObt8rlEIY/t2MuTMiMiiHhO2JAHRGqSLCQ7b8DM3RpvkiiSB0N0ZyEn+CetZqJCTYb8DNKBS/g==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-4.4.0.tgz", + "integrity": "sha512-DeyVIS060hNV9g8dnTx92syqvgbvPricE3MerCxe/DquNZT3tD8aVgFfq65GATtpCgDDJffO2bVeHp3XBemnSQ==", + "license": "LGPL-3.0", "dependencies": { "@adraffy/ens-normalize": "^1.8.8", - "web3-core": "^4.3.2", - "web3-errors": "^1.1.4", - "web3-eth": "^4.5.0", - "web3-eth-contract": "^4.3.0", - "web3-net": "^4.0.7", - "web3-types": "^1.5.0", - "web3-utils": "^4.2.2", - "web3-validator": "^2.0.5" + "web3-core": "^4.5.0", + "web3-errors": "^1.2.0", + "web3-eth": "^4.8.0", + "web3-eth-contract": "^4.5.0", + "web3-net": "^4.1.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1569,15 +1992,16 @@ } }, "node_modules/web3-eth-ens/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1649,15 +2073,16 @@ } }, "node_modules/web3-eth/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1665,14 +2090,15 @@ } }, "node_modules/web3-net": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-4.0.7.tgz", - "integrity": "sha512-SzEaXFrBjY25iQGk5myaOfO9ZyfTwQEa4l4Ps4HDNVMibgZji3WPzpjq8zomVHMwi8bRp6VV7YS71eEsX7zLow==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-4.1.0.tgz", + "integrity": "sha512-WWmfvHVIXWEoBDWdgKNYKN8rAy6SgluZ0abyRyXOL3ESr7ym7pKWbfP4fjApIHlYTh8tNqkrdPfM4Dyi6CA0SA==", + "license": "LGPL-3.0", "dependencies": { - "web3-core": "^4.3.0", - "web3-rpc-methods": "^1.1.3", - "web3-types": "^1.3.0", - "web3-utils": "^4.0.7" + "web3-core": "^4.4.0", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.6.0", + "web3-utils": "^4.3.0" }, "engines": { "node": ">=14", @@ -1680,15 +2106,16 @@ } }, "node_modules/web3-net/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1696,14 +2123,15 @@ } }, "node_modules/web3-providers-http": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-4.1.0.tgz", - "integrity": "sha512-6qRUGAhJfVQM41E5t+re5IHYmb5hSaLc02BE2MaRQsz2xKA6RjmHpOA5h/+ojJxEpI9NI2CrfDKOAgtJfoUJQg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-4.2.0.tgz", + "integrity": "sha512-IPMnDtHB7dVwaB7/mMxAZzyq7d5ezfO1+Vw0bNfAeIi7gaDlJiggp85SdyAfOgov8AMUA/dyiY72kQ0KmjXKvQ==", + "license": "LGPL-3.0", "dependencies": { "cross-fetch": "^4.0.0", - "web3-errors": "^1.1.3", - "web3-types": "^1.3.0", - "web3-utils": "^4.0.7" + "web3-errors": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1" }, "engines": { "node": ">=14", @@ -1711,15 +2139,16 @@ } }, "node_modules/web3-providers-http/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1759,16 +2188,17 @@ } }, "node_modules/web3-providers-ws": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-4.0.7.tgz", - "integrity": "sha512-n4Dal9/rQWjS7d6LjyEPM2R458V8blRm0eLJupDEJOOIBhGYlxw5/4FthZZ/cqB7y/sLVi7K09DdYx2MeRtU5w==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-4.0.8.tgz", + "integrity": "sha512-goJdgata7v4pyzHRsg9fSegUG4gVnHZSHODhNnn6J93ykHkBI1nz4fjlGpcQLUMi4jAMz6SHl9Ibzs2jj9xqPw==", + "license": "LGPL-3.0", "dependencies": { "@types/ws": "8.5.3", "isomorphic-ws": "^5.0.0", - "web3-errors": "^1.1.3", - "web3-types": "^1.3.0", - "web3-utils": "^4.0.7", - "ws": "^8.8.1" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "ws": "^8.17.1" }, "engines": { "node": ">=14", @@ -1776,15 +2206,16 @@ } }, "node_modules/web3-providers-ws/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1792,13 +2223,49 @@ } }, "node_modules/web3-rpc-methods": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/web3-rpc-methods/-/web3-rpc-methods-1.2.0.tgz", - "integrity": "sha512-CWJ/g4I4WyYvLkf21wCZAehdhU/VjX/OAPHnqF5/FPDJlogOsOnGXHqi1Z5AP+ocdt395PNubd8jyMMJoYGSBA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-rpc-methods/-/web3-rpc-methods-1.3.0.tgz", + "integrity": "sha512-/CHmzGN+IYgdBOme7PdqzF+FNeMleefzqs0LVOduncSaqsppeOEoskLXb2anSpzmQAP3xZJPaTrkQPWSJMORig==", + "license": "LGPL-3.0", "dependencies": { - "web3-core": "^4.3.2", - "web3-types": "^1.5.0", - "web3-validator": "^2.0.4" + "web3-core": "^4.4.0", + "web3-types": "^1.6.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-rpc-providers": { + "version": "1.0.0-rc.2", + "resolved": "https://registry.npmjs.org/web3-rpc-providers/-/web3-rpc-providers-1.0.0-rc.2.tgz", + "integrity": "sha512-ocFIEXcBx/DYQ90HhVepTBUVnL9pGsZw8wyPb1ZINSenwYus9SvcFkjU1Hfvd/fXjuhAv2bUVch9vxvMx1mXAQ==", + "license": "LGPL-3.0", + "dependencies": { + "web3-errors": "^1.3.0", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-rpc-providers/node_modules/web3-utils": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1806,9 +2273,10 @@ } }, "node_modules/web3-types": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.6.0.tgz", - "integrity": "sha512-qgOtADqlD5hw+KPKBUGaXAcdNLL0oh6qTeVgXwewCfbL/lG9R+/GrgMQB1gbTJ3cit8hMwtH8KX2Em6OwO0HRw==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.7.0.tgz", + "integrity": "sha512-nhXxDJ7a5FesRw9UG5SZdP/C/3Q2EzHGnB39hkAV+YGXDMgwxBXFWebQLfEzZzuArfHnvC0sQqkIHNwSKcVjdA==", + "license": "LGPL-3.0", "engines": { "node": ">=14", "npm": ">=6.12.0" @@ -1833,14 +2301,15 @@ } }, "node_modules/web3-validator": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.5.tgz", - "integrity": "sha512-2gLOSW8XqEN5pw5jVUm20EB7A8SbQiekpAtiI0JBmCIV0a2rp97v8FgWY5E3UEqnw5WFfEqvcDVW92EyynDTyQ==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.6.tgz", + "integrity": "sha512-qn9id0/l1bWmvH4XfnG/JtGKKwut2Vokl6YXP5Kfg424npysmtRLe9DgiNBM9Op7QL/aSiaA0TVXibuIuWcizg==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "util": "^0.12.5", - "web3-errors": "^1.1.4", - "web3-types": "^1.5.0", + "web3-errors": "^1.2.0", + "web3-types": "^1.6.0", "zod": "^3.21.4" }, "engines": { @@ -1849,15 +2318,16 @@ } }, "node_modules/web3/node_modules/web3-utils": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.3.tgz", - "integrity": "sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.1.tgz", + "integrity": "sha512-kGwOk8FxOLJ9DQC68yqNQc7AzN+k9YDLaW+ZjlAXs3qORhf8zXk5SxWAAGLbLykMs3vTeB0FTb1Exut4JEYfFA==", + "license": "LGPL-3.0", "dependencies": { "ethereum-cryptography": "^2.0.0", "eventemitter3": "^5.0.1", - "web3-errors": "^1.1.4", - "web3-types": "^1.6.0", - "web3-validator": "^2.0.5" + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-validator": "^2.0.6" }, "engines": { "node": ">=14", @@ -1897,15 +2367,16 @@ } }, "node_modules/winston": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.13.0.tgz", - "integrity": "sha512-rwidmA1w3SE4j0E5MuIufFhyJPBDG7Nu71RkZor1p2+qHvJSZ9GYDA81AyleQcZbh/+V6HjeBdfnTZJm9rSeQQ==", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.14.2.tgz", + "integrity": "sha512-CO8cdpBB2yqzEf8v895L+GNKYJiEq8eKlHU38af3snQBQ+sdAIUepjMSguOIJC7ICbzm0ZI+Af2If4vIJrtmOg==", + "license": "MIT", "dependencies": { "@colors/colors": "^1.6.0", "@dabh/diagnostics": "^2.0.2", "async": "^3.2.3", "is-stream": "^2.0.0", - "logform": "^2.4.0", + "logform": "^2.6.0", "one-time": "^1.0.0", "readable-stream": "^3.4.0", "safe-stable-stringify": "^2.3.1", @@ -1931,9 +2402,10 @@ } }, "node_modules/ws": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", - "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "license": "MIT", "engines": { "node": ">=10.0.0" }, diff --git a/local-network/deploy/package.json b/local-network/deploy/package.json index 50c0f055..6dc3d80b 100644 --- a/local-network/deploy/package.json +++ b/local-network/deploy/package.json @@ -6,16 +6,17 @@ "deploy": "npx tsx deploy.ts", "test": "npx tsx test.ts $*" }, + "//dependencies": "npx npm-check-updates -u", "dependencies": { - "@types/node": "^20.12.12", + "@types/node": "^22.5", "@waves/node-api-js": "^1.3.11-beta.1", "@waves/ts-lib-crypto": "^1.4.4-beta.1", - "@waves/waves-transactions": "^4.3.11", - "merkletreejs": "^0.3.11", - "solc": "0.8.25", - "tsx": "^4.10.2", - "typescript": "^4.9.5", - "web3": "^4.7.0", - "winston": "^3.13.0" + "@waves/waves-transactions": "^4.3", + "merkletreejs": "^0.4", + "solc": "0.8.27", + "tsx": "^4.19", + "typescript": "^5.5", + "web3": "^4.12", + "winston": "^3.14" } } From 51068b2a092f9671780364431007ec9a80699a5f Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 9 Sep 2024 17:17:06 +0400 Subject: [PATCH 13/31] geth: logs in file, removed redundant options --- local-network/configs/geth/geth.yml | 33 ++++------------------------- local-network/configs/geth/init.sh | 6 ------ local-network/configs/geth/run.sh | 24 +++++++++++++++++++++ local-network/docker-compose.yml | 13 +----------- 4 files changed, 29 insertions(+), 47 deletions(-) delete mode 100755 local-network/configs/geth/init.sh create mode 100755 local-network/configs/geth/run.sh diff --git a/local-network/configs/geth/geth.yml b/local-network/configs/geth/geth.yml index 47a6e524..517c6d41 100644 --- a/local-network/configs/geth/geth.yml +++ b/local-network/configs/geth/geth.yml @@ -1,36 +1,11 @@ services: - geth-init: - image: ethereum/client-go:stable - entrypoint: /tmp/init.sh - volumes: - - ./init.sh:/tmp/init.sh - - ../ec-common/genesis.json:/tmp/genesis.json:ro geth: image: ethereum/client-go:stable stop_grace_period: 30s - command: - - --networkid=1337 # TODO remove: https://ethereum.stackexchange.com/a/56118 Commented, because both besu and geth uses genesis.json - - --verbosity=4 - - --http - - --http.addr=0.0.0.0 - - --http.vhosts=* - - --http.api=eth,web3,txpool,net,debug,engine - - --http.corsdomain=* - - --ws - - --ws.addr=0.0.0.0 - - --ws.api=eth,web3,txpool,net,debug - - --ws.rpcprefix=/ - - --ws.origins=* - - --authrpc.addr=0.0.0.0 - - --authrpc.vhosts=* - - --authrpc.jwtsecret=/etc/secrets/jwtsecret - - --nodekey=/etc/secrets/p2p-key - - --bootnodes=enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303,enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303 - logging: - driver: local - options: - max-size: 1g - max-file: 5 + entrypoint: /tmp/run.sh + volumes: + - ./run.sh:/tmp/run.sh + - ../ec-common/genesis.json:/tmp/genesis.json:ro healthcheck: test: 'wget -qO /dev/null --header "content-type: application/json" --post-data {\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1} http://127.0.0.1:8545' interval: 5s diff --git a/local-network/configs/geth/init.sh b/local-network/configs/geth/init.sh deleted file mode 100755 index 4341514b..00000000 --- a/local-network/configs/geth/init.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -if [ ! -d /root/.ethereum/geth ] ; then - geth init /tmp/genesis.json -else - echo geth already initialized -fi diff --git a/local-network/configs/geth/run.sh b/local-network/configs/geth/run.sh new file mode 100755 index 00000000..77713bc6 --- /dev/null +++ b/local-network/configs/geth/run.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env sh + +if [ ! -d /root/.ethereum/geth ] ; then + geth init /tmp/genesis.json 2>&1 | tee /root/logs/init.log +fi + +geth \ + --verbosity=4 \ + --http \ + --http.addr=0.0.0.0 \ + --http.vhosts=* \ + --http.api=eth,web3,txpool,net,debug,engine \ + --http.corsdomain=* \ + --ws \ + --ws.addr=0.0.0.0 \ + --ws.api=eth,web3,txpool,net,debug \ + --ws.rpcprefix=/ \ + --ws.origins=* \ + --authrpc.addr=0.0.0.0 \ + --authrpc.vhosts=* \ + --authrpc.jwtsecret=/etc/secrets/jwtsecret \ + --nodekey=/etc/secrets/p2p-key \ + --bootnodes=enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303,enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303 \ +2>&1 | tee /root/logs/geth.log # There can be logrotate or something like this diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index 680f5d0a..cc8d20a4 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -16,14 +16,6 @@ services: - ./configs/ec-common/p2p-key-1:/etc/secrets/p2p-key:ro - ./logs/ec-1:/opt/besu/logs - ec-2-init: - container_name: ec-2-init - extends: - file: ./configs/geth/geth.yml - service: geth-init - volumes: - - ./data/geth:/root/.ethereum - ec-2: container_name: ec-2 hostname: ec-2 @@ -37,9 +29,8 @@ services: - ./configs/ec-common/p2p-key-2:/etc/secrets/p2p-key:ro - ./configs/ec-common/jwtsecret-2:/etc/secrets/jwtsecret:ro - ./data/geth:/root/.ethereum + - ./logs/ec-2:/root/logs depends_on: - ec-2-init: - condition: service_completed_successfully ec-1: # TODO issues with connections condition: service_healthy @@ -55,7 +46,6 @@ services: - JAVA_OPTS=-Dwaves.config.directory=/etc/waves -Dlogback.file.level=TRACE - NODE_NUMBER=1 volumes: - - ./data/wavesnode-1:/var/lib/waves - ./logs/wavesnode-1:/var/log/waves - ./configs/wavesnode/common:/etc/waves/common:ro - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro @@ -80,7 +70,6 @@ services: - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro - ./configs/wavesnode/waves-2.conf:/etc/waves/waves.conf:ro - ./configs/ec-common/jwtsecret-2:/etc/secrets/jwtsecret:ro - - ./data/wavesnode-2:/var/lib/waves - ./logs/wavesnode-2:/var/log/waves depends_on: ec-2: From f9703f552c8d6bd8f1394b91374e538a75bad774 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 9 Sep 2024 18:52:54 +0400 Subject: [PATCH 14/31] Fixes after merge --- local-network/configs/besu/besu.conf | 3 ++- local-network/configs/blockscout/backend/bs-backend.env | 2 +- local-network/configs/geth/geth.yml | 2 +- local-network/configs/geth/run.sh | 4 ++-- local-network/configs/wavesnode/common/waves-common.conf | 2 ++ local-network/configs/wavesnode/waves-1.conf | 8 +------- local-network/configs/wavesnode/waves-2.conf | 9 ++------- local-network/docker-compose.yml | 6 ++++-- .../scala/units/client/engine/HttpEngineApiClient.scala | 3 ++- 9 files changed, 17 insertions(+), 22 deletions(-) diff --git a/local-network/configs/besu/besu.conf b/local-network/configs/besu/besu.conf index 4f37aee7..ab2b22de 100644 --- a/local-network/configs/besu/besu.conf +++ b/local-network/configs/besu/besu.conf @@ -20,6 +20,7 @@ rpc-http-enabled = true rpc-http-host = "0.0.0.0" rpc-http-port = 8545 rpc-http-cors-origins = ["*"] +rpc-http-api = ["ADMIN", "CLIQUE", "DEBUG", "EEA", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "PRIV", "QBFT", "TRACE", "TXPOOL", "WEB3"] engine-rpc-enabled = true engine-rpc-port = 8551 @@ -27,7 +28,7 @@ engine-host-allowlist = ["*"] engine-jwt-disabled = true rpc-ws-enabled = true -rpc-http-api = ["ADMIN", "CLIQUE", "DEBUG", "EEA", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "PRIV", "QBFT", "TRACE", "TXPOOL", "WEB3"] +rpc-ws-api = ["ADMIN", "CLIQUE", "DEBUG", "EEA", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "PRIV", "QBFT", "TRACE", "TXPOOL", "WEB3"] p2p-enabled = true # p2p-host = "ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 diff --git a/local-network/configs/blockscout/backend/bs-backend.env b/local-network/configs/blockscout/backend/bs-backend.env index d71ccbea..cc95fc58 100644 --- a/local-network/configs/blockscout/backend/bs-backend.env +++ b/local-network/configs/blockscout/backend/bs-backend.env @@ -3,7 +3,7 @@ ETHEREUM_JSONRPC_HTTP_URL=http://ec-1:8545/ # ETHEREUM_JSONRPC_FALLBACK_HTTP_URL= DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout # DATABASE_QUEUE_TARGET -ETHEREUM_JSONRPC_TRACE_URL=http://besu:8545/ +ETHEREUM_JSONRPC_TRACE_URL=http://ec-1:8545/ # ETHEREUM_JSONRPC_FALLBACK_TRACE_URL= # ETHEREUM_JSONRPC_ETH_CALL_URL= # ETHEREUM_JSONRPC_HTTP_TIMEOUT= diff --git a/local-network/configs/geth/geth.yml b/local-network/configs/geth/geth.yml index 517c6d41..1cf2122b 100644 --- a/local-network/configs/geth/geth.yml +++ b/local-network/configs/geth/geth.yml @@ -1,7 +1,7 @@ services: geth: image: ethereum/client-go:stable - stop_grace_period: 30s + stop_grace_period: 10s entrypoint: /tmp/run.sh volumes: - ./run.sh:/tmp/run.sh diff --git a/local-network/configs/geth/run.sh b/local-network/configs/geth/run.sh index 77713bc6..3e884546 100755 --- a/local-network/configs/geth/run.sh +++ b/local-network/configs/geth/run.sh @@ -9,11 +9,11 @@ geth \ --http \ --http.addr=0.0.0.0 \ --http.vhosts=* \ - --http.api=eth,web3,txpool,net,debug,engine \ + --http.api=eth,web3,net,txpool,debug,trace,admin,rpc \ --http.corsdomain=* \ --ws \ --ws.addr=0.0.0.0 \ - --ws.api=eth,web3,txpool,net,debug \ + --ws.api=eth,web3,net,txpool,debug,trace,admin,rpc \ --ws.rpcprefix=/ \ --ws.origins=* \ --authrpc.addr=0.0.0.0 \ diff --git a/local-network/configs/wavesnode/common/waves-common.conf b/local-network/configs/wavesnode/common/waves-common.conf index c3759d40..90015443 100644 --- a/local-network/configs/wavesnode/common/waves-common.conf +++ b/local-network/configs/wavesnode/common/waves-common.conf @@ -81,6 +81,7 @@ waves { # P2P Network settings network { + node-name = "waves-"${NODE_NUMBER} break-idle-connections-timeout = 10m # Network address @@ -112,6 +113,7 @@ waves { l2 { chain-contract = "3FdaanzgX4roVgHevhq8L8q42E7EZL9XTQr" + execution-client-address = "http://"${EXECUTION_CLIENT}":8551" network { bind-address = "0.0.0.0" port = 6865 diff --git a/local-network/configs/wavesnode/waves-1.conf b/local-network/configs/wavesnode/waves-1.conf index b9f30a9d..d997e641 100644 --- a/local-network/configs/wavesnode/waves-1.conf +++ b/local-network/configs/wavesnode/waves-1.conf @@ -1,9 +1,3 @@ include "common/waves-common.conf" -waves { - network.node-name = waves-1 - - l2.execution-client-address = ec-1 - - wallet.seed = HnyGuCEnV1A # devnet-1 , addr: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e -} +waves.wallet.seed = HnyGuCEnV1A # devnet-1 , addr: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e diff --git a/local-network/configs/wavesnode/waves-2.conf b/local-network/configs/wavesnode/waves-2.conf index 46ed1571..db29bc7d 100644 --- a/local-network/configs/wavesnode/waves-2.conf +++ b/local-network/configs/wavesnode/waves-2.conf @@ -1,12 +1,7 @@ include "common/waves-common.conf" waves { - network.node-name = waves-2 - - l2 { - execution-client-address = ec-2 - jwt-secret-file = /etc/secrets/jwtsecret - } - wallet.seed = HnyGuCEnV1B # devnet-2 , addr: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU + + l2.jwt-secret-file = /etc/secrets/jwtsecret } diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index cc8d20a4..34c40708 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -9,7 +9,7 @@ services: file: ./configs/besu/besu.yml service: besu ports: - - "0.0.0.0:18551:8551" # Engine port + - "0.0.0.0:18551:8551" # Engine port - doesn't have all APIs - "0.0.0.0:18545:8545" # RPC port, for Metamask e.g. - "0.0.0.0:18546:8546" # WebSocket volumes: @@ -24,7 +24,7 @@ services: service: geth ports: - "0.0.0.0:28551:8551" # Engine port - - "0.0.0.0:28545:8545" # RPC port + - "0.0.0.0:28545:8545" # RPC port, useful because doesn't require an auth token volumes: - ./configs/ec-common/p2p-key-2:/etc/secrets/p2p-key:ro - ./configs/ec-common/jwtsecret-2:/etc/secrets/jwtsecret:ro @@ -45,6 +45,7 @@ services: - WAVES_HEAP_SIZE=2g - JAVA_OPTS=-Dwaves.config.directory=/etc/waves -Dlogback.file.level=TRACE - NODE_NUMBER=1 + - EXECUTION_CLIENT=ec-1 volumes: - ./logs/wavesnode-1:/var/log/waves - ./configs/wavesnode/common:/etc/waves/common:ro @@ -65,6 +66,7 @@ services: - WAVES_HEAP_SIZE=2g - JAVA_OPTS=-Dwaves.config.directory=/etc/waves -Dlogback.file.level=TRACE - NODE_NUMBER=2 + - EXECUTION_CLIENT=ec-2 volumes: - ./configs/wavesnode/common:/etc/waves/common:ro - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro diff --git a/src/main/scala/units/client/engine/HttpEngineApiClient.scala b/src/main/scala/units/client/engine/HttpEngineApiClient.scala index 2b6e176d..108e6d69 100644 --- a/src/main/scala/units/client/engine/HttpEngineApiClient.scala +++ b/src/main/scala/units/client/engine/HttpEngineApiClient.scala @@ -2,6 +2,7 @@ package units.client.engine import cats.syntax.either.* import cats.syntax.traverse.* +import com.wavesplatform.common.utils.EitherExt2 import play.api.libs.json.* import sttp.client3.* import sttp.model.Uri @@ -17,7 +18,7 @@ import scala.concurrent.duration.{DurationInt, FiniteDuration} class HttpEngineApiClient(val config: ClientConfig, val backend: SttpBackend[Identity, ?]) extends EngineApiClient with JsonRpcClient { - val apiUrl: Uri = Uri(config.executionClientAddress) + val apiUrl: Uri = Uri.parse(config.executionClientAddress).explicitGet() def forkChoiceUpdate(blockHash: BlockHash, finalizedBlockHash: BlockHash): Job[String] = { sendEngineRequest[ForkChoiceUpdatedRequest, ForkChoiceUpdatedResponse]( From 3737189e334deddc531334fa3d9862010cf5e852 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Tue, 10 Sep 2024 09:04:03 +0400 Subject: [PATCH 15/31] local-network: EC network settings fixes --- local-network/configs/besu/besu.conf | 14 +++++++------- local-network/configs/besu/besu.yml | 2 ++ local-network/configs/ec-common/peers.env | 1 + local-network/configs/geth/geth.yml | 4 +++- local-network/configs/geth/run.sh | 7 ++++--- 5 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 local-network/configs/ec-common/peers.env diff --git a/local-network/configs/besu/besu.conf b/local-network/configs/besu/besu.conf index ab2b22de..bf423a92 100644 --- a/local-network/configs/besu/besu.conf +++ b/local-network/configs/besu/besu.conf @@ -20,7 +20,8 @@ rpc-http-enabled = true rpc-http-host = "0.0.0.0" rpc-http-port = 8545 rpc-http-cors-origins = ["*"] -rpc-http-api = ["ADMIN", "CLIQUE", "DEBUG", "EEA", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "PRIV", "QBFT", "TRACE", "TXPOOL", "WEB3"] +# Disabled: ["EEA", "PRIV"] +rpc-http-api = ["ADMIN", "CLIQUE", "DEBUG", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "QBFT", "TRACE", "TXPOOL", "WEB3"] engine-rpc-enabled = true engine-rpc-port = 8551 @@ -28,18 +29,17 @@ engine-host-allowlist = ["*"] engine-jwt-disabled = true rpc-ws-enabled = true -rpc-ws-api = ["ADMIN", "CLIQUE", "DEBUG", "EEA", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "PRIV", "QBFT", "TRACE", "TXPOOL", "WEB3"] +rpc-ws-api = ["ADMIN", "CLIQUE", "DEBUG", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "QBFT", "TRACE", "TXPOOL", "WEB3"] p2p-enabled = true # p2p-host = "ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 p2p-port = 30303 -discovery-enabled = true nat-method = "NONE" + +discovery-enabled = true + Xdns-enabled = true Xdns-update-enabled = true -bootnodes = [ - "enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303", - "enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303" -] +# bootnodes = [ see in peers.env ] tx-pool-max-future-by-sender = "1250" diff --git a/local-network/configs/besu/besu.yml b/local-network/configs/besu/besu.yml index 768f5ac0..9eb09649 100644 --- a/local-network/configs/besu/besu.yml +++ b/local-network/configs/besu/besu.yml @@ -6,5 +6,7 @@ services: - .:/config:ro environment: - LOG4J_CONFIGURATION_FILE=/config/log4j2.xml + env_file: + - ../ec-common/peers.env command: - --config-file=/config/besu.conf diff --git a/local-network/configs/ec-common/peers.env b/local-network/configs/ec-common/peers.env new file mode 100644 index 00000000..110bdc04 --- /dev/null +++ b/local-network/configs/ec-common/peers.env @@ -0,0 +1 @@ +BESU_BOOTNODES=enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303,enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303 diff --git a/local-network/configs/geth/geth.yml b/local-network/configs/geth/geth.yml index 1cf2122b..b285771d 100644 --- a/local-network/configs/geth/geth.yml +++ b/local-network/configs/geth/geth.yml @@ -4,8 +4,10 @@ services: stop_grace_period: 10s entrypoint: /tmp/run.sh volumes: - - ./run.sh:/tmp/run.sh - ../ec-common/genesis.json:/tmp/genesis.json:ro + - ./run.sh:/tmp/run.sh + env_file: + - ../ec-common/peers.env healthcheck: test: 'wget -qO /dev/null --header "content-type: application/json" --post-data {\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1} http://127.0.0.1:8545' interval: 5s diff --git a/local-network/configs/geth/run.sh b/local-network/configs/geth/run.sh index 3e884546..b63fe0da 100755 --- a/local-network/configs/geth/run.sh +++ b/local-network/configs/geth/run.sh @@ -9,16 +9,17 @@ geth \ --http \ --http.addr=0.0.0.0 \ --http.vhosts=* \ - --http.api=eth,web3,net,txpool,debug,trace,admin,rpc \ + --http.api=eth,web3,net,txpool,debug,admin,rpc \ --http.corsdomain=* \ --ws \ --ws.addr=0.0.0.0 \ - --ws.api=eth,web3,net,txpool,debug,trace,admin,rpc \ + --ws.api=eth,web3,net,txpool,debug,admin,rpc \ --ws.rpcprefix=/ \ --ws.origins=* \ --authrpc.addr=0.0.0.0 \ --authrpc.vhosts=* \ --authrpc.jwtsecret=/etc/secrets/jwtsecret \ --nodekey=/etc/secrets/p2p-key \ - --bootnodes=enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303,enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303 \ + --nat=none \ + --bootnodes="${BESU_BOOTNODES}" \ 2>&1 | tee /root/logs/geth.log # There can be logrotate or something like this From 2dafd00b914fec41452dabd546551ae8926cd720 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Tue, 10 Sep 2024 10:20:36 +0400 Subject: [PATCH 16/31] local-network: geth log rotation --- local-network/configs/besu/besu.conf | 2 +- local-network/configs/besu/besu.yml | 4 ++-- local-network/configs/ec-common/peers.env | 2 +- local-network/configs/geth/geth.yml | 2 ++ local-network/configs/geth/run.sh | 7 +++++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/local-network/configs/besu/besu.conf b/local-network/configs/besu/besu.conf index bf423a92..0421fe32 100644 --- a/local-network/configs/besu/besu.conf +++ b/local-network/configs/besu/besu.conf @@ -40,6 +40,6 @@ discovery-enabled = true Xdns-enabled = true Xdns-update-enabled = true -# bootnodes = [ see in peers.env ] +# bootnodes = [ see BESU_BOOTNODES in peers.env ] tx-pool-max-future-by-sender = "1250" diff --git a/local-network/configs/besu/besu.yml b/local-network/configs/besu/besu.yml index 9eb09649..eb8e5a0a 100644 --- a/local-network/configs/besu/besu.yml +++ b/local-network/configs/besu/besu.yml @@ -4,9 +4,9 @@ services: volumes: - ../ec-common/genesis.json:/genesis.json:ro - .:/config:ro - environment: - - LOG4J_CONFIGURATION_FILE=/config/log4j2.xml env_file: - ../ec-common/peers.env + environment: + LOG4J_CONFIGURATION_FILE: /config/log4j2.xml command: - --config-file=/config/besu.conf diff --git a/local-network/configs/ec-common/peers.env b/local-network/configs/ec-common/peers.env index 110bdc04..378bdc46 100644 --- a/local-network/configs/ec-common/peers.env +++ b/local-network/configs/ec-common/peers.env @@ -1 +1 @@ -BESU_BOOTNODES=enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303,enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303 +BESU_BOOTNODES=enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303,enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303 \ No newline at end of file diff --git a/local-network/configs/geth/geth.yml b/local-network/configs/geth/geth.yml index b285771d..435bc7d1 100644 --- a/local-network/configs/geth/geth.yml +++ b/local-network/configs/geth/geth.yml @@ -8,6 +8,8 @@ services: - ./run.sh:/tmp/run.sh env_file: - ../ec-common/peers.env + logging: + driver: none healthcheck: test: 'wget -qO /dev/null --header "content-type: application/json" --post-data {\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1} http://127.0.0.1:8545' interval: 5s diff --git a/local-network/configs/geth/run.sh b/local-network/configs/geth/run.sh index b63fe0da..7b8a7236 100755 --- a/local-network/configs/geth/run.sh +++ b/local-network/configs/geth/run.sh @@ -5,7 +5,6 @@ if [ ! -d /root/.ethereum/geth ] ; then fi geth \ - --verbosity=4 \ --http \ --http.addr=0.0.0.0 \ --http.vhosts=* \ @@ -22,4 +21,8 @@ geth \ --nodekey=/etc/secrets/p2p-key \ --nat=none \ --bootnodes="${BESU_BOOTNODES}" \ -2>&1 | tee /root/logs/geth.log # There can be logrotate or something like this + --log.file="/root/logs/geth.log" \ + --verbosity=4 \ + --log.format=terminal \ + --log.rotate \ + --log.compress From 106309111bcafa3a8cd4a74826e569dcf27c5262 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Tue, 10 Sep 2024 12:19:14 +0400 Subject: [PATCH 17/31] local-network: fixed geth sync issue, added ".hex" extension to secrets --- .../ec-common/{jwtsecret-1 => jwtsecret-1.hex} | 0 .../ec-common/{jwtsecret-2 => jwtsecret-2.hex} | 0 .../ec-common/{jwtsecret-3 => jwtsecret-3.hex} | 0 .../ec-common/{jwtsecret-4 => jwtsecret-4.hex} | 0 .../ec-common/{jwtsecret-5 => jwtsecret-5.hex} | 0 .../configs/ec-common/{p2p-key-1 => p2p-key-1.hex} | 0 .../configs/ec-common/{p2p-key-2 => p2p-key-2.hex} | 0 .../configs/ec-common/{p2p-key-3 => p2p-key-3.hex} | 0 .../configs/ec-common/{p2p-key-4 => p2p-key-4.hex} | 0 .../configs/ec-common/{p2p-key-5 => p2p-key-5.hex} | 0 local-network/configs/geth/run.sh | 4 +++- local-network/docker-compose.yml | 11 ++++------- .../units/client/engine/HttpEngineApiClient.scala | 3 +-- 13 files changed, 8 insertions(+), 10 deletions(-) rename local-network/configs/ec-common/{jwtsecret-1 => jwtsecret-1.hex} (100%) rename local-network/configs/ec-common/{jwtsecret-2 => jwtsecret-2.hex} (100%) rename local-network/configs/ec-common/{jwtsecret-3 => jwtsecret-3.hex} (100%) rename local-network/configs/ec-common/{jwtsecret-4 => jwtsecret-4.hex} (100%) rename local-network/configs/ec-common/{jwtsecret-5 => jwtsecret-5.hex} (100%) rename local-network/configs/ec-common/{p2p-key-1 => p2p-key-1.hex} (100%) rename local-network/configs/ec-common/{p2p-key-2 => p2p-key-2.hex} (100%) rename local-network/configs/ec-common/{p2p-key-3 => p2p-key-3.hex} (100%) rename local-network/configs/ec-common/{p2p-key-4 => p2p-key-4.hex} (100%) rename local-network/configs/ec-common/{p2p-key-5 => p2p-key-5.hex} (100%) diff --git a/local-network/configs/ec-common/jwtsecret-1 b/local-network/configs/ec-common/jwtsecret-1.hex similarity index 100% rename from local-network/configs/ec-common/jwtsecret-1 rename to local-network/configs/ec-common/jwtsecret-1.hex diff --git a/local-network/configs/ec-common/jwtsecret-2 b/local-network/configs/ec-common/jwtsecret-2.hex similarity index 100% rename from local-network/configs/ec-common/jwtsecret-2 rename to local-network/configs/ec-common/jwtsecret-2.hex diff --git a/local-network/configs/ec-common/jwtsecret-3 b/local-network/configs/ec-common/jwtsecret-3.hex similarity index 100% rename from local-network/configs/ec-common/jwtsecret-3 rename to local-network/configs/ec-common/jwtsecret-3.hex diff --git a/local-network/configs/ec-common/jwtsecret-4 b/local-network/configs/ec-common/jwtsecret-4.hex similarity index 100% rename from local-network/configs/ec-common/jwtsecret-4 rename to local-network/configs/ec-common/jwtsecret-4.hex diff --git a/local-network/configs/ec-common/jwtsecret-5 b/local-network/configs/ec-common/jwtsecret-5.hex similarity index 100% rename from local-network/configs/ec-common/jwtsecret-5 rename to local-network/configs/ec-common/jwtsecret-5.hex diff --git a/local-network/configs/ec-common/p2p-key-1 b/local-network/configs/ec-common/p2p-key-1.hex similarity index 100% rename from local-network/configs/ec-common/p2p-key-1 rename to local-network/configs/ec-common/p2p-key-1.hex diff --git a/local-network/configs/ec-common/p2p-key-2 b/local-network/configs/ec-common/p2p-key-2.hex similarity index 100% rename from local-network/configs/ec-common/p2p-key-2 rename to local-network/configs/ec-common/p2p-key-2.hex diff --git a/local-network/configs/ec-common/p2p-key-3 b/local-network/configs/ec-common/p2p-key-3.hex similarity index 100% rename from local-network/configs/ec-common/p2p-key-3 rename to local-network/configs/ec-common/p2p-key-3.hex diff --git a/local-network/configs/ec-common/p2p-key-4 b/local-network/configs/ec-common/p2p-key-4.hex similarity index 100% rename from local-network/configs/ec-common/p2p-key-4 rename to local-network/configs/ec-common/p2p-key-4.hex diff --git a/local-network/configs/ec-common/p2p-key-5 b/local-network/configs/ec-common/p2p-key-5.hex similarity index 100% rename from local-network/configs/ec-common/p2p-key-5 rename to local-network/configs/ec-common/p2p-key-5.hex diff --git a/local-network/configs/geth/run.sh b/local-network/configs/geth/run.sh index 7b8a7236..d5b3ea5f 100755 --- a/local-network/configs/geth/run.sh +++ b/local-network/configs/geth/run.sh @@ -4,6 +4,7 @@ if [ ! -d /root/.ethereum/geth ] ; then geth init /tmp/genesis.json 2>&1 | tee /root/logs/init.log fi +# --syncmode full, because default "snap" mode and starting concurrently with ec-1 cause a stopped sync geth \ --http \ --http.addr=0.0.0.0 \ @@ -21,8 +22,9 @@ geth \ --nodekey=/etc/secrets/p2p-key \ --nat=none \ --bootnodes="${BESU_BOOTNODES}" \ + --syncmode full \ --log.file="/root/logs/geth.log" \ - --verbosity=4 \ + --verbosity=5 \ --log.format=terminal \ --log.rotate \ --log.compress diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index 34c40708..ebd8162c 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -13,7 +13,7 @@ services: - "0.0.0.0:18545:8545" # RPC port, for Metamask e.g. - "0.0.0.0:18546:8546" # WebSocket volumes: - - ./configs/ec-common/p2p-key-1:/etc/secrets/p2p-key:ro + - ./configs/ec-common/p2p-key-1.hex:/etc/secrets/p2p-key:ro - ./logs/ec-1:/opt/besu/logs ec-2: @@ -26,13 +26,10 @@ services: - "0.0.0.0:28551:8551" # Engine port - "0.0.0.0:28545:8545" # RPC port, useful because doesn't require an auth token volumes: - - ./configs/ec-common/p2p-key-2:/etc/secrets/p2p-key:ro - - ./configs/ec-common/jwtsecret-2:/etc/secrets/jwtsecret:ro + - ./configs/ec-common/p2p-key-2.hex:/etc/secrets/p2p-key:ro + - ./configs/ec-common/jwtsecret-2.hex:/etc/secrets/jwtsecret:ro - ./data/geth:/root/.ethereum - ./logs/ec-2:/root/logs - depends_on: - ec-1: # TODO issues with connections - condition: service_healthy wavesnode-1: container_name: wavesnode-1 @@ -71,7 +68,7 @@ services: - ./configs/wavesnode/common:/etc/waves/common:ro - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro - ./configs/wavesnode/waves-2.conf:/etc/waves/waves.conf:ro - - ./configs/ec-common/jwtsecret-2:/etc/secrets/jwtsecret:ro + - ./configs/ec-common/jwtsecret-2.hex:/etc/secrets/jwtsecret:ro - ./logs/wavesnode-2:/var/log/waves depends_on: ec-2: diff --git a/src/main/scala/units/client/engine/HttpEngineApiClient.scala b/src/main/scala/units/client/engine/HttpEngineApiClient.scala index 108e6d69..810af2a7 100644 --- a/src/main/scala/units/client/engine/HttpEngineApiClient.scala +++ b/src/main/scala/units/client/engine/HttpEngineApiClient.scala @@ -2,7 +2,6 @@ package units.client.engine import cats.syntax.either.* import cats.syntax.traverse.* -import com.wavesplatform.common.utils.EitherExt2 import play.api.libs.json.* import sttp.client3.* import sttp.model.Uri @@ -18,7 +17,7 @@ import scala.concurrent.duration.{DurationInt, FiniteDuration} class HttpEngineApiClient(val config: ClientConfig, val backend: SttpBackend[Identity, ?]) extends EngineApiClient with JsonRpcClient { - val apiUrl: Uri = Uri.parse(config.executionClientAddress).explicitGet() + val apiUrl: Uri = uri"${config.executionClientAddress}" def forkChoiceUpdate(blockHash: BlockHash, finalizedBlockHash: BlockHash): Job[String] = { sendEngineRequest[ForkChoiceUpdatedRequest, ForkChoiceUpdatedResponse]( From dc50363f373c71284bdcb625ccb8bde695d746ef Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Wed, 11 Sep 2024 12:10:57 +0400 Subject: [PATCH 18/31] local-network: bootnode to exchange peers information (WIP) --- local-network/configs/besu/besu.conf | 5 ++-- local-network/configs/ec-common/peers.env | 1 - local-network/configs/geth/run.sh | 5 ++-- local-network/docker-compose.yml | 29 +++++++++++++++++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/local-network/configs/besu/besu.conf b/local-network/configs/besu/besu.conf index 0421fe32..6c6d22c9 100644 --- a/local-network/configs/besu/besu.conf +++ b/local-network/configs/besu/besu.conf @@ -33,13 +33,14 @@ rpc-ws-api = ["ADMIN", "CLIQUE", "DEBUG", "ETH", "IBFT", "MINER", "NET", "PERM", p2p-enabled = true # p2p-host = "ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 +p2p-interface = "0.0.0.0" +p2p-host = "172.18.0.3" p2p-port = 30303 -nat-method = "NONE" discovery-enabled = true Xdns-enabled = true Xdns-update-enabled = true -# bootnodes = [ see BESU_BOOTNODES in peers.env ] +bootnodes = [ "enode://7804485fc3eed8f7f5ccd61f44d6925bc3c4adb3dd9bcd417da7f74ff4e518c0367697ca74b375d134d5a73bd731076d8498391b20bd862f6b763d4299f487e2@172.18.0.2:0?discport=30303" ] tx-pool-max-future-by-sender = "1250" diff --git a/local-network/configs/ec-common/peers.env b/local-network/configs/ec-common/peers.env index 378bdc46..e69de29b 100644 --- a/local-network/configs/ec-common/peers.env +++ b/local-network/configs/ec-common/peers.env @@ -1 +0,0 @@ -BESU_BOOTNODES=enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303,enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303 \ No newline at end of file diff --git a/local-network/configs/geth/run.sh b/local-network/configs/geth/run.sh index d5b3ea5f..82aeabbd 100755 --- a/local-network/configs/geth/run.sh +++ b/local-network/configs/geth/run.sh @@ -20,8 +20,9 @@ geth \ --authrpc.vhosts=* \ --authrpc.jwtsecret=/etc/secrets/jwtsecret \ --nodekey=/etc/secrets/p2p-key \ - --nat=none \ - --bootnodes="${BESU_BOOTNODES}" \ + --nat="extip:172.18.0.4" \ + --netrestrict="172.18.0.0/16" \ + --bootnodes="enode://7804485fc3eed8f7f5ccd61f44d6925bc3c4adb3dd9bcd417da7f74ff4e518c0367697ca74b375d134d5a73bd731076d8498391b20bd862f6b763d4299f487e2@172.18.0.2:0?discport=30303" \ --syncmode full \ --log.file="/root/logs/geth.log" \ --verbosity=5 \ diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index ebd8162c..0161ae3d 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -2,6 +2,16 @@ name: l2 include: - ./configs/blockscout/${BS-enabled}.yml services: + ec-bootnode: + container_name: ec-bootnode + hostname: ec-bootnode + image: ethereum/client-go:alltools-stable + volumes: + - ./configs/ec-common/p2p-key-5.hex:/bootnode.key + # -addr ec-bootnode:30303 + command: > + bootnode --nodekey /bootnode.key --nat "extip:172.18.0.2" --addr ":30303" --verbosity 5 --netrestrict 172.18.0.0/16 + ec-1: container_name: ec-1 hostname: ec-1 @@ -15,6 +25,11 @@ services: volumes: - ./configs/ec-common/p2p-key-1.hex:/etc/secrets/p2p-key:ro - ./logs/ec-1:/opt/besu/logs + depends_on: + - ec-bootnode # TODO healthy? + networks: + default: + ipv4_address: 172.18.0.3 ec-2: container_name: ec-2 @@ -30,6 +45,11 @@ services: - ./configs/ec-common/jwtsecret-2.hex:/etc/secrets/jwtsecret:ro - ./data/geth:/root/.ethereum - ./logs/ec-2:/root/logs + depends_on: + - ec-bootnode + networks: + default: + ipv4_address: 172.18.0.4 wavesnode-1: container_name: wavesnode-1 @@ -92,3 +112,12 @@ services: depends_on: - wavesnode-1 - ec-1 + +networks: + default: + driver: bridge + enable_ipv6: false + ipam: + driver: default + config: + - subnet: 172.18.0.0/16 From a88e47d81a13a712f5885efb7c434c4162b9f727 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Wed, 11 Sep 2024 12:21:56 +0400 Subject: [PATCH 19/31] local-network: bootnode address in one file --- local-network/configs/besu/besu.conf | 5 ++--- local-network/configs/ec-common/peers.env | 1 + local-network/configs/geth/run.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/local-network/configs/besu/besu.conf b/local-network/configs/besu/besu.conf index 6c6d22c9..5fb97f93 100644 --- a/local-network/configs/besu/besu.conf +++ b/local-network/configs/besu/besu.conf @@ -32,15 +32,14 @@ rpc-ws-enabled = true rpc-ws-api = ["ADMIN", "CLIQUE", "DEBUG", "ETH", "IBFT", "MINER", "NET", "PERM", "PLUGINS", "QBFT", "TRACE", "TXPOOL", "WEB3"] p2p-enabled = true -# p2p-host = "ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 p2p-interface = "0.0.0.0" -p2p-host = "172.18.0.3" +p2p-host = "172.18.0.3" # p2p-host = "ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 p2p-port = 30303 discovery-enabled = true Xdns-enabled = true Xdns-update-enabled = true -bootnodes = [ "enode://7804485fc3eed8f7f5ccd61f44d6925bc3c4adb3dd9bcd417da7f74ff4e518c0367697ca74b375d134d5a73bd731076d8498391b20bd862f6b763d4299f487e2@172.18.0.2:0?discport=30303" ] +# bootnodes = [ see BESU_BOOTNODES in peers.env ] tx-pool-max-future-by-sender = "1250" diff --git a/local-network/configs/ec-common/peers.env b/local-network/configs/ec-common/peers.env index e69de29b..75967c36 100644 --- a/local-network/configs/ec-common/peers.env +++ b/local-network/configs/ec-common/peers.env @@ -0,0 +1 @@ +BESU_BOOTNODES=enode://7804485fc3eed8f7f5ccd61f44d6925bc3c4adb3dd9bcd417da7f74ff4e518c0367697ca74b375d134d5a73bd731076d8498391b20bd862f6b763d4299f487e2@ec-bootnode:0?discport=30303 \ No newline at end of file diff --git a/local-network/configs/geth/run.sh b/local-network/configs/geth/run.sh index 82aeabbd..6d925495 100755 --- a/local-network/configs/geth/run.sh +++ b/local-network/configs/geth/run.sh @@ -22,7 +22,7 @@ geth \ --nodekey=/etc/secrets/p2p-key \ --nat="extip:172.18.0.4" \ --netrestrict="172.18.0.0/16" \ - --bootnodes="enode://7804485fc3eed8f7f5ccd61f44d6925bc3c4adb3dd9bcd417da7f74ff4e518c0367697ca74b375d134d5a73bd731076d8498391b20bd862f6b763d4299f487e2@172.18.0.2:0?discport=30303" \ + --bootnodes="${BESU_BOOTNODES}" \ --syncmode full \ --log.file="/root/logs/geth.log" \ --verbosity=5 \ From 670f312912e92c6ce37b668615c5d2f6bd25f83d Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Wed, 11 Sep 2024 12:37:03 +0400 Subject: [PATCH 20/31] local-network: bootnode logs and config in geth dir --- .../configs/ec-common/jwtsecret-5.hex | 1 - .../{p2p-key-5.hex => p2p-key-bootnode.hex} | 0 local-network/configs/geth/geth.yml | 9 ++++++++- local-network/configs/geth/run-bootnode.sh | 11 +++++++++++ .../configs/geth/{run.sh => run-node.sh} | 0 local-network/docker-compose.yml | 19 ++++++++----------- 6 files changed, 27 insertions(+), 13 deletions(-) delete mode 100644 local-network/configs/ec-common/jwtsecret-5.hex rename local-network/configs/ec-common/{p2p-key-5.hex => p2p-key-bootnode.hex} (100%) create mode 100755 local-network/configs/geth/run-bootnode.sh rename local-network/configs/geth/{run.sh => run-node.sh} (100%) diff --git a/local-network/configs/ec-common/jwtsecret-5.hex b/local-network/configs/ec-common/jwtsecret-5.hex deleted file mode 100644 index a9c3b88d..00000000 --- a/local-network/configs/ec-common/jwtsecret-5.hex +++ /dev/null @@ -1 +0,0 @@ -cd5d2407415cb16bbad23e2f30a430b79a7b561be90fef333763fa8451d322fd diff --git a/local-network/configs/ec-common/p2p-key-5.hex b/local-network/configs/ec-common/p2p-key-bootnode.hex similarity index 100% rename from local-network/configs/ec-common/p2p-key-5.hex rename to local-network/configs/ec-common/p2p-key-bootnode.hex diff --git a/local-network/configs/geth/geth.yml b/local-network/configs/geth/geth.yml index 435bc7d1..3279daf9 100644 --- a/local-network/configs/geth/geth.yml +++ b/local-network/configs/geth/geth.yml @@ -1,11 +1,18 @@ services: + bootnode: + image: ethereum/client-go:alltools-stable + volumes: + - ./run-bootnode.sh:/tmp/run.sh:ro + - ../ec-common/p2p-key-bootnode.hex:/bootnode.key:ro + - ../../logs/ec-bootnode:/root/logs + command: /tmp/run.sh geth: image: ethereum/client-go:stable stop_grace_period: 10s entrypoint: /tmp/run.sh volumes: - ../ec-common/genesis.json:/tmp/genesis.json:ro - - ./run.sh:/tmp/run.sh + - ./run-node.sh:/tmp/run.sh env_file: - ../ec-common/peers.env logging: diff --git a/local-network/configs/geth/run-bootnode.sh b/local-network/configs/geth/run-bootnode.sh new file mode 100755 index 00000000..44baa3f7 --- /dev/null +++ b/local-network/configs/geth/run-bootnode.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +mkdir -p /root/logs + +bootnode \ + --nodekey /bootnode.key \ + --nat "extip:172.18.0.2" \ + --addr ":30303" \ + --verbosity=5 \ + --netrestrict 172.18.0.0/16 \ + > /root/logs/bootnode.log 2>&1 diff --git a/local-network/configs/geth/run.sh b/local-network/configs/geth/run-node.sh similarity index 100% rename from local-network/configs/geth/run.sh rename to local-network/configs/geth/run-node.sh diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index 0161ae3d..85eca089 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -5,12 +5,9 @@ services: ec-bootnode: container_name: ec-bootnode hostname: ec-bootnode - image: ethereum/client-go:alltools-stable - volumes: - - ./configs/ec-common/p2p-key-5.hex:/bootnode.key - # -addr ec-bootnode:30303 - command: > - bootnode --nodekey /bootnode.key --nat "extip:172.18.0.2" --addr ":30303" --verbosity 5 --netrestrict 172.18.0.0/16 + extends: + file: ./configs/geth/geth.yml + service: bootnode ec-1: container_name: ec-1 @@ -25,11 +22,11 @@ services: volumes: - ./configs/ec-common/p2p-key-1.hex:/etc/secrets/p2p-key:ro - ./logs/ec-1:/opt/besu/logs - depends_on: - - ec-bootnode # TODO healthy? networks: default: - ipv4_address: 172.18.0.3 + ipv4_address: 172.18.0.3 # Static IP otherwise docker changes it everytime + depends_on: + - ec-bootnode ec-2: container_name: ec-2 @@ -45,11 +42,11 @@ services: - ./configs/ec-common/jwtsecret-2.hex:/etc/secrets/jwtsecret:ro - ./data/geth:/root/.ethereum - ./logs/ec-2:/root/logs - depends_on: - - ec-bootnode networks: default: ipv4_address: 172.18.0.4 + depends_on: + - ec-bootnode wavesnode-1: container_name: wavesnode-1 From 84ea22ee046baf46a6d4801d36b06781a0a221c4 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Wed, 11 Sep 2024 13:22:57 +0400 Subject: [PATCH 21/31] local-network: bootnode right IP inside script --- local-network/configs/geth/run-bootnode.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) mode change 100755 => 100644 local-network/configs/geth/run-bootnode.sh diff --git a/local-network/configs/geth/run-bootnode.sh b/local-network/configs/geth/run-bootnode.sh old mode 100755 new mode 100644 index 44baa3f7..6792da3f --- a/local-network/configs/geth/run-bootnode.sh +++ b/local-network/configs/geth/run-bootnode.sh @@ -2,10 +2,21 @@ mkdir -p /root/logs +IP_RAW=$(ip -4 addr show dev eth0 | awk '/inet / {print $2}') +IP=$(echo "$IP_RAW" | cut -d/ -f1) +NETWORK=$(echo "$IP_RAW" | xargs ipcalc -n | awk -F= '{print $2}') +PREFIX=$(echo "$IP_RAW" | xargs ipcalc -p | awk -F= '{print $2}') + +tee /root/logs/bootnode.log < /root/logs/bootnode.log 2>&1 + --netrestrict "${NETWORK}/${PREFIX}" \ + 2>&1 | tee /root/logs/bootnode.log From c8f28a0425d5f86173d8206b6cda23c8226673ec Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Wed, 11 Sep 2024 14:56:20 +0400 Subject: [PATCH 22/31] local-network: local IPs, besu knowns its IP, ECs connect each other without a bootnode --- local-network/configs/besu/besu.conf | 2 +- local-network/configs/besu/besu.yml | 4 +- local-network/configs/besu/run-besu.sh | 8 ++++ .../configs/blockscout/nginx/nginx.yml | 8 ++-- local-network/configs/ec-common/peers.env | 2 +- local-network/configs/geth/geth.yml | 9 +---- local-network/configs/geth/run-bootnode.sh | 22 ---------- .../configs/geth/{run-node.sh => run-geth.sh} | 15 ++++++- local-network/docker-compose.yml | 40 ++++--------------- 9 files changed, 37 insertions(+), 73 deletions(-) create mode 100755 local-network/configs/besu/run-besu.sh delete mode 100644 local-network/configs/geth/run-bootnode.sh rename local-network/configs/geth/{run-node.sh => run-geth.sh} (67%) diff --git a/local-network/configs/besu/besu.conf b/local-network/configs/besu/besu.conf index 5fb97f93..65846933 100644 --- a/local-network/configs/besu/besu.conf +++ b/local-network/configs/besu/besu.conf @@ -33,7 +33,7 @@ rpc-ws-api = ["ADMIN", "CLIQUE", "DEBUG", "ETH", "IBFT", "MINER", "NET", "PERM", p2p-enabled = true p2p-interface = "0.0.0.0" -p2p-host = "172.18.0.3" # p2p-host = "ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 +# p2p-host = "see run-besu.sh" p2p-port = 30303 discovery-enabled = true diff --git a/local-network/configs/besu/besu.yml b/local-network/configs/besu/besu.yml index eb8e5a0a..95b693d8 100644 --- a/local-network/configs/besu/besu.yml +++ b/local-network/configs/besu/besu.yml @@ -4,9 +4,9 @@ services: volumes: - ../ec-common/genesis.json:/genesis.json:ro - .:/config:ro + - ./run-besu.sh:/tmp/run.sh:ro env_file: - ../ec-common/peers.env environment: LOG4J_CONFIGURATION_FILE: /config/log4j2.xml - command: - - --config-file=/config/besu.conf + entrypoint: /tmp/run.sh diff --git a/local-network/configs/besu/run-besu.sh b/local-network/configs/besu/run-besu.sh new file mode 100755 index 00000000..22df3454 --- /dev/null +++ b/local-network/configs/besu/run-besu.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +IP=$(hostname -I) + +# p2p-host = "ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 +besu \ + --config-file=/config/besu.conf \ + --p2p-host=${IP} diff --git a/local-network/configs/blockscout/nginx/nginx.yml b/local-network/configs/blockscout/nginx/nginx.yml index 2e852744..2a034586 100644 --- a/local-network/configs/blockscout/nginx/nginx.yml +++ b/local-network/configs/blockscout/nginx/nginx.yml @@ -14,7 +14,7 @@ services: BESU_WS_PROXY_PASS: ${BESU_WS_PROXY_PASS:-http://ec-1:8546} WAVES_PROXY_PASS: ${WAVES_PROXY_PASS:-http://wavesnode-1:6869} ports: - - '0.0.0.0:3000:3000' - - '0.0.0.0:3001:3001' - - '0.0.0.0:3002:3002' - - '0.0.0.0:10001:10001' + - '127.0.0.1:3000:3000' + - '127.0.0.1:3001:3001' + - '127.0.0.1:3002:3002' + - '127.0.0.1:10001:10001' diff --git a/local-network/configs/ec-common/peers.env b/local-network/configs/ec-common/peers.env index 75967c36..110bdc04 100644 --- a/local-network/configs/ec-common/peers.env +++ b/local-network/configs/ec-common/peers.env @@ -1 +1 @@ -BESU_BOOTNODES=enode://7804485fc3eed8f7f5ccd61f44d6925bc3c4adb3dd9bcd417da7f74ff4e518c0367697ca74b375d134d5a73bd731076d8498391b20bd862f6b763d4299f487e2@ec-bootnode:0?discport=30303 \ No newline at end of file +BESU_BOOTNODES=enode://b2ce9caff5e7472eafaf006904e2cb39cdd79801cda1328c510118cafdb0e9574526af6d05a89dae07a376606227c54c724cab1e88edf43190b7544976b275b8@ec-1:30303,enode://4e355eebfd77e5c2c0c20328c2bd5f3fde033c58e06e758c3e0a4ad88e8ced176f0d5eb32e214461b73e014591587f7c6567ee373e9c389b872a6d97d74a913c@ec-2:30303 diff --git a/local-network/configs/geth/geth.yml b/local-network/configs/geth/geth.yml index 3279daf9..5a4656c5 100644 --- a/local-network/configs/geth/geth.yml +++ b/local-network/configs/geth/geth.yml @@ -1,18 +1,11 @@ services: - bootnode: - image: ethereum/client-go:alltools-stable - volumes: - - ./run-bootnode.sh:/tmp/run.sh:ro - - ../ec-common/p2p-key-bootnode.hex:/bootnode.key:ro - - ../../logs/ec-bootnode:/root/logs - command: /tmp/run.sh geth: image: ethereum/client-go:stable stop_grace_period: 10s entrypoint: /tmp/run.sh volumes: - ../ec-common/genesis.json:/tmp/genesis.json:ro - - ./run-node.sh:/tmp/run.sh + - ./run-geth.sh:/tmp/run.sh:ro env_file: - ../ec-common/peers.env logging: diff --git a/local-network/configs/geth/run-bootnode.sh b/local-network/configs/geth/run-bootnode.sh deleted file mode 100644 index 6792da3f..00000000 --- a/local-network/configs/geth/run-bootnode.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env sh - -mkdir -p /root/logs - -IP_RAW=$(ip -4 addr show dev eth0 | awk '/inet / {print $2}') -IP=$(echo "$IP_RAW" | cut -d/ -f1) -NETWORK=$(echo "$IP_RAW" | xargs ipcalc -n | awk -F= '{print $2}') -PREFIX=$(echo "$IP_RAW" | xargs ipcalc -p | awk -F= '{print $2}') - -tee /root/logs/bootnode.log <&1 | tee /root/logs/bootnode.log diff --git a/local-network/configs/geth/run-node.sh b/local-network/configs/geth/run-geth.sh similarity index 67% rename from local-network/configs/geth/run-node.sh rename to local-network/configs/geth/run-geth.sh index 6d925495..c022c6b8 100755 --- a/local-network/configs/geth/run-node.sh +++ b/local-network/configs/geth/run-geth.sh @@ -4,6 +4,17 @@ if [ ! -d /root/.ethereum/geth ] ; then geth init /tmp/genesis.json 2>&1 | tee /root/logs/init.log fi +IP_RAW=$(ip -4 addr show dev eth0 | awk '/inet / {print $2}') +IP=$(echo "$IP_RAW" | cut -d/ -f1) +NETWORK=$(echo "$IP_RAW" | xargs ipcalc -n | awk -F= '{print $2}') +PREFIX=$(echo "$IP_RAW" | xargs ipcalc -p | awk -F= '{print $2}') + +tee /root/logs/bootnode.log < Date: Wed, 11 Sep 2024 15:07:15 +0400 Subject: [PATCH 23/31] local-network: removed unnecessary config record --- local-network/docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index da27ce35..d8786df5 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -28,7 +28,6 @@ services: volumes: - ./configs/ec-common/p2p-key-2.hex:/etc/secrets/p2p-key:ro - ./configs/ec-common/jwtsecret-2.hex:/etc/secrets/jwtsecret:ro - - ./data/geth:/root/.ethereum - ./logs/ec-2:/root/logs wavesnode-1: From 950b8f8124c5fd8459325232aecdc19112d80dd5 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Thu, 12 Sep 2024 08:07:10 +0400 Subject: [PATCH 24/31] Fix --- local-network/docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index d8786df5..86b12367 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -72,8 +72,6 @@ services: depends_on: ec-2: condition: service_healthy - wavesnode-1: # To reduce possible forks at start - condition: service_started deploy: container_name: deploy From 30b47d2242c025d3c09bafee93df080ef4baa375 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Thu, 12 Sep 2024 08:22:32 +0400 Subject: [PATCH 25/31] Update dependencies --- local-network/configs/besu/run-besu.sh | 2 +- local-network/deploy/package-lock.json | 368 ------------------------- 2 files changed, 1 insertion(+), 369 deletions(-) diff --git a/local-network/configs/besu/run-besu.sh b/local-network/configs/besu/run-besu.sh index 22df3454..09c6009e 100755 --- a/local-network/configs/besu/run-besu.sh +++ b/local-network/configs/besu/run-besu.sh @@ -2,7 +2,7 @@ IP=$(hostname -I) -# p2p-host = "ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 +# --p2p-host="ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380 besu \ --config-file=/config/besu.conf \ --p2p-host=${IP} diff --git a/local-network/deploy/package-lock.json b/local-network/deploy/package-lock.json index 42c2a2cb..98f9bda1 100644 --- a/local-network/deploy/package-lock.json +++ b/local-network/deploy/package-lock.json @@ -42,70 +42,6 @@ "kuler": "^2.0.0" } }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", - "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", - "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", - "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", - "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, "node_modules/@esbuild/darwin-arm64": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", @@ -122,310 +58,6 @@ "node": ">=18" } }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", - "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", - "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", - "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", - "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", - "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", - "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", - "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", - "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", - "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", - "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", - "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", - "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", - "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", - "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", - "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", - "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", - "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", - "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", - "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, "node_modules/@ethereumjs/rlp": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", From 933cfbed80156883e6bd7c1c965cdcc87ab0517b Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Thu, 12 Sep 2024 14:54:25 +0400 Subject: [PATCH 26/31] local-network: common name of log files for different EC, waiting at least 1 peer for waves node to solve rollback issues --- local-network/configs/besu/log4j2.xml | 2 +- local-network/configs/geth/geth.yml | 2 -- local-network/configs/geth/run-geth.sh | 4 ++-- local-network/deploy/src/waves-txs.ts | 2 +- local-network/deploy/src/waves.ts | 14 ++++++++++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/local-network/configs/besu/log4j2.xml b/local-network/configs/besu/log4j2.xml index 6364c7fd..6309ddbb 100644 --- a/local-network/configs/besu/log4j2.xml +++ b/local-network/configs/besu/log4j2.xml @@ -10,7 +10,7 @@ - + diff --git a/local-network/configs/geth/geth.yml b/local-network/configs/geth/geth.yml index 5a4656c5..7f4fe47c 100644 --- a/local-network/configs/geth/geth.yml +++ b/local-network/configs/geth/geth.yml @@ -8,8 +8,6 @@ services: - ./run-geth.sh:/tmp/run.sh:ro env_file: - ../ec-common/peers.env - logging: - driver: none healthcheck: test: 'wget -qO /dev/null --header "content-type: application/json" --post-data {\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1} http://127.0.0.1:8545' interval: 5s diff --git a/local-network/configs/geth/run-geth.sh b/local-network/configs/geth/run-geth.sh index c022c6b8..b608afd0 100755 --- a/local-network/configs/geth/run-geth.sh +++ b/local-network/configs/geth/run-geth.sh @@ -9,7 +9,7 @@ IP=$(echo "$IP_RAW" | cut -d/ -f1) NETWORK=$(echo "$IP_RAW" | xargs ipcalc -n | awk -F= '{print $2}') PREFIX=$(echo "$IP_RAW" | xargs ipcalc -p | awk -F= '{print $2}') -tee /root/logs/bootnode.log < { if (isContractSetupResponse.result.value) { logger.info('The contract is already set up.'); } else { - const setupTxResult = await wavesApi1.transactions.broadcast(tx); - await wavesUtils.waitForTxn(wavesApi1, setupTxResult.id); + await wavesApi1.transactions.broadcast(tx); + await wavesUtils.waitForTxn(wavesApi1, tx.id); } }; @@ -88,6 +89,15 @@ export async function setup(force: boolean): Promise { logger.info('Wait Waves 1 node'); await wavesUtils.waitForUp(wavesApi1); + logger.info('Wait Waves node has at least one peer'); // Otherwise we can have problems with rollbacks + let connectedPeers = 0; + do { + await common.sleep(2000); + connectedPeers = (await wavesApi1.peers.fetchConnected()).peers.length; + } while (connectedPeers < 1); + + logger.info(`Waves nodes peers: ${connectedPeers}`); + logger.info('Set staking contract balances'); const isNew = await scSetBalances(); const waitTime = 3000;// To eliminate micro fork issue From 61f3eb7d4466800ab5f055a909188c43bd0955a8 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Thu, 12 Sep 2024 16:14:02 +0400 Subject: [PATCH 27/31] local-network: a common config for Waves nodes --- local-network/README.md | 6 ++-- .../configs/wavesnode/{common => }/.gitignore | 0 .../configs/wavesnode/common/logback.xml | 15 ---------- .../{common => }/genesis-template.conf | 0 local-network/configs/wavesnode/logback.xml | 5 ++++ local-network/configs/wavesnode/waves-1.conf | 3 -- local-network/configs/wavesnode/waves-2.conf | 7 ----- .../{common/waves-common.conf => waves.conf} | 9 ++++-- local-network/docker-compose.yml | 15 ++++------ local-network/genesis-update.sh | 4 +-- .../ChainContractSnapshotClient.scala | 29 ------------------- 11 files changed, 22 insertions(+), 71 deletions(-) rename local-network/configs/wavesnode/{common => }/.gitignore (100%) delete mode 100644 local-network/configs/wavesnode/common/logback.xml rename local-network/configs/wavesnode/{common => }/genesis-template.conf (100%) create mode 100644 local-network/configs/wavesnode/logback.xml delete mode 100644 local-network/configs/wavesnode/waves-1.conf delete mode 100644 local-network/configs/wavesnode/waves-2.conf rename local-network/configs/wavesnode/{common/waves-common.conf => waves.conf} (95%) delete mode 100644 src/main/scala/units/client/contract/ChainContractSnapshotClient.scala diff --git a/local-network/README.md b/local-network/README.md index c87e3a29..9e8ef30a 100644 --- a/local-network/README.md +++ b/local-network/README.md @@ -29,7 +29,7 @@ See [./deploy](./deploy/). # Keys * Node HTTP API Key: `testapi` -* CL accounts (see [genesis-template.conf](./configs/wavesnode/common/genesis-template.conf) for more information): +* CL accounts (see [genesis-template.conf](configs/wavesnode/genesis-template.conf) for more information): * Node wallet seed: * wavesnode-1: `devnet-1` * wavesnode-2: `devnet-2` @@ -100,5 +100,5 @@ See [Besu configuration](configs/besu/). ## How to change Waves initial miners or time between blocks -1. Update [genesis-template.conf](./configs/wavesnode/common/genesis-template.conf). -2. [genesis.conf](./configs/wavesnode/common/genesis.conf) will be updated in [restart.sh](./restart.sh). +1. Update [genesis-template.conf](configs/wavesnode/genesis-template.conf). +2. [genesis.conf](configs/wavesnode/genesis.conf) will be updated in [restart.sh](./restart.sh). diff --git a/local-network/configs/wavesnode/common/.gitignore b/local-network/configs/wavesnode/.gitignore similarity index 100% rename from local-network/configs/wavesnode/common/.gitignore rename to local-network/configs/wavesnode/.gitignore diff --git a/local-network/configs/wavesnode/common/logback.xml b/local-network/configs/wavesnode/common/logback.xml deleted file mode 100644 index d2c6282e..00000000 --- a/local-network/configs/wavesnode/common/logback.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - /var/log/waves/ChainContractSnapshotClient.log - - ${default.pattern} - - - - - - - diff --git a/local-network/configs/wavesnode/common/genesis-template.conf b/local-network/configs/wavesnode/genesis-template.conf similarity index 100% rename from local-network/configs/wavesnode/common/genesis-template.conf rename to local-network/configs/wavesnode/genesis-template.conf diff --git a/local-network/configs/wavesnode/logback.xml b/local-network/configs/wavesnode/logback.xml new file mode 100644 index 00000000..6d094c09 --- /dev/null +++ b/local-network/configs/wavesnode/logback.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/local-network/configs/wavesnode/waves-1.conf b/local-network/configs/wavesnode/waves-1.conf deleted file mode 100644 index d997e641..00000000 --- a/local-network/configs/wavesnode/waves-1.conf +++ /dev/null @@ -1,3 +0,0 @@ -include "common/waves-common.conf" - -waves.wallet.seed = HnyGuCEnV1A # devnet-1 , addr: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e diff --git a/local-network/configs/wavesnode/waves-2.conf b/local-network/configs/wavesnode/waves-2.conf deleted file mode 100644 index db29bc7d..00000000 --- a/local-network/configs/wavesnode/waves-2.conf +++ /dev/null @@ -1,7 +0,0 @@ -include "common/waves-common.conf" - -waves { - wallet.seed = HnyGuCEnV1B # devnet-2 , addr: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU - - l2.jwt-secret-file = /etc/secrets/jwtsecret -} diff --git a/local-network/configs/wavesnode/common/waves-common.conf b/local-network/configs/wavesnode/waves.conf similarity index 95% rename from local-network/configs/wavesnode/common/waves-common.conf rename to local-network/configs/wavesnode/waves.conf index 90015443..1c4d6042 100644 --- a/local-network/configs/wavesnode/common/waves-common.conf +++ b/local-network/configs/wavesnode/waves.conf @@ -113,7 +113,9 @@ waves { l2 { chain-contract = "3FdaanzgX4roVgHevhq8L8q42E7EZL9XTQr" - execution-client-address = "http://"${EXECUTION_CLIENT}":8551" + execution-client-address = "http://ec-"${NODE_NUMBER}":8551" + jwt-secret-file = /etc/secrets/jwtsecret + network { bind-address = "0.0.0.0" port = 6865 @@ -159,7 +161,10 @@ waves { units.ConsensusClient ] - wallet.password = "" + wallet { + seed = ${WAVES_WALLET_SEED} + password = "" + } } kamon.enable = no diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index 86b12367..06d85b41 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -39,14 +39,12 @@ services: - "127.0.0.1:16869:6869" environment: - WAVES_HEAP_SIZE=2g - - JAVA_OPTS=-Dwaves.config.directory=/etc/waves -Dlogback.file.level=TRACE - NODE_NUMBER=1 - - EXECUTION_CLIENT=ec-1 + - WAVES_WALLET_SEED=HnyGuCEnV1A # devnet-1, addr: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e volumes: + - ./configs/wavesnode:/etc/waves:ro + - ./configs/ec-common/jwtsecret-1.hex:/etc/secrets/jwtsecret:ro - ./logs/wavesnode-1:/var/log/waves - - ./configs/wavesnode/common:/etc/waves/common:ro - - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro - - ./configs/wavesnode/waves-1.conf:/etc/waves/waves.conf:ro depends_on: ec-1: condition: service_healthy @@ -60,13 +58,10 @@ services: - "127.0.0.1:26869:6869" environment: - WAVES_HEAP_SIZE=2g - - JAVA_OPTS=-Dwaves.config.directory=/etc/waves -Dlogback.file.level=TRACE - NODE_NUMBER=2 - - EXECUTION_CLIENT=ec-2 + - WAVES_WALLET_SEED=HnyGuCEnV1B # devnet-2, addr: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU volumes: - - ./configs/wavesnode/common:/etc/waves/common:ro - - ./configs/wavesnode/common/logback.xml:/etc/waves/logback.xml:ro - - ./configs/wavesnode/waves-2.conf:/etc/waves/waves.conf:ro + - ./configs/wavesnode:/etc/waves:ro - ./configs/ec-common/jwtsecret-2.hex:/etc/secrets/jwtsecret:ro - ./logs/wavesnode-2:/var/log/waves depends_on: diff --git a/local-network/genesis-update.sh b/local-network/genesis-update.sh index 25872f6e..abcc8fd6 100755 --- a/local-network/genesis-update.sh +++ b/local-network/genesis-update.sh @@ -18,7 +18,7 @@ else fi java -cp "${DIR}/.cache/waves.jar" com.wavesplatform.GenesisBlockGenerator \ - "${DIR}/configs/wavesnode/common/genesis-template.conf" \ - "${DIR}/configs/wavesnode/common/genesis.conf" > /dev/null + "${DIR}/configs/wavesnode/genesis-template.conf" \ + "${DIR}/configs/wavesnode/genesis.conf" > /dev/null echo "Genesis config updated" diff --git a/src/main/scala/units/client/contract/ChainContractSnapshotClient.scala b/src/main/scala/units/client/contract/ChainContractSnapshotClient.scala deleted file mode 100644 index be643b3a..00000000 --- a/src/main/scala/units/client/contract/ChainContractSnapshotClient.scala +++ /dev/null @@ -1,29 +0,0 @@ -package units.client.contract - -import cats.kernel.Monoid -import com.wavesplatform.account.Address -import com.wavesplatform.api.http.StateSnapshotJson -import com.wavesplatform.state.{DataEntry, NewTransactionInfo, StateSnapshot, TxMeta} -import com.wavesplatform.transaction.smart.InvokeScriptTransaction -import com.wavesplatform.utils.ScorexLogging -import play.api.libs.json.Json - -class ChainContractSnapshotClient(val contract: Address, snapshot: StateSnapshot) extends ChainContractClient with ScorexLogging { - - private val totalSnapshot: StateSnapshot = - Monoid[StateSnapshot].combineAll(snapshot +: snapshot.transactions.values.toSeq.map(_.snapshot)) - - def logDataChanges(): Unit = if (totalSnapshot.accountData.nonEmpty) { - snapshot.transactions.foreach { - case (id, txInfo @ NewTransactionInfo(tx: InvokeScriptTransaction, txSnapshot, _, TxMeta.Status.Succeeded, _)) - if tx.dApp == contract && txSnapshot.accountData.nonEmpty => // Don't resolve a possible alias, because it is only for logs - val dataJson = Json.toJson(StateSnapshotJson.fromSnapshot(txSnapshot, txInfo.status).accountData) - log.trace(s"[$id] Data changes: $dataJson") - - case _ => - } - } - - override def extractData(key: String): Option[DataEntry[?]] = - totalSnapshot.accountData.get(contract).flatMap(_.get(key)) -} From ce156b0a085272ca62a325969feb826a234ea594 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 16 Sep 2024 10:28:28 +0400 Subject: [PATCH 28/31] Generate JWT tokens --- local-network/.gitignore | 2 -- local-network/README.md | 2 ++ local-network/configs/ec-common/.gitignore | 1 + local-network/configs/ec-common/generate.sh | 22 +++++++++------- .../{jwtsecret-1.hex => jwt-secret-1.hex} | 2 +- .../{jwtsecret-2.hex => jwt-secret-2.hex} | 2 +- .../{jwtsecret-3.hex => jwt-secret-3.hex} | 2 +- .../{jwtsecret-4.hex => jwt-secret-4.hex} | 0 .../configs/ec-common/jwt-token-generate.sh | 26 +++++++++++++++++++ local-network/configs/ec-common/p2p-key-3.hex | 2 +- local-network/configs/ec-common/p2p-key-4.hex | 2 +- .../configs/ec-common/p2p-key-bootnode.hex | 2 +- 12 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 local-network/configs/ec-common/.gitignore rename local-network/configs/ec-common/{jwtsecret-1.hex => jwt-secret-1.hex} (98%) rename local-network/configs/ec-common/{jwtsecret-2.hex => jwt-secret-2.hex} (98%) rename local-network/configs/ec-common/{jwtsecret-3.hex => jwt-secret-3.hex} (98%) rename local-network/configs/ec-common/{jwtsecret-4.hex => jwt-secret-4.hex} (100%) create mode 100755 local-network/configs/ec-common/jwt-token-generate.sh diff --git a/local-network/.gitignore b/local-network/.gitignore index 658c75d9..1579cb20 100644 --- a/local-network/.gitignore +++ b/local-network/.gitignore @@ -1,5 +1,3 @@ -.DS_Store -.idea .env .cache/ data/ diff --git a/local-network/README.md b/local-network/README.md index 9e8ef30a..bda98739 100644 --- a/local-network/README.md +++ b/local-network/README.md @@ -57,6 +57,8 @@ a non-empty balance. So you can use them to issue transactions on EL. * wavesnode-1: http://127.0.0.1:16869/ * wavesnode-2: http://127.0.0.1:26869/ +If you need a JWT token for authenticated APIs, use [generate.sh](configs/ec-common/generate.sh). + # How to set up Metamask Settings: diff --git a/local-network/configs/ec-common/.gitignore b/local-network/configs/ec-common/.gitignore new file mode 100644 index 00000000..c1e6509a --- /dev/null +++ b/local-network/configs/ec-common/.gitignore @@ -0,0 +1 @@ +jwt-token-*.hex diff --git a/local-network/configs/ec-common/generate.sh b/local-network/configs/ec-common/generate.sh index fbb9903c..d5bf0a0d 100755 --- a/local-network/configs/ec-common/generate.sh +++ b/local-network/configs/ec-common/generate.sh @@ -3,21 +3,25 @@ DIR="$(cd "$(dirname "$0")" && pwd)" cd "${DIR}" || exit -for N in {1..5}; do - p2p_file="p2p-key-${N}" - jwt_file="jwtsecret-${N}" +for N in {1..4}; do + p2p_file="p2p-key-${N}.hex" + jwt_file="jwt-secret-${N}.hex" + jwt_token_file="jwt-token-${N}.hex" + # Generate p2p key without newline if [ ! -f "$p2p_file" ]; then - openssl rand 32 | xxd -p -c 32 > "$p2p_file" + openssl rand 32 | xxd -p -c 32 | tr -d '\n' > "$p2p_file" echo "Created $p2p_file" - else - echo "$p2p_file already exists, skipping..." fi + # Generate JWT secret without newline if [ ! -f "$jwt_file" ]; then - openssl rand 32 | xxd -p -c 32 > "$jwt_file" + openssl rand 32 | xxd -p -c 32 | tr -d '\n' > "$jwt_file" echo "Created $jwt_file" - else - echo "$jwt_file already exists, skipping..." fi + + # Generate JWT token + secret=$(cat "$jwt_file") + ./jwt-token-generate.sh "$secret" > "$jwt_token_file" + echo "Generated JWT token in $jwt_token_file" done diff --git a/local-network/configs/ec-common/jwtsecret-1.hex b/local-network/configs/ec-common/jwt-secret-1.hex similarity index 98% rename from local-network/configs/ec-common/jwtsecret-1.hex rename to local-network/configs/ec-common/jwt-secret-1.hex index 3dde3fc3..402a3f1e 100644 --- a/local-network/configs/ec-common/jwtsecret-1.hex +++ b/local-network/configs/ec-common/jwt-secret-1.hex @@ -1 +1 @@ -ed292c1b8df420f0fed62f9e83e3ca176b88e5723218b83d9e1b36df375e4ac4 +ed292c1b8df420f0fed62f9e83e3ca176b88e5723218b83d9e1b36df375e4ac4 \ No newline at end of file diff --git a/local-network/configs/ec-common/jwtsecret-2.hex b/local-network/configs/ec-common/jwt-secret-2.hex similarity index 98% rename from local-network/configs/ec-common/jwtsecret-2.hex rename to local-network/configs/ec-common/jwt-secret-2.hex index 377cb928..0a747833 100644 --- a/local-network/configs/ec-common/jwtsecret-2.hex +++ b/local-network/configs/ec-common/jwt-secret-2.hex @@ -1 +1 @@ -a59c7150d727e228fceabfc4497c21d6acbdd083e0063dadcb20e2be661cefb2 +a59c7150d727e228fceabfc4497c21d6acbdd083e0063dadcb20e2be661cefb2 \ No newline at end of file diff --git a/local-network/configs/ec-common/jwtsecret-3.hex b/local-network/configs/ec-common/jwt-secret-3.hex similarity index 98% rename from local-network/configs/ec-common/jwtsecret-3.hex rename to local-network/configs/ec-common/jwt-secret-3.hex index f5ab60a2..baa373af 100644 --- a/local-network/configs/ec-common/jwtsecret-3.hex +++ b/local-network/configs/ec-common/jwt-secret-3.hex @@ -1 +1 @@ -2703dcfc67b9a772756c4d354e2943fd7e3d8a2cb95b2129faa497b09662780d +2703dcfc67b9a772756c4d354e2943fd7e3d8a2cb95b2129faa497b09662780d \ No newline at end of file diff --git a/local-network/configs/ec-common/jwtsecret-4.hex b/local-network/configs/ec-common/jwt-secret-4.hex similarity index 100% rename from local-network/configs/ec-common/jwtsecret-4.hex rename to local-network/configs/ec-common/jwt-secret-4.hex diff --git a/local-network/configs/ec-common/jwt-token-generate.sh b/local-network/configs/ec-common/jwt-token-generate.sh new file mode 100755 index 00000000..d8318250 --- /dev/null +++ b/local-network/configs/ec-common/jwt-token-generate.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +hexsecret=$(echo -n "$1" | tr -d '\n') + +# Construct the header +jwt_header=$(echo -n '{"alg":"HS256","typ":"JWT"}' | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//) + +# Get the current Unix timestamp (seconds since 1970-01-01) +iat=$(date +%s) + +# Construct the payload with 'iat' claim +payload=$(echo -n "{\"iat\":${iat}}" | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//) + +# Calculate hmac signature -- note option to pass in the key as hex bytes +hmac_signature=$(echo -n "${jwt_header}.${payload}" | openssl dgst -sha256 -mac HMAC -macopt hexkey:$hexsecret -binary | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//) + +# Create the full token +jwt="${jwt_header}.${payload}.${hmac_signature}" + +# Output the generated JWT token +echo -n $jwt diff --git a/local-network/configs/ec-common/p2p-key-3.hex b/local-network/configs/ec-common/p2p-key-3.hex index fb351098..fbd82756 100644 --- a/local-network/configs/ec-common/p2p-key-3.hex +++ b/local-network/configs/ec-common/p2p-key-3.hex @@ -1 +1 @@ -244bb704084d2a49b4fc2da3b27a1c1c76329d7cac6fbadfd8c1a615730d6f77 +244bb704084d2a49b4fc2da3b27a1c1c76329d7cac6fbadfd8c1a615730d6f77 \ No newline at end of file diff --git a/local-network/configs/ec-common/p2p-key-4.hex b/local-network/configs/ec-common/p2p-key-4.hex index 8841a0e0..cd8c6af5 100644 --- a/local-network/configs/ec-common/p2p-key-4.hex +++ b/local-network/configs/ec-common/p2p-key-4.hex @@ -1 +1 @@ -7c2d9d0bb13ac806701462ab2e1bbcc54eb7b5e8f6658610a6e06dcc30e0aa47 +7c2d9d0bb13ac806701462ab2e1bbcc54eb7b5e8f6658610a6e06dcc30e0aa47 \ No newline at end of file diff --git a/local-network/configs/ec-common/p2p-key-bootnode.hex b/local-network/configs/ec-common/p2p-key-bootnode.hex index c27d77e7..cf2d9f0e 100644 --- a/local-network/configs/ec-common/p2p-key-bootnode.hex +++ b/local-network/configs/ec-common/p2p-key-bootnode.hex @@ -1 +1 @@ -dc51ae50601364b0d9354bad516acd16261447f89bde416399fa4ae5f2cbe8ab +dc51ae50601364b0d9354bad516acd16261447f89bde416399fa4ae5f2cbe8ab \ No newline at end of file From 7f6b92c0c80e83a495ed80db270530ee8514a01e Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 16 Sep 2024 10:43:29 +0400 Subject: [PATCH 29/31] Fixed logs --- local-network/configs/wavesnode/logback.xml | 5 ----- local-network/docker-compose.yml | 8 +++++--- 2 files changed, 5 insertions(+), 8 deletions(-) delete mode 100644 local-network/configs/wavesnode/logback.xml diff --git a/local-network/configs/wavesnode/logback.xml b/local-network/configs/wavesnode/logback.xml deleted file mode 100644 index 6d094c09..00000000 --- a/local-network/configs/wavesnode/logback.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index 06d85b41..a2ce8c67 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -27,7 +27,7 @@ services: - "127.0.0.1:28545:8545" # RPC port, useful because doesn't require an auth token volumes: - ./configs/ec-common/p2p-key-2.hex:/etc/secrets/p2p-key:ro - - ./configs/ec-common/jwtsecret-2.hex:/etc/secrets/jwtsecret:ro + - ./configs/ec-common/jwt-secret-2.hex:/etc/secrets/jwtsecret:ro - ./logs/ec-2:/root/logs wavesnode-1: @@ -38,12 +38,13 @@ services: ports: - "127.0.0.1:16869:6869" environment: + - JAVA_OPTS=-Dlogback.file.level=TRACE - WAVES_HEAP_SIZE=2g - NODE_NUMBER=1 - WAVES_WALLET_SEED=HnyGuCEnV1A # devnet-1, addr: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e volumes: - ./configs/wavesnode:/etc/waves:ro - - ./configs/ec-common/jwtsecret-1.hex:/etc/secrets/jwtsecret:ro + - ./configs/ec-common/jwt-secret-1.hex:/etc/secrets/jwtsecret:ro - ./logs/wavesnode-1:/var/log/waves depends_on: ec-1: @@ -57,12 +58,13 @@ services: ports: - "127.0.0.1:26869:6869" environment: + - JAVA_OPTS=-Dlogback.file.level=TRACE - WAVES_HEAP_SIZE=2g - NODE_NUMBER=2 - WAVES_WALLET_SEED=HnyGuCEnV1B # devnet-2, addr: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU volumes: - ./configs/wavesnode:/etc/waves:ro - - ./configs/ec-common/jwtsecret-2.hex:/etc/secrets/jwtsecret:ro + - ./configs/ec-common/jwt-secret-2.hex:/etc/secrets/jwtsecret:ro - ./logs/wavesnode-2:/var/log/waves depends_on: ec-2: From 58227257a5a094bd499268492db2e1dc651fc451 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 16 Sep 2024 12:50:21 +0400 Subject: [PATCH 30/31] Fixes --- .gitignore | 1 + .../configs/ec-common/jwt-token-generate.sh | 21 +++++++------------ local-network/docker-compose.yml | 18 +++++++++------- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 907f72cc..80467331 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store target .bsp .idea diff --git a/local-network/configs/ec-common/jwt-token-generate.sh b/local-network/configs/ec-common/jwt-token-generate.sh index d8318250..86cfdd84 100755 --- a/local-network/configs/ec-common/jwt-token-generate.sh +++ b/local-network/configs/ec-common/jwt-token-generate.sh @@ -7,20 +7,15 @@ fi hexsecret=$(echo -n "$1" | tr -d '\n') -# Construct the header -jwt_header=$(echo -n '{"alg":"HS256","typ":"JWT"}' | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//) +base64_url_encode() { + echo -n "$1" | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$// +} -# Get the current Unix timestamp (seconds since 1970-01-01) -iat=$(date +%s) +jwt_header=$(base64_url_encode '{"alg":"HS256","typ":"JWT"}') -# Construct the payload with 'iat' claim -payload=$(echo -n "{\"iat\":${iat}}" | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//) +iat=$(date +%s) # Seconds since 1970-01-01 +payload=$(base64_url_encode "{\"iat\":${iat}}") -# Calculate hmac signature -- note option to pass in the key as hex bytes -hmac_signature=$(echo -n "${jwt_header}.${payload}" | openssl dgst -sha256 -mac HMAC -macopt hexkey:$hexsecret -binary | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//) +hmac_signature=$(echo -n "${jwt_header}.${payload}" | openssl dgst -sha256 -mac HMAC -macopt hexkey:"${hexsecret}" -binary | base64_url_encode) -# Create the full token -jwt="${jwt_header}.${payload}.${hmac_signature}" - -# Output the generated JWT token -echo -n $jwt +echo -n "${jwt_header}.${payload}.${hmac_signature}" diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index a2ce8c67..643ddc96 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -1,6 +1,10 @@ name: l2 include: - ./configs/blockscout/${BS-enabled}.yml +x-waves-common-environment: &waves-common-environment + JAVA_OPTS: -Dlogback.file.level=TRACE + WAVES_LOG_LEVEL: TRACE + WAVES_HEAP_SIZE: 2g services: ec-1: container_name: ec-1 @@ -38,10 +42,9 @@ services: ports: - "127.0.0.1:16869:6869" environment: - - JAVA_OPTS=-Dlogback.file.level=TRACE - - WAVES_HEAP_SIZE=2g - - NODE_NUMBER=1 - - WAVES_WALLET_SEED=HnyGuCEnV1A # devnet-1, addr: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e + <<: *waves-common-environment + NODE_NUMBER: 1 + WAVES_WALLET_SEED: HnyGuCEnV1A # devnet-1, addr: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e volumes: - ./configs/wavesnode:/etc/waves:ro - ./configs/ec-common/jwt-secret-1.hex:/etc/secrets/jwtsecret:ro @@ -58,10 +61,9 @@ services: ports: - "127.0.0.1:26869:6869" environment: - - JAVA_OPTS=-Dlogback.file.level=TRACE - - WAVES_HEAP_SIZE=2g - - NODE_NUMBER=2 - - WAVES_WALLET_SEED=HnyGuCEnV1B # devnet-2, addr: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU + <<: *waves-common-environment + NODE_NUMBER: 2 + WAVES_WALLET_SEED: HnyGuCEnV1B # devnet-2, addr: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU volumes: - ./configs/wavesnode:/etc/waves:ro - ./configs/ec-common/jwt-secret-2.hex:/etc/secrets/jwtsecret:ro From 8be9518216be899701179af36f3f54c81afb0cd9 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Mon, 16 Sep 2024 13:25:52 +0400 Subject: [PATCH 31/31] local-network: wavesnode.yml --- local-network/configs/wavesnode/waves.conf | 2 +- local-network/configs/wavesnode/wavesnode.yml | 13 +++++++++++++ local-network/docker-compose.yml | 18 ++++++------------ 3 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 local-network/configs/wavesnode/wavesnode.yml diff --git a/local-network/configs/wavesnode/waves.conf b/local-network/configs/wavesnode/waves.conf index 1c4d6042..b7d38280 100644 --- a/local-network/configs/wavesnode/waves.conf +++ b/local-network/configs/wavesnode/waves.conf @@ -114,7 +114,7 @@ waves { chain-contract = "3FdaanzgX4roVgHevhq8L8q42E7EZL9XTQr" execution-client-address = "http://ec-"${NODE_NUMBER}":8551" - jwt-secret-file = /etc/secrets/jwtsecret + jwt-secret-file = "/etc/secrets/jwt-secret-"${NODE_NUMBER}".hex" network { bind-address = "0.0.0.0" diff --git a/local-network/configs/wavesnode/wavesnode.yml b/local-network/configs/wavesnode/wavesnode.yml new file mode 100644 index 00000000..8d7c9a2d --- /dev/null +++ b/local-network/configs/wavesnode/wavesnode.yml @@ -0,0 +1,13 @@ +services: + wavesnode: + image: unitsnetwork/consensus-client:main + pull_policy: never + environment: + JAVA_OPTS: -Dlogback.file.level=TRACE + WAVES_LOG_LEVEL: TRACE + WAVES_HEAP_SIZE: 2g + # NODE_NUMBER: + # WAVES_WALLET_SEED: + volumes: + - ./:/etc/waves:ro + - ../ec-common:/etc/secrets:ro diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index 643ddc96..39699668 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -1,10 +1,6 @@ name: l2 include: - ./configs/blockscout/${BS-enabled}.yml -x-waves-common-environment: &waves-common-environment - JAVA_OPTS: -Dlogback.file.level=TRACE - WAVES_LOG_LEVEL: TRACE - WAVES_HEAP_SIZE: 2g services: ec-1: container_name: ec-1 @@ -37,17 +33,16 @@ services: wavesnode-1: container_name: wavesnode-1 hostname: wavesnode-1 + extends: + file: ./configs/wavesnode/wavesnode.yml + service: wavesnode image: unitsnetwork/consensus-client:${WAVES_NODE_1_TAG:-main} - pull_policy: never ports: - "127.0.0.1:16869:6869" environment: - <<: *waves-common-environment NODE_NUMBER: 1 WAVES_WALLET_SEED: HnyGuCEnV1A # devnet-1, addr: 3FNraPMYcfuGREcxorNSEBHgNLjmYtaHy9e volumes: - - ./configs/wavesnode:/etc/waves:ro - - ./configs/ec-common/jwt-secret-1.hex:/etc/secrets/jwtsecret:ro - ./logs/wavesnode-1:/var/log/waves depends_on: ec-1: @@ -56,17 +51,16 @@ services: wavesnode-2: container_name: wavesnode-2 hostname: wavesnode-2 + extends: + file: ./configs/wavesnode/wavesnode.yml + service: wavesnode image: unitsnetwork/consensus-client:${WAVES_NODE_2_TAG:-main} - pull_policy: never ports: - "127.0.0.1:26869:6869" environment: - <<: *waves-common-environment NODE_NUMBER: 2 WAVES_WALLET_SEED: HnyGuCEnV1B # devnet-2, addr: 3FSrRN8X7cDsLyYTScS8Yf8KSwZgJBwf1jU volumes: - - ./configs/wavesnode:/etc/waves:ro - - ./configs/ec-common/jwt-secret-2.hex:/etc/secrets/jwtsecret:ro - ./logs/wavesnode-2:/var/log/waves depends_on: ec-2: