diff --git a/README.md b/README.md index bca79fc..9fde892 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ repositories { } dependencies { - implementation "org.web3j:core:4.10.2" - implementation "org.web3j:web3j-evm:4.10.2" + implementation "org.web3j:core:4.10.3" + implementation "org.web3j:web3j-evm:4.10.3" } ``` diff --git a/build.gradle b/build.gradle index 01c33af..764616e 100644 --- a/build.gradle +++ b/build.gradle @@ -7,21 +7,21 @@ plugins { id 'com.diffplug.gradle.spotless' version '4.5.1' id 'io.codearte.nexus-staging' version '0.21.1' id 'de.marcphilipp.nexus-publish' version '0.4.0' - id 'org.jetbrains.kotlin.jvm' version '1.6.21' - id 'de.undercouch.download' version '4.0.0' + id 'org.jetbrains.kotlin.jvm' version '1.8.10' + id 'de.undercouch.download' version '4.1.2' } description 'Web3j-evm extension' ext { - web3jVersion = '4.10.2' + web3jVersion = '4.10.3' log4jVersion = '2.15.0' guavaVersion = '28.1-jre' jacksonVersion = '2.10.0' klaxonVersion = '5.0.1' - kotlinVersion = '1.6.21' - besuPluginVersion = '23.4.1' - besuInternalVersion = '23.4.1' + kotlinVersion = '1.8.10' + besuPluginVersion = '23.7.0' + besuInternalVersion = '23.7.0' besuInternalCryptoVersion = '23.1.3' besuCryptoDepVersion = '0.7.1' } @@ -59,7 +59,6 @@ dependencies { implementation "org.web3j:core:$web3jVersion" implementation "com.google.guava:guava:$guavaVersion" implementation "com.beust:klaxon:$klaxonVersion" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion" def withoutAbi = { exclude group: 'org.web3j', module: 'abi' } diff --git a/gradle.properties b/gradle.properties index b98ef93..bf0d888 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official group=org.web3j -version=4.10.3-SNAPSHOT +version=4.10.4-SNAPSHOT diff --git a/gradle/spotless/build.gradle b/gradle/spotless/build.gradle index 9dd2d47..2edff87 100644 --- a/gradle/spotless/build.gradle +++ b/gradle/spotless/build.gradle @@ -9,6 +9,7 @@ task downloadJavaLicense(type: Download) { onlyIfModified true } + task downloadFormatterProperties(type: Download) { src 'https://raw.githubusercontent.com/web3j/build-tools/master/gradle/spotless/formatter.properties' dest new File("$rootDir/gradle/spotless",'formatter.properties') diff --git a/src/main/kotlin/org/web3j/evm/EmbeddedEthereum.kt b/src/main/kotlin/org/web3j/evm/EmbeddedEthereum.kt index 084d176..f17b169 100644 --- a/src/main/kotlin/org/web3j/evm/EmbeddedEthereum.kt +++ b/src/main/kotlin/org/web3j/evm/EmbeddedEthereum.kt @@ -40,7 +40,9 @@ import java.util.Optional import org.web3j.abi.datatypes.Address as wAddress import org.web3j.protocol.core.methods.request.Transaction as wTransaction import org.web3j.protocol.core.methods.response.TransactionReceipt as wTransactionReceipt +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalParameter import org.web3j.evm.utils.TestAccountsConstants +import org.web3j.protocol.core.methods.response.EthBlock.Withdrawal /** * Embedded Web3j Ethereum blockchain. @@ -309,10 +311,19 @@ class EmbeddedEthereum( transactionResults, null, // TODO? null, // TODO? - blockResult.baseFeePerGas + blockResult.baseFeePerGas, + blockResult.withdrawalsRoot, + blockResult.withdrawals?.map { withdrawalParameter -> + toWithdrawal(withdrawalParameter) + }?.toList() ) } + private fun toWithdrawal(withdrawalParameter: WithdrawalParameter): Withdrawal { + val withdrawal = withdrawalParameter.toWithdrawal() + return Withdrawal(withdrawal.index.toString(), withdrawal.validatorIndex.toString(), withdrawal.address.toHexString(), withdrawal.amount.toHexString()) + } + fun ethGetCode(w3jAddress: wAddress, defaultBlockParameter: String): String { val blockParameter = BlockParameter(defaultBlockParameter) val blockNumber: Optional = blockParameter.number diff --git a/src/main/kotlin/org/web3j/evm/InMemoryBesuChain.kt b/src/main/kotlin/org/web3j/evm/InMemoryBesuChain.kt index 7132e3e..aa51202 100644 --- a/src/main/kotlin/org/web3j/evm/InMemoryBesuChain.kt +++ b/src/main/kotlin/org/web3j/evm/InMemoryBesuChain.kt @@ -54,6 +54,7 @@ import org.slf4j.LoggerFactory import java.math.BigInteger import java.nio.charset.StandardCharsets import java.util.Optional +import org.hyperledger.besu.ethereum.storage.keyvalue.VariablesKeyValueStorage import org.hyperledger.besu.ethereum.vm.CachingBlockHashLookup import org.hyperledger.besu.evm.internal.EvmConfiguration import org.hyperledger.besu.evm.worldstate.WorldUpdater @@ -105,8 +106,9 @@ class InMemoryBesuChain( ) val keyValueStorage = InMemoryKeyValueStorage() + val variablesStorage = VariablesKeyValueStorage(keyValueStorage) val blockchainStorage = KeyValueStoragePrefixedKeyBlockchainStorage( - keyValueStorage, MainnetBlockHeaderFunctions() + keyValueStorage, variablesStorage, MainnetBlockHeaderFunctions() ) val worldStateStorage = WorldStateKeyValueStorage(InMemoryKeyValueStorage()) val worldStatePreimageStorage = WorldStatePreimageKeyValueStorage(InMemoryKeyValueStorage())