EspressoSystems / EspressoSystems/espresso-network

foundry: determinstic bindings with bytecode hash

Open
#780 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
193
Forks
177
Avg merge
2d 4h
Merged PRs (30d)
60

Description

The solidity compiler appends an IPFS hash of the metadata and the compiler version at the end of the bytecode.

https://docs.soliditylang.org/en/latest/metadata.html#encoding-of-the-metadata-hash-in-the-bytecode

At the moment despite the metadata being the same (can be checked by running `forge build --extra-output-files metadata --force` and finding the metadata files in `contracts/out`) the IPFS hash is sometimes different. This is very troublesome because we want to generate consistent bindings on all our dev machines and the CI.

It may be possible to disable this metadata hash but that's not desirable. Currently waiting for foundry community to see if they have any suggestions about how to further debug this.

Another maybe related problem is differences in bindings (not just due to bytecode differences) in the CI vs locally.

cc @alxiong

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running `forge build --extra-output-files metadata --force` and comparing the metadata files under `contracts/out` across local and CI environments. Trace how bytecode hashes and bindings are generated, using the Solidity metadata documentation linked in the issue as context. Done means the cause of differing hashes or bindings is identified and deterministic generation is restored or clearly scoped.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, solidity
Domain
blockchain, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.