Context: Currently all of the message calls to ref-fvm in rust integration tests contain hardcoded hex string making the readability of the code extremely difficult and its maintainability hard.
Approach
Using alloy-rs and its sol! macro we are generating Rust types for custom Solidity structs and functions. This gives us an opportunity to set all of their fields individually and to also use the provided abi_encode method which is enough to generate the needed ABI encoded hex string.
Note: functions are encoded with their selector and have Call added to the the of the function (see sol! examples).
This generated string is then CBOR encoded using the cbor crate to comply with the desired format.
Description
Closes: https://github.com/filecoin-project/filecoin-solidity/issues/6 - Compile params automatically from ABI on rust tests
Context: Currently all of the message calls to ref-fvm in rust integration tests contain hardcoded hex string making the readability of the code extremely difficult and its maintainability hard.
Approach
Using alloy-rs and its
sol!
macro we are generating Rust types for custom Solidity structs and functions. This gives us an opportunity to set all of their fields individually and to also use the provided abi_encode method which is enough to generate the needed ABI encoded hex string.Note: functions are encoded with their selector and have
Call
added to the the of the function (see sol! examples).This generated string is then CBOR encoded using the cbor crate to comply with the desired format.