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

Required quorums glitch #255

Merged
merged 8 commits into from
Jan 24, 2025
Merged
Changes from 6 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
27 changes: 26 additions & 1 deletion verify/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"context"
"encoding/json"
"fmt"
"strings"

"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/gnark-crypto/ecc/bn254"
Expand All @@ -17,6 +18,10 @@
"github.com/Layr-Labs/eigenda/encoding/rs"
)

var (
HOLESKY_SVC_MANAGER_V1_ADDRESS = "0xD4A7E1Bd8015057293f0D0A557088c286942e84b"

Check failure on line 22 in verify/verifier.go

View workflow job for this annotation

GitHub Actions / Linter

var-naming: don't use ALL_CAPS in Go names; use CamelCase (revive)
)

type Config struct {
KzgConfig *kzg.KzgConfig
VerifyCerts bool
Expand Down Expand Up @@ -45,6 +50,8 @@
// cert verification is optional, and verifies certs retrieved from eigenDA when turned on
verifyCerts bool
cv *CertVerifier
// holesky is a flag to enable/disable holesky specific checks
holesky bool
}

func NewVerifier(cfg *Config, l log.Logger) (*Verifier, error) {
Expand All @@ -67,6 +74,7 @@
kzgVerifier: kzgVerifier,
verifyCerts: cfg.VerifyCerts,
cv: cv,
holesky: isHolesky(cfg.SvcManagerAddr),
}, nil
}

Expand Down Expand Up @@ -183,11 +191,28 @@
}

// ensure that required quorums are present in the confirmed ones
for _, quorum := range v.cv.quorumsRequired {
for _, quorum := range requiredQuorum(batchHeader.ReferenceBlockNumber, v) {
if !confirmedQuorums[quorum] {
return fmt.Errorf("quorum %d is required but not present in confirmed quorums", quorum)
}
}

return nil
}

func requiredQuorum(referenceBlockNumber uint32, v *Verifier) []uint8 {
// This check is required due to a bug we had when we updated the EigenDAServiceManager in Holesky. For a brief period of time, the quorum 1 was not
// required for the commitment to be confirmed, so the disperser created batches with only quorum 0 signatures.
// Archive nodes trying to sync from these stored batches would thus fail validation here since
// quorumsRequired is read from the latestBlock, where the bug has been fixed and both quorums are required.
// This check is only for testnet and for a specific block range.
if v.holesky && referenceBlockNumber >= 2950000 && referenceBlockNumber < 2960000 {
return []uint8{0}
} else {

Check failure on line 211 in verify/verifier.go

View workflow job for this annotation

GitHub Actions / Linter

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
return v.cv.quorumsRequired
}
}

func isHolesky(svcAddress string) bool {
return strings.ToLower(strings.TrimPrefix(svcAddress, "0x")) == strings.ToLower(strings.TrimPrefix(HOLESKY_SVC_MANAGER_V1_ADDRESS, "0x"))

Check failure on line 217 in verify/verifier.go

View workflow job for this annotation

GitHub Actions / Linter

SA6005: should use strings.EqualFold instead (staticcheck)
}
Loading