autonity / aut

A command-line RPC client for Autonity
MIT License
11 stars 10 forks source link

`contract call` to `Accountability.abi` `getValidatorAccusation` throws `web3.exception.ContractCustomError` #126

Closed cmjc closed 6 months ago

cmjc commented 11 months ago

Bug Calling the Accountability Contract Interface function getValidatorAccusation using aut contract call fails throwing web3.exception.ContractCustomError.

Note that an equivalent call to getValidatorFault succeeds.

Expected behaviour The method returns without error, the response being:

For example, a call to getValidatorFaults returns so:

ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut contract call --address 0x5a443704dd4B594B382c22a083e2BD3090A6feF3 --abi Accountability.abi getValidatorFaults 0x21bb01Ae8EB831fFf68EbE1D87B11c85a766C94C
[]

aut version

$ aut --version
aut, version 0.3.0.dev1

Example

ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut contract call --address 0x5a443704dd4B594B382c22a083e2BD3090A6feF3 --abi Accountability.abi getValidatorAccusation  0x21bb01Ae8EB831fFf68EbE1D87B11c85a766C94C
web3.exceptions.ContractCustomError: 0x4e487b710000000000000000000000000000000000000000000000000000000000000011

To replicate

  1. call aut contract call specifying the Accountability contract address and ABI, either in the call per example or in your .autrc config file.
cmjc commented 7 months ago

Testing with aut 0.3.0 the problem remains:

aut contract call --address 0x5a443704dd4B594B382c22a083e2BD3090A6feF3 getValidatorAccusation 0xaf86859ea7e36f580d2702caeeaf7a79a3838449
web3.exceptions.ContractCustomError: 0x4e487b710000000000000000000000000000000000000000000000000000000000000011
...
aut --version
aut, version 0.3.0
aiman commented 7 months ago

@cmjc There is no need to re-test an issue unless the issue has been marked as fixed, or there is reason to believe there would be different behavior.

szemate commented 6 months ago

Expected behaviour

The method returns without error, the response being:

  • [] if no accusation, else an Event object of type FaultProof.

Note that an equivalent call to getValidatorFault succeeds.

I don't think this should be the expected behaviour.

The return type of getValidatorFault is Event[] i.e. the return value in case of no accusation is expected to be an empty array indeed.

However for getValidatorAccusation the return type is a single Event object. If there is no accusation, the exepected output is

web3.exceptions.ContractLogicError: execution reverted: no accusation

because of

require(validatorAccusation[_val] > 0 , "no accusation");

in Accountability.sol.


Interestingly, I got the expected output "no accusation" on Devnet and Bakerloo networks, but on Piccadilly the output is the reported

web3.exceptions.ContractCustomError: 0x4e487b710000000000000000000000000000000000000000000000000000000000000011

I suspect some kind of ABI version mismatch.

szemate commented 6 months ago

Closing as this has been fixed in the Accountability contract, see https://github.com/autonity/autonity/issues/951#issuecomment-1971926646.