mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-03-09 18:27:26 +08:00
v2.0.3-p3
This commit is contained in:
parent
d4a5e30ba2
commit
71b13c5490
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user