Skip to content

Conversation

@RaoulSchaffranek
Copy link
Member

@RaoulSchaffranek RaoulSchaffranek commented Oct 25, 2025

This PR adds implementations for Foundry's toString cheat codes. They're frequently used in tests and needed for Simbolik.

function toString(address) external returns (string memory);
function toString(bytes) external returns (string memory);
function toString(bool) external returns (string memory);
function toString(bytes32) external returns (string memory);
function toString(uint256) external returns (string memory);
function toString(int256) external returns (string memory);

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements Foundry's toString cheatcode functions, enabling conversion of various data types (address, bytes, bool, bytes32, uint256, int256) to their string representations. These cheatcodes are frequently used in tests and are needed for Simbolik.

Key Changes:

  • Implements six toString variants with appropriate conversion logic including EIP-55 checksum for addresses
  • Moves selector definitions from unimplemented to implemented section
  • Removes corresponding tests from the skip list to enable verification

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/kontrol/kdist/cheatcodes.md Adds implementation rules for all toString variants with helper functions for address checksumming and hex conversion; moves selectors to implemented section
src/tests/integration/test-data/foundry-prove-skip Removes six ToStringTest entries from skip list to enable test execution
src/tests/integration/test-data/foundry/test/ToStringTest.t.sol Updates test data from zero value to meaningful hex value for better validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@palinatolmach palinatolmach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! I just left a couple of suggestions removing empty lines for consistency. Did you get a chance to run these cheatcodes with symbolic arguments? It might be good to add a test for it, at least for some arg types, to make sure the execution doesn't crash.

RaoulSchaffranek and others added 3 commits October 28, 2025 17:54
Co-authored-by: Palina <[email protected]>
Co-authored-by: Palina <[email protected]>
Co-authored-by: Palina <[email protected]>
@automergerpr-permission-manager automergerpr-permission-manager bot merged commit 50f22ff into master Oct 28, 2025
9 checks passed
@automergerpr-permission-manager automergerpr-permission-manager bot deleted the raoul/toString-cheatcodes branch October 28, 2025 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants