hyperledger / web3j-maven-plugin

web3j Maven plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrade the generator to reflect changes in web3j

flefevre opened this issue · comments

I have issed an error in web3j 1
Initially I was thinking the error comes from FastRawTransactionManager, in fact after a deeper analysis it is due to the fact the generated code from web3j-Maven-plugin is not compliant with latest changes in web3j plugin.

protected SimpleStorage(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
    }

    protected SimpleStorage(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
    }

default constructor are deprecated super

By adding manually the following one, I was able to solve the error

protected SimpleStorage(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
        super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
    }

So I would like to propose a PR where the generator is upgraded with a new constructor

I have no idéa where to modify the generator ? Does anyone have an advice ? And confirmé it comes from web3j or web3j-maven-plugin or solcj ?
Thanks

the plugin is only an execution "helper" of the generator. So if we need to change anything in the generator, we have to do that inside the web3j project.

Thanks for your analysis.
Nevertheless I have tried to highlight this problem in web3j github project, I was not able to convince that a problem exists and that it is located in web3j generator.

Initially I created the following issue:
hyperledger/web3j#688
FastRawTransactionManager is not able to deploy smartcontract #688

I will add the code snipped above wondering it will help us to adress this issue which is due to a switch of API in web3j not upgraded in the web3j generator.

I have made a PR in the web3j project: hyperledger/web3j#711

Stumbled upon the same issue when trying to upgrade to the latest web3j:

java.lang.NoSuchMethodException:
test.integ.be.e_contract.ethereum.ra.contract.DemoContract.<init>(java.lang.String, 
org.web3j.protocol.Web3j, org.web3j.tx.TransactionManager, 
org.web3j.tx.gas.ContractGasProvider)