mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 07:28:05 -05:00
coordinator: fix duplicated anchoring on high frequency tick interval (#1135)
This commit is contained in:
@@ -75,9 +75,6 @@
|
||||
<!-- </RollingFile>-->
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<!-- <Logger name="net.consensys.linea.jsonrpc.client" level="DEBUG" additivity="false">-->
|
||||
<!-- <appender-ref ref="console"/>-->
|
||||
<!-- </Logger>-->
|
||||
<!-- <Logger name="net.consensys.zkevm.ethereum.coordination.dynamicgasprice.GasPriceUpdaterImpl" level="TRACE" additivity="false">-->
|
||||
<!-- <appender-ref ref="console"/>-->
|
||||
<!-- </Logger>-->
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.consensys.linea.contract.l1
|
||||
|
||||
import build.linea.contract.LineaRollupV6
|
||||
import linea.contract.l1.Web3JLineaRollupSmartContractClientReadOnly
|
||||
import linea.domain.BlockParameter.Companion.toBlockParameter
|
||||
import linea.domain.gas.GasPriceCaps
|
||||
import linea.kotlin.toULong
|
||||
import linea.web3j.SmartContractErrors
|
||||
@@ -91,9 +92,9 @@ class Web3JLineaRollupSmartContractClient internal constructor(
|
||||
return transactionManager.currentNonce().toULong()
|
||||
}
|
||||
|
||||
private fun resetNonce(blockNumber: BigInteger?): SafeFuture<ULong> {
|
||||
private fun resetNonce(blockNumber: BigInteger): SafeFuture<ULong> {
|
||||
return transactionManager
|
||||
.resetNonce(blockNumber)
|
||||
.resetNonce(blockNumber.toBlockParameter())
|
||||
.thenApply { currentNonce() }
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import linea.web3j.ethapi.Web3jEthApiClient
|
||||
import linea.web3j.gas.EIP1559GasProvider
|
||||
import linea.web3j.requestAsync
|
||||
import linea.web3j.transactionmanager.AsyncFriendlyTransactionManager
|
||||
import net.consensys.linea.async.toSafeFuture
|
||||
import net.consensys.linea.contract.L2MessageService
|
||||
import net.consensys.linea.contract.Web3JContractAsyncHelper
|
||||
import org.apache.logging.log4j.LogManager
|
||||
@@ -157,7 +156,9 @@ class Web3JL2MessageServiceSmartContractClient(
|
||||
|
||||
override fun getAddress(): String = contractAddress
|
||||
override fun getVersion(): SafeFuture<L2MessageServiceSmartContractVersion> = getSmartContractVersion()
|
||||
override fun getDeploymentBlock(): SafeFuture<ULong> { return deploymentBlockNumberProvider() }
|
||||
override fun getDeploymentBlock(): SafeFuture<ULong> {
|
||||
return deploymentBlockNumberProvider()
|
||||
}
|
||||
|
||||
override fun getLastAnchoredL1MessageNumber(block: BlockParameter): SafeFuture<ULong> {
|
||||
return contractClientAtBlock(block, L2MessageService::class.java)
|
||||
@@ -202,14 +203,18 @@ class Web3JL2MessageServiceSmartContractClient(
|
||||
)
|
||||
|
||||
return web3jContractHelper
|
||||
.sendTransactionAfterEthCallAsync(
|
||||
function = function,
|
||||
weiValue = BigInteger.ZERO,
|
||||
gasPriceCaps = null,
|
||||
)
|
||||
.transactionManager
|
||||
.resetNonce(blockParameter = BlockParameter.Tag.LATEST)
|
||||
.thenCompose {
|
||||
web3jContractHelper
|
||||
.sendTransactionAfterEthCallAsync(
|
||||
function = function,
|
||||
weiValue = BigInteger.ZERO,
|
||||
gasPriceCaps = null,
|
||||
)
|
||||
}
|
||||
.thenApply { response ->
|
||||
response.transactionHash
|
||||
}
|
||||
.toSafeFuture()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package linea.web3j.transactionmanager
|
||||
|
||||
import linea.domain.BlockParameter
|
||||
import linea.kotlin.toULong
|
||||
import linea.web3j.domain.toWeb3j
|
||||
import linea.web3j.requestAsync
|
||||
import org.apache.logging.log4j.LogManager
|
||||
import org.web3j.abi.datatypes.Function
|
||||
@@ -7,8 +10,6 @@ import org.web3j.crypto.Blob
|
||||
import org.web3j.crypto.Credentials
|
||||
import org.web3j.crypto.RawTransaction
|
||||
import org.web3j.protocol.Web3j
|
||||
import org.web3j.protocol.core.DefaultBlockParameter
|
||||
import org.web3j.protocol.core.DefaultBlockParameterName
|
||||
import org.web3j.protocol.core.RemoteFunctionCall
|
||||
import org.web3j.protocol.core.methods.response.EthSendTransaction
|
||||
import org.web3j.protocol.core.methods.response.TransactionReceipt
|
||||
@@ -66,16 +67,15 @@ class AsyncFriendlyTransactionManager : RawTransactionManager {
|
||||
resetNonce().get()
|
||||
}
|
||||
|
||||
fun resetNonce(blockNumber: BigInteger? = null): SafeFuture<Unit> {
|
||||
val blockParameter = blockNumber
|
||||
?.let { DefaultBlockParameter.valueOf(blockNumber) }
|
||||
?: DefaultBlockParameterName.LATEST
|
||||
|
||||
fun resetNonce(blockParameter: BlockParameter = BlockParameter.Tag.LATEST): SafeFuture<ULong> {
|
||||
return web3j.ethGetTransactionCount(
|
||||
fromAddress,
|
||||
blockParameter,
|
||||
blockParameter.toWeb3j(),
|
||||
)
|
||||
.requestAsync { setNonce(it.transactionCount) }
|
||||
.requestAsync {
|
||||
setNonce(it.transactionCount)
|
||||
it.transactionCount.toULong()
|
||||
}
|
||||
}
|
||||
|
||||
fun currentNonce(): BigInteger {
|
||||
|
||||
Reference in New Issue
Block a user