Closed cmjc closed 6 months ago
Update: a revision of the call to use the index number removes that error ValueError: invalid literal for int() with base 10: 'InvalidProposal'
Now using aut version 0.3.0
, I get an Assertion Error, calling with an example here to call a validator for a PVN
error (rule 2):
aut contract call --address 0x5a443704dd4B594B382c22a083e2BD3090A6feF3 canAccuse 0x43936c8c13ffe8078d9e374d42e0b4f27d35352a 2 3475260
AssertionError
Because uint256 starts at 0 and InvalidProposal is the 9th enumeration it is perhaps expecting the value 8?
Yes it is correct. The ABI type spec looks like:
{
"internalType": "enum Accountability.Rule",
"name": "_rule",
"type": "uint8"
},
and therefore web3.py translates it into an int
parameter.
As the aut contract call
function is supposed to work with any contract ABI I don't think we should add a workaround here. I would propose a "won't fix" for this issue, and it will be implemented properly in #135 when we add proper CLI commands for the Accountability functionality.
Now using aut version 0.3.0, I get an Assertion Error, calling with an example here to call a validator for a PVN error (rule 2):
I could reproduce it, this error is fixed by https://github.com/autonity/autonity.py/pull/45.
Bug
These methods take as parameters:
The
_rule
values are defined as a string enumeration type:https://github.com/autonity/autonity/blob/8183c96276bfc0764ad59b31cde423d6245329c0/autonity/solidity/contracts/Accountability.sol#L30
The function method signatures are:
https://github.com/autonity/autonity/blob/8183c96276bfc0764ad59b31cde423d6245329c0/autonity/solidity/contracts/Accountability.sol#L173
function canAccuse(address _offender, Rule _rule, uint256 _block) public view
https://github.com/autonity/autonity/blob/8183c96276bfc0764ad59b31cde423d6245329c0/autonity/solidity/contracts/Accountability.sol#L165
function canSlash(address _offender, Rule _rule, uint256 _block) public view returns (bool) {
The bug is calling the Accountability Contract Interface function
canAccuse
orcanSlash
usingaut contract call
fails throwing aValueError
on the type of the second method argument_rule
:aut
is expecting an integer not a string. See Example beneath.Because
uint256
starts at0
andInvalidProposal
is the 9th enumeration it is perhaps expecting the value8
?Expected behaviour The method returns without error.
aut version
Example
To replicate
get valid values for parameters
aut validator list
to get a validator addressaut block height
to return a valid block height value.Accountability.sol
and get a valid rule ID - https://github.com/autonity/autonity/blob/8183c96276bfc0764ad59b31cde423d6245329c0/autonity/solidity/contracts/Accountability.sol#L30call
aut contract call
specifying the Accountability contract address and ABI, either in the call per example or in your.autrc
config file.