Skip to content
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
b318f2f
Starting to add tests for sourcify
Mar 31, 2025
a13efc6
Basic working version of the Sourcify parser tests.
Apr 2, 2025
b6e12d5
* Build a CompilationUnit from source files in a contract, resolving …
Apr 4, 2025
f2fa3eb
Use json feature of reqwest
Apr 7, 2025
cb6a88a
Rewriting the archive and contract iterators again so that they can b…
Apr 7, 2025
2212541
Fetch archives on a separate thread from processing so that we can ge…
Apr 7, 2025
b30c5ac
Fetch archive data on the main thread instead of spawning an addition…
Apr 7, 2025
b9ff97f
Starting to add bindings tests. As part of this, I'm reworking a lot …
Apr 9, 2025
1ca5524
Fix path resolution when the source file was imported with a URL
Apr 10, 2025
9b2fa58
Add sharding options, which are not used yet. Also add the ability to…
Apr 10, 2025
ad3227a
* Use sharding options
Apr 11, 2025
094ac93
Lots of changes in this commit, largely focused on correctly and clea…
Apr 15, 2025
3e7673e
Run infra lint
Apr 15, 2025
67f316c
* Remove some unused code
Apr 15, 2025
1d2208c
Add `ShowCombinedResultsCommand` from Sanctuary tests
Apr 15, 2025
86296ce
Add more chains
Apr 15, 2025
f357d74
Fix corner case bugs in import resolution
Apr 15, 2025
b4ba88b
Run infra lint
Apr 15, 2025
89eaa28
Improve error reporting for parse errors
Apr 16, 2025
a6051a5
Remove unused function
Apr 16, 2025
dca9529
Merge branch 'main' into feature/sourcify
Apr 16, 2025
e231037
Fix clippy lint errors
Apr 16, 2025
2785daa
Add the ability to skip contracts with known parser bugs, like in the…
Apr 16, 2025
7805cea
Fix a bug in ImportRemap, `matches_context` should always return true…
Apr 16, 2025
9768423
* Add `--check-infer-version` like in the Sanctuary tests
Apr 16, 2025
594d9c2
Run infra lint
Apr 16, 2025
5961436
Better error messages when version inference tests fail
Apr 18, 2025
71897fc
Better error messages for bindings errors
Apr 18, 2025
ee1d243
Revamping almost everything in `sourcify.rs` to try to provide a nice…
Apr 18, 2025
ab7f490
Got rid of `ContractMetadata`, since it was mostly being used for imp…
Apr 18, 2025
1fb4b3f
Fix bug where import remaps were being filtered on `remap.has_known_b…
Apr 21, 2025
bd3ae92
Refactor `CompilationBuilder` a bit, using a `HashSet` for seen files…
Apr 21, 2025
38cc787
Fix lint errors
Apr 21, 2025
9737901
Merge branch 'main' into feature/sourcify
Apr 21, 2025
511f4d4
Change `Contract::read_file` to not take an output buffer parameter, …
Apr 23, 2025
98ed7fd
Use `CargoWorkspace::locate_source_crate` to ensure that archive file…
Apr 23, 2025
77305a3
Don't make the checks return `Err` if `contract.read_file` fails. Mos…
Apr 23, 2025
eca990a
Move tests out of `main.rs` and into a new dedicated file.
Apr 23, 2025
3dfdb99
Fix lint issues
Apr 23, 2025
812a389
* Make archive fetching more explicit
Apr 23, 2025
7b86350
* Rename `SourceMap::real_name` to `SourceMap::source_id`
Apr 23, 2025
cc4a04e
More ImportResolver refactors, trying to make everything clearer
Apr 23, 2025
4a000be
Fix shard range
Apr 23, 2025
3384ba0
Fix lint issues
Apr 23, 2025
1169c3c
Quick refactor in test_single_contract
Apr 23, 2025
6780897
Use url crate to parse/check url imports
Apr 23, 2025
e93a941
Fix lint issues
Apr 24, 2025
10f8e6c
Print error message if fetching a contract archive fails
Apr 25, 2025
ea02ef7
Add all known bugged contracts to exceptions list
Apr 25, 2025
224a119
* Added a workflow which runs sourcify tests against several differen…
Apr 25, 2025
17d4975
Fix error diagnostics for bindings
Apr 28, 2025
fb85549
Add exception for unbound identifiers in pragma abicoder
Apr 28, 2025
cb66e03
Rename workflows:
Apr 29, 2025
0359ba6
Cleanup in Cargo.toml
Apr 29, 2025
5d0ab94
Add doc comment to sourcify test runner option
Apr 29, 2025
0959162
Change `Range<u16>` to `RangeInclusive<u8>`. Must be `RangeInclusive`…
Apr 29, 2025
5ef993d
Fix lint issues
Apr 29, 2025
a3e75d7
`--shards-count` -> `--shard-count`
Apr 29, 2025
4e5045c
Let users select chains with their IDs instead of provided a predifin…
Apr 29, 2025
4d48e4d
Add tests for ImportResolver
Apr 29, 2025
db85e08
Merge branch 'main' into feature/sourcify
Apr 30, 2025
73a2d8e
Update .github/workflows/sourcify_single_chain.yml
mjoerussell May 5, 2025
8270e05
TEMP: Add 'pull_request' trigger for `sourcify_all_chains` workflow t…
May 5, 2025
ae50712
Update name of called workflow: 'sourcify' -> 'sourcify_single_chain'
May 5, 2025
7a5aab6
Remove runs-on
May 5, 2025
8e2878f
Remove quotes around variables that do not resolve to string values
May 5, 2025
53024ec
Update variable handlebars
May 5, 2025
91227ce
Update variable handlebars
May 5, 2025
60d7ef6
Add temp defaults for bindings and infer_version while testing with a…
May 5, 2025
10409f6
Debug terminal::step crash
May 5, 2025
2cca411
Strip repo root for contract archive display_path
May 5, 2025
dabc1e3
Avoid underflow when calculating spacer_width in Terminal::banner
May 5, 2025
eb4af9c
* Expect results file to contain SOURCIFY instead of SANCTUARY
May 5, 2025
1840c24
Restore default values
May 5, 2025
3b1ec52
Remove testing features from sourcify_all_shards workflow
May 5, 2025
f013656
Remove check_parser option, we always want to check the parser
May 5, 2025
2d889f8
Merge branch 'main' into feature/sourcify
May 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/sourcify_all_chains.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "sourcify_all_chains"

on:
workflow_dispatch:
inputs:
check_bindings:
description: "Check name bindings on contracts, failing if there's any unresolved symbol."
type: "boolean"
required: false
default: false
check_infer_version:
description: "Check that we can infer the correct language version based on the available version pragmas."
type: "boolean"
required: false
default: false
jobs:
run_tests:
runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync)
uses: "./.github/workflows/sourcify.yml"
with:
chain: "${matrix.chains.name}"
network: "${matrix.chains.network}"
check_bindings: "${inputs.check_bindings}"
check_infer_version: "${inputs.check_infer_version}"
strategy:
fail-fast: false
matrix:
chains:
- name: "arbitrum"
network: "one"
- name: "base"
network: "mainnet"
- name: "ethereum"
network: "mainnet"
- name: "polygon"
network: "mainnet"
163 changes: 163 additions & 0 deletions .github/workflows/sourcify_single_chain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: "sourcify_single_chain"

on:
# Run using manual triggers from GitHub UI:
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
inputs:
chain:
description: "Name of the chain/SOURCIFY to run against, e.g. 'ethereum' or 'tron'."
type: "string"
required: true
default: "ethereum"
network:
description: "Name of the sub-network to run against, e.g. 'mainnet' or 'testnet'."
type: "string"
required: true
default: "mainnet"
check_bindings:
description: "Check name bindings on contracts, failing if there's any unresolved symbol."
type: "boolean"
required: false
default: false
check_infer_version:
description: "Check that we can infer the correct language version based on the available version pragmas."
type: "boolean"
required: false
default: false
workflow_call:
inputs:
chain:
description: "Name of the chain/SOURCIFY to run against, e.g. 'ethereum' or 'tron'."
type: "string"
required: true
default: "ethereum"
network:
description: "Name of the sub-network to run against, e.g. 'mainnet' or 'testnet'."
type: "string"
required: true
default: "mainnet"
check_bindings:
description: "Check name bindings on contracts, failing if there's any unresolved symbol."
type: "boolean"
required: false
default: false
check_infer_version:
description: "Check that we can infer the correct language version based on the available version pragmas."
type: "boolean"
required: false
default: false
jobs:
singleShard:
runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync)
outputs:
__SLANG_SOURCIFY_SHARD_RESULTS__0: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__0 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__1: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__1 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__2: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__2 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__3: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__3 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__4: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__4 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__5: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__5 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__6: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__6 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__7: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__7 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__8: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__8 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__9: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__9 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__10: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__10 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__11: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__11 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__12: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__12 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__13: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__13 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__14: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__14 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__15: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__15 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__16: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__16 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__17: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__17 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__18: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__18 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__19: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__19 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__20: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__20 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__21: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__21 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__22: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__22 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__23: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__23 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__24: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__24 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__25: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__25 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__26: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__26 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__27: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__27 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__28: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__28 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__29: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__29 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__30: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__30 }}"
__SLANG_SOURCIFY_SHARD_RESULTS__31: "${{ steps.output-shard-results.outputs.__SLANG_SOURCIFY_SHARD_RESULTS__31 }}"

strategy:
fail-fast: false # Continue running all shards even if some fail.
matrix:
shard_index:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31

env:
SHARDS_COUNT: 32 # Length of the 'shard_index' array above.

steps:
- name: "Checkout Repository"
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"

- name: "Restore Cache"
uses: "./.github/actions/cache/restore"

- name: "infra setup"
run: "./scripts/bin/infra setup"

- name: "infra run solidity_testing_sourcify"
run: "./scripts/bin/infra run --release --bin solidity_testing_sourcify -- test --shards-count ${{ env.SHARDS_COUNT }} --shard-index ${{ matrix.shard_index }} ${{ inputs.check_bindings == true && '--check-bindings' || '' }} ${{ inputs.check_infer_version == true && '--check-infer-version' || '' }} ${{ inputs.chain }} ${{ inputs.network }}"

- name: "Write shard results to output"
if: "!cancelled()"
id: "output-shard-results"
run: 'echo "__SLANG_SOURCIFY_SHARD_RESULTS__${{ matrix.shard_index }}=$(cat target/__SLANG_SOURCIFY_SHARD_RESULTS__.json)" >> "$GITHUB_OUTPUT"'

combinedResults:
runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync)
needs: "singleShard"
if: "!cancelled()"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"

- name: "Restore Cache"
uses: "./.github/actions/cache/restore"

- name: "infra setup"
run: "./scripts/bin/infra setup"

- name: "Output shards results"
run: "echo '${{ toJSON(needs.singleShard.outputs) }}' > __SLANG_SOURCIFY_MATRIX_RESULTS__.json"

- name: "Show combined results"
run: "./scripts/bin/infra run --bin solidity_testing_sourcify -- show-combined-results __SLANG_SOURCIFY_MATRIX_RESULTS__.json"
73 changes: 73 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ members = [
"crates/solidity/testing/sanctuary",
"crates/solidity/testing/snapshots",
"crates/solidity/testing/solc",
"crates/solidity/testing/sourcify",

"crates/testlang/inputs/language",
"crates/testlang/outputs/cargo/crate",
Expand Down Expand Up @@ -79,6 +80,7 @@ solidity_testing_perf = { path = "crates/solidity/testing/perf", version = "1.1.
solidity_testing_sanctuary = { path = "crates/solidity/testing/sanctuary", version = "1.1.0" }
solidity_testing_snapshots = { path = "crates/solidity/testing/snapshots", version = "1.1.0" }
solidity_testing_solc = { path = "crates/solidity/testing/solc", version = "1.1.0" }
solidity_testing_sourcify = { path = "crates/solidity/testing/sourcify", version = "1.1.0" }

slang_testlang = { path = "crates/testlang/outputs/cargo/crate", version = "1.1.0" }
testlang_cargo_tests = { path = "crates/testlang/outputs/cargo/tests", version = "1.1.0" }
Expand Down Expand Up @@ -145,6 +147,7 @@ syn = { version = "2.0.100", features = [
"parsing",
"printing",
] }
tar = { version = "0.4.44" }
tempfile = { version = "3.19.1" }
tera = { version = "1.20.0" }
thiserror = { version = "2.0.12" }
Expand Down
3 changes: 3 additions & 0 deletions crates/infra/cli/src/commands/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ enum BinaryName {
/// Runs compatibility tests between our language definition and 'solc' actual output.
#[clap(name = "solidity_testing_solc")]
SolidityTestingSolc,
/// Tests our parser/binding graph against contracts fetched from the Sourcify dataset.
#[clap(name = "solidity_testing_sourcify")]
SolidityTestingSourcify,
}

impl RunController {
Expand Down
25 changes: 25 additions & 0 deletions crates/solidity/testing/sourcify/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "solidity_testing_sourcify"
version.workspace = true
rust-version.workspace = true
edition.workspace = true
publish = false

[dependencies]
anyhow = { workspace = true }
clap = { workspace = true }
console = { workspace = true }
indicatif = { workspace = true }
infra_utils = { workspace = true }
rayon = { workspace = true }
reqwest = { workspace = true, features = ["json"] }
semver = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
slang_solidity = { workspace = true, features = ["__private_ariadne_errors", "__experimental_bindings_api"] }
strum_macros = { workspace = true }
tar = { workspace = true }
url = { workspace = true }

[lints]
workspace = true
Loading
Loading