fix: remove global prover state from size calculation

This commit is contained in:
Cassandra Heart 2025-10-06 18:32:18 -05:00
parent 93820ad135
commit b8cd46b920
No known key found for this signature in database
GPG Key ID: 371083BFA6C240AA

View File

@ -174,7 +174,29 @@ func (hg *HypergraphCRDT) GetSize(
hg.mu.RLock()
defer hg.mu.RUnlock()
if shardKey == nil {
return hg.size
sk := tries.ShardKey{
L1: [3]byte{0, 0, 0},
L2: [32]byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
}
vas := hg.getVertexAddsSet(sk)
has := hg.getHyperedgeAddsSet(sk)
vrs := hg.getVertexRemovesSet(sk)
hrs := hg.getHyperedgeRemovesSet(sk)
size := new(big.Int).Set(hg.size)
size = size.Sub(
size,
new(big.Int).Add(
new(big.Int).Add(vas.GetSize(), has.GetSize()),
new(big.Int).Add(vrs.GetSize(), hrs.GetSize()),
),
)
return size
}
vas := hg.getVertexAddsSet(*shardKey)