Skip to content
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

Develop #80

Merged
merged 30 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
be4b8ea
add target fraction spec
bsamuels453 Jan 31, 2024
035e654
add target node count scaling
bsamuels453 Jan 31, 2024
97c5a0a
update readme
bsamuels453 Jan 31, 2024
96bd7c9
Merge pull request #61 from crytic/custom-topology
bsamuels453 Jan 31, 2024
b0139c0
add network latency fault
bsamuels453 Feb 1, 2024
04973f0
Merge pull request #65 from crytic/planner-network-latency
bsamuels453 Feb 1, 2024
46ce6a2
add beacon client health checks
bsamuels453 Feb 2, 2024
8e31528
update readme
bsamuels453 Feb 2, 2024
86d3770
remove unused struct member
bsamuels453 Feb 2, 2024
a131281
Merge pull request #66 from crytic/consensus-health-checks
bsamuels453 Feb 2, 2024
841f54b
checkpoint
bsamuels453 Feb 3, 2024
393adc7
fix determinism
bsamuels453 Feb 5, 2024
6175dcd
checkpoint
bsamuels453 Feb 6, 2024
67a6ccb
Merge pull request #70 from crytic/main
bsamuels453 Feb 23, 2024
949c8a9
fix port forwarding issue #69
bsamuels453 Feb 23, 2024
4e6acab
checkpoint
bsamuels453 Feb 23, 2024
877d641
update planner configs
bsamuels453 Feb 23, 2024
e560add
checkpoint
bsamuels453 Feb 23, 2024
b1c107f
improve beacon health checks
bsamuels453 Feb 23, 2024
b0f35d7
re-add pari's changes and 10+ node bug fix
bsamuels453 Feb 23, 2024
a0e2c38
backport port forwarding fix
bsamuels453 Feb 23, 2024
d659003
Merge pull request #72 from crytic/consensus-health-checks-v2
bsamuels453 Feb 23, 2024
c08815e
Merge branch 'exploration-mode-2' into develop
bsamuels453 Feb 23, 2024
c6cc1b8
update changelog and switch architecture to svg
bsamuels453 Feb 23, 2024
9fa4679
remove vscode directory
bsamuels453 Feb 23, 2024
c79935d
disable exploration mode on develop
bsamuels453 Feb 23, 2024
7cca008
add codeowners
bsamuels453 Feb 23, 2024
0379701
remove unused file
bsamuels453 Feb 23, 2024
ac8ee3d
code cleanup
bsamuels453 Feb 23, 2024
8d02902
Merge pull request #77 from crytic/update-release
bsamuels453 Feb 23, 2024
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
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ geth/execution/geth
.test/
deposit_manifest.json
/attacknet
/.DS_Store
.DS_Store
.idea
.vscode
artifacts
artifacts
webhook
attacknetruns
metrics-server.yaml
17 changes: 0 additions & 17 deletions .vscode/launch.json

This file was deleted.

5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

5 changes: 5 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* @bsamuels453
terraform/ @barnabasbusa
planner-configs/ @parithosh @barnabasbusa
network-configs/ @parithosh @barnabasbusa
test-suites/ @parithosh @barnabasbusa
46 changes: 34 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The overall architecture of Attacknet relies on Kubernetes to run the workloads,
[Chaos Mesh](https://chaos-mesh.org/) to inject faults into it. Attacknet can then be configured to run healthchecks and
reports back the state of the network at the end of a test.

![architecture-diag.png](architecture-diag.png)
![docs/attacknet.svg](docs/attacknet.svg)

### TLDR; Capabilities
Attacknet can be used in the following ways:
Expand Down Expand Up @@ -137,12 +137,15 @@ network_params:
num_validator_keys_per_node: 32 # required.
kurtosis_package: "github.com/kurtosis-tech/ethereum-package"
kubernetes_namespace: kt-ethereum
topology:
bootnode_el: geth # self explanatory
bootnode_cl: prysm
targets_as_percent_of_network: 0.25 # [optional] defines what percentage of the network contains the target client. 0.25 means only 25% of nodes will contain the client defined in the fault spec. Warning: low percentages may lead to massive networks.
target_node_multiplier: 2 # optional, default:1. Adds duplicate el/cl combinations based on the multiplier. Useful for testing weird edge cases in consensus
fault_config:
fault_type: ClockSkew # which fault to use. A list of faults currently supported by the planner can be found in pkg/plan/suite/types.go in FaultTypeEnum
target_client: reth # which client to test. this can be an exec client or a consensus client. must show up in the client definitions above.
wait_before_first_test: 300s # how long to wait before running the first test. Set this to 25 minutes to test against a finalized network.
bootnode_el: geth
bootnode_cl: prysm
fault_config_dimensions: # the different fault configurations to use when creating tests. At least one config dimension is required.
- skew: -2m # these configs differ for each fault
duration: 1m
Expand Down Expand Up @@ -212,16 +215,23 @@ If you're just trying to test things out, use `attacknet start suite`. This refe

## Changelog

**Dec 15, 2023 version v0.1 (internal)**
- Initial internal release
**TBD**

**Jan 11, 2024 version v0.2 (internal)**
- Updated to kurtosis v0.86.1
- Updated to Go 1.21
- Grafana port-forwarding has been temporarily disabled
- Introduces multi-step tests. This allows multiple faults and other actions to be composed into a single test.
- Introduces the suite planner. The suite planner allows the user to define a set of testing criteria/dimensions, which the planner turns into a suite containing multiple tests.
- Successful & failed test suites now emit test artifacts summarizing the results of the test.
First public release!

**New**
- Added two new configuration options in the test planner:
- target_node_multiplier, which duplicates the number of nodes on the network containing the client under test
- targets_as_percent_of_network, which adds more non-test nodes to the network to improve client diversity testing
- Added new fault options to the test planner:
- Network latency faults
- Network packet loss faults
- Beacon chain clients are now included in health checking.

**Fixed**
- Fixed an issue where the test planner's resultant network topology was non-deterministic
- Fixed an issue where a dropped port-forwarding connection to a pod may result in a panic
- Fixed an issue where Chaos Mesh would fail to find targets in networks with more than 10 nodes

**Jan 30, 2024 version v0.3 (internal)**
- Fixed the demo example suite
Expand All @@ -232,9 +242,21 @@ If you're just trying to test things out, use `attacknet start suite`. This refe
- Peer scoring is now disabled for all planner-generated network configurations.
- Bootnodes are no longer targetable by planner-generated test suites.

**Jan 11, 2024 version v0.2 (internal)**
- Updated to kurtosis v0.86.1
- Updated to Go 1.21
- Grafana port-forwarding has been temporarily disabled
- Introduces multi-step tests. This allows multiple faults and other actions to be composed into a single test.
- Introduces the suite planner. The suite planner allows the user to define a set of testing criteria/dimensions, which the planner turns into a suite containing multiple tests.
- Successful & failed test suites now emit test artifacts summarizing the results of the test.

**Dec 15, 2023 version v0.1 (internal)**
- Initial internal release

## Developing (wip)

1. Install pre-commit
- `brew install pre-commit`
- `pre-commit install`

When making pull requests, target the `develop` branch, not main.
Binary file removed architecture-diag.png
Binary file not shown.
39 changes: 39 additions & 0 deletions cmd/attacknet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var CLI struct {
Name string `arg:"" optional:"" name:"name" help:"The name of the test suite to be generated"`
Path string `arg:"" optional:"" type:"existingfile" name:"path" help:"Location of the planner configuration."`
} `cmd:"" help:"Construct an attacknet suite for a client"`
// Explore struct{} `cmd:"" help:"Run in exploration mode"`
}

