You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<AvailableOnlyForSolidityAdmonitiondescription="Vyper contracts are verifiable only using the dedicated /verify/vyper API enpoint. UI, frameworks and tools don't support Vyper verification via Sourcify yet."/>
12
+
9
13
## Using the UI (legacy)
10
14
11
15
1. Drag and drop the folder containing your source files and metadata, or add them seperately.
Copy file name to clipboardExpand all lines: docs/3. Verification/2 .fullVsPartialMatch.md
+4
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@ title: Full vs Partial Match
4
4
slug: /full-vs-partial-match
5
5
---
6
6
7
+
import AvailableOnlyForSolidityAdmonition from "../AvailableOnlyForSolidityAdmonition";
8
+
7
9
# Matches
8
10
9
11
A Sourcify match in summary works as follows:
@@ -21,6 +23,8 @@ If the bytecode from recompiling the contract with the given source code files a
21
23
22
24
## Full (Perfect) Matches
23
25
26
+
<AvailableOnlyForSolidityAdmonitiondescription="Vyper contracts don't support full matches because Vyper doesn't include the metadata hash in the bytecode."/>
27
+
24
28
Full matches (sometimes referred as _perfect matches_) refer to the cases when the bytecode of the deployed contract is byte-by-byte the same as compilation output of the given source code files under the compilation settings defined in the [metadata file](/docs/metadata).
25
29
26
30
This means the contents of the source code files and the compilation settings are exactly the same as when the contract author compiled and deployed the contract. Not even a byte! If you were to add a comment, change a variable or function name, the full match will be broken.
Copy file name to clipboardExpand all lines: docs/3. Verification/4. immutables.md
+29-2
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,13 @@ slug: /immutables
6
6
7
7
# Verification with Immutable Varibles
8
8
9
-
While Sourcify can verify contracts containing immutable variables, the process is more intricate than verifying contracts that don't have immutables. First, Sourcify recompiles the contract, which produces the runtime bytecode and the `immutableReferences` object. This object indicates the specific position within the execution bytecode where the immutable variables are located. After obtaining these, the next step is to replace all instances of the immutables in both the runtime and deployed bytecodes with zeros. Finally, a direct comparison is made between the two bytecodes to get a full or a partial match.
9
+
## Solidity
10
+
11
+
While Sourcify can verify **Solidity** contracts containing immutable variables, the process is more intricate than verifying contracts that don't have immutables. First, Sourcify recompiles the contract, which produces the runtime bytecode and the `immutableReferences` object. This object indicates the specific position within the execution bytecode where the immutable variables are located. After obtaining these, the next step is to replace all instances of the immutables in both the runtime and deployed bytecodes with zeros. Finally, a direct comparison is made between the two bytecodes to get a full or a partial match.
10
12
11
13
More details on how immutables affect verification below:
12
14
13
-
## Immutable variables
15
+
###Immutable variables
14
16
15
17
It is not as straightforward to verify contracts with immutable variables because of their nature. Quoting from the [Solidity docs](https://docs.soliditylang.org/en/v0.8.14/contracts.html#constant-and-immutable-state-variables):
16
18
@@ -30,3 +32,28 @@ For example in the bytecode excerpt from the Görli contract 0xbdde4d595f2cdda92
Sourcify supports Vyper verification via the `/verify/vyper` API endpoint, you can find more information in the [APIs documentation](/docs/api/).
10
+
11
+
Vyper doesn't support [metadata](/docs/metadata/), so most of Sourcify features are not available for Vyper.
12
+
13
+
## Vyper Feature Support
14
+
15
+
- 🟢 **Partial match**: Sourcify uses the metadata hash as a compilation fingerprint (you can read more about it [here](/docs/full-vs-partial-match)), since Vyper doesn't support metadata, every Vyper match will result in a partial match. Starting from version 0.4.1 Vyper implements a similar concept called [integrity](https://docs.vyperlang.org/en/stable/compiling-a-contract.html#integrity-hash), but Sourcify doesn't support it yet.
16
+
- 🟢 **Database transformations**: For more details, see the [Sourcify Database section](/docs/repository/sourcify-database/). Currently, Vyper verification supports `cborAuxdata`, `immutable` and `constructorArguments` transformations.
17
+
- 🟢 **Generated metadata**: Sourcify generates a metadata file for Vyper contracts, but it's used only for compatibility with the [Sourcify File Repositories](/docs/repository/file-repositories/).
18
+
- 🟡 **IPFS support**: Sourcify automatically uploads all verified contract's sources to IPFS. Even if the files are on IPFS, there is no link to them in the Vyper contract's bytecode. This is because Vyper doesn't include the metadata IPFS CID in the bytecode's auxdata.
19
+
- 🔴 **Full match**: Not possible due to lack of metadata support.
20
+
- 🔴 **Verification via UI**: Sourcify UI is based on the metadata and uses the statfull `/session/*` API endpoints, currently Sourcify support Vyper verification only via the stateless `/verify/vyper` API endpoint.
21
+
- 🔴 **Monitoring**: Monitor listens for `create` operations on many chains. It attempts to fetch the sources of deployed contracts from IPFS using the metadata embedded in the bytecodes. Since Vyper doesn't support metadata, Sourcify can't fetch the sources from IPFS.
Copy file name to clipboardExpand all lines: docs/6. monitoring.md
+4
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,12 @@ title: Monitoring Service
4
4
slug: /monitoring
5
5
---
6
6
7
+
import AvailableOnlyForSolidityAdmonition from "./AvailableOnlyForSolidityAdmonition";
8
+
7
9
# Monitoring Service
8
10
11
+
<AvailableOnlyForSolidityAdmonitiondescription="Sourcify monitoring service uses the metadata file to retrieve the source files. Vyper contracts don't support this."/>
12
+
9
13
Sourcify runs a "monitor" that listens to certain chains and checks contract creations (currently only checking tx's with `tx.to === null` and can't catch evm level contract creations). You can see which chains are monitored in [Supported Chains](/docs/chains/) table under "Monitoring" column.
10
14
11
15
If the monitor notices a contract creation it checks the contract bytecode for the appended metadata hash and will try to fetch the metadata file from Swarm or IPFS. If it succeeds, it further tries to fetch the source files. The source files will be either embedded in the metadata file in text form, or they will have IPFS hashes in the metadata file. If all the files are found, the monitor tries to compile and verify the detected contract with the fetched files.
<AvailableOnlyForSolidityAdmonitiondescription="Vyper contracts don't support metadata."/>
12
+
9
13
## Metadata
10
14
11
15
Since [v0.4.7](https://github.com/ethereum/solidity/releases/tag/v0.4.7) (2016-12-15) Solidity compiler generates an output file called metadata that contains information about the contract and the compilation ([see Solidity docs](https://docs.soliditylang.org/en/latest/metadata.html)). This includes the compiler settings, [contract ABI](https://docs.soliditylang.org/en/latest/abi-spec.html), [NatSpec contract documentation](https://docs.soliditylang.org/en/latest/natspec-format.html), and used source files and their hashes. Sourcify takes full advantage of this information to [fully verify](/docs/full-vs-partial-match) a deployed contract i.e. a byte-by-byte match of the contract. **Metadata file is required for the Sourcify verification** alongside the Solidity source files.
0 commit comments