Skip to content

Commit

Permalink
Merge branch 'main' into TT-1297-remove-secret-keys-from-toml
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Aug 28, 2024
2 parents 63ff5b8 + 18dd1ae commit 0d0417e
Show file tree
Hide file tree
Showing 99 changed files with 22,675 additions and 109 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/seth-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: SETH Lint
on:
push:
permissions:
contents: read
jobs:
golangci:
defaults:
run:
working-directory: seth
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for changes in Seth project
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'seth/**'
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
if: steps.changes.outputs.src == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests
if: steps.changes.outputs.src == 'true'
run: |
nix develop -c make lint
37 changes: 37 additions & 0 deletions .github/workflows/seth-test-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: SETH API tests
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
defaults:
run:
working-directory: seth
runs-on: ubuntu-latest
strategy:
matrix:
network: [Anvil, Geth]
env:
SETH_ROOT_PRIVATE_KEY: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for changes in Seth project
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'seth/**'
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
if: steps.changes.outputs.src == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests
if: steps.changes.outputs.src == 'true'
env:
SETH_NETWORK: ${{ matrix.network }}
run: |
nix develop -c make "$SETH_NETWORK" && make SETH_LOG_LEVEL=debug root_private_key="$SETH_ROOT_PRIVATE_KEY" network="$SETH_NETWORK" test_api
37 changes: 37 additions & 0 deletions .github/workflows/seth-test-bumping.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: SETH Gas bumping tests
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
defaults:
run:
working-directory: seth
runs-on: ubuntu-latest
strategy:
matrix:
network: [Geth]
env:
SETH_ROOT_PRIVATE_KEY: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for changes in Seth project
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'seth/**'
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
if: steps.changes.outputs.src == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests
if: steps.changes.outputs.src == 'true'
env:
SETH_NETWORK: ${{ matrix.network }}
run: |
nix develop -c make "$SETH_NETWORK" && make SETH_LOG_LEVEL=debug root_private_key="$SETH_ROOT_PRIVATE_KEY" network="$SETH_NETWORK" test_gas_bumping
37 changes: 37 additions & 0 deletions .github/workflows/seth-test-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: SETH CLI tests
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
defaults:
run:
working-directory: seth
runs-on: ubuntu-latest
strategy:
matrix:
network: [Anvil, Geth]
env:
SETH_ROOT_PRIVATE_KEY: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for changes in Seth project
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'seth/**'
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
if: steps.changes.outputs.src == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests
if: steps.changes.outputs.src == 'true'
env:
SETH_NETWORK: ${{ matrix.network }}
run: |
nix develop -c make "$SETH_NETWORK" && make SETH_LOG_LEVEL=debug root_private_key="$SETH_ROOT_PRIVATE_KEY" network="$SETH_NETWORK" test_cli
40 changes: 40 additions & 0 deletions .github/workflows/seth-test-decode-testnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: SETH Decoding tests (testnets)
on:
push:
tags:
- v.**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
defaults:
run:
working-directory: seth
runs-on: ubuntu-latest
strategy:
matrix:
# TODO: Sepolia is usually down but it worked, turn it on when possible
# TODO: Mumbai is not working right now
network: [Fuji]
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for changes in Seth project
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'seth/**'
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
if: steps.changes.outputs.src == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests
if: steps.changes.outputs.src == 'true'
env:
SETH_NETWORK: ${{ matrix.network }}
SETH_ROOT_PRIVATE_KEY: ${{ secrets.TESTNET_COMMON_KEYS }}
run: |
nix develop -c make SETH_LOG_LEVEL=debug root_private_key="$SETH_ROOT_PRIVATE_KEY" network="$SETH_NETWORK" test
37 changes: 37 additions & 0 deletions .github/workflows/seth-test-decode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: SETH Decoding tests
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
defaults:
run:
working-directory: seth
runs-on: ubuntu-latest
strategy:
matrix:
network: [Anvil, Geth]
env:
SETH_ROOT_PRIVATE_KEY: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for changes in Seth project
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'seth/**'
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
if: steps.changes.outputs.src == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests
if: steps.changes.outputs.src == 'true'
env:
SETH_NETWORK: ${{ matrix.network }}
run: |
nix develop -c make "$SETH_NETWORK" && make SETH_LOG_LEVEL=debug root_private_key="$SETH_ROOT_PRIVATE_KEY" network="$SETH_NETWORK" test
37 changes: 37 additions & 0 deletions .github/workflows/seth-test-others.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: SETH Other tests
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
defaults:
run:
working-directory: seth
runs-on: ubuntu-latest
strategy:
matrix:
network: [Geth]
env:
SETH_ROOT_PRIVATE_KEY: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for changes in Seth project
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'seth/**'
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
if: steps.changes.outputs.src == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests
if: steps.changes.outputs.src == 'true'
env:
SETH_NETWORK: ${{ matrix.network }}
run: |
nix develop -c make "$SETH_NETWORK" && make SETH_LOG_LEVEL=debug root_private_key="$SETH_ROOT_PRIVATE_KEY" network="$SETH_NETWORK" test_others
37 changes: 37 additions & 0 deletions .github/workflows/seth-test-trace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: SETH Tracing tests
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
defaults:
run:
working-directory: seth
runs-on: ubuntu-latest
strategy:
matrix:
network: [Anvil, Geth]
env:
SETH_ROOT_PRIVATE_KEY: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check for changes in Seth project
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'seth/**'
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
if: steps.changes.outputs.src == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests
if: steps.changes.outputs.src == 'true'
env:
SETH_NETWORK: ${{ matrix.network }}
run: |
nix develop -c make "$SETH_NETWORK" && make SETH_LOG_LEVEL=debug root_private_key="$SETH_ROOT_PRIVATE_KEY" network="$SETH_NETWORK" test_trace
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
exclude: '(\.bin|\.abi)'

