Open aaronbuchwald opened 1 year ago
We have discussed it with @aaronbuchwald and we lean towards these two solutions:
abi
package. Results will be written to a json file.Pros:
Cons:
- We can create a solidity function for different inputs as following:
function encode(string memory _string1, uint _uint, string memory _string2) public pure returns (bytes memory) {
result = abi.encode(_string1, _uint, _string2)
precompileResult = precompile.encode(_string1, _uint, _string2)
require(result == precompileResult)
}
where the precompile contract is also generated to perform same encoding with abi packers.
Pros:
Cons:
After migrating an upstream change from geth here: https://github.com/ava-labs/subnet-evm/pull/750 (upstream PR here: https://github.com/ethereum/go-ethereum/pull/26568) we discussed adding better testing coverage to the ABI package.
We should set up a test framework that packs/unpacks Solidity types using the ABI vs. an actual Solidity contract returning an encoded type vs. unpacking a byte array into a specific type to ensure that the behaviors match.
We should set this framework up, so that we can easily run differential fuzzing between the ABI package and a generated Solidity contract that packs / unpacks the relevant types to search for any further edge cases / discrepancies that may exist.