v2.0.3-p3

This commit is contained in:
Cassandra Heart 2024-11-12 03:33:20 -06:00
parent d4a5e30ba2
commit 71b13c5490
No known key found for this signature in database
GPG Key ID: 6352152859385958
4 changed files with 20 additions and 6 deletions

View File

@ -139,7 +139,7 @@ func (e *DataClockConsensusEngine) processFrame(
return nextFrame
} else {
if latestFrame.Timestamp > time.Now().UnixMilli()-30000 {
if latestFrame.Timestamp > time.Now().UnixMilli()-120000 {
if !e.IsInProverTrie(e.pubSub.GetPeerID()) {
e.logger.Info("announcing prover join")
for _, eng := range e.executionEngines {
@ -156,10 +156,12 @@ func (e *DataClockConsensusEngine) processFrame(
peerProvingKeyAddress := h.FillBytes(make([]byte, 32))
ring := -1
for i, tries := range e.GetFrameProverTries()[1:] {
i := i
if tries.Contains(peerProvingKeyAddress) {
ring = i
if len(e.GetFrameProverTries()) > 1 {
for i, tries := range e.GetFrameProverTries()[1:] {
i := i
if tries.Contains(peerProvingKeyAddress) {
ring = i
}
}
}

View File

@ -19,7 +19,7 @@ import (
)
const PROOF_FRAME_CUTOFF = 46500
const PROOF_FRAME_RING_RESET = 53000
const PROOF_FRAME_RING_RESET = 52000
func (a *TokenApplication) handleMint(
currentFrameNumber uint64,

View File

@ -67,6 +67,12 @@ func PackOutputIntoPayloadAndProof(
if previousTree != nil {
hash := sha3.Sum256(frame.Output)
pick := BytesToUnbiasedMod(hash, uint64(modulo))
if uint64(modulo) < pick {
return nil, nil, nil, errors.Wrap(
errors.New("proof size mismatch"),
"pack output into payload and proof",
)
}
for _, sib := range previousTree.Proofs[int(pick)].Siblings {
payload = append(payload, sib...)
output = append(output, sib)

View File

@ -38,6 +38,9 @@ type RollingFrecencyCritbitTrie struct {
func (t *RollingFrecencyCritbitTrie) Serialize() ([]byte, error) {
t.mu.RLock()
defer t.mu.RUnlock()
if t.Root == nil {
return []byte{}, nil
}
var b bytes.Buffer
enc := gob.NewEncoder(&b)
@ -52,6 +55,9 @@ func (t *RollingFrecencyCritbitTrie) Serialize() ([]byte, error) {
func (t *RollingFrecencyCritbitTrie) Deserialize(buf []byte) error {
t.mu.Lock()
defer t.mu.Unlock()
if len(buf) == 0 {
return nil
}
var b bytes.Buffer
b.Write(buf)