repos:
- repo: local
hooks:
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ node_modules/
index.yaml
wasp/**
havoc/**
seth/**
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CTF contains a set of useful libraries:

- [WASP](wasp/README.md) - Scalable protocol-agnostic load testing library for `Go`
- [Havoc](havoc/README.md) - Chaos testing library
- [Seth](seth/README.md) - Ethereum client library with transaction tracing and gas bumping

## k8s package

Expand Down
4 changes: 3 additions & 1 deletion _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ extend-exclude = [
"**/*.tgz",
"**/*.png",
"wasp/HOW_IT_WORKS.md",
"wasp/dashboard/**"
"wasp/dashboard/**",
"seth/*_test.go",
"seth/dot_graph.go"
]
5 changes: 3 additions & 2 deletions client/miner.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package client

import (
"net/http"
"strconv"
"time"

Expand All @@ -18,9 +19,9 @@ type RemoteAnvilMiner struct {
}

// NewRemoteAnvilMiner creates a new remote miner client
func NewRemoteAnvilMiner(url string) *RemoteAnvilMiner {
func NewRemoteAnvilMiner(url string, headers http.Header) *RemoteAnvilMiner {
return &RemoteAnvilMiner{
Client: NewRPCClient(url),
Client: NewRPCClient(url, headers),
stop: make(chan struct{}),
}
}
Expand Down
20 changes: 18 additions & 2 deletions client/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ package client

import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"net/http"
"os"
"strconv"
"time"

Expand All @@ -24,8 +27,21 @@ type RPCClient struct {
}

// NewRPCClient creates Anvil client
func NewRPCClient(url string) *RPCClient {
return &RPCClient{URL: url, client: resty.New()}
func NewRPCClient(url string, headers http.Header) *RPCClient {
isDebug := os.Getenv("RESTY_DEBUG") == "true"
h := make(map[string]string)
for k, v := range headers {
h[k] = v[0]
}
// TODO: use proper certificated in CRIB
//nolint
return &RPCClient{
URL: url,
client: resty.New().
SetDebug(isDebug).
SetHeaders(h).
SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true}),
}
}

// AnvilMine calls "evm_mine", mines one or more blocks, see the reference on RPCClient
Expand Down
2 changes: 1 addition & 1 deletion client/rpc_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestRPCSuite(t *testing.T) {
require.NoError(t, err)
printGasPrices(t, client)
// set a base fee
anvilClient := NewRPCClient(ac.URL)
anvilClient := NewRPCClient(ac.URL, nil)
// set fee for the next block
err = anvilClient.AnvilSetNextBlockBaseFeePerGas([]interface{}{"2000000000"})
require.NoError(t, err)
Expand Down
Loading

0 comments on commit 0d0417e

Please sign in to comment.