Skip to content

Instantly share code, notes, and snippets.

@arthurgousset
Last active December 10, 2022 01:04
Show Gist options
  • Save arthurgousset/d47d8b0bccd449a25579b2a58cefac71 to your computer and use it in GitHub Desktop.
Save arthurgousset/d47d8b0bccd449a25579b2a58cefac71 to your computer and use it in GitHub Desktop.

Adding Celo to Foundry

Context

We'd love Celo to be fully compatible with Foundry out of the box 🙌

@douglasqian kindly pointed us to Github discussion in the Foundry repo discussing how to add non-Ethereum precompiles to Foundry: Decode non-Ethereum precompiles when tracing #1078.

According to @mattsse, they main ask would be a list of all address and function signature pairs (e.g. <name>(<inputs>)<outputs>):

It would help if you could prepare them as address + signature pairs, this would make it easier to integrate them in the codebase ~ Source: Github comment

Useful links

Next steps

We're compiling the required information to simplify the Foundry integration.

See sample of information below (to confirm this is suits the Foundry team).

@palango
Copy link

palango commented Dec 9, 2022

Precompiles

0x00000000000000000000000000000000000000fd transfer                 (bytes32 sender, bytes32 recipient, uint256 amount) bytes

0x00000000000000000000000000000000000000fc fractionMulExp           (uint256 aNumerator, uint256 aDenominator, uint256 bNumerator, uint256 bDenominator, uint256 exponent, uint256 decimals) (uint256, uint256)

0x00000000000000000000000000000000000000fb proofOfPossession        (address sender, bytes blsKey, bytes blsPop) bool

0x00000000000000000000000000000000000000fa getValidator             (uint256 index, uint256 blockNumber) address

0x00000000000000000000000000000000000000f9 numberValidators         (uint256 blockNumber) uint256

0x00000000000000000000000000000000000000f8 epochSize                () uint256

0x00000000000000000000000000000000000000f7 blockNumberFromHeader    (bytes header) uint256

0x00000000000000000000000000000000000000f6 hashHeader               (bytes header) bytes32

0x00000000000000000000000000000000000000F5 getParentSealBitmap      (uint256 blockNumber) bytes32

0x00000000000000000000000000000000000000F4 getVerifiedSealBitmap    (bytes header) bytes32

Questions

  • getValidator returns a 20 bytes address padded to 32 bytes, what's the correct type here?
  • proofOfPossession return a bool in 32 bytes format, what's the correct type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment