TransactionException with empty revert reason
Steps To Reproduce
Here's my test:
package bounty_hunter_gradle
import kotlin.test.assertFailsWith
import com.google.common.truth.Truth.assertThat
import java.math.BigInteger
import java.time.Duration
import java.time.Instant
import org.junit.jupiter.api.Test
import org.web3j.EVMTest
import org.web3j.NodeType
import org.web3j.protocol.Web3j
import org.web3j.protocol.core.methods.response.TransactionReceipt
import org.web3j.protocol.exceptions.TransactionException
import org.web3j.tx.TransactionManager
import org.web3j.tx.gas.ContractGasProvider
import bounty_hunter_gradle.web3j.Bounties
@EVMTest(type = NodeType.EMBEDDED)
class AppTest {
@Test
fun shouldAnswerWithTrue(
web3j: Web3j, transactionManager: TransactionManager, gasProvider: ContractGasProvider,
) {
val bounties: Bounties = Bounties.deploy(web3j, transactionManager, gasProvider).send()
val deadline: BigInteger = BigInteger.valueOf(Instant.now().plus(Duration.ofHours(1)).getEpochSecond())
val send: TransactionReceipt = bounties.issueBounty("test_bounty", deadline, BigInteger.valueOf(1000)).send()
assertThat(send.getStatus()).isEqualTo("ok")
}
}
Here's the contract: Bounties.sol.txt
Here's the test run details: index.html.txt
Expected behavior
The error message for TransactionException contains the reason the transaction failed.
Actual behavior
Here's the test output:
org.web3j.protocol.exceptions.TransactionException: Transaction 0x0d91b6a3ab8c18cfb2788d6bc3f67e3d7f59d46be96f4aa06dc4a83bb29b5697 has failed with status: 0x0. Gas used: 36782. Revert reason: ''.
at app//org.web3j.tx.Contract.executeTransaction(Contract.java:419)
at app//org.web3j.tx.Contract.executeTransaction(Contract.java:358)
at app//org.web3j.tx.Contract.executeTransaction(Contract.java:352)
at app//org.web3j.tx.Contract.lambda$executeRemoteCallTransaction$4(Contract.java:457)
at app//org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:42)
at app//bounty_hunter_gradle.AppTest.shouldAnswerWithTrue(AppTest.kt:30)
...
Environment
JUnit test with the embedded EVM
_
- Web3j version: 4.9.4
- Java or Android version: openjdk version "17.0.4.1" 2022-08-12 LTS
- Operating System: Ubuntu
Additional context
none
TransactionException with empty revert reason
Steps To Reproduce
Here's my test:
Here's the contract: Bounties.sol.txt
Here's the test run details: index.html.txt
Expected behavior
The error message for
TransactionExceptioncontains the reason the transaction failed.Actual behavior
Here's the test output:
Environment
JUnit test with the embedded EVM
_
Additional context
none