Closed hellgate13 closed 1 year ago
@metalicjames
Thanks for your report @hellgate13. It's worth pointing out that the server's response to methods.mint.call(...)
(which invokes ethereum's eth_call
json_rpc) is not well-defined since the mint()
call requires an alteration to the contract's state. The system does handle functions that can be run locally (i.e. read-only) without changing state such as:
myContract.methods.totalSupply().call().then(console.log)
.
All of that being said, the system's response is certainly not correct and it should not crash. We will issue a fix in the next few days.
Thank you for Response.
However I do have one question.
I think that executing a smart contract by putting ABI code in the input data to sendRawTransxaction also has the commonality of changing the contract state like using eth_call.
{
...
from: '0x01A151CC5ED14d110cc0e6b64360913DE9f453F1',
to: '0x01A151CC5ED14d110cc0e6b64360913DE9f453F1',
value: BigNumber { value: "0" },
data: '0xa0712d6800000000000000000000000000000000000000000000000000000000000003e8', <- this
...
}
Arccrding to your answer, System only handles read-only functions, so I think the ABI Byte code in sendRawTransaction shouldn;t have been executed.
I realize i'm asking a dumb question because I don't understand System Architecture, but maybe you can help me out?
The system, of course, handles transactions that modify state.
The mint()
function of your contract - which requires a change to the state of contract - can be invoked with both eth_sendRawTransaction
and eth_call
. However, as described in the Ethereum JSON-RPC API, eth_call
must execute messages "without creating a transaction on the block chain" and hence the system behavior when invoked with a state changing function is not well defined. Note that eth_sendRawTransaction
does indeed commit state changes.
Also, note the web3js documentation you linked above on methods.myMethod.call
: "Will call a “constant” method and execute its smart contract method in the EVM without sending any transaction. Note calling cannot alter the smart contract state."
I hope I understood your question correctly and you find this helpful.
Again, we will make changes such that the system responds gracefully when eth_call
is invoked with a function that requires state changes.
thank you for your answering my stupid question.
it made me realize that i need to study much more about blockchain system, Web3JS and OpenCBDC System.
thank you for your answering my stupid question.
it made me realize that i need to study much more about blockchain system, Web3JS and OpenCBDC System.
Not at all @hellgate13. Your contribution is appreciated and we look forward to hearing more of your work.
Sounds like this issue has been resolved. Additionally, the referenced commit by @AlexRamRam resolves the infinite loop problem if call() is used in an attempt to change state. @hellgate13 are you comfortable with this issue being closed?
thank you for update.
The contract.mint.send(from : address) in web3j library is throwing a signature error, but i'm guessing this is a problem with my setup.
I have checked that when i incorrectly request the mint function with call ( contract.mint.call() ) it returns an empty value.
I agree that this issue is closed.
Affected Branch
programmability
Basic Diagnostics
[X] I've pulled the latest changes on the affected branch and the issue is still present.
[X] The issue is reproducible in docker
Description
In order to reproduce the issue, follow these steps:
For now, based on the logs, it looks like the write locked and not released. do_try_lock_request of type write when m_is_readonly_run = true
The tested logs can be found in the following repositories : https://github.com/Black-NS/opencbdc-erc20-tesing/tree/develop/logs
Thank you.
Code of Conduct