farcasterxyz / contracts

Implementation of the Farcaster contracts
https://www.farcaster.xyz/
MIT License
334 stars 118 forks source link

test: simplify symbolic tests using new halmos cheatcode #431

Open daejunpark opened 5 days ago

daejunpark commented 5 days ago

Motivation

This PR improves symbolic tests using new halmos cheatcode createCalldata().

Previously, symbolic tests required custom calldata generators to handle dynamic-sized arrays and bytes. The new createCalldata() cheatcode now seamlessly supports such dynamically-sized parameters by considering all combinations of size candidates. These sizes can be specified using the additional flags --array-lengths and --default-bytes-lengths (refer to halmos -h for more details.)

With this new cheatcode, the symbolic tests are now much simpler to understand and maintain, while also accounting for more combinations of dynamic parameter sizes.

Change Summary

Replaced the custom calldata generator _calldataFor() with the createCalldata() cheatcode.

Merge Checklist

Choose all relevant options below by adding an x now or at any time before submitting for review


PR-Codex overview

This PR focuses on simplifying the handling of function selectors and calldata in various smart contract tests. It removes unnecessary functions and improves the way calldata is generated, enhancing code clarity and maintainability.

Detailed summary

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}