rust-ethereum / ethabi

Encode and decode smart contract invocations
Apache License 2.0
517 stars 186 forks source link

Parsing constant functions from newer solidity ("stateMutability" instead of "constant") #208

Closed smessmer closed 3 years ago

smessmer commented 3 years ago

In the original JSON ABI specification, there was a constant flag for each function, but that was deprecated and is now replaced with stateMutability. Newer solidity only generates stateMutability in the JSON output, constant isn't generated anymore. However, ethabi deserialization still attempts to find a constant parameter, and since it's missing, erroneously marks all functions as non-constant even if they have stateMutability: "view" set in the JSON.

vkgnosis commented 3 years ago

StateMutability has been added in 9121c221b9d83b7931022e47f526591801699652 .