func main() {
Expand Down Expand Up @@ -68,6 +69,44 @@ func main() {
log.Fatal(err)
os.Exit(1)
}
/*
case "explore":
topo, err := plan.LoadPlannerConfigFromPath("planner-configs/network-latency-reth.yaml")
if err != nil {
log.Fatal(err)
}
suiteCfg, err := project.LoadSuiteConfigFromName("plan/network-latency-reth")
if err != nil {
log.Fatal(err)
}

f, err := os.ReadFile("webhook")
if err != nil {
log.Fatal(err)
}
w := string(f)
client, err := webhook.NewWithURL(w)
if err != nil {
log.Fatal(err)
}

err = exploration.StartExploration(topo, suiteCfg)
if err != nil {
message, err := client.CreateContent(fmt.Sprintf("attacknet run completed with error %s", err.Error()))
if err != nil {
log.Fatal(err)
}
_ = message
log.Fatal(err)
}

message, err := client.CreateContent("attacknet run completed with error ")
if err != nil {
log.Fatal(err)
}
_ = message
os.Exit(1)
*/
default:
log.Fatal("unrecognized arguments")
}
Expand Down
4 changes: 4 additions & 0 deletions docs/attacknet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 23 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ toolchain go1.21.3

require (
github.com/alecthomas/kong v0.8.1
github.com/attestantio/go-eth2-client v0.19.10
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20240104130649-f55576898805
github.com/disgoorg/disgo v0.17.2
github.com/ethereum/go-ethereum v1.13.8
github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc
github.com/kurtosis-tech/kurtosis/api/golang v0.86.1
github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409
github.com/rs/zerolog v1.29.1
github.com/sirupsen/logrus v1.9.3
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.29.0
k8s.io/apimachinery v0.29.0
Expand All @@ -20,13 +24,10 @@ require (
)

require (
connectrpc.com/connect v1.11.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
Expand All @@ -37,21 +38,26 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/disgoorg/json v1.1.0 // indirect
github.com/disgoorg/snowflake/v2 v2.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/emicklei/go-restful/v3 v3.11.1 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/ferranbt/fastssz v0.1.3 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/swag v0.22.7 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/go-yaml/yaml v2.1.0+incompatible // indirect
github.com/goccy/go-yaml v1.9.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand All @@ -64,20 +70,22 @@ require (
github.com/gosimple/slug v1.13.1 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/huandu/go-clone v1.6.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20231031173452-349f1ec9a443 // indirect
github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20240109102239-4ba41ce90af0 // indirect
github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20240109102239-4ba41ce90af0 // indirect
github.com/kurtosis-tech/kurtosis/utils v0.0.0-20240109102239-4ba41ce90af0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mholt/archiver v3.1.1+incompatible // indirect
github.com/mholt/archiver/v3 v3.5.1 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/moby/spdystream v0.2.0 // indirect
Expand All @@ -87,15 +95,16 @@ require (
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/nwaples/rardecode v1.1.3 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be // indirect
github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 // indirect
github.com/r3labs/sse/v2 v2.10.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sasha-s/go-csync v0.0.0-20240107134140-fcbab37b09ad // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.1 // indirect
Expand All @@ -106,10 +115,12 @@ require (
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
Expand All @@ -119,13 +130,15 @@ require (
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.16.1 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apiextensions-apiserver v0.29.0 // indirect
Expand Down
Loading
Loading