eth_call can run a transaction to see whether a transaction will succeed or did succeed and return the result of the transaction which can include the reason for the revert if a solidity developer specifies a reason.
Example
function test() payable public {
require(msg.value > 0, "msg.value too small");
require(false, "this failed cuz this is always false");
}
Say I call test() with a transaction where I sent 2 eth. It would fail with message this failed cuz this is always false. However, if I want to use eth_call to get the reason, I'm restricted to only transactions with an empty value field. When if I attempt without any eth in transaction options so the message will always be msg.value too small, so I essentially tested a different transaction.
I made the TransactionOptions NoPay to be forall. TransactionOptions a. Maybe this is too flexible so would appreciate feedback.
Purpose
eth_call
can run a transaction to see whether a transaction will succeed or did succeed and return the result of the transaction which can include the reason for the revert if a solidity developer specifies a reason.Example
Say I call
test()
with a transaction where I sent 2 eth. It would fail with messagethis failed cuz this is always false
. However, if I want to useeth_call
to get the reason, I'm restricted to only transactions with an emptyvalue
field. When if I attempt without any eth in transaction options so the message will always bemsg.value too small
, so I essentially tested a different transaction.I made the
TransactionOptions NoPay
to beforall. TransactionOptions a
. Maybe this is too flexible so would appreciate feedback.Cheers! Charles