Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransactionException with empty revert reason #55

Open
jdreddaway opened this issue Oct 30, 2022 · 1 comment
Open

TransactionException with empty revert reason #55

jdreddaway opened this issue Oct 30, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@jdreddaway
Copy link

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

@jdreddaway jdreddaway added the bug Something isn't working label Oct 30, 2022
@Julius278
Copy link

same issue here with
web3j-core 4.12.2
web3j-unit 4.12.2
web3j-maven-plugin 4.12.1

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants