mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-31 08:08:18 -05:00
Compare commits
2 Commits
simplify-p
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55fe85c887 | ||
|
|
31f77567dd |
3
changelog/jtraglia-add-specrefs-readme.md
Normal file
3
changelog/jtraglia-add-specrefs-readme.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
### Added
|
||||||
|
|
||||||
|
- Added README for maintaining specrefs.
|
||||||
3
changelog/jtraglia-nightly-reftests-with-run-id.md
Normal file
3
changelog/jtraglia-nightly-reftests-with-run-id.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
### Added
|
||||||
|
|
||||||
|
- The ability to download the nightly reference tests from a specific day.
|
||||||
35
specrefs/README.md
Normal file
35
specrefs/README.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Specification References
|
||||||
|
|
||||||
|
This directory contains specification reference tracking files managed by
|
||||||
|
[ethspecify](https://github.com/jtraglia/ethspecify).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install `ethspecify` with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pipx install ethspecify
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> You can run `ethspecify <cmd>` in the `specrefs` directory or
|
||||||
|
> `ethspecify <cmd> --path=specrefs` from the project's root directory.
|
||||||
|
|
||||||
|
## Maintenance
|
||||||
|
|
||||||
|
When adding support for a new specification version, follow these steps:
|
||||||
|
|
||||||
|
0. Change directory into the `specrefs` directory.
|
||||||
|
1. Update the version in `.ethspecify.yml` configuration.
|
||||||
|
2. Run `ethspecify process` to update/populate specrefs.
|
||||||
|
3. Run `ethspecify check` to check specrefs.
|
||||||
|
4. If there are errors, use the error message as a guide to fix the issue. If
|
||||||
|
there are new specrefs with empty sources, implement/locate each item and
|
||||||
|
update each specref source list. If you choose not to implement an item,
|
||||||
|
add an exception to the appropriate section the the `.ethspecify.yml`
|
||||||
|
configuration.
|
||||||
|
5. Repeat steps 3 and 4 until `ethspecify check` passes.
|
||||||
|
6. Run `git diff` to view updated specrefs. If an object/function/etc has
|
||||||
|
changed, make the necessary updates to the implementation.
|
||||||
|
7. Lastly, in the project's root directory, run `act -j check-specrefs` to
|
||||||
|
ensure everything is correct.
|
||||||
@@ -21,10 +21,14 @@ There are tests for mainnet and minimal config, so for each config we will add a
|
|||||||
|
|
||||||
## Running nightly spectests
|
## Running nightly spectests
|
||||||
|
|
||||||
Since [PR 15312](https://github.com/OffchainLabs/prysm/pull/15312), Prysm has support to download "nightly" spectests from github via a starlark rule configuration by environment variable.
|
Since [PR 15312](https://github.com/OffchainLabs/prysm/pull/15312), Prysm has support to download "nightly" spectests from github via a starlark rule configuration by environment variable.
|
||||||
Set `--repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly` when running spectest to download the "nightly" spectests.
|
Set `--repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly` or `--repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly-<run_id>` when running spectest to download the "nightly" spectests.
|
||||||
Note: A GITHUB_TOKEN environment variable is required to be set. The github token must be a [fine grained token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token).
|
Note: A GITHUB_TOKEN environment variable is required to be set. The github token does not need to be associated with your main account; it can be from a "burner account". And the token does not need to be a fine-grained token; it can be a classic token.
|
||||||
|
|
||||||
```
|
```
|
||||||
bazel test //... --test_tag_filters=spectest --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly
|
bazel test //... --test_tag_filters=spectest --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
bazel test //... --test_tag_filters=spectest --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly-21422848633
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# bazel build @consensus_spec_tests//:test_data
|
# bazel build @consensus_spec_tests//:test_data
|
||||||
# bazel build @consensus_spec_tests//:test_data --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly
|
# bazel build @consensus_spec_tests//:test_data --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly
|
||||||
|
# bazel build @consensus_spec_tests//:test_data --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly-<run_id>
|
||||||
|
|
||||||
def _get_redirected_url(repository_ctx, url, headers):
|
def _get_redirected_url(repository_ctx, url, headers):
|
||||||
if not repository_ctx.which("curl"):
|
if not repository_ctx.which("curl"):
|
||||||
@@ -24,7 +25,7 @@ def _impl(repository_ctx):
|
|||||||
version = repository_ctx.getenv("CONSENSUS_SPEC_TESTS_VERSION") or repository_ctx.attr.version
|
version = repository_ctx.getenv("CONSENSUS_SPEC_TESTS_VERSION") or repository_ctx.attr.version
|
||||||
token = repository_ctx.getenv("GITHUB_TOKEN") or ""
|
token = repository_ctx.getenv("GITHUB_TOKEN") or ""
|
||||||
|
|
||||||
if version == "nightly":
|
if version == "nightly" or version.startswith("nightly-"):
|
||||||
print("Downloading nightly tests")
|
print("Downloading nightly tests")
|
||||||
if not token:
|
if not token:
|
||||||
fail("Error GITHUB_TOKEN is not set")
|
fail("Error GITHUB_TOKEN is not set")
|
||||||
@@ -34,16 +35,22 @@ def _impl(repository_ctx):
|
|||||||
"Accept": "application/vnd.github+json",
|
"Accept": "application/vnd.github+json",
|
||||||
}
|
}
|
||||||
|
|
||||||
repository_ctx.download(
|
if version.startswith("nightly-"):
|
||||||
"https://api.github.com/repos/%s/actions/workflows/%s/runs?branch=%s&status=success&per_page=1"
|
run_id = version.split("nightly-", 1)[1]
|
||||||
% (repository_ctx.attr.repo, repository_ctx.attr.workflow, repository_ctx.attr.branch),
|
if not run_id:
|
||||||
headers = headers,
|
fail("Error invalid run id")
|
||||||
output = "runs.json"
|
else:
|
||||||
)
|
repository_ctx.download(
|
||||||
|
"https://api.github.com/repos/%s/actions/workflows/%s/runs?branch=%s&status=success&per_page=1"
|
||||||
|
% (repository_ctx.attr.repo, repository_ctx.attr.workflow, repository_ctx.attr.branch),
|
||||||
|
headers = headers,
|
||||||
|
output = "runs.json"
|
||||||
|
)
|
||||||
|
|
||||||
run_id = json.decode(repository_ctx.read("runs.json"))["workflow_runs"][0]["id"]
|
run_id = json.decode(repository_ctx.read("runs.json"))["workflow_runs"][0]["id"]
|
||||||
repository_ctx.delete("runs.json")
|
repository_ctx.delete("runs.json")
|
||||||
|
|
||||||
|
print("Run id:", run_id)
|
||||||
repository_ctx.download(
|
repository_ctx.download(
|
||||||
"https://api.github.com/repos/%s/actions/runs/%s/artifacts"
|
"https://api.github.com/repos/%s/actions/runs/%s/artifacts"
|
||||||
% (repository_ctx.attr.repo, run_id),
|
% (repository_ctx.attr.repo, run_id),
|
||||||
@@ -108,8 +115,8 @@ consensus_spec_tests = repository_rule(
|
|||||||
"version": attr.string(mandatory = True),
|
"version": attr.string(mandatory = True),
|
||||||
"flavors": attr.string_dict(mandatory = True),
|
"flavors": attr.string_dict(mandatory = True),
|
||||||
"repo": attr.string(default = "ethereum/consensus-specs"),
|
"repo": attr.string(default = "ethereum/consensus-specs"),
|
||||||
"workflow": attr.string(default = "generate_vectors.yml"),
|
"workflow": attr.string(default = "nightly-reftests.yml"),
|
||||||
"branch": attr.string(default = "dev"),
|
"branch": attr.string(default = "master"),
|
||||||
"release_url_template": attr.string(default = "https://github.com/ethereum/consensus-specs/releases/download/%s"),
|
"release_url_template": attr.string(default = "https://github.com/ethereum/consensus-specs/releases/download/%s"),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user