Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
connectrpc.com/connect v1.18.1
connectrpc.com/grpcreflect v1.3.0
github.com/DataDog/zstd v1.5.2
github.com/StephenButtolph/canoto v0.18.0
github.com/StephenButtolph/canoto v0.19.0
github.com/antithesishq/antithesis-sdk-go v0.3.8
github.com/arr4n/shed v0.0.0-20260217105731-4cd15adfa100
github.com/ava-labs/avalanchego/graft/coreth v1.14.2
Expand Down Expand Up @@ -95,7 +95,7 @@ require (
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/ava-labs/avalanchego/graft/evm v1.14.2
github.com/ava-labs/firewood-go-ethhash/ffi v0.8.0
github.com/ava-labs/simplex v0.0.0-20260429081342-03ce910391ad
github.com/ava-labs/simplex v0.0.0-20260611151552-a52ac47b7a98
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.20.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.5 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
github.com/StephenButtolph/canoto v0.18.0 h1:czLis9aEly5R/ExPwB5X0PJLhXi7Sv4PpffaAJV3KnE=
github.com/StephenButtolph/canoto v0.18.0/go.mod h1:01RsiQp1gnV1eJ6LwygP6buPCLUoAz7jKadQSB0FI0o=
github.com/StephenButtolph/canoto v0.19.0 h1:a28jijQ4gyaSW920h69nX1E/o9WilHlx6L9PVuLkB/Y=
github.com/StephenButtolph/canoto v0.19.0/go.mod h1:01RsiQp1gnV1eJ6LwygP6buPCLUoAz7jKadQSB0FI0o=
github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40=
github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
Expand Down Expand Up @@ -337,8 +337,8 @@ github.com/ava-labs/firewood-go-ethhash/ffi v0.8.0 h1:EDhwnUb6Fy/88cqUCcuj0R5u8i
github.com/ava-labs/firewood-go-ethhash/ffi v0.8.0/go.mod h1:3pf8KGfCmqegWoY5/pZ1NHUcyuRkfl/vHQuOjsdUtbI=
github.com/ava-labs/libevm v1.13.15-0.20260803133207-db6d70f2748e h1:lgh3CISHSmfA0IYmnzrQUfoo2XPBhhOcDOnvftqryQk=
github.com/ava-labs/libevm v1.13.15-0.20260803133207-db6d70f2748e/go.mod h1:6NxGoR1aLABnfLy+fncXRj0W6rUoUrXghnAWZ+Rhr4o=
github.com/ava-labs/simplex v0.0.0-20260429081342-03ce910391ad h1:P5IRndHUinfIZ73jdxl3M6jdcnKkQOLYvhGvE3VDiSU=
github.com/ava-labs/simplex v0.0.0-20260429081342-03ce910391ad/go.mod h1:DADqV3zJ+ij8GqliStJ+aj9l/cPtb5ZUhNy5KxlDEsQ=
github.com/ava-labs/simplex v0.0.0-20260611151552-a52ac47b7a98 h1:Q+RgaYN3qa5kYVy4WAvsNa+caxgG0R99plX7gvcHDW4=
github.com/ava-labs/simplex v0.0.0-20260611151552-a52ac47b7a98/go.mod h1:7okfX9Bkv6AzH5248vuYMjvAaFTXppVelZkyJzgCm9I=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down
2 changes: 1 addition & 1 deletion graft/coreth/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
connectrpc.com/grpcreflect v1.3.0 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/StephenButtolph/canoto v0.18.0 // indirect
github.com/StephenButtolph/canoto v0.19.0 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.20.0 // indirect
Expand Down
3 changes: 1 addition & 2 deletions graft/coreth/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKz
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
github.com/StephenButtolph/canoto v0.18.0 h1:czLis9aEly5R/ExPwB5X0PJLhXi7Sv4PpffaAJV3KnE=
github.com/StephenButtolph/canoto v0.18.0/go.mod h1:01RsiQp1gnV1eJ6LwygP6buPCLUoAz7jKadQSB0FI0o=
github.com/StephenButtolph/canoto v0.19.0 h1:a28jijQ4gyaSW920h69nX1E/o9WilHlx6L9PVuLkB/Y=
github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40=
github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
Expand Down
2 changes: 1 addition & 1 deletion graft/evm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/BurntSushi/toml v1.5.0 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/StephenButtolph/canoto v0.18.0 // indirect
github.com/StephenButtolph/canoto v0.19.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.20.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.5 // indirect
Expand Down
3 changes: 1 addition & 2 deletions graft/evm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKz
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
github.com/StephenButtolph/canoto v0.18.0 h1:czLis9aEly5R/ExPwB5X0PJLhXi7Sv4PpffaAJV3KnE=
github.com/StephenButtolph/canoto v0.18.0/go.mod h1:01RsiQp1gnV1eJ6LwygP6buPCLUoAz7jKadQSB0FI0o=
github.com/StephenButtolph/canoto v0.19.0 h1:a28jijQ4gyaSW920h69nX1E/o9WilHlx6L9PVuLkB/Y=
github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40=
github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
Expand Down
2 changes: 1 addition & 1 deletion graft/subnet-evm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ require (
connectrpc.com/grpcreflect v1.3.0 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/StephenButtolph/canoto v0.18.0 // indirect
github.com/StephenButtolph/canoto v0.19.0 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/ava-labs/avalanchego/graft/coreth v1.14.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down
3 changes: 1 addition & 2 deletions graft/subnet-evm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKz
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
github.com/StephenButtolph/canoto v0.18.0 h1:czLis9aEly5R/ExPwB5X0PJLhXi7Sv4PpffaAJV3KnE=
github.com/StephenButtolph/canoto v0.18.0/go.mod h1:01RsiQp1gnV1eJ6LwygP6buPCLUoAz7jKadQSB0FI0o=
github.com/StephenButtolph/canoto v0.19.0 h1:a28jijQ4gyaSW920h69nX1E/o9WilHlx6L9PVuLkB/Y=
github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40=
github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
Expand Down
11 changes: 7 additions & 4 deletions simplex/comm.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Comm struct {
// broadcastNodes are the nodes that should receive broadcast messages
broadcastNodes set.Set[ids.NodeID]
// allNodes are the IDs of all the nodes in the subnet
allNodes []simplex.NodeID
allNodes simplex.Nodes

// sender is used to send messages to other nodes
sender sender.ExternalSender
Expand All @@ -40,12 +40,15 @@ type Comm struct {

func NewComm(config *Config) (*Comm, error) {
broadcastNodes := set.NewSet[ids.NodeID](len(config.Params.InitialValidators) - 1)
allNodes := make([]simplex.NodeID, 0, len(config.Params.InitialValidators))
allNodes := make(simplex.Nodes, 0, len(config.Params.InitialValidators))

includesOurNodeID := false
// grab all the nodes that are validators for the subnet
for _, vd := range config.Params.InitialValidators {
allNodes = append(allNodes, vd.NodeID[:])
allNodes = append(allNodes, simplex.Node{
Node: vd.NodeID[:],
Weight: 1,
})
if vd.NodeID == config.Ctx.NodeID {
includesOurNodeID = true
continue // skip our own node ID
Expand Down Expand Up @@ -74,7 +77,7 @@ func NewComm(config *Config) (*Comm, error) {
}, nil
}

func (c *Comm) Nodes() []simplex.NodeID {
func (c *Comm) Nodes() simplex.Nodes {
return c.allNodes
}

Expand Down
4 changes: 2 additions & 2 deletions simplex/comm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func TestCommBroadcast(t *testing.T) {
require.NoError(t, err)
outboundMsg, err := config.OutboundMsgBuilder.SimplexMessage(newVote(config.Ctx.ChainID, testSimplexMessage.VoteMessage))
require.NoError(t, err)
nodes := make([]ids.NodeID, 0, len(comm.Nodes()))
for _, node := range comm.Nodes() {
nodes := make([]ids.NodeID, 0, len(comm.Nodes().NodeIDs()))
for _, node := range comm.Nodes().NodeIDs() {
if node.Equals(config.Ctx.NodeID[:]) {
continue // skip the sending node
}
Expand Down
4 changes: 3 additions & 1 deletion simplex/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func newEngineWithSignerVerifier(ctx context.Context, config *Config, signer BLS
Signer: &signer,
Verifier: &verifier,
BlockDeserializer: blockDeserializer,
SignatureAggregator: signatureAggregator,
SignatureAggregatorCreator: func(_ []simplex.Node) simplex.SignatureAggregator {
return signatureAggregator
},
Comm: comm,
Storage: storage,
WAL: config.WAL,
Expand Down
29 changes: 29 additions & 0 deletions simplex/qc.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,35 @@ func (a *SignatureAggregator) Aggregate(signatures []simplex.Signature) (simplex
sig: aggregatedSig,
}, nil
}
func (*SignatureAggregator) AppendSignatures(existing []byte, sigs ...[]byte) ([]byte, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function isn't tested

blsSigs := make([]*bls.Signature, 0, len(sigs)+1)

if len(existing) > 0 {
sig, err := bls.SignatureFromBytes(existing)
if err != nil {
return nil, fmt.Errorf("%w: %w", errFailedToParseSignature, err)
}
blsSigs = append(blsSigs, sig)
}
for _, rawSig := range sigs {
sig, err := bls.SignatureFromBytes(rawSig)
if err != nil {
return nil, fmt.Errorf("%w: %w", errFailedToParseSignature, err)
}
blsSigs = append(blsSigs, sig)
}
if len(blsSigs) == 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why though? isn't (nil, nil) a valid input?

return nil, errSignatureAggregation
}

aggregated, err := bls.AggregateSignatures(blsSigs)
if err != nil {
return nil, fmt.Errorf("%w: %w", errSignatureAggregation, err)
}

return bls.SignatureToBytes(aggregated), nil

}

// IsQuorum checks if the provided nodes are a quorum of the membership set.
// For now, this is calculated using one node = one vote, but in the future we can adjust
Expand Down
2 changes: 1 addition & 1 deletion simplex/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func newTestFinalization(t *testing.T, configs []*Config, bh simplex.BlockHeader
require.NoError(t, err)
sigAgg := &SignatureAggregator{verifier: &verifier}

finalization, err := simplex.NewFinalization(configs[0].Log, sigAgg, finalizedVotes)
finalization, err := simplex.NewFinalization(sigAgg, finalizedVotes)
require.NoError(t, err)
return finalization
}
Expand Down