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

chore: public testnet checks #434

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,3 +450,25 @@ example:
--tracing-port string port to send tracing data
--tracing-service-name string service name identifier for tracing (default "beekeeper")
```

## Public Testnet Checks

### One by one

```shell
./dist/beekeeper check --cluster-name=bee-testnet --checks=pingpong
./dist/beekeeper check --cluster-name=bee-testnet --checks=pt-retrieval
./dist/beekeeper check --cluster-name=bee-testnet --checks=pt-settlements
./dist/beekeeper check --cluster-name=bee-testnet --checks=pt-manifest
./dist/beekeeper check --cluster-name=bee-testnet --checks=pt-pss
./dist/beekeeper check --cluster-name=bee-testnet --checks=pt-soc
./dist/beekeeper check --cluster-name=bee-testnet --checks=pt-pushsync-chunks
./dist/beekeeper check --cluster-name=bee-testnet --checks=pt-postage
./dist/beekeeper check --cluster-name=bee-testnet --checks=pt-gsoc
```

### All at once, sequentially

```shell
./dist/beekeeper check --cluster-name=bee-testnet --timeout=2h --checks=pingpong,pt-retrieval,pt-settlements,pt-manifest,pt-pss,pt-soc,pt-pushsync-chunks,pt-postage,pt-gsoc
```
128 changes: 128 additions & 0 deletions config/public-testnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
clusters:
bee-testnet:
_inherit: "default"
namespace: bee-testnet
use-static-endpoints: true
node-groups:
bee:
mode: node
bee-config: default
config: default
count: 20
endpoints:
- name: bee-1-0
api-url: http://bee-1-0.bee-testnet.testnet.internal
- name: bee-1-1
api-url: http://bee-1-1.bee-testnet.testnet.internal
- name: bee-1-2
api-url: http://bee-1-2.bee-testnet.testnet.internal
- name: bee-1-3
api-url: http://bee-1-3.bee-testnet.testnet.internal
- name: bee-1-4
api-url: http://bee-1-4.bee-testnet.testnet.internal
- name: bee-2-0
api-url: http://bee-2-0.bee-testnet.testnet.internal
- name: bee-2-1
api-url: http://bee-2-1.bee-testnet.testnet.internal
- name: bee-2-2
api-url: http://bee-2-2.bee-testnet.testnet.internal
- name: bee-2-3
api-url: http://bee-2-3.bee-testnet.testnet.internal
- name: bee-2-4
api-url: http://bee-2-4.bee-testnet.testnet.internal
- name: bee-3-0
api-url: http://bee-3-0.bee-testnet.testnet.internal
- name: bee-3-1
api-url: http://bee-3-1.bee-testnet.testnet.internal
- name: bee-3-2
api-url: http://bee-3-2.bee-testnet.testnet.internal
- name: bee-3-3
api-url: http://bee-3-3.bee-testnet.testnet.internal
- name: bee-3-4
api-url: http://bee-3-4.bee-testnet.testnet.internal
- name: bee-4-0
api-url: http://bee-4-0.bee-testnet.testnet.internal
- name: bee-4-1
api-url: http://bee-4-1.bee-testnet.testnet.internal
- name: bee-4-2
api-url: http://bee-4-2.bee-testnet.testnet.internal
- name: bee-4-3
api-url: http://bee-4-3.bee-testnet.testnet.internal
- name: bee-4-4
api-url: http://bee-4-4.bee-testnet.testnet.internal

checks:
pt-retrieval:
options:
chunks-per-node: 3
postage-amount: 140000000
postage-depth: 17
upload-node-count: 3
timeout: 15m
type: retrieval
pt-settlements:
options:
dry-run: false
expect-settlements: true
file-name: settlements
file-size: 14680064 # 14mb = 14*1024*1024
postage-amount: 140000000
postage-depth: 20
threshold: 100000000
upload-node-count: 3
wait-before-download: 15s
timeout: 15m
type: settlements
pt-manifest:
options:
files-in-collection: 10
max-pathname-length: 64
postage-amount: 140000000
postage-depth: 17
timeout: 5m
type: manifest
pt-pss:
options:
count: 3
address-prefix: 2
postage-amount: 140000000
postage-depth: 17
request-timeout: 5m
timeout: 30m
type: pss
pt-soc:
options:
postage-amount: 140000000
postage-depth: 17
request-timeout: 5m
timeout: 5m
type: soc
pt-pushsync-chunks:
options:
chunks-per-node: 3
mode: chunks
postage-amount: 140000000
postage-depth: 17
retries: 5
retry-delay: 15s
upload-node-count: 3
exclude-node-group:
- light
- bootnode
timeout: 30m
type: pushsync
pt-postage:
type: postage
timeout: 30m
options:
postage-amount: 140000000
postage-depth: 17
postage-topup-amount: 100
postage-new-depth: 18
pt-gsoc:
options:
postage-amount: 140000000
postage-depth: 20
postage-label: gsoc-label
timeout: 10m
type: gsoc
28 changes: 11 additions & 17 deletions pkg/check/settlements/settlements.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int

if o.DryRun {
c.logger.Info("running settlements (dry mode)")
return dryRun(ctx, cluster, o, c.logger)
return dryRun(ctx, cluster, c.logger)
}

rnd := random.PseudoGenerator(o.Seed)
Expand All @@ -97,7 +97,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int
return err
}

if err := validateSettlements(overlays, accounting, settlements, c.logger); err != nil {
if err := validateSettlements(accounting, settlements, c.logger); err != nil {
return fmt.Errorf("invalid initial settlements: %s", err.Error())
}
c.logger.Info("Settlements are valid")
Expand Down Expand Up @@ -152,8 +152,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int
settlementsHappened = true
}

err = validateSettlements(overlays, accounting, settlements, c.logger)
if err != nil {
if err = validateSettlements(accounting, settlements, c.logger); err != nil {
c.logger.Infof("Invalid settlements after uploading a file: %s", err.Error())
c.logger.Info("Retrying ...")
continue
Expand Down Expand Up @@ -203,7 +202,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int
settlementsHappened = true
}

err = validateSettlements(overlays, accounting, settlements, c.logger)
err = validateSettlements(accounting, settlements, c.logger)
if err != nil {
c.logger.Infof("Invalid settlements after downloading a file: %s", err.Error())
c.logger.Info("Retrying ...")
Expand All @@ -228,12 +227,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int
}

// dryRun executes settlements validation check without files uploading/downloading
func dryRun(ctx context.Context, cluster orchestration.Cluster, o Options, logger logging.Logger) (err error) {
overlays, err := cluster.FlattenOverlays(ctx)
if err != nil {
return err
}

func dryRun(ctx context.Context, cluster orchestration.Cluster, logger logging.Logger) (err error) {
accounting, err := cluster.FlattenAccounting(ctx)
if err != nil {
return err
Expand All @@ -244,7 +238,7 @@ func dryRun(ctx context.Context, cluster orchestration.Cluster, o Options, logge
return err
}

if err := validateSettlements(overlays, accounting, settlements, logger); err != nil {
if err := validateSettlements(accounting, settlements, logger); err != nil {
return fmt.Errorf("invalid settlements")
}
logger.Info("Settlements are valid")
Expand All @@ -253,7 +247,7 @@ func dryRun(ctx context.Context, cluster orchestration.Cluster, o Options, logge
}

// validateSettlements checks if settlements are valid
func validateSettlements(overlays orchestration.NodeGroupOverlays, accounting orchestration.NodeGroupAccounting, settlements orchestration.NodeGroupSettlements, logger logging.Logger) (err error) {
func validateSettlements(accounting orchestration.NodeGroupAccounting, settlements orchestration.NodeGroupSettlements, logger logging.Logger) (err error) {
// threshold validation
for node, v := range accounting {
for _, peerInfo := range v {
Expand All @@ -273,10 +267,10 @@ func validateSettlements(overlays orchestration.NodeGroupOverlays, accounting or
for peer, peerInfo := range v {
diff := peerInfo.Balance + accounting[peer][node].Balance
if diff != 0 {
logger.Infof("Node %s has asymmetric balance with peer %s\n", node, peer)
logger.Infof("Node %s has balance %d with peer %s\n", node, peerInfo.Balance, peer)
logger.Infof("Peer %s has balance %d with node %s\n", peer, accounting[peer][node].Balance, node)
logger.Infof("Difference: %d\n", diff)
logger.Infof("Node %s has asymmetric balance with peer %s", node, peer)
logger.Infof("Node %s has balance %d with peer %s", node, peerInfo.Balance, peer)
logger.Infof("Peer %s has balance %d with node %s", peer, accounting[peer][node].Balance, node)
logger.Infof("Difference: %d", diff)
noBalanceSymmetry = true
}
}
Expand Down