fix: fewer available shards than provers should choose shard length

This commit is contained in:
Cassandra Heart 2025-10-05 23:49:10 -05:00
parent 7c13667ad9
commit 0174e0c324
No known key found for this signature in database
GPG Key ID: 371083BFA6C240AA

View File

@ -2077,10 +2077,11 @@ func (e *GlobalConsensusEngine) ProposeWorkerJoin(
challenge := sha3.Sum256(frame.Header.Output)
results := make([][516]byte, len(serviceClients))
joins := min(len(serviceClients), len(filters))
results := make([][516]byte, joins)
idx := uint32(0)
ids := [][]byte{}
for range len(serviceClients) {
for range joins {
ids = append(
ids,
slices.Concat(
@ -2095,11 +2096,15 @@ func (e *GlobalConsensusEngine) ProposeWorkerJoin(
idx = 0
wg := errgroup.Group{}
wg.SetLimit(len(serviceClients))
wg.SetLimit(joins)
for _, svc := range serviceClients {
svc := svc
i := idx
// limit to available joins
if i == uint32(joins) {
break
}
wg.Go(func() error {
client := protobufs.NewDataIPCServiceClient(svc)
resp, err := client.CreateJoinProof(
@ -2148,6 +2153,10 @@ func (e *GlobalConsensusEngine) ProposeWorkerJoin(
return errors.Wrap(err, "propose worker join")
}
for _, res := range results {
join.Proof = append(join.Proof, res[:]...)
}
bundle := &protobufs.MessageBundle{
Requests: []*protobufs.MessageRequest{
{
@ -2156,6 +2165,7 @@ func (e *GlobalConsensusEngine) ProposeWorkerJoin(
},
},
},
Timestamp: time.Now().UnixMilli(),
}
msg, err := bundle.ToCanonicalBytes()