Skip to content

Commit

Permalink
feat(docs,filler): add info about ripemd160 & running actions locally (
Browse files Browse the repository at this point in the history
…ethereum#847)

Co-authored-by: Dimitry Kh <[email protected]>
  • Loading branch information
danceratopz and winsvega authored Oct 2, 2024
1 parent 802467c commit 96efd73
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 25 deletions.
69 changes: 59 additions & 10 deletions docs/dev/test_actions_locally.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,65 @@
# Testing Github Actions Locally
# Running Github Actions Locally

The Github Actions workflows can be tested locally using [nektos/act](https://github.com/nektos/act) which allows you to test Github Actions locally, without pushing changes to the remote.
The Github Actions workflows can be tested locally using [nektos/act](https://github.com/nektos/act) without pushing changes to the remote. The local repository state will be used in the executed workflow.

## Prerequisites

1. Install the `act` tool, [docs](https://nektosact.com/installation/index.html).
2. Install the Github CLI (`gh`) for authentication: [linux](https://github.com/cli/cli/blob/trunk/docs/install_linux.md), [macos](https://github.com/cli/cli/tree/trunk?tab=readme-ov-file#macos).
3. Authenticate with the Github CLI:
1. Install the Github CLI (`gh`): [linux](https://github.com/cli/cli/blob/trunk/docs/install_linux.md), [macos](https://github.com/cli/cli/tree/trunk?tab=readme-ov-file#macos).
2. Install the `act` tool as a Github extension ([nektos/act docs](https://nektosact.com/installation/gh.html)):

```bash
gh extension install https://github.com/nektos/gh-act
```

or use one of the [other available methods](https://nektosact.com/installation/index.html).

3. Authenticate your Github account with the Github CLI:

```bash
gh auth login
```

## Testing Workflows
This is required to set `GITHUB_TOKEN` to the output of `gh auth token` when running the workflows.

!!! note "Updating nektos/act to the latest version via the Github CLI"
The `act` tool can be updated via the Github CLI:

```bash
gh extension upgrade nektos/act
```

## Listing the Available Workflows

```bash
gh act list
```

will output something similar to:

```bash
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock'
Stage Job ID Job name Workflow name Workflow file Events
0 evmone-coverage-diff evmone-coverage-diff Evmone Coverage Report coverage.yaml pull_request
0 deploy deploy Deploy Docs Main docs_main.yaml push
0 deploy deploy Deploy Docs Tags docs_tags.yaml push
0 features features Build and Package Fixtures fixtures.yaml push,workflow_dispatch
0 feature-names feature-names Build and Package Fixtures for a feature fixtures_feature.yaml push,workflow_dispatch
0 build build Run Tox Verifications tox_verify.yaml push,pull_request,workflow_dispatch
1 build build Build and Package Fixtures fixtures.yaml push,workflow_dispatch
1 build build Build and Package Fixtures for a feature fixtures_feature.yaml push,workflow_dispatch
2 release release Build and Package Fixtures fixtures.yaml push,workflow_dispatch
2 release release Build and Package Fixtures for a feature fixtures_feature.yaml push,workflow_dispatch
```

The `Job ID` is required to run a specific workflow and is provided to the `-j` option of `gh act`.

### Testing a Workflow that uses a Matrix Strategy
### Running Workflows Locally that use a Matrix Strategy

```bash
act -j build --workflows .github/workflows/tox_verify.yaml -s GITHUB_TOKEN=$(gh auth token) --matrix python:3.10
gh act -j build --workflows .github/workflows/tox_verify.yaml -s GITHUB_TOKEN=$(gh auth token) --matrix python:3.12
```

### Testing Release Builds
### Running Release Workflows

Release builds require the `ref` input to be specified. To test a release build locally:

Expand All @@ -35,5 +74,15 @@ Release builds require the `ref` input to be specified. To test a release build
2. Run `act` and specify the workflow file, the Github token, and the event file:

```bash
act -j build --workflows .github/workflows/fixtures_feature.yaml -s GITHUB_TOKEN=$(gh auth token) -e event.json
gh act -j build --workflows .github/workflows/fixtures_feature.yaml -s GITHUB_TOKEN=$(gh auth token) -e event.json
```

### Manually Specifying the Docker Image

It's possible to specify the Docker image used by the `act` tool for a specific platform defined in a workflow using the `-P` (`--platform`) option. For example, use map `ubuntu-latest` in the workflow to use `ubuntu-24.04`:
```bash
-P ubuntu-latest=ubuntu-24.04
```
This can be added to any `gh act` command.
34 changes: 34 additions & 0 deletions docs/getting_started/installation_troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,40 @@ This page provides guidance on how to troubleshoot common issues that may arise
/Applications/Python\ 3.11/Install\ Certificates.command
```

## Problem: `ValueError: unsupported hash type ripemd160`

!!! danger "Problem: `Running fill fails with tests that use the RIPEMD160 precompile (0x03)`"
When running `fill`, you encounter the following error:

```python
ValueError: unsupported hash type ripemd160
# or
ValueError: [digital envelope routines] unsupported
```

This is due to the removal of certain cryptographic primitives in OpenSSL 3. These were re-introduced in [OpenSSL v3.0.7](https://github.com/openssl/openssl/blob/master/CHANGES.md#changes-between-306-and-307-1-nov-2022).

!!! success "Solution: Modify OpenSSL configuration"
On platforms where OpenSSL v3.0.7 is unavailable (e.g., Ubuntu 22.04), modify your OpenSSL configuration to enable RIPEMD160. Make the following changes in the OpenSSL config file:

```ini
[openssl_init]
providers = provider_sect

# List of providers to load
[provider_sect]
default = default_sect
legacy = legacy_sect

[default_sect]
activate = 1

[legacy_sect]
activate = 1
```

This will enable the legacy cryptographic algorithms, including RIPEMD160. See [ethereum/execution-specs#506](https://github.com/ethereum/execution-specs/issues/506) for more information.

## Other Issues Not Listed?

If you're facing an issue that's not listed here, you can easily report it on GitHub for resolution.
Expand Down
20 changes: 6 additions & 14 deletions docs/writing_tests/verifying_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,18 @@ The `tox` tool can be executed locally to check that local changes won't cause G

## Executing `tox`

### Prerequisites

```console
python -m venv ./venv/
source ./venv/bin/activate
pip install tox-uv
```

### Execution

Run tox, as executed in Github Actions, with:
Run `tox` and execute the defined environments (see `tox.ini`) in parallel with:

```console
tox run-parallel
uvx --with=tox-uv tox run-parallel
```

or, with sequential test environment execution and verbose output as:

```console
tox
uvx --with=tox-uv tox
```

This executes all the environments described in the next section.
Expand All @@ -51,15 +43,15 @@ For targeted tox runs locally, each environment can be ran separately as describ
Verify:

```console
tox -e tests
uvx --with=tox-uv tox -e tests
```

### Framework Verification: `framework`

Verify:

```console
tox -e framework
uvx --with=tox-uv tox -e framework
```

### Documentation Verification: `docs`
Expand All @@ -86,7 +78,7 @@ Additional, optional prerequisites:
Verify:

```console
tox -e docs
uvx --with=tox-uv tox -e docs
```

### Verifying Fixture Changes
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_plugins/filler/filler.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def create_properties_file(
command_line_args = command_line_args.replace("<code>", "").replace("</code>", "")
fixture_properties["command_line_args"] = command_line_args

config = configparser.ConfigParser()
config = configparser.ConfigParser(interpolation=None)
config["fixtures"] = fixture_properties
environment_properties = {}
for key, val in request.config.stash[metadata_key].items():
Expand Down
2 changes: 2 additions & 0 deletions whitelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ namespace
natively
nav
ncheck
nektos
nethermind
nexternal
nGo
Expand All @@ -289,6 +290,7 @@ ommer
ommers
oneliner
oob
OpenSSL
opc
oprypin
ori
Expand Down

0 comments on commit 96efd73

Please sign in to comment.