-
Notifications
You must be signed in to change notification settings - Fork 47
Sourcify Tests #1305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Sourcify Tests #1305
Changes from all commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
b318f2f
Starting to add tests for sourcify
a13efc6
Basic working version of the Sourcify parser tests.
b6e12d5
* Build a CompilationUnit from source files in a contract, resolving …
f2fa3eb
Use json feature of reqwest
cb6a88a
Rewriting the archive and contract iterators again so that they can b…
2212541
Fetch archives on a separate thread from processing so that we can ge…
b30c5ac
Fetch archive data on the main thread instead of spawning an addition…
b9ff97f
Starting to add bindings tests. As part of this, I'm reworking a lot …
1ca5524
Fix path resolution when the source file was imported with a URL
9b2fa58
Add sharding options, which are not used yet. Also add the ability to…
ad3227a
* Use sharding options
094ac93
Lots of changes in this commit, largely focused on correctly and clea…
3e7673e
Run infra lint
67f316c
* Remove some unused code
1d2208c
Add `ShowCombinedResultsCommand` from Sanctuary tests
86296ce
Add more chains
f357d74
Fix corner case bugs in import resolution
b4ba88b
Run infra lint
89eaa28
Improve error reporting for parse errors
a6051a5
Remove unused function
dca9529
Merge branch 'main' into feature/sourcify
e231037
Fix clippy lint errors
2785daa
Add the ability to skip contracts with known parser bugs, like in the…
7805cea
Fix a bug in ImportRemap, `matches_context` should always return true…
9768423
* Add `--check-infer-version` like in the Sanctuary tests
594d9c2
Run infra lint
5961436
Better error messages when version inference tests fail
71897fc
Better error messages for bindings errors
ee1d243
Revamping almost everything in `sourcify.rs` to try to provide a nice…
ab7f490
Got rid of `ContractMetadata`, since it was mostly being used for imp…
1fb4b3f
Fix bug where import remaps were being filtered on `remap.has_known_b…
bd3ae92
Refactor `CompilationBuilder` a bit, using a `HashSet` for seen files…
38cc787
Fix lint errors
9737901
Merge branch 'main' into feature/sourcify
511f4d4
Change `Contract::read_file` to not take an output buffer parameter, …
98ed7fd
Use `CargoWorkspace::locate_source_crate` to ensure that archive file…
77305a3
Don't make the checks return `Err` if `contract.read_file` fails. Mos…
eca990a
Move tests out of `main.rs` and into a new dedicated file.
3dfdb99
Fix lint issues
812a389
* Make archive fetching more explicit
7b86350
* Rename `SourceMap::real_name` to `SourceMap::source_id`
cc4a04e
More ImportResolver refactors, trying to make everything clearer
4a000be
Fix shard range
3384ba0
Fix lint issues
1169c3c
Quick refactor in test_single_contract
6780897
Use url crate to parse/check url imports
e93a941
Fix lint issues
10f8e6c
Print error message if fetching a contract archive fails
ea02ef7
Add all known bugged contracts to exceptions list
224a119
* Added a workflow which runs sourcify tests against several differen…
17d4975
Fix error diagnostics for bindings
fb85549
Add exception for unbound identifiers in pragma abicoder
cb66e03
Rename workflows:
0359ba6
Cleanup in Cargo.toml
5d0ab94
Add doc comment to sourcify test runner option
0959162
Change `Range<u16>` to `RangeInclusive<u8>`. Must be `RangeInclusive`…
5ef993d
Fix lint issues
a3e75d7
`--shards-count` -> `--shard-count`
4e5045c
Let users select chains with their IDs instead of provided a predifin…
4d48e4d
Add tests for ImportResolver
db85e08
Merge branch 'main' into feature/sourcify
73a2d8e
Update .github/workflows/sourcify_single_chain.yml
mjoerussell 8270e05
TEMP: Add 'pull_request' trigger for `sourcify_all_chains` workflow t…
ae50712
Update name of called workflow: 'sourcify' -> 'sourcify_single_chain'
7a5aab6
Remove runs-on
8e2878f
Remove quotes around variables that do not resolve to string values
53024ec
Update variable handlebars
91227ce
Update variable handlebars
60d7ef6
Add temp defaults for bindings and infer_version while testing with a…
10409f6
Debug terminal::step crash
2cca411
Strip repo root for contract archive display_path
dabc1e3
Avoid underflow when calculating spacer_width in Terminal::banner
eb4af9c
* Expect results file to contain SOURCIFY instead of SANCTUARY
1840c24
Restore default values
3b1ec52
Remove testing features from sourcify_all_shards workflow
f013656
Remove check_parser option, we always want to check the parser
2d889f8
Merge branch 'main' into feature/sourcify
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| 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: | ||
| uses: "./.github/workflows/sourcify_single_chain.yml" | ||
| with: | ||
| chain_id: "${{ matrix.chain_id }}" | ||
| check_bindings: "${{ inputs.check_bindings }}" | ||
| check_infer_version: "${{ inputs.check_infer_version }}" | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| chain_id: | ||
| - 1 # Ethereum Mainnet | ||
| - 42161 # Arbitrum One | ||
| - 8453 # Base | ||
| - 137 # Polygon Mainnet | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| 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_id: | ||
| description: "ID of the chain to run against." | ||
| type: "number" | ||
| required: true | ||
| default: 1 | ||
| 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_id: | ||
| description: "ID of the chain to run against: https://docs.sourcify.dev/docs/chains/" | ||
| type: "number" | ||
| required: true | ||
| default: 1 | ||
| 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: | ||
| SHARD_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 --shard-count ${{ env.SHARD_COUNT }} --shard-index ${{ matrix.shard_index }} ${{ inputs.check_bindings == true && '--check-bindings' || '' }} ${{ inputs.check_infer_version == true && '--check-infer-version' || '' }} --chain-id ${{ inputs.chain_id }} ${{ 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" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| [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", "__private_compilation_api"] } | ||
| tar = { workspace = true } | ||
| url = { workspace = true } | ||
|
|
||
| [lints] | ||
| workspace = true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.