Skip to content

About Contracts Verification

Didi edited this page Oct 3, 2023 · 6 revisions

Contracts verification is an important step for the deployment of EVMv1 smart contracts. The goals of the production pipeline of the contracts verification are:

  1. Automated verification after each smart contracts deployment.
  2. Reproducible verification process locally as a developer.
  3. Support major block explorer solutions.
  4. Keep the pipeline lean.

Production Pipeline

While etherscan-like explorers are the only ones we explicitly verify for, other explorers may now also show verified contracts if they use the sourcify repository of verified contracts. Examples of such alternative explorers are Avascan, available for Avalanche and Blockscout, available for various networks.

Security Considerations

Verifiability

The Solidity compiler generates contract metadata which contains the contract ABI, compiler version and settings, hashes of source files, natspec docs and more - see related Solidity docs.
A hash of this metadata and the compiler version are CBOR encoded and appended to the bytecode deployed on chain, such that the compile-time metadata is cryptographically verifiable.
Check out the sourcify playground for an intuitive and interactive explanation.

Availability

Making metadata (most importantly - the underlying sourcecode) available is a process independent of the actual contract deployment.

With sourcify there now exists an open and decentralized repository for verified contracts.
The process of getting contracts verified on sourcify via the truffle verification plugin is still not very reliable, thus not all Superfluid contracts may be verified on sourcify all the time.

Contracts additionally get verified on etherscan-like explorers via their API.
After verification of a contract, this explorers provide a UI interface which not only shows the contract source code, but also provides forms which allow to query and modify (if a wallet is connected) the contract state based on its ABI. It essentially provides a minimal, autogenerated Dapp for every verified contract, based on its public interface. As an example, see the Polygon Superfluid Host contract.

Proxies

Etherscan-like explorers also have a convenience feature for explicit support of EIP-1967, rendering additional tabs "Read Proxy" and "Write Proxy" for contracts using this ERC. That's the case for many Superfluid protocol contracts.
Important: This convenience feature needs to be used with caution! Etherscan assumes that the ERC is used as intended. A malicious contract may pretend to delegate to a contract as signaled in the EIP-1967 storage slot, while in reality doing something else. In this case the Etherscan UI can be misleading. Such cases can be discovered by carefully studying the logic of the proxy contract itself.

Bugs & Future Work

  • Since truffle is being sunset, investigate upgrading to hardhat and/or foundry and its plugin as new pipeline
Clone this wiki locally