Skip to content

Commit

Permalink
added more block constraints to check_consensus_block_proposals task
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Feb 9, 2024
1 parent 1a5e2a0 commit 93f2fea
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 13 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/itchyny/gojq v0.12.14 // indirect
github.com/itchyny/timefmt-go v0.1.5 // indirect
github.com/juliangruber/go-intersect v1.1.0 // indirect
github.com/kilic/bls12-381 v0.1.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down Expand Up @@ -90,4 +91,4 @@ require (
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88=
github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
Expand Down Expand Up @@ -142,14 +143,19 @@ github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm
github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/juliangruber/go-intersect v1.1.0 h1:sc+y5dCjMMx0pAdYk/N6KBm00tD/f3tq+Iox7dYDUrY=
github.com/juliangruber/go-intersect v1.1.0/go.mod h1:WMau+1kAmnlQnKiikekNJbtGtfmILU/mMU6H7AgKbWQ=
github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4=
github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig=
github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw=
github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4=
github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc=
github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
Expand Down
21 changes: 21 additions & 0 deletions pkg/coordinator/tasks/check_consensus_block_proposals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ The `check_consensus_block_proposals` task checks consensus block proposals to m
- **`minBlobCount`**:\
The minimum number of blob sidecars (extra data packets) in a block.

- **`expectDeposits`**:\
A list of validator public keys expected to have deposit operations included in the block.

- **`expectExits`**:\
A list of validator public keys expected to have exit operations included in the block.

- **`expectSlashings`**:\
A list of expected slashing operations in the block, each specified as an object with a `publicKey` and a `slashingType` ("attester" or "proposer"). If `slashingType` is omitted, any type of slashing is accepted.

- **`expectBlsChanges`**:\
A list of expected BLS change operations in the block, each as an object with a `publicKey` and the target `address` (optional).

- **`expectWithdrawals`**:\
A list of expected withdrawal operations in the block, each as an object with a `publicKey`, `address`, and a `minAmount` specifying the minimum amount expected for the withdrawal.


### Defaults

These are the default settings for the `check_consensus_block_proposals` task:
Expand All @@ -64,4 +80,9 @@ These are the default settings for the `check_consensus_block_proposals` task:
minWithdrawalCount: 0
minTransactionCount: 0
minBlobCount: 0
expectDeposits: []
expectExits: []
expectSlashings: []
expectBlsChanges: []
expectWithdrawals: []
```
18 changes: 18 additions & 0 deletions pkg/coordinator/tasks/check_consensus_block_proposals/config.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package checkconsensusblockproposals

import "math/big"

type Config struct {
BlockCount int `yaml:"blockCount" json:"blockCount"`
GraffitiPattern string `yaml:"graffitiPattern" json:"graffitiPattern"`
Expand All @@ -14,6 +16,22 @@ type Config struct {
MinWithdrawalCount int `yaml:"minWithdrawalCount" json:"minWithdrawalCount"`
MinTransactionCount int `yaml:"minTransactionCount" json:"minTransactionCount"`
MinBlobCount int `yaml:"minBlobCount" json:"minBlobCount"`

ExpectDeposits []string `yaml:"expectDeposits" json:"expectDeposits"`
ExpectExits []string `yaml:"expectExits" json:"expectExits"`
ExpectSlashings []struct {
PublicKey string `yaml:"publicKey" json:"publicKey"`
SlashingType string `yaml:"slashingType" json:"slashingType"`
} `yaml:"expectSlashings" json:"expectSlashings"`
ExpectBlsChanges []struct {
PublicKey string `yaml:"publicKey" json:"publicKey"`
Address string `yaml:"address" json:"address"`
} `yaml:"expectBlsChanges" json:"expectBlsChanges"`
ExpectWithdrawals []struct {
PublicKey string `yaml:"publicKey" json:"publicKey"`
Address string `yaml:"address" json:"address"`
MinAmount *big.Int `yaml:"minAmount" json:"minAmount"`
} `yaml:"expectWithdrawals" json:"expectWithdrawals"`
}

func DefaultConfig() Config {
Expand Down
Loading

0 comments on commit 93f2fea

Please sign in to comment.