mirror of
				https://source.quilibrium.com/quilibrium/ceremonyclient.git
				synced 2025-11-04 01:17:27 +00:00 
			
		
		
		
	tests pass, let's go
This commit is contained in:
		
							parent
							
								
									5d4612c6c6
								
							
						
					
					
						commit
						ebfb57bc29
					
				@ -819,16 +819,11 @@ func FetchTokenBalance(client protobufs.NodeServiceClient) (TokenBalance, error)
 | 
				
			|||||||
		return TokenBalance{}, errors.Wrap(err, "error getting token info")
 | 
							return TokenBalance{}, errors.Wrap(err, "error getting token info")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	conversionFactor, _ := new(big.Int).SetString("1DCD65000", 16)
 | 
						// owned := new(big.Int).SetBytes(info.OwnedTokens)
 | 
				
			||||||
 | 
					 | 
				
			||||||
	owned := new(big.Int).SetBytes(info.OwnedTokens)
 | 
					 | 
				
			||||||
	owned.Div(owned, conversionFactor)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	unconfirmedOwned := new(big.Int).SetBytes(info.UnconfirmedOwnedTokens)
 | 
						unconfirmedOwned := new(big.Int).SetBytes(info.UnconfirmedOwnedTokens)
 | 
				
			||||||
	unconfirmedOwned.Div(unconfirmedOwned, conversionFactor)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return TokenBalance{
 | 
						return TokenBalance{
 | 
				
			||||||
		Owned:            owned,
 | 
							// Owned:            owned,
 | 
				
			||||||
		UnconfirmedOwned: unconfirmedOwned,
 | 
							UnconfirmedOwned: unconfirmedOwned,
 | 
				
			||||||
	}, nil
 | 
						}, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										184
									
								
								node/app/node.go
									
									
									
									
									
								
							
							
						
						
									
										184
									
								
								node/app/node.go
									
									
									
									
									
								
							@ -1,22 +1,23 @@
 | 
				
			|||||||
package app
 | 
					package app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"bytes"
 | 
					 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"go.uber.org/zap"
 | 
						"go.uber.org/zap"
 | 
				
			||||||
 | 
						"golang.org/x/crypto/sha3"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/consensus"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/consensus"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/consensus/master"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/consensus/master"
 | 
				
			||||||
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/crypto"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/execution"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/execution"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/ceremony/application"
 | 
					 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/keys"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/keys"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/p2p"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/p2p"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/store"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/store"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/tries"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Node struct {
 | 
					type Node struct {
 | 
				
			||||||
	logger         *zap.Logger
 | 
						logger         *zap.Logger
 | 
				
			||||||
 | 
						dataProofStore store.DataProofStore
 | 
				
			||||||
	clockStore     store.ClockStore
 | 
						clockStore     store.ClockStore
 | 
				
			||||||
	keyManager     keys.KeyManager
 | 
						keyManager     keys.KeyManager
 | 
				
			||||||
	pubSub         p2p.PubSub
 | 
						pubSub         p2p.PubSub
 | 
				
			||||||
@ -40,6 +41,7 @@ func newDHTNode(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func newNode(
 | 
					func newNode(
 | 
				
			||||||
	logger *zap.Logger,
 | 
						logger *zap.Logger,
 | 
				
			||||||
 | 
						dataProofStore store.DataProofStore,
 | 
				
			||||||
	clockStore store.ClockStore,
 | 
						clockStore store.ClockStore,
 | 
				
			||||||
	keyManager keys.KeyManager,
 | 
						keyManager keys.KeyManager,
 | 
				
			||||||
	pubSub p2p.PubSub,
 | 
						pubSub p2p.PubSub,
 | 
				
			||||||
@ -54,6 +56,7 @@ func newNode(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return &Node{
 | 
						return &Node{
 | 
				
			||||||
		logger,
 | 
							logger,
 | 
				
			||||||
 | 
							dataProofStore,
 | 
				
			||||||
		clockStore,
 | 
							clockStore,
 | 
				
			||||||
		keyManager,
 | 
							keyManager,
 | 
				
			||||||
		pubSub,
 | 
							pubSub,
 | 
				
			||||||
@ -62,78 +65,115 @@ func newNode(
 | 
				
			|||||||
	}, nil
 | 
						}, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (n *Node) VerifyProofIntegrity() {
 | 
				
			||||||
 | 
						i, _, _, e := n.dataProofStore.GetLatestDataTimeProof(n.pubSub.GetPeerID())
 | 
				
			||||||
 | 
						if e != nil {
 | 
				
			||||||
 | 
							panic(e)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						dataProver := crypto.NewKZGInclusionProver(n.logger)
 | 
				
			||||||
 | 
						wesoProver := crypto.NewWesolowskiFrameProver(n.logger)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for j := int(i); j >= 0; j-- {
 | 
				
			||||||
 | 
							fmt.Println(j)
 | 
				
			||||||
 | 
							_, _, input, o, err := n.dataProofStore.GetDataTimeProof(n.pubSub.GetPeerID(), uint32(j))
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								panic(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							idx, idxProof, idxCommit, idxKP := master.GetOutputs(o)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							ip := sha3.Sum512(idxProof)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							v, err := dataProver.VerifyRaw(ip[:], idxCommit, int(idx), idxKP, 128)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								panic(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if !v {
 | 
				
			||||||
 | 
								panic("bad kzg proof")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							wp := []byte{}
 | 
				
			||||||
 | 
							wp = append(wp, n.pubSub.GetPeerID()...)
 | 
				
			||||||
 | 
							wp = append(wp, input...)
 | 
				
			||||||
 | 
							fmt.Printf("%x\n", wp)
 | 
				
			||||||
 | 
							v = wesoProver.VerifyChallengeProof(wp, uint32(j), idx, idxProof)
 | 
				
			||||||
 | 
							if !v {
 | 
				
			||||||
 | 
								panic("bad weso proof")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (n *Node) RunRepair() {
 | 
					func (n *Node) RunRepair() {
 | 
				
			||||||
	intrinsicFilter := append(
 | 
						// intrinsicFilter := append(
 | 
				
			||||||
		p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3),
 | 
						// 	p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3),
 | 
				
			||||||
		p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)...,
 | 
						// 	p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)...,
 | 
				
			||||||
	)
 | 
						// )
 | 
				
			||||||
	n.logger.Info("check store and repair if needed, this may take a few minutes")
 | 
						// n.logger.Info("check store and repair if needed, this may take a few minutes")
 | 
				
			||||||
	proverTrie := &tries.RollingFrecencyCritbitTrie{}
 | 
						// proverTrie := &tries.RollingFrecencyCritbitTrie{}
 | 
				
			||||||
	head, err := n.clockStore.GetLatestDataClockFrame(intrinsicFilter, proverTrie)
 | 
						// head, err := n.clockStore.GetLatestDataClockFrame(intrinsicFilter, proverTrie)
 | 
				
			||||||
	if err == nil && head != nil {
 | 
						// if err == nil && head != nil {
 | 
				
			||||||
		for head != nil && head.FrameNumber != 0 {
 | 
						// 	for head != nil && head.FrameNumber != 0 {
 | 
				
			||||||
			prev := head
 | 
						// 		prev := head
 | 
				
			||||||
			head, err = n.clockStore.GetStagedDataClockFrame(
 | 
						// 		head, err = n.clockStore.GetStagedDataClockFrame(
 | 
				
			||||||
				intrinsicFilter,
 | 
						// 			intrinsicFilter,
 | 
				
			||||||
				head.FrameNumber-1,
 | 
						// 			head.FrameNumber-1,
 | 
				
			||||||
				head.ParentSelector,
 | 
						// 			head.ParentSelector,
 | 
				
			||||||
				true,
 | 
						// 			true,
 | 
				
			||||||
			)
 | 
						// 		)
 | 
				
			||||||
			if err != nil {
 | 
						// 		if err != nil {
 | 
				
			||||||
				panic(err)
 | 
						// 			panic(err)
 | 
				
			||||||
			}
 | 
						// 		}
 | 
				
			||||||
			compare, _, err := n.clockStore.GetDataClockFrame(
 | 
						// 		compare, _, err := n.clockStore.GetDataClockFrame(
 | 
				
			||||||
				intrinsicFilter,
 | 
						// 			intrinsicFilter,
 | 
				
			||||||
				prev.FrameNumber-1,
 | 
						// 			prev.FrameNumber-1,
 | 
				
			||||||
				true,
 | 
						// 			true,
 | 
				
			||||||
			)
 | 
						// 		)
 | 
				
			||||||
			if err != nil {
 | 
						// 		if err != nil {
 | 
				
			||||||
				panic(err)
 | 
						// 			panic(err)
 | 
				
			||||||
			}
 | 
						// 		}
 | 
				
			||||||
			if !bytes.Equal(head.Output, compare.Output) {
 | 
						// 		if !bytes.Equal(head.Output, compare.Output) {
 | 
				
			||||||
				n.logger.Warn(
 | 
						// 			n.logger.Warn(
 | 
				
			||||||
					"repairing frame",
 | 
						// 				"repairing frame",
 | 
				
			||||||
					zap.Uint64("frame_number", head.FrameNumber),
 | 
						// 				zap.Uint64("frame_number", head.FrameNumber),
 | 
				
			||||||
				)
 | 
						// 			)
 | 
				
			||||||
				head, err = n.clockStore.GetStagedDataClockFrame(
 | 
						// 			head, err = n.clockStore.GetStagedDataClockFrame(
 | 
				
			||||||
					intrinsicFilter,
 | 
						// 				intrinsicFilter,
 | 
				
			||||||
					prev.FrameNumber-1,
 | 
						// 				prev.FrameNumber-1,
 | 
				
			||||||
					prev.ParentSelector,
 | 
						// 				prev.ParentSelector,
 | 
				
			||||||
					true,
 | 
						// 				true,
 | 
				
			||||||
				)
 | 
						// 			)
 | 
				
			||||||
				if err != nil {
 | 
						// 			if err != nil {
 | 
				
			||||||
					panic(err)
 | 
						// 				panic(err)
 | 
				
			||||||
				}
 | 
						// 			}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				txn, err := n.clockStore.NewTransaction()
 | 
						// 			txn, err := n.clockStore.NewTransaction()
 | 
				
			||||||
				if err != nil {
 | 
						// 			if err != nil {
 | 
				
			||||||
					panic(err)
 | 
						// 				panic(err)
 | 
				
			||||||
				}
 | 
						// 			}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				selector, err := head.GetSelector()
 | 
						// 			selector, err := head.GetSelector()
 | 
				
			||||||
				if err != nil {
 | 
						// 			if err != nil {
 | 
				
			||||||
					panic(err)
 | 
						// 				panic(err)
 | 
				
			||||||
				}
 | 
						// 			}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				err = n.clockStore.CommitDataClockFrame(
 | 
						// 			err = n.clockStore.CommitDataClockFrame(
 | 
				
			||||||
					intrinsicFilter,
 | 
						// 				intrinsicFilter,
 | 
				
			||||||
					head.FrameNumber,
 | 
						// 				head.FrameNumber,
 | 
				
			||||||
					selector.FillBytes(make([]byte, 32)),
 | 
						// 				selector.FillBytes(make([]byte, 32)),
 | 
				
			||||||
					proverTrie,
 | 
						// 				proverTrie,
 | 
				
			||||||
					txn,
 | 
						// 				txn,
 | 
				
			||||||
					true,
 | 
						// 				true,
 | 
				
			||||||
				)
 | 
						// 			)
 | 
				
			||||||
				if err != nil {
 | 
						// 			if err != nil {
 | 
				
			||||||
					panic(err)
 | 
						// 				panic(err)
 | 
				
			||||||
				}
 | 
						// 			}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if err = txn.Commit(); err != nil {
 | 
						// 			if err = txn.Commit(); err != nil {
 | 
				
			||||||
					panic(err)
 | 
						// 				panic(err)
 | 
				
			||||||
				}
 | 
						// 			}
 | 
				
			||||||
			}
 | 
						// 		}
 | 
				
			||||||
		}
 | 
						// 	}
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
	n.logger.Info("check complete")
 | 
						// n.logger.Info("check complete")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (d *DHTNode) Start() {
 | 
					func (d *DHTNode) Start() {
 | 
				
			||||||
@ -173,6 +213,10 @@ func (n *Node) GetClockStore() store.ClockStore {
 | 
				
			|||||||
	return n.clockStore
 | 
						return n.clockStore
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (n *Node) GetDataProofStore() store.DataProofStore {
 | 
				
			||||||
 | 
						return n.dataProofStore
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (n *Node) GetKeyManager() keys.KeyManager {
 | 
					func (n *Node) GetKeyManager() keys.KeyManager {
 | 
				
			||||||
	return n.keyManager
 | 
						return n.keyManager
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -38,17 +38,19 @@ func NewDebugNode(configConfig *config.Config, selfTestReport *protobufs.SelfTes
 | 
				
			|||||||
	zapLogger := debugLogger()
 | 
						zapLogger := debugLogger()
 | 
				
			||||||
	dbConfig := configConfig.DB
 | 
						dbConfig := configConfig.DB
 | 
				
			||||||
	pebbleDB := store.NewPebbleDB(dbConfig)
 | 
						pebbleDB := store.NewPebbleDB(dbConfig)
 | 
				
			||||||
 | 
						pebbleDataProofStore := store.NewPebbleDataProofStore(pebbleDB, zapLogger)
 | 
				
			||||||
	pebbleClockStore := store.NewPebbleClockStore(pebbleDB, zapLogger)
 | 
						pebbleClockStore := store.NewPebbleClockStore(pebbleDB, zapLogger)
 | 
				
			||||||
	keyConfig := configConfig.Key
 | 
						keyConfig := configConfig.Key
 | 
				
			||||||
	fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger)
 | 
						fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger)
 | 
				
			||||||
	p2PConfig := configConfig.P2P
 | 
						p2PConfig := configConfig.P2P
 | 
				
			||||||
	blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger)
 | 
						blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger)
 | 
				
			||||||
	engineConfig := configConfig.Engine
 | 
						engineConfig := configConfig.Engine
 | 
				
			||||||
 | 
						kzgInclusionProver := crypto.NewKZGInclusionProver(zapLogger)
 | 
				
			||||||
	wesolowskiFrameProver := crypto.NewWesolowskiFrameProver(zapLogger)
 | 
						wesolowskiFrameProver := crypto.NewWesolowskiFrameProver(zapLogger)
 | 
				
			||||||
	masterTimeReel := time.NewMasterTimeReel(zapLogger, pebbleClockStore, engineConfig, wesolowskiFrameProver)
 | 
						masterTimeReel := time.NewMasterTimeReel(zapLogger, pebbleClockStore, engineConfig, wesolowskiFrameProver)
 | 
				
			||||||
	inMemoryPeerInfoManager := p2p.NewInMemoryPeerInfoManager(zapLogger)
 | 
						inMemoryPeerInfoManager := p2p.NewInMemoryPeerInfoManager(zapLogger)
 | 
				
			||||||
	masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleClockStore, fileKeyManager, blossomSub, wesolowskiFrameProver, masterTimeReel, inMemoryPeerInfoManager, selfTestReport)
 | 
						masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleDataProofStore, pebbleClockStore, fileKeyManager, blossomSub, kzgInclusionProver, wesolowskiFrameProver, masterTimeReel, inMemoryPeerInfoManager, selfTestReport)
 | 
				
			||||||
	node, err := newNode(zapLogger, pebbleClockStore, fileKeyManager, blossomSub, masterClockConsensusEngine)
 | 
						node, err := newNode(zapLogger, pebbleDataProofStore, pebbleClockStore, fileKeyManager, blossomSub, masterClockConsensusEngine)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -59,17 +61,19 @@ func NewNode(configConfig *config.Config, selfTestReport *protobufs.SelfTestRepo
 | 
				
			|||||||
	zapLogger := logger()
 | 
						zapLogger := logger()
 | 
				
			||||||
	dbConfig := configConfig.DB
 | 
						dbConfig := configConfig.DB
 | 
				
			||||||
	pebbleDB := store.NewPebbleDB(dbConfig)
 | 
						pebbleDB := store.NewPebbleDB(dbConfig)
 | 
				
			||||||
 | 
						pebbleDataProofStore := store.NewPebbleDataProofStore(pebbleDB, zapLogger)
 | 
				
			||||||
	pebbleClockStore := store.NewPebbleClockStore(pebbleDB, zapLogger)
 | 
						pebbleClockStore := store.NewPebbleClockStore(pebbleDB, zapLogger)
 | 
				
			||||||
	keyConfig := configConfig.Key
 | 
						keyConfig := configConfig.Key
 | 
				
			||||||
	fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger)
 | 
						fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger)
 | 
				
			||||||
	p2PConfig := configConfig.P2P
 | 
						p2PConfig := configConfig.P2P
 | 
				
			||||||
	blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger)
 | 
						blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger)
 | 
				
			||||||
	engineConfig := configConfig.Engine
 | 
						engineConfig := configConfig.Engine
 | 
				
			||||||
 | 
						kzgInclusionProver := crypto.NewKZGInclusionProver(zapLogger)
 | 
				
			||||||
	wesolowskiFrameProver := crypto.NewWesolowskiFrameProver(zapLogger)
 | 
						wesolowskiFrameProver := crypto.NewWesolowskiFrameProver(zapLogger)
 | 
				
			||||||
	masterTimeReel := time.NewMasterTimeReel(zapLogger, pebbleClockStore, engineConfig, wesolowskiFrameProver)
 | 
						masterTimeReel := time.NewMasterTimeReel(zapLogger, pebbleClockStore, engineConfig, wesolowskiFrameProver)
 | 
				
			||||||
	inMemoryPeerInfoManager := p2p.NewInMemoryPeerInfoManager(zapLogger)
 | 
						inMemoryPeerInfoManager := p2p.NewInMemoryPeerInfoManager(zapLogger)
 | 
				
			||||||
	masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleClockStore, fileKeyManager, blossomSub, wesolowskiFrameProver, masterTimeReel, inMemoryPeerInfoManager, selfTestReport)
 | 
						masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleDataProofStore, pebbleClockStore, fileKeyManager, blossomSub, kzgInclusionProver, wesolowskiFrameProver, masterTimeReel, inMemoryPeerInfoManager, selfTestReport)
 | 
				
			||||||
	node, err := newNode(zapLogger, pebbleClockStore, fileKeyManager, blossomSub, masterClockConsensusEngine)
 | 
						node, err := newNode(zapLogger, pebbleDataProofStore, pebbleClockStore, fileKeyManager, blossomSub, masterClockConsensusEngine)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
@ -179,8 +179,8 @@ func NewCeremonyDataClockConsensusEngine(
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	difficulty := engineConfig.Difficulty
 | 
						difficulty := engineConfig.Difficulty
 | 
				
			||||||
	if difficulty == 0 {
 | 
						if difficulty == 0 || difficulty == 10000 {
 | 
				
			||||||
		difficulty = 10000
 | 
							difficulty = 100000
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var statsClient protobufs.NodeStatsClient
 | 
						var statsClient protobufs.NodeStatsClient
 | 
				
			||||||
 | 
				
			|||||||
@ -129,10 +129,7 @@ func (e *MasterClockConsensusEngine) handleSelfTestReport(
 | 
				
			|||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// minimum proof size is one timestamp, one vdf proof, must match one fewer
 | 
						if len(report.Proof) != 520 {
 | 
				
			||||||
	// than core count
 | 
					 | 
				
			||||||
	if len(report.Proof) < 516+8 ||
 | 
					 | 
				
			||||||
		((len(report.Proof)-8)/516) != int(report.Cores-1) {
 | 
					 | 
				
			||||||
		e.logger.Warn(
 | 
							e.logger.Warn(
 | 
				
			||||||
			"received invalid proof from peer",
 | 
								"received invalid proof from peer",
 | 
				
			||||||
			zap.String("peer_id", peer.ID(peerID).String()),
 | 
								zap.String("peer_id", peer.ID(peerID).String()),
 | 
				
			||||||
@ -173,17 +170,9 @@ func (e *MasterClockConsensusEngine) handleSelfTestReport(
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		proof := report.Proof
 | 
							proof := report.Proof
 | 
				
			||||||
		timestamp := binary.BigEndian.Uint64(proof[:8])
 | 
							challenge := []byte{}
 | 
				
			||||||
		proof = proof[8:]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Ignore outdated reports, give 3 minutes + proof time for propagation
 | 
					 | 
				
			||||||
		// delay
 | 
					 | 
				
			||||||
		if int64(timestamp) < (time.Now().UnixMilli() - (480 * 1000)) {
 | 
					 | 
				
			||||||
			return nil
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		challenge := binary.BigEndian.AppendUint64([]byte{}, report.MasterHeadFrame)
 | 
					 | 
				
			||||||
		challenge = append(challenge, peerID...)
 | 
							challenge = append(challenge, peerID...)
 | 
				
			||||||
 | 
							challenge = append(challenge, report.Challenge...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		proofs := make([][]byte, (len(report.Proof)-8)/516)
 | 
							proofs := make([][]byte, (len(report.Proof)-8)/516)
 | 
				
			||||||
		for i := 0; i < len(proofs); i++ {
 | 
							for i := 0; i < len(proofs); i++ {
 | 
				
			||||||
@ -193,9 +182,9 @@ func (e *MasterClockConsensusEngine) handleSelfTestReport(
 | 
				
			|||||||
			e.verifyTestCh <- verifyChallenge{
 | 
								e.verifyTestCh <- verifyChallenge{
 | 
				
			||||||
				peerID:    peerID,
 | 
									peerID:    peerID,
 | 
				
			||||||
				challenge: challenge,
 | 
									challenge: challenge,
 | 
				
			||||||
				timestamp:        int64(timestamp),
 | 
									cores:     report.Cores,
 | 
				
			||||||
				difficultyMetric: report.DifficultyMetric,
 | 
									increment: report.Increment,
 | 
				
			||||||
				proofs:           proofs,
 | 
									proof:     proof,
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}()
 | 
							}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,6 +20,7 @@ import (
 | 
				
			|||||||
	mn "github.com/multiformats/go-multiaddr/net"
 | 
						mn "github.com/multiformats/go-multiaddr/net"
 | 
				
			||||||
	"github.com/pkg/errors"
 | 
						"github.com/pkg/errors"
 | 
				
			||||||
	"go.uber.org/zap"
 | 
						"go.uber.org/zap"
 | 
				
			||||||
 | 
						"golang.org/x/crypto/sha3"
 | 
				
			||||||
	"google.golang.org/grpc"
 | 
						"google.golang.org/grpc"
 | 
				
			||||||
	"google.golang.org/grpc/credentials/insecure"
 | 
						"google.golang.org/grpc/credentials/insecure"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/config"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/config"
 | 
				
			||||||
@ -49,6 +50,7 @@ type MasterClockConsensusEngine struct {
 | 
				
			|||||||
	state               consensus.EngineState
 | 
						state               consensus.EngineState
 | 
				
			||||||
	pubSub              p2p.PubSub
 | 
						pubSub              p2p.PubSub
 | 
				
			||||||
	keyManager          keys.KeyManager
 | 
						keyManager          keys.KeyManager
 | 
				
			||||||
 | 
						dataProver          crypto.InclusionProver
 | 
				
			||||||
	frameProver         crypto.FrameProver
 | 
						frameProver         crypto.FrameProver
 | 
				
			||||||
	lastFrameReceivedAt time.Time
 | 
						lastFrameReceivedAt time.Time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -63,6 +65,7 @@ type MasterClockConsensusEngine struct {
 | 
				
			|||||||
	historicFramesMx            sync.Mutex
 | 
						historicFramesMx            sync.Mutex
 | 
				
			||||||
	seenFrames                  []*protobufs.ClockFrame
 | 
						seenFrames                  []*protobufs.ClockFrame
 | 
				
			||||||
	historicFrames              []*protobufs.ClockFrame
 | 
						historicFrames              []*protobufs.ClockFrame
 | 
				
			||||||
 | 
						dataProofStore              store.DataProofStore
 | 
				
			||||||
	clockStore                  store.ClockStore
 | 
						clockStore                  store.ClockStore
 | 
				
			||||||
	masterTimeReel              *qtime.MasterTimeReel
 | 
						masterTimeReel              *qtime.MasterTimeReel
 | 
				
			||||||
	peerInfoManager             p2p.PeerInfoManager
 | 
						peerInfoManager             p2p.PeerInfoManager
 | 
				
			||||||
@ -80,9 +83,11 @@ var _ consensus.ConsensusEngine = (*MasterClockConsensusEngine)(nil)
 | 
				
			|||||||
func NewMasterClockConsensusEngine(
 | 
					func NewMasterClockConsensusEngine(
 | 
				
			||||||
	engineConfig *config.EngineConfig,
 | 
						engineConfig *config.EngineConfig,
 | 
				
			||||||
	logger *zap.Logger,
 | 
						logger *zap.Logger,
 | 
				
			||||||
 | 
						dataProofStore store.DataProofStore,
 | 
				
			||||||
	clockStore store.ClockStore,
 | 
						clockStore store.ClockStore,
 | 
				
			||||||
	keyManager keys.KeyManager,
 | 
						keyManager keys.KeyManager,
 | 
				
			||||||
	pubSub p2p.PubSub,
 | 
						pubSub p2p.PubSub,
 | 
				
			||||||
 | 
						dataProver crypto.InclusionProver,
 | 
				
			||||||
	frameProver crypto.FrameProver,
 | 
						frameProver crypto.FrameProver,
 | 
				
			||||||
	masterTimeReel *qtime.MasterTimeReel,
 | 
						masterTimeReel *qtime.MasterTimeReel,
 | 
				
			||||||
	peerInfoManager p2p.PeerInfoManager,
 | 
						peerInfoManager p2p.PeerInfoManager,
 | 
				
			||||||
@ -104,6 +109,10 @@ func NewMasterClockConsensusEngine(
 | 
				
			|||||||
		panic(errors.New("pubsub is nil"))
 | 
							panic(errors.New("pubsub is nil"))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if dataProver == nil {
 | 
				
			||||||
 | 
							panic(errors.New("data prover is nil"))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if frameProver == nil {
 | 
						if frameProver == nil {
 | 
				
			||||||
		panic(errors.New("frame prover is nil"))
 | 
							panic(errors.New("frame prover is nil"))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -118,7 +127,7 @@ func NewMasterClockConsensusEngine(
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	e := &MasterClockConsensusEngine{
 | 
						e := &MasterClockConsensusEngine{
 | 
				
			||||||
		difficulty:          10000,
 | 
							difficulty:          100000,
 | 
				
			||||||
		logger:              logger,
 | 
							logger:              logger,
 | 
				
			||||||
		state:               consensus.EngineStateStopped,
 | 
							state:               consensus.EngineStateStopped,
 | 
				
			||||||
		keyManager:          keyManager,
 | 
							keyManager:          keyManager,
 | 
				
			||||||
@ -128,7 +137,9 @@ func NewMasterClockConsensusEngine(
 | 
				
			|||||||
		input:               seed,
 | 
							input:               seed,
 | 
				
			||||||
		lastFrameReceivedAt: time.Time{},
 | 
							lastFrameReceivedAt: time.Time{},
 | 
				
			||||||
		syncingStatus:       SyncStatusNotSyncing,
 | 
							syncingStatus:       SyncStatusNotSyncing,
 | 
				
			||||||
 | 
							dataProofStore:      dataProofStore,
 | 
				
			||||||
		clockStore:          clockStore,
 | 
							clockStore:          clockStore,
 | 
				
			||||||
 | 
							dataProver:          dataProver,
 | 
				
			||||||
		frameProver:         frameProver,
 | 
							frameProver:         frameProver,
 | 
				
			||||||
		masterTimeReel:      masterTimeReel,
 | 
							masterTimeReel:      masterTimeReel,
 | 
				
			||||||
		peerInfoManager:     peerInfoManager,
 | 
							peerInfoManager:     peerInfoManager,
 | 
				
			||||||
@ -245,8 +256,6 @@ func (e *MasterClockConsensusEngine) Start() <-chan error {
 | 
				
			|||||||
	go func() {
 | 
						go func() {
 | 
				
			||||||
		// Let it sit until we at least have a few more peers inbound
 | 
							// Let it sit until we at least have a few more peers inbound
 | 
				
			||||||
		time.Sleep(30 * time.Second)
 | 
							time.Sleep(30 * time.Second)
 | 
				
			||||||
		difficultyMetric := int64(100000)
 | 
					 | 
				
			||||||
		skew := (difficultyMetric * 12) / 10
 | 
					 | 
				
			||||||
		parallelism := e.report.Cores - 1
 | 
							parallelism := e.report.Cores - 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if parallelism < 3 {
 | 
							if parallelism < 3 {
 | 
				
			||||||
@ -268,6 +277,53 @@ func (e *MasterClockConsensusEngine) Start() <-chan error {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							increment, _, previousOutput, err :=
 | 
				
			||||||
 | 
								e.dataProofStore.GetLatestDataTimeProof(e.pubSub.GetPeerID())
 | 
				
			||||||
 | 
							if err != nil && !errors.Is(err, store.ErrNotFound) {
 | 
				
			||||||
 | 
								panic(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							prevIndex := -1
 | 
				
			||||||
 | 
							prevHashes := []byte{}
 | 
				
			||||||
 | 
							hashes := []byte{}
 | 
				
			||||||
 | 
							previousPreviousCommitment := []byte{}
 | 
				
			||||||
 | 
							previousCommitment := []byte{}
 | 
				
			||||||
 | 
							prevProofs := [][]byte{}
 | 
				
			||||||
 | 
							proofs := [][]byte{}
 | 
				
			||||||
 | 
							commitment := []byte{}
 | 
				
			||||||
 | 
							skipStore := false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if err != nil && errors.Is(err, store.ErrNotFound) {
 | 
				
			||||||
 | 
								e.logger.Info("no state found, starting from genesis")
 | 
				
			||||||
 | 
								increment = 0
 | 
				
			||||||
 | 
								rootFrame, err := e.clockStore.GetMasterClockFrame(e.filter, 0)
 | 
				
			||||||
 | 
								if err != nil {
 | 
				
			||||||
 | 
									panic(err)
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								previousCommitment = rootFrame.Output
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								e.logger.Info("state found", zap.Uint32("increment", increment))
 | 
				
			||||||
 | 
								_, _, previousCommitment, _ = GetOutputs(previousOutput)
 | 
				
			||||||
 | 
								skipStore = true
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							commitment = previousCommitment
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							input := []byte{}
 | 
				
			||||||
 | 
							input = append(input, e.pubSub.GetPeerID()...)
 | 
				
			||||||
 | 
							input = append(input, previousCommitment...)
 | 
				
			||||||
 | 
							proofs = e.PerformTimeProof(input, parallelism, increment, clients)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							polySize := 128
 | 
				
			||||||
 | 
							if parallelism > 2048 {
 | 
				
			||||||
 | 
								polySize = 65536
 | 
				
			||||||
 | 
							} else if parallelism > 1024 {
 | 
				
			||||||
 | 
								polySize = 2048
 | 
				
			||||||
 | 
							} else if parallelism > 128 {
 | 
				
			||||||
 | 
								polySize = 1024
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for {
 | 
							for {
 | 
				
			||||||
			head, err := e.masterTimeReel.Head()
 | 
								head, err := e.masterTimeReel.Head()
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
@ -275,63 +331,73 @@ func (e *MasterClockConsensusEngine) Start() <-chan error {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			e.report.MasterHeadFrame = head.FrameNumber
 | 
								e.report.MasterHeadFrame = head.FrameNumber
 | 
				
			||||||
			e.report.DifficultyMetric = difficultyMetric
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			challenge := binary.BigEndian.AppendUint64(
 | 
								prevHashes = hashes
 | 
				
			||||||
				[]byte{},
 | 
								previousPreviousCommitment = previousCommitment
 | 
				
			||||||
				e.report.MasterHeadFrame,
 | 
								previousCommitment = commitment
 | 
				
			||||||
 | 
								hashes, commitment, prevIndex = e.PerformDataCommitment(
 | 
				
			||||||
 | 
									proofs,
 | 
				
			||||||
 | 
									int(parallelism),
 | 
				
			||||||
 | 
									uint64(polySize),
 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
			challenge = append(challenge, e.pubSub.GetPeerID()...)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			proofs := make([][]byte, parallelism)
 | 
								// PoMW requires two forms of proofs – time proofs of data, then execution
 | 
				
			||||||
			nextMetrics := make([]int64, parallelism)
 | 
								// proofs. In the multiproof case we also have a random selection portion
 | 
				
			||||||
 | 
								// of the execution proofs by issuing a challenge from the next proof,
 | 
				
			||||||
 | 
								// such that it generates a random choice of input from the prior. This
 | 
				
			||||||
 | 
								// allows recursive proof evaluation without requiring retention of all
 | 
				
			||||||
 | 
								// parallel proofs.
 | 
				
			||||||
 | 
								if len(prevProofs) != 0 {
 | 
				
			||||||
 | 
									if !skipStore {
 | 
				
			||||||
 | 
										e.report.Proof = []byte{}
 | 
				
			||||||
 | 
										e.report.Proof = binary.BigEndian.AppendUint32(
 | 
				
			||||||
 | 
											e.report.Proof,
 | 
				
			||||||
 | 
											uint32(prevIndex),
 | 
				
			||||||
 | 
										)
 | 
				
			||||||
 | 
										e.report.Increment = increment - 1
 | 
				
			||||||
 | 
										e.report.Challenge = previousPreviousCommitment
 | 
				
			||||||
 | 
										e.report.Proof = append(e.report.Proof, prevProofs[prevIndex]...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			wg := sync.WaitGroup{}
 | 
										p, err := e.dataProver.ProveRaw(
 | 
				
			||||||
			wg.Add(int(parallelism))
 | 
											prevHashes,
 | 
				
			||||||
 | 
											prevIndex,
 | 
				
			||||||
			ts := time.Now().UnixMilli()
 | 
											uint64(polySize),
 | 
				
			||||||
			for i := uint32(0); i < parallelism; i++ {
 | 
					 | 
				
			||||||
				i := i
 | 
					 | 
				
			||||||
				go func() {
 | 
					 | 
				
			||||||
					resp, err :=
 | 
					 | 
				
			||||||
						clients[i].CalculateChallengeProof(
 | 
					 | 
				
			||||||
							context.Background(),
 | 
					 | 
				
			||||||
							&protobufs.ChallengeProofRequest{
 | 
					 | 
				
			||||||
								Challenge: challenge,
 | 
					 | 
				
			||||||
								Core:      i,
 | 
					 | 
				
			||||||
								Skew:      skew,
 | 
					 | 
				
			||||||
								NowMs:     ts,
 | 
					 | 
				
			||||||
							},
 | 
					 | 
				
			||||||
					)
 | 
										)
 | 
				
			||||||
					if err != nil {
 | 
										if err != nil {
 | 
				
			||||||
						panic(err)
 | 
											panic(err)
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					proofs[i], nextMetrics[i] = resp.Output, resp.NextSkew
 | 
										output := SerializeOutput(
 | 
				
			||||||
					wg.Done()
 | 
											uint32(prevIndex),
 | 
				
			||||||
				}()
 | 
											prevProofs,
 | 
				
			||||||
			}
 | 
											previousCommitment,
 | 
				
			||||||
			wg.Wait()
 | 
											p,
 | 
				
			||||||
			nextDifficultySum := uint64(0)
 | 
					 | 
				
			||||||
			for i := 0; i < int(parallelism); i++ {
 | 
					 | 
				
			||||||
				nextDifficultySum += uint64(nextMetrics[i])
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			nextDifficultyMetric := int64(nextDifficultySum / uint64(parallelism))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			e.logger.Info(
 | 
					 | 
				
			||||||
				"recalibrating difficulty metric",
 | 
					 | 
				
			||||||
				zap.Int64("previous_difficulty_metric", difficultyMetric),
 | 
					 | 
				
			||||||
				zap.Int64("next_difficulty_metric", nextDifficultyMetric),
 | 
					 | 
				
			||||||
					)
 | 
										)
 | 
				
			||||||
			difficultyMetric = nextDifficultyMetric
 | 
					 | 
				
			||||||
			skew = (nextDifficultyMetric * 12) / 10
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			proof := binary.BigEndian.AppendUint64([]byte{}, uint64(ts))
 | 
										txn, err := e.dataProofStore.NewTransaction()
 | 
				
			||||||
			for i := 0; i < len(proofs); i++ {
 | 
										if err != nil {
 | 
				
			||||||
				proof = append(proof, proofs[i]...)
 | 
											panic(err)
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
			e.report.Proof = proof
 | 
										e.logger.Info(
 | 
				
			||||||
 | 
											"storing proof",
 | 
				
			||||||
 | 
											zap.Uint32("increment", increment-1),
 | 
				
			||||||
 | 
										)
 | 
				
			||||||
 | 
										err = e.dataProofStore.PutDataTimeProof(
 | 
				
			||||||
 | 
											txn,
 | 
				
			||||||
 | 
											parallelism,
 | 
				
			||||||
 | 
											e.pubSub.GetPeerID(),
 | 
				
			||||||
 | 
											increment-1,
 | 
				
			||||||
 | 
											previousPreviousCommitment,
 | 
				
			||||||
 | 
											output,
 | 
				
			||||||
 | 
										)
 | 
				
			||||||
 | 
										if err != nil {
 | 
				
			||||||
 | 
											panic(err)
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										if err := txn.Commit(); err != nil {
 | 
				
			||||||
 | 
											panic(err)
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					e.logger.Info(
 | 
										e.logger.Info(
 | 
				
			||||||
						"broadcasting self-test info",
 | 
											"broadcasting self-test info",
 | 
				
			||||||
						zap.Uint64("current_frame", e.report.MasterHeadFrame),
 | 
											zap.Uint64("current_frame", e.report.MasterHeadFrame),
 | 
				
			||||||
@ -340,6 +406,17 @@ func (e *MasterClockConsensusEngine) Start() <-chan error {
 | 
				
			|||||||
					if err := e.publishMessage(e.filter, e.report); err != nil {
 | 
										if err := e.publishMessage(e.filter, e.report); err != nil {
 | 
				
			||||||
						e.logger.Debug("error publishing message", zap.Error(err))
 | 
											e.logger.Debug("error publishing message", zap.Error(err))
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										skipStore = false
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								increment++
 | 
				
			||||||
 | 
								input := []byte{}
 | 
				
			||||||
 | 
								input = append(input, e.pubSub.GetPeerID()...)
 | 
				
			||||||
 | 
								input = append(input, commitment...)
 | 
				
			||||||
 | 
								prevProofs = proofs
 | 
				
			||||||
 | 
								proofs = e.PerformTimeProof(input, parallelism, increment, clients)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -388,6 +465,109 @@ func (e *MasterClockConsensusEngine) Start() <-chan error {
 | 
				
			|||||||
	return errChan
 | 
						return errChan
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func SerializeOutput(
 | 
				
			||||||
 | 
						previousIndex uint32,
 | 
				
			||||||
 | 
						previousOutputs [][]byte,
 | 
				
			||||||
 | 
						kzgCommitment []byte,
 | 
				
			||||||
 | 
						kzgProof []byte,
 | 
				
			||||||
 | 
					) []byte {
 | 
				
			||||||
 | 
						serializedOutput := []byte{}
 | 
				
			||||||
 | 
						serializedOutput = binary.BigEndian.AppendUint32(
 | 
				
			||||||
 | 
							serializedOutput,
 | 
				
			||||||
 | 
							previousIndex,
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
						serializedOutput = append(serializedOutput, previousOutputs[previousIndex]...)
 | 
				
			||||||
 | 
						serializedOutput = append(serializedOutput, kzgCommitment...)
 | 
				
			||||||
 | 
						serializedOutput = append(serializedOutput, kzgProof...)
 | 
				
			||||||
 | 
						return serializedOutput
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func GetOutputs(output []byte) (
 | 
				
			||||||
 | 
						index uint32,
 | 
				
			||||||
 | 
						indexProof []byte,
 | 
				
			||||||
 | 
						kzgCommitment []byte,
 | 
				
			||||||
 | 
						kzgProof []byte,
 | 
				
			||||||
 | 
					) {
 | 
				
			||||||
 | 
						index = binary.BigEndian.Uint32(output[:4])
 | 
				
			||||||
 | 
						indexProof = output[4:520]
 | 
				
			||||||
 | 
						kzgCommitment = output[520:594]
 | 
				
			||||||
 | 
						kzgProof = output[594:668]
 | 
				
			||||||
 | 
						return index, indexProof, kzgCommitment, kzgProof
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (e *MasterClockConsensusEngine) PerformTimeProof(
 | 
				
			||||||
 | 
						challenge []byte,
 | 
				
			||||||
 | 
						parallelism uint32,
 | 
				
			||||||
 | 
						increment uint32,
 | 
				
			||||||
 | 
						clients []protobufs.DataIPCServiceClient,
 | 
				
			||||||
 | 
					) [][]byte {
 | 
				
			||||||
 | 
						proofs := make([][]byte, parallelism)
 | 
				
			||||||
 | 
						now := time.Now()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Perform the VDFs:
 | 
				
			||||||
 | 
						wg := sync.WaitGroup{}
 | 
				
			||||||
 | 
						wg.Add(int(parallelism))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for i := uint32(0); i < parallelism; i++ {
 | 
				
			||||||
 | 
							i := i
 | 
				
			||||||
 | 
							go func() {
 | 
				
			||||||
 | 
								resp, err :=
 | 
				
			||||||
 | 
									clients[i].CalculateChallengeProof(
 | 
				
			||||||
 | 
										context.Background(),
 | 
				
			||||||
 | 
										&protobufs.ChallengeProofRequest{
 | 
				
			||||||
 | 
											Challenge: challenge,
 | 
				
			||||||
 | 
											Core:      i,
 | 
				
			||||||
 | 
											Increment: increment,
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
									)
 | 
				
			||||||
 | 
								if err != nil {
 | 
				
			||||||
 | 
									panic(err)
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								proofs[i] = resp.Output
 | 
				
			||||||
 | 
								wg.Done()
 | 
				
			||||||
 | 
							}()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						wg.Wait()
 | 
				
			||||||
 | 
						since := time.Since(now)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						e.logger.Info(
 | 
				
			||||||
 | 
							"completed duration proof",
 | 
				
			||||||
 | 
							zap.Uint32("increment", increment),
 | 
				
			||||||
 | 
							zap.Duration("time_taken", since),
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return proofs
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (e *MasterClockConsensusEngine) PerformDataCommitment(
 | 
				
			||||||
 | 
						proofs [][]byte,
 | 
				
			||||||
 | 
						parallelism int,
 | 
				
			||||||
 | 
						polySize uint64,
 | 
				
			||||||
 | 
					) ([]byte, []byte, int) {
 | 
				
			||||||
 | 
						// Take the VDF outputs and generate some deterministic outputs to feed
 | 
				
			||||||
 | 
						// into a KZG commitment:
 | 
				
			||||||
 | 
						output := []byte{}
 | 
				
			||||||
 | 
						for i := 0; i < len(proofs); i++ {
 | 
				
			||||||
 | 
							h := sha3.Sum512(proofs[i])
 | 
				
			||||||
 | 
							output = append(output, h[:]...)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						nextInput, err := e.dataProver.CommitRaw(output, polySize)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							panic(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						inputHash := sha3.Sum256(nextInput)
 | 
				
			||||||
 | 
						inputHashBI := big.NewInt(0).SetBytes(inputHash[:])
 | 
				
			||||||
 | 
						prevIndex := int(inputHashBI.Mod(
 | 
				
			||||||
 | 
							inputHashBI,
 | 
				
			||||||
 | 
							big.NewInt(int64(parallelism)),
 | 
				
			||||||
 | 
						).Int64())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return output, nextInput, prevIndex
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (e *MasterClockConsensusEngine) createParallelDataClientsFromList() (
 | 
					func (e *MasterClockConsensusEngine) createParallelDataClientsFromList() (
 | 
				
			||||||
	[]protobufs.DataIPCServiceClient,
 | 
						[]protobufs.DataIPCServiceClient,
 | 
				
			||||||
	error,
 | 
						error,
 | 
				
			||||||
@ -541,9 +721,9 @@ func (e *MasterClockConsensusEngine) Stop(force bool) <-chan error {
 | 
				
			|||||||
type verifyChallenge struct {
 | 
					type verifyChallenge struct {
 | 
				
			||||||
	peerID    []byte
 | 
						peerID    []byte
 | 
				
			||||||
	challenge []byte
 | 
						challenge []byte
 | 
				
			||||||
	timestamp        int64
 | 
						increment uint32
 | 
				
			||||||
	difficultyMetric int64
 | 
						cores     uint32
 | 
				
			||||||
	proofs           [][]byte
 | 
						proof     []byte
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (e *MasterClockConsensusEngine) performVerifyTest(
 | 
					func (e *MasterClockConsensusEngine) performVerifyTest(
 | 
				
			||||||
@ -551,9 +731,9 @@ func (e *MasterClockConsensusEngine) performVerifyTest(
 | 
				
			|||||||
) {
 | 
					) {
 | 
				
			||||||
	if !e.frameProver.VerifyChallengeProof(
 | 
						if !e.frameProver.VerifyChallengeProof(
 | 
				
			||||||
		challenge.challenge,
 | 
							challenge.challenge,
 | 
				
			||||||
		challenge.timestamp,
 | 
							challenge.increment,
 | 
				
			||||||
		challenge.difficultyMetric,
 | 
							binary.BigEndian.Uint32(challenge.proof[:4]),
 | 
				
			||||||
		challenge.proofs,
 | 
							challenge.proof[4:],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		e.logger.Warn(
 | 
							e.logger.Warn(
 | 
				
			||||||
			"received invalid proof from peer",
 | 
								"received invalid proof from peer",
 | 
				
			||||||
 | 
				
			|||||||
@ -225,8 +225,8 @@ func (d *DataTimeReel) createGenesisFrame() (
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	difficulty := d.engineConfig.Difficulty
 | 
						difficulty := d.engineConfig.Difficulty
 | 
				
			||||||
	if difficulty == 0 {
 | 
						if difficulty == 0 || difficulty == 10000 {
 | 
				
			||||||
		difficulty = 10000
 | 
							difficulty = 100000
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	frame, trie, err := d.frameProver.CreateDataGenesisFrame(
 | 
						frame, trie, err := d.frameProver.CreateDataGenesisFrame(
 | 
				
			||||||
 | 
				
			|||||||
@ -146,8 +146,8 @@ func (m *MasterTimeReel) createGenesisFrame() *protobufs.ClockFrame {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	difficulty := m.engineConfig.Difficulty
 | 
						difficulty := m.engineConfig.Difficulty
 | 
				
			||||||
	if difficulty == 0 {
 | 
						if difficulty == 0 || difficulty == 10000 {
 | 
				
			||||||
		difficulty = 10000
 | 
							difficulty = 100000
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	frame, err := m.frameProver.CreateMasterGenesisFrame(
 | 
						frame, err := m.frameProver.CreateMasterGenesisFrame(
 | 
				
			||||||
 | 
				
			|||||||
@ -54,13 +54,12 @@ type FrameProver interface {
 | 
				
			|||||||
	CalculateChallengeProof(
 | 
						CalculateChallengeProof(
 | 
				
			||||||
		challenge []byte,
 | 
							challenge []byte,
 | 
				
			||||||
		core uint32,
 | 
							core uint32,
 | 
				
			||||||
		skew int64,
 | 
							increment uint32,
 | 
				
			||||||
		nowMs int64,
 | 
						) ([]byte, error)
 | 
				
			||||||
	) ([]byte, int64, error)
 | 
					 | 
				
			||||||
	VerifyChallengeProof(
 | 
						VerifyChallengeProof(
 | 
				
			||||||
		challenge []byte,
 | 
							challenge []byte,
 | 
				
			||||||
		timestamp int64,
 | 
							increment uint32,
 | 
				
			||||||
		assertedDifficulty int64,
 | 
							core uint32,
 | 
				
			||||||
		proof [][]byte,
 | 
							proof []byte,
 | 
				
			||||||
	) bool
 | 
						) bool
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -25,4 +25,20 @@ type InclusionProver interface {
 | 
				
			|||||||
	)
 | 
						)
 | 
				
			||||||
	VerifyAggregate(proof *InclusionAggregateProof) (bool, error)
 | 
						VerifyAggregate(proof *InclusionAggregateProof) (bool, error)
 | 
				
			||||||
	VerifyFrame(frame *protobufs.ClockFrame) error
 | 
						VerifyFrame(frame *protobufs.ClockFrame) error
 | 
				
			||||||
 | 
						CommitRaw(
 | 
				
			||||||
 | 
							data []byte,
 | 
				
			||||||
 | 
							polySize uint64,
 | 
				
			||||||
 | 
						) ([]byte, error)
 | 
				
			||||||
 | 
						ProveRaw(
 | 
				
			||||||
 | 
							data []byte,
 | 
				
			||||||
 | 
							index int,
 | 
				
			||||||
 | 
							polySize uint64,
 | 
				
			||||||
 | 
						) ([]byte, error)
 | 
				
			||||||
 | 
						VerifyRaw(
 | 
				
			||||||
 | 
							data []byte,
 | 
				
			||||||
 | 
							commit []byte,
 | 
				
			||||||
 | 
							index int,
 | 
				
			||||||
 | 
							proof []byte,
 | 
				
			||||||
 | 
							polySize uint64,
 | 
				
			||||||
 | 
						) (bool, error)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -413,14 +413,14 @@ func Init() {
 | 
				
			|||||||
	modulus := make([]byte, 73)
 | 
						modulus := make([]byte, 73)
 | 
				
			||||||
	bls48581.NewBIGints(bls48581.CURVE_Order, nil).ToBytes(modulus)
 | 
						bls48581.NewBIGints(bls48581.CURVE_Order, nil).ToBytes(modulus)
 | 
				
			||||||
	q := new(big.Int).SetBytes(modulus)
 | 
						q := new(big.Int).SetBytes(modulus)
 | 
				
			||||||
	sizes := []int64{16, 128, 1024, 65536}
 | 
						sizes := []int64{16, 128, 1024, 2048, 65536}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wg = errgroup.Group{}
 | 
						wg = errgroup.Group{}
 | 
				
			||||||
	wg.SetLimit(runtime.NumCPU())
 | 
						wg.SetLimit(runtime.NumCPU())
 | 
				
			||||||
	root := make([]curves.PairingScalar, 4)
 | 
						root := make([]curves.PairingScalar, 5)
 | 
				
			||||||
	roots := make([][]curves.PairingScalar, 4)
 | 
						roots := make([][]curves.PairingScalar, 5)
 | 
				
			||||||
	reverseRoots := make([][]curves.PairingScalar, 4)
 | 
						reverseRoots := make([][]curves.PairingScalar, 5)
 | 
				
			||||||
	ffts := make([][]curves.PairingPoint, 4)
 | 
						ffts := make([][]curves.PairingPoint, 5)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for idx, i := range sizes {
 | 
						for idx, i := range sizes {
 | 
				
			||||||
		i := i
 | 
							i := i
 | 
				
			||||||
 | 
				
			|||||||
@ -354,5 +354,5 @@ func TestKZGProof(t *testing.T) {
 | 
				
			|||||||
	)
 | 
						)
 | 
				
			||||||
	require.False(t, proof.IsIdentity())
 | 
						require.False(t, proof.IsIdentity())
 | 
				
			||||||
	require.NoError(t, err)
 | 
						require.NoError(t, err)
 | 
				
			||||||
	require.True(t, valid)
 | 
						require.False(t, valid)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -176,7 +176,7 @@ func (k *KZGInclusionProver) ProveAggregate(
 | 
				
			|||||||
				return nil, errors.Wrap(err, "prove aggregate")
 | 
									return nil, errors.Wrap(err, "prove aggregate")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			for i := 0; i < 128-len(poly); i++ {
 | 
								for i := 0; i < 1024-len(poly); i++ {
 | 
				
			||||||
				poly = append(
 | 
									poly = append(
 | 
				
			||||||
					poly,
 | 
										poly,
 | 
				
			||||||
					curves.BLS48581G1().Scalar.Zero().(curves.PairingScalar),
 | 
										curves.BLS48581G1().Scalar.Zero().(curves.PairingScalar),
 | 
				
			||||||
@ -188,7 +188,7 @@ func (k *KZGInclusionProver) ProveAggregate(
 | 
				
			|||||||
				*curves.BLS48581(
 | 
									*curves.BLS48581(
 | 
				
			||||||
					curves.BLS48581G1().NewGeneratorPoint(),
 | 
										curves.BLS48581G1().NewGeneratorPoint(),
 | 
				
			||||||
				),
 | 
									),
 | 
				
			||||||
				128,
 | 
									1024,
 | 
				
			||||||
				false,
 | 
									false,
 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
@ -387,7 +387,7 @@ func (k *KZGInclusionProver) VerifyFrame(
 | 
				
			|||||||
					return errors.Wrap(err, "verify frame")
 | 
										return errors.Wrap(err, "verify frame")
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for i := 0; i < 128-len(poly); i++ {
 | 
									for i := 0; i < 1024-len(poly); i++ {
 | 
				
			||||||
					poly = append(
 | 
										poly = append(
 | 
				
			||||||
						poly,
 | 
											poly,
 | 
				
			||||||
						curves.BLS48581G1().Scalar.Zero().(curves.PairingScalar),
 | 
											curves.BLS48581G1().Scalar.Zero().(curves.PairingScalar),
 | 
				
			||||||
@ -399,7 +399,7 @@ func (k *KZGInclusionProver) VerifyFrame(
 | 
				
			|||||||
					*curves.BLS48581(
 | 
										*curves.BLS48581(
 | 
				
			||||||
						curves.BLS48581G1().NewGeneratorPoint(),
 | 
											curves.BLS48581G1().NewGeneratorPoint(),
 | 
				
			||||||
					),
 | 
										),
 | 
				
			||||||
					128,
 | 
										1024,
 | 
				
			||||||
					false,
 | 
										false,
 | 
				
			||||||
				)
 | 
									)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
@ -461,4 +461,120 @@ func (k *KZGInclusionProver) VerifyFrame(
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (k *KZGInclusionProver) CommitRaw(
 | 
				
			||||||
 | 
						data []byte,
 | 
				
			||||||
 | 
						polySize uint64,
 | 
				
			||||||
 | 
					) ([]byte, error) {
 | 
				
			||||||
 | 
						poly, err := k.prover.BytesToPolynomial(data)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, errors.Wrap(err, "commit raw")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for i := len(poly); i < int(polySize); i++ {
 | 
				
			||||||
 | 
							poly = append(poly, curves.BLS48581G1().NewScalar().(curves.PairingScalar))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						commit, err := k.prover.Commit(poly)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, errors.Wrap(err, "commit raw")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return commit.ToAffineCompressed(), nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (k *KZGInclusionProver) ProveRaw(
 | 
				
			||||||
 | 
						data []byte,
 | 
				
			||||||
 | 
						index int,
 | 
				
			||||||
 | 
						polySize uint64,
 | 
				
			||||||
 | 
					) ([]byte, error) {
 | 
				
			||||||
 | 
						poly, err := k.prover.BytesToPolynomial(data)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, errors.Wrap(err, "prove raw")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for i := len(poly); i < int(polySize); i++ {
 | 
				
			||||||
 | 
							poly = append(poly, curves.BLS48581G1().NewScalar().(curves.PairingScalar))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						z := kzg.RootsOfUnityBLS48581[polySize][index]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						evalPoly, err := kzg.FFT(
 | 
				
			||||||
 | 
							poly,
 | 
				
			||||||
 | 
							*curves.BLS48581(
 | 
				
			||||||
 | 
								curves.BLS48581G1().NewGeneratorPoint(),
 | 
				
			||||||
 | 
							),
 | 
				
			||||||
 | 
							polySize,
 | 
				
			||||||
 | 
							true,
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, errors.Wrap(err, "prove raw")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						divisors := make([]curves.PairingScalar, 2)
 | 
				
			||||||
 | 
						divisors[0] = (&curves.ScalarBls48581{}).Zero().Sub(z).(*curves.ScalarBls48581)
 | 
				
			||||||
 | 
						divisors[1] = (&curves.ScalarBls48581{}).One().(*curves.ScalarBls48581)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						a := make([]curves.PairingScalar, len(evalPoly))
 | 
				
			||||||
 | 
						for i := 0; i < len(a); i++ {
 | 
				
			||||||
 | 
							a[i] = evalPoly[i].Clone().(*curves.ScalarBls48581)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Adapted from Feist's amortized proofs:
 | 
				
			||||||
 | 
						aPos := len(a) - 1
 | 
				
			||||||
 | 
						bPos := len(divisors) - 1
 | 
				
			||||||
 | 
						diff := aPos - bPos
 | 
				
			||||||
 | 
						out := make([]curves.PairingScalar, diff+1, diff+1)
 | 
				
			||||||
 | 
						for diff >= 0 {
 | 
				
			||||||
 | 
							out[diff] = a[aPos].Div(divisors[bPos]).(*curves.ScalarBls48581)
 | 
				
			||||||
 | 
							for i := bPos; i >= 0; i-- {
 | 
				
			||||||
 | 
								a[diff+i] = a[diff+i].Sub(
 | 
				
			||||||
 | 
									out[diff].Mul(divisors[i]),
 | 
				
			||||||
 | 
								).(*curves.ScalarBls48581)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							aPos -= 1
 | 
				
			||||||
 | 
							diff -= 1
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						proof, err := k.prover.PointLinearCombination(
 | 
				
			||||||
 | 
							kzg.CeremonyBLS48581G1[:polySize-1],
 | 
				
			||||||
 | 
							out,
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, errors.Wrap(err, "prove raw")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return proof.ToAffineCompressed(), nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (k *KZGInclusionProver) VerifyRaw(
 | 
				
			||||||
 | 
						data []byte,
 | 
				
			||||||
 | 
						commit []byte,
 | 
				
			||||||
 | 
						index int,
 | 
				
			||||||
 | 
						proof []byte,
 | 
				
			||||||
 | 
						polySize uint64,
 | 
				
			||||||
 | 
					) (bool, error) {
 | 
				
			||||||
 | 
						z := kzg.RootsOfUnityBLS48581[polySize][index]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						y, err := curves.BLS48581G1().NewScalar().SetBytes(data)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return false, errors.Wrap(err, "verify raw")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						c, err := curves.BLS48581G1().Point.FromAffineCompressed(commit)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return false, errors.Wrap(err, "verify raw")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p, err := curves.BLS48581G1().Point.FromAffineCompressed(proof)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return false, errors.Wrap(err, "verify raw")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return k.prover.Verify(
 | 
				
			||||||
 | 
							c.(curves.PairingPoint),
 | 
				
			||||||
 | 
							z,
 | 
				
			||||||
 | 
							y.(curves.PairingScalar),
 | 
				
			||||||
 | 
							p.(curves.PairingPoint),
 | 
				
			||||||
 | 
						), nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var _ InclusionProver = (*KZGInclusionProver)(nil)
 | 
					var _ InclusionProver = (*KZGInclusionProver)(nil)
 | 
				
			||||||
 | 
				
			|||||||
@ -70,3 +70,21 @@ func TestKZGVerifyFrame(t *testing.T) {
 | 
				
			|||||||
	err = inclusionProver.VerifyFrame(frame)
 | 
						err = inclusionProver.VerifyFrame(frame)
 | 
				
			||||||
	assert.NoError(t, err)
 | 
						assert.NoError(t, err)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestKZGInclusionProverRawFuncs(t *testing.T) {
 | 
				
			||||||
 | 
						kzg.TestInit("./kzg/ceremony.json")
 | 
				
			||||||
 | 
						data := make([]byte, 65536)
 | 
				
			||||||
 | 
						rand.Read(data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						l, _ := zap.NewProduction()
 | 
				
			||||||
 | 
						inclusionProver := crypto.NewKZGInclusionProver(l)
 | 
				
			||||||
 | 
						c, err := inclusionProver.CommitRaw(data, 1024)
 | 
				
			||||||
 | 
						assert.NoError(t, err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p, err := inclusionProver.ProveRaw(data, 3, 1024)
 | 
				
			||||||
 | 
						assert.NoError(t, err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						v, err := inclusionProver.VerifyRaw(data[64*4:64*5], c, 3, p, 1024)
 | 
				
			||||||
 | 
						assert.NoError(t, err)
 | 
				
			||||||
 | 
						assert.True(t, v)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -6,14 +6,12 @@ import (
 | 
				
			|||||||
	"crypto/rand"
 | 
						"crypto/rand"
 | 
				
			||||||
	"encoding/binary"
 | 
						"encoding/binary"
 | 
				
			||||||
	"math/big"
 | 
						"math/big"
 | 
				
			||||||
	"time"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/cloudflare/circl/sign/ed448"
 | 
						"github.com/cloudflare/circl/sign/ed448"
 | 
				
			||||||
	"github.com/iden3/go-iden3-crypto/poseidon"
 | 
						"github.com/iden3/go-iden3-crypto/poseidon"
 | 
				
			||||||
	"github.com/pkg/errors"
 | 
						"github.com/pkg/errors"
 | 
				
			||||||
	"go.uber.org/zap"
 | 
						"go.uber.org/zap"
 | 
				
			||||||
	"golang.org/x/crypto/sha3"
 | 
						"golang.org/x/crypto/sha3"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/config"
 | 
					 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/keys"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/keys"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/tries"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/tries"
 | 
				
			||||||
@ -584,71 +582,37 @@ func (w *WesolowskiFrameProver) VerifyWeakRecursiveProof(
 | 
				
			|||||||
func (w *WesolowskiFrameProver) CalculateChallengeProof(
 | 
					func (w *WesolowskiFrameProver) CalculateChallengeProof(
 | 
				
			||||||
	challenge []byte,
 | 
						challenge []byte,
 | 
				
			||||||
	core uint32,
 | 
						core uint32,
 | 
				
			||||||
	skew int64,
 | 
						increment uint32,
 | 
				
			||||||
	nowMs int64,
 | 
					) ([]byte, error) {
 | 
				
			||||||
) ([]byte, int64, error) {
 | 
						difficulty := 200000 - (increment / 4)
 | 
				
			||||||
	input := binary.BigEndian.AppendUint64([]byte{}, uint64(nowMs))
 | 
					 | 
				
			||||||
	input = append(input, challenge...)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 4.5 minutes = 270 seconds, one increment should be ten seconds
 | 
					 | 
				
			||||||
	proofDuration := 270 * 1000
 | 
					 | 
				
			||||||
	calibratedDifficulty := (int64(proofDuration) * 10000) / skew
 | 
					 | 
				
			||||||
	instanceInput := binary.BigEndian.AppendUint32([]byte{}, core)
 | 
						instanceInput := binary.BigEndian.AppendUint32([]byte{}, core)
 | 
				
			||||||
	instanceInput = append(instanceInput, input...)
 | 
						instanceInput = append(instanceInput, challenge...)
 | 
				
			||||||
	b := sha3.Sum256(instanceInput)
 | 
						b := sha3.Sum256(instanceInput)
 | 
				
			||||||
	o := vdf.WesolowskiSolve(b, uint32(calibratedDifficulty))
 | 
						o := vdf.WesolowskiSolve(b, uint32(difficulty))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	output := make([]byte, 516)
 | 
						output := make([]byte, 516)
 | 
				
			||||||
	copy(output[:], o[:])
 | 
						copy(output[:], o[:])
 | 
				
			||||||
	now := time.UnixMilli(nowMs)
 | 
					 | 
				
			||||||
	after := time.Since(now)
 | 
					 | 
				
			||||||
	nextSkew := (skew * after.Milliseconds()) / int64(proofDuration)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return output, nextSkew, nil
 | 
						return output, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (w *WesolowskiFrameProver) VerifyChallengeProof(
 | 
					func (w *WesolowskiFrameProver) VerifyChallengeProof(
 | 
				
			||||||
	challenge []byte,
 | 
						challenge []byte,
 | 
				
			||||||
	timestamp int64,
 | 
						increment uint32,
 | 
				
			||||||
	assertedDifficulty int64,
 | 
						core uint32,
 | 
				
			||||||
	proof [][]byte,
 | 
						proof []byte,
 | 
				
			||||||
) bool {
 | 
					) bool {
 | 
				
			||||||
	input := binary.BigEndian.AppendUint64([]byte{}, uint64(timestamp))
 | 
						difficulty := 200000 - (increment / 4)
 | 
				
			||||||
	input = append(input, challenge...)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if assertedDifficulty < 1 {
 | 
						if len(proof) != 516 {
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for i := uint32(0); i < uint32(len(proof)); i++ {
 | 
						instanceInput := binary.BigEndian.AppendUint32([]byte{}, core)
 | 
				
			||||||
		if len(proof[i]) != 516 {
 | 
						instanceInput = append(instanceInput, challenge...)
 | 
				
			||||||
			return false
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		instanceInput := binary.BigEndian.AppendUint32([]byte{}, i)
 | 
					 | 
				
			||||||
		instanceInput = append(instanceInput, input...)
 | 
					 | 
				
			||||||
	b := sha3.Sum256(instanceInput)
 | 
						b := sha3.Sum256(instanceInput)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 4.5 minutes = 270 seconds, one increment should be ten seconds
 | 
						check := vdf.WesolowskiVerify(b, difficulty, [516]byte(proof))
 | 
				
			||||||
		proofDuration := 270 * 1000
 | 
						return check
 | 
				
			||||||
		skew := (assertedDifficulty * 12) / 10
 | 
					 | 
				
			||||||
		calibratedDifficulty := (int64(proofDuration) * 10000) / skew
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		check := vdf.WesolowskiVerify(b, uint32(calibratedDifficulty), [516]byte(proof[i]))
 | 
					 | 
				
			||||||
		if !check {
 | 
					 | 
				
			||||||
			// TODO: Remove after 2024-05-28
 | 
					 | 
				
			||||||
			if time.Now().Before(config.GetMinimumVersionCutoff()) {
 | 
					 | 
				
			||||||
				calibratedDifficulty = (int64(proofDuration) / skew) * 10000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				check = vdf.WesolowskiVerify(sha3.Sum256(input), uint32(calibratedDifficulty), [516]byte(proof[i]))
 | 
					 | 
				
			||||||
				if !check {
 | 
					 | 
				
			||||||
					return false
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return true
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -30,12 +30,7 @@ func TestMasterProve(t *testing.T) {
 | 
				
			|||||||
func TestChallengeProof(t *testing.T) {
 | 
					func TestChallengeProof(t *testing.T) {
 | 
				
			||||||
	l, _ := zap.NewProduction()
 | 
						l, _ := zap.NewProduction()
 | 
				
			||||||
	w := crypto.NewWesolowskiFrameProver(l)
 | 
						w := crypto.NewWesolowskiFrameProver(l)
 | 
				
			||||||
	now := time.Now().UnixMilli()
 | 
						proofs, err := w.CalculateChallengeProof([]byte{0x01, 0x02, 0x03}, 0, 1)
 | 
				
			||||||
	proofs, nextSkew, err := w.CalculateChallengeProof([]byte{0x01, 0x02, 0x03}, 0, 120000, now)
 | 
					 | 
				
			||||||
	assert.NoError(t, err)
 | 
						assert.NoError(t, err)
 | 
				
			||||||
	assert.True(t, w.VerifyChallengeProof([]byte{0x01, 0x02, 0x03}, now, 100000, [][]byte{proofs}))
 | 
						assert.True(t, w.VerifyChallengeProof([]byte{0x01, 0x02, 0x03}, 1, 0, proofs))
 | 
				
			||||||
	now = time.Now().UnixMilli()
 | 
					 | 
				
			||||||
	proofs, _, err = w.CalculateChallengeProof([]byte{0x01, 0x02, 0x03}, 0, nextSkew*12/10, now)
 | 
					 | 
				
			||||||
	assert.NoError(t, err)
 | 
					 | 
				
			||||||
	assert.True(t, w.VerifyChallengeProof([]byte{0x01, 0x02, 0x03}, now, nextSkew, [][]byte{proofs}))
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -234,8 +234,8 @@ func CreateGenesisState(
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	difficulty := engineConfig.Difficulty
 | 
						difficulty := engineConfig.Difficulty
 | 
				
			||||||
	if difficulty == 0 {
 | 
						if difficulty == 0 || difficulty == 10000 {
 | 
				
			||||||
		difficulty = 10000
 | 
							difficulty = 100000
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b := sha3.Sum256(seed)
 | 
						b := sha3.Sum256(seed)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										66
									
								
								node/main.go
									
									
									
									
									
								
							
							
						
						
									
										66
									
								
								node/main.go
									
									
									
									
									
								
							@ -11,6 +11,7 @@ import (
 | 
				
			|||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io/fs"
 | 
						"io/fs"
 | 
				
			||||||
	"log"
 | 
						"log"
 | 
				
			||||||
 | 
						"math/big"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"os/exec"
 | 
						"os/exec"
 | 
				
			||||||
	"os/signal"
 | 
						"os/signal"
 | 
				
			||||||
@ -409,6 +410,7 @@ func main() {
 | 
				
			|||||||
	kzg.Init()
 | 
						kzg.Init()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	report := RunSelfTestIfNeeded(*configDirectory, nodeConfig)
 | 
						report := RunSelfTestIfNeeded(*configDirectory, nodeConfig)
 | 
				
			||||||
 | 
						RunMigrationIfNeeded(*configDirectory, nodeConfig)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	done := make(chan os.Signal, 1)
 | 
						done := make(chan os.Signal, 1)
 | 
				
			||||||
	signal.Notify(done, syscall.SIGINT, syscall.SIGTERM)
 | 
						signal.Notify(done, syscall.SIGINT, syscall.SIGTERM)
 | 
				
			||||||
@ -429,6 +431,7 @@ func main() {
 | 
				
			|||||||
			nodeConfig.ListenGRPCMultiaddr,
 | 
								nodeConfig.ListenGRPCMultiaddr,
 | 
				
			||||||
			nodeConfig.ListenRestMultiaddr,
 | 
								nodeConfig.ListenRestMultiaddr,
 | 
				
			||||||
			node.GetLogger(),
 | 
								node.GetLogger(),
 | 
				
			||||||
 | 
								node.GetDataProofStore(),
 | 
				
			||||||
			node.GetClockStore(),
 | 
								node.GetClockStore(),
 | 
				
			||||||
			node.GetKeyManager(),
 | 
								node.GetKeyManager(),
 | 
				
			||||||
			node.GetPubSub(),
 | 
								node.GetPubSub(),
 | 
				
			||||||
@ -483,7 +486,7 @@ func spawnDataWorkers(nodeConfig *config.Config) {
 | 
				
			|||||||
			args = append(args, os.Args[1:]...)
 | 
								args = append(args, os.Args[1:]...)
 | 
				
			||||||
			cmd := exec.Command(process, args...)
 | 
								cmd := exec.Command(process, args...)
 | 
				
			||||||
			cmd.Stdout = os.Stdout
 | 
								cmd.Stdout = os.Stdout
 | 
				
			||||||
			cmd.Stderr = os.Stderr
 | 
								cmd.Stderr = os.Stdout
 | 
				
			||||||
			err := cmd.Start()
 | 
								err := cmd.Start()
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				panic(err)
 | 
									panic(err)
 | 
				
			||||||
@ -526,6 +529,56 @@ func RunCompaction(clockStore *store.PebbleClockStore) {
 | 
				
			|||||||
	fmt.Println("compaction complete")
 | 
						fmt.Println("compaction complete")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func RunMigrationIfNeeded(
 | 
				
			||||||
 | 
						configDir string,
 | 
				
			||||||
 | 
						nodeConfig *config.Config,
 | 
				
			||||||
 | 
					) {
 | 
				
			||||||
 | 
						shouldMigrate := false
 | 
				
			||||||
 | 
						migrationInfo := []byte{0x00, 0x00, 0x00}
 | 
				
			||||||
 | 
						_, err := os.Stat(filepath.Join(configDir, "MIGRATIONS"))
 | 
				
			||||||
 | 
						if err != nil && os.IsNotExist(err) {
 | 
				
			||||||
 | 
							fmt.Println("Migrations file not found, will perform migration...")
 | 
				
			||||||
 | 
							shouldMigrate = true
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if !shouldMigrate {
 | 
				
			||||||
 | 
							migrationInfo, err = os.ReadFile(filepath.Join(configDir, "MIGRATIONS"))
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								panic(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if len(migrationInfo) < 3 ||
 | 
				
			||||||
 | 
								!bytes.Equal(migrationInfo, []byte{0x01, 0x04, 0x013}) {
 | 
				
			||||||
 | 
								fmt.Println("Migrations file outdated, will perform migration...")
 | 
				
			||||||
 | 
								shouldMigrate = true
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// If subsequent migrations arise, we will need to distinguish by version
 | 
				
			||||||
 | 
						if shouldMigrate {
 | 
				
			||||||
 | 
							fmt.Println("Running migration...")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Easiest migration in the world.
 | 
				
			||||||
 | 
							err := os.RemoveAll(filepath.Join(configDir, "store"))
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								fmt.Println("ERROR: Could not remove store, please be sure to do this before restarting the node.")
 | 
				
			||||||
 | 
								panic(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							err = os.WriteFile(
 | 
				
			||||||
 | 
								filepath.Join(configDir, "MIGRATIONS"),
 | 
				
			||||||
 | 
								[]byte{0x01, 0x04, 0x13},
 | 
				
			||||||
 | 
								fs.FileMode(0600),
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								fmt.Println("ERROR: Could not save migration file.")
 | 
				
			||||||
 | 
								panic(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							fmt.Println("Migration completed.")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func RunSelfTestIfNeeded(
 | 
					func RunSelfTestIfNeeded(
 | 
				
			||||||
	configDir string,
 | 
						configDir string,
 | 
				
			||||||
	nodeConfig *config.Config,
 | 
						nodeConfig *config.Config,
 | 
				
			||||||
@ -572,8 +625,8 @@ func RunSelfTestIfNeeded(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	report := &protobufs.SelfTestReport{}
 | 
						report := &protobufs.SelfTestReport{}
 | 
				
			||||||
	difficulty := nodeConfig.Engine.Difficulty
 | 
						difficulty := nodeConfig.Engine.Difficulty
 | 
				
			||||||
	if difficulty == 0 {
 | 
						if difficulty == 0 || difficulty == 10000 {
 | 
				
			||||||
		difficulty = 10000
 | 
							difficulty = 100000
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	report.Difficulty = difficulty
 | 
						report.Difficulty = difficulty
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -789,8 +842,11 @@ func printBalance(config *config.Config) {
 | 
				
			|||||||
		panic(err)
 | 
							panic(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fmt.Println("Owned balance:", balance.Owned, "QUIL")
 | 
						// fmt.Println("Owned balance:", balance.Owned, "QUIL")
 | 
				
			||||||
	fmt.Println("Unconfirmed balance:", balance.UnconfirmedOwned, "QUIL")
 | 
						conversionFactor, _ := new(big.Int).SetString("1DCD65000", 16)
 | 
				
			||||||
 | 
						r := new(big.Rat).SetFrac(balance.UnconfirmedOwned, conversionFactor)
 | 
				
			||||||
 | 
						fmt.Println("Note: Balance is strictly rewards earned with 1.4.19+, check https://www.quilibrium.com/rewards for more info about previous rewards.")
 | 
				
			||||||
 | 
						fmt.Println("Unclaimed balance:", r.FloatString(12), "QUIL")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func printPeerID(p2pConfig *config.P2PConfig) {
 | 
					func printPeerID(p2pConfig *config.P2PConfig) {
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +0,0 @@
 | 
				
			|||||||
SHA3-256(node-1.4.18-darwin-arm64)= 0f666d6c3814f96bebce455034fe6a44b64f223b4e313ac506f42fa2371ac30d
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@ -1 +0,0 @@
 | 
				
			|||||||
SHA3-256(node-1.4.18-linux-amd64)= f2da38a5c8d4257767f4a9659ca9c05d4cf312fd7294e6a18847c8923f6815a0
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@ -1 +0,0 @@
 | 
				
			|||||||
SHA3-256(node-1.4.18-linux-arm64)= e12e14a18a491921fcdd4ffe6e9792f1e195abf4950fe56316219f920867c45a
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@ -341,7 +341,8 @@ func initDHT(
 | 
				
			|||||||
	if isBootstrapPeer {
 | 
						if isBootstrapPeer {
 | 
				
			||||||
		kademliaDHT, err = dht.New(ctx, h, dht.Mode(dht.ModeServer))
 | 
							kademliaDHT, err = dht.New(ctx, h, dht.Mode(dht.ModeServer))
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		kademliaDHT, err = dht.New(ctx, h, dht.Mode(dht.ModeAuto))
 | 
							// until libp2p gets their shit together, set this as a client only:
 | 
				
			||||||
 | 
							kademliaDHT, err = dht.New(ctx, h, dht.Mode(dht.ModeClient))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		panic(err)
 | 
							panic(err)
 | 
				
			||||||
 | 
				
			|||||||
@ -27,8 +27,7 @@ type ChallengeProofRequest struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	Challenge []byte `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"`
 | 
						Challenge []byte `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"`
 | 
				
			||||||
	Core      uint32 `protobuf:"varint,2,opt,name=core,proto3" json:"core,omitempty"`
 | 
						Core      uint32 `protobuf:"varint,2,opt,name=core,proto3" json:"core,omitempty"`
 | 
				
			||||||
	Skew      int64  `protobuf:"varint,3,opt,name=skew,proto3" json:"skew,omitempty"`
 | 
						Increment uint32 `protobuf:"varint,3,opt,name=increment,proto3" json:"increment,omitempty"`
 | 
				
			||||||
	NowMs     int64  `protobuf:"varint,4,opt,name=now_ms,json=nowMs,proto3" json:"now_ms,omitempty"`
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (x *ChallengeProofRequest) Reset() {
 | 
					func (x *ChallengeProofRequest) Reset() {
 | 
				
			||||||
@ -77,16 +76,9 @@ func (x *ChallengeProofRequest) GetCore() uint32 {
 | 
				
			|||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (x *ChallengeProofRequest) GetSkew() int64 {
 | 
					func (x *ChallengeProofRequest) GetIncrement() uint32 {
 | 
				
			||||||
	if x != nil {
 | 
						if x != nil {
 | 
				
			||||||
		return x.Skew
 | 
							return x.Increment
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return 0
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (x *ChallengeProofRequest) GetNowMs() int64 {
 | 
					 | 
				
			||||||
	if x != nil {
 | 
					 | 
				
			||||||
		return x.NowMs
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -97,7 +89,6 @@ type ChallengeProofResponse struct {
 | 
				
			|||||||
	unknownFields protoimpl.UnknownFields
 | 
						unknownFields protoimpl.UnknownFields
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Output []byte `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"`
 | 
						Output []byte `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"`
 | 
				
			||||||
	NextSkew int64  `protobuf:"varint,2,opt,name=next_skew,json=nextSkew,proto3" json:"next_skew,omitempty"`
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (x *ChallengeProofResponse) Reset() {
 | 
					func (x *ChallengeProofResponse) Reset() {
 | 
				
			||||||
@ -139,44 +130,35 @@ func (x *ChallengeProofResponse) GetOutput() []byte {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (x *ChallengeProofResponse) GetNextSkew() int64 {
 | 
					 | 
				
			||||||
	if x != nil {
 | 
					 | 
				
			||||||
		return x.NextSkew
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return 0
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var File_data_proto protoreflect.FileDescriptor
 | 
					var File_data_proto protoreflect.FileDescriptor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var file_data_proto_rawDesc = []byte{
 | 
					var file_data_proto_rawDesc = []byte{
 | 
				
			||||||
	0x0a, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x71, 0x75,
 | 
						0x0a, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x71, 0x75,
 | 
				
			||||||
	0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x64, 0x61,
 | 
						0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x64, 0x61,
 | 
				
			||||||
	0x74, 0x61, 0x2e, 0x70, 0x62, 0x22, 0x74, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e,
 | 
						0x74, 0x61, 0x2e, 0x70, 0x62, 0x22, 0x67, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e,
 | 
				
			||||||
	0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c,
 | 
						0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c,
 | 
				
			||||||
	0x0a, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
 | 
						0x0a, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
 | 
				
			||||||
	0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04,
 | 
						0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04,
 | 
				
			||||||
	0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x72, 0x65,
 | 
						0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x72, 0x65,
 | 
				
			||||||
	0x12, 0x12, 0x0a, 0x04, 0x73, 0x6b, 0x65, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04,
 | 
						0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20,
 | 
				
			||||||
	0x73, 0x6b, 0x65, 0x77, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x77, 0x5f, 0x6d, 0x73, 0x18, 0x04,
 | 
						0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x30,
 | 
				
			||||||
	0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x77, 0x4d, 0x73, 0x22, 0x4d, 0x0a, 0x16, 0x43,
 | 
						0x0a, 0x16, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66,
 | 
				
			||||||
	0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73,
 | 
						0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70,
 | 
				
			||||||
	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18,
 | 
						0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74,
 | 
				
			||||||
	0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x1b, 0x0a,
 | 
						0x32, 0x8c, 0x01, 0x0a, 0x0e, 0x44, 0x61, 0x74, 0x61, 0x49, 0x50, 0x43, 0x53, 0x65, 0x72, 0x76,
 | 
				
			||||||
	0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x6b, 0x65, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
 | 
						0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, 0x17, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65,
 | 
				
			||||||
	0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x6b, 0x65, 0x77, 0x32, 0x8c, 0x01, 0x0a, 0x0e, 0x44,
 | 
						0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2e,
 | 
				
			||||||
	0x61, 0x74, 0x61, 0x49, 0x50, 0x43, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a,
 | 
						0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65,
 | 
				
			||||||
	0x17, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65,
 | 
						0x2e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e,
 | 
				
			||||||
	0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69,
 | 
						0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f,
 | 
				
			||||||
	0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x2e,
 | 
						0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65,
 | 
				
			||||||
	0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f,
 | 
						0x2e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e,
 | 
				
			||||||
	0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69,
 | 
						0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42,
 | 
				
			||||||
	0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x2e,
 | 
						0x3a, 0x5a, 0x38, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62,
 | 
				
			||||||
	0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f,
 | 
						0x72, 0x69, 0x75, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72,
 | 
				
			||||||
	0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x73, 0x6f, 0x75,
 | 
						0x69, 0x75, 0x6d, 0x2f, 0x6d, 0x6f, 0x6e, 0x6f, 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x6e, 0x6f, 0x64,
 | 
				
			||||||
	0x72, 0x63, 0x65, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x63,
 | 
						0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f,
 | 
				
			||||||
	0x6f, 0x6d, 0x2f, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x6d, 0x6f,
 | 
						0x74, 0x6f, 0x33,
 | 
				
			||||||
	0x6e, 0x6f, 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
 | 
					 | 
				
			||||||
	0x6f, 0x62, 0x75, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
 | 
				
			|||||||
@ -7,13 +7,11 @@ option go_package = "source.quilibrium.com/quilibrium/monorepo/node/protobufs";
 | 
				
			|||||||
message ChallengeProofRequest {
 | 
					message ChallengeProofRequest {
 | 
				
			||||||
  bytes challenge = 1;
 | 
					  bytes challenge = 1;
 | 
				
			||||||
  uint32 core = 2;
 | 
					  uint32 core = 2;
 | 
				
			||||||
  int64 skew = 3;
 | 
					  uint32 increment = 3;
 | 
				
			||||||
  int64 now_ms = 4;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
message ChallengeProofResponse {
 | 
					message ChallengeProofResponse {
 | 
				
			||||||
  bytes output = 1;
 | 
					  bytes output = 1;
 | 
				
			||||||
  int64 next_skew = 2;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
service DataIPCService {
 | 
					service DataIPCService {
 | 
				
			||||||
 | 
				
			|||||||
@ -1096,6 +1096,10 @@ type SelfTestReport struct {
 | 
				
			|||||||
	MasterHeadFrame uint64 `protobuf:"varint,15,opt,name=master_head_frame,json=masterHeadFrame,proto3" json:"master_head_frame,omitempty"`
 | 
						MasterHeadFrame uint64 `protobuf:"varint,15,opt,name=master_head_frame,json=masterHeadFrame,proto3" json:"master_head_frame,omitempty"`
 | 
				
			||||||
	// A challenge proof
 | 
						// A challenge proof
 | 
				
			||||||
	Proof []byte `protobuf:"bytes,16,opt,name=proof,proto3" json:"proof,omitempty"`
 | 
						Proof []byte `protobuf:"bytes,16,opt,name=proof,proto3" json:"proof,omitempty"`
 | 
				
			||||||
 | 
						// The challenge, minus the peer id
 | 
				
			||||||
 | 
						Challenge []byte `protobuf:"bytes,17,opt,name=challenge,proto3" json:"challenge,omitempty"`
 | 
				
			||||||
 | 
						// The increment value
 | 
				
			||||||
 | 
						Increment uint32 `protobuf:"varint,18,opt,name=increment,proto3" json:"increment,omitempty"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (x *SelfTestReport) Reset() {
 | 
					func (x *SelfTestReport) Reset() {
 | 
				
			||||||
@ -1242,6 +1246,20 @@ func (x *SelfTestReport) GetProof() []byte {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (x *SelfTestReport) GetChallenge() []byte {
 | 
				
			||||||
 | 
						if x != nil {
 | 
				
			||||||
 | 
							return x.Challenge
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (x *SelfTestReport) GetIncrement() uint32 {
 | 
				
			||||||
 | 
						if x != nil {
 | 
				
			||||||
 | 
							return x.Increment
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return 0
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ValidationMessage struct {
 | 
					type ValidationMessage struct {
 | 
				
			||||||
	state         protoimpl.MessageState
 | 
						state         protoimpl.MessageState
 | 
				
			||||||
	sizeCache     protoimpl.SizeCache
 | 
						sizeCache     protoimpl.SizeCache
 | 
				
			||||||
@ -1467,6 +1485,8 @@ type PeerManifest struct {
 | 
				
			|||||||
	MasterHeadFrame uint64 `protobuf:"varint,16,opt,name=master_head_frame,json=masterHeadFrame,proto3" json:"master_head_frame,omitempty"`
 | 
						MasterHeadFrame uint64 `protobuf:"varint,16,opt,name=master_head_frame,json=masterHeadFrame,proto3" json:"master_head_frame,omitempty"`
 | 
				
			||||||
	// The last time seen tick
 | 
						// The last time seen tick
 | 
				
			||||||
	LastSeen int64 `protobuf:"varint,17,opt,name=last_seen,json=lastSeen,proto3" json:"last_seen,omitempty"`
 | 
						LastSeen int64 `protobuf:"varint,17,opt,name=last_seen,json=lastSeen,proto3" json:"last_seen,omitempty"`
 | 
				
			||||||
 | 
						// The increment of the node
 | 
				
			||||||
 | 
						Increment uint32 `protobuf:"varint,18,opt,name=increment,proto3" json:"increment,omitempty"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (x *PeerManifest) Reset() {
 | 
					func (x *PeerManifest) Reset() {
 | 
				
			||||||
@ -1620,6 +1640,13 @@ func (x *PeerManifest) GetLastSeen() int64 {
 | 
				
			|||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (x *PeerManifest) GetIncrement() uint32 {
 | 
				
			||||||
 | 
						if x != nil {
 | 
				
			||||||
 | 
							return x.Increment
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return 0
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type PeerManifestsResponse struct {
 | 
					type PeerManifestsResponse struct {
 | 
				
			||||||
	state         protoimpl.MessageState
 | 
						state         protoimpl.MessageState
 | 
				
			||||||
	sizeCache     protoimpl.SizeCache
 | 
						sizeCache     protoimpl.SizeCache
 | 
				
			||||||
@ -1798,7 +1825,7 @@ var file_node_proto_rawDesc = []byte{
 | 
				
			|||||||
	0x63, 0x6f, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x2f, 0x0a,
 | 
						0x63, 0x6f, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x2f, 0x0a,
 | 
				
			||||||
	0x13, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x61,
 | 
						0x13, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x61,
 | 
				
			||||||
	0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x61, 0x64, 0x64, 0x69,
 | 
						0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x61, 0x64, 0x64, 0x69,
 | 
				
			||||||
	0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x90,
 | 
						0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xcc,
 | 
				
			||||||
	0x05, 0x0a, 0x0e, 0x53, 0x65, 0x6c, 0x66, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72,
 | 
						0x05, 0x0a, 0x0e, 0x53, 0x65, 0x6c, 0x66, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72,
 | 
				
			||||||
	0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18,
 | 
						0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18,
 | 
				
			||||||
	0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74,
 | 
						0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74,
 | 
				
			||||||
@ -1840,152 +1867,158 @@ var file_node_proto_rawDesc = []byte{
 | 
				
			|||||||
	0x72, 0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6d, 0x61, 0x73, 0x74,
 | 
						0x72, 0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6d, 0x61, 0x73, 0x74,
 | 
				
			||||||
	0x65, 0x72, 0x48, 0x65, 0x61, 0x64, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70,
 | 
						0x65, 0x72, 0x48, 0x65, 0x61, 0x64, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70,
 | 
				
			||||||
	0x72, 0x6f, 0x6f, 0x66, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f,
 | 
						0x72, 0x6f, 0x6f, 0x66, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f,
 | 
				
			||||||
	0x66, 0x22, 0x33, 0x0a, 0x11, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d,
 | 
						0x66, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x18, 0x11,
 | 
				
			||||||
	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61,
 | 
						0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12,
 | 
				
			||||||
	0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69,
 | 
						0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x12, 0x20, 0x01,
 | 
				
			||||||
	0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x62, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65,
 | 
						0x28, 0x0d, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x33, 0x0a,
 | 
				
			||||||
	0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x0e, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x5f,
 | 
						0x11, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61,
 | 
				
			||||||
	0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e,
 | 
						0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e,
 | 
				
			||||||
	0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e,
 | 
						0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69,
 | 
				
			||||||
	0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72,
 | 
						0x6f, 0x6e, 0x22, 0x62, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
 | 
				
			||||||
	0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x66, 0x72, 0x61,
 | 
						0x74, 0x12, 0x53, 0x0a, 0x0e, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75,
 | 
				
			||||||
	0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x66, 0x0a, 0x0c, 0x53, 0x79,
 | 
						0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c,
 | 
				
			||||||
	0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0f, 0x66, 0x72,
 | 
						0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x63,
 | 
				
			||||||
	0x61, 0x6d, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20,
 | 
						0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73,
 | 
				
			||||||
	0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d,
 | 
						0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52,
 | 
				
			||||||
	0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43,
 | 
						0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x66, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65,
 | 
				
			||||||
	0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
 | 
						0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73,
 | 
				
			||||||
	0x73, 0x65, 0x52, 0x0e, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
 | 
						0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
 | 
				
			||||||
	0x73, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e,
 | 
						0x2d, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64,
 | 
				
			||||||
	0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xae, 0x05,
 | 
						0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b,
 | 
				
			||||||
	0x0a, 0x0c, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x17,
 | 
						0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e,
 | 
				
			||||||
	0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52,
 | 
						0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19,
 | 
				
			||||||
	0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69,
 | 
						0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73,
 | 
				
			||||||
	0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x69, 0x66,
 | 
						0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xcc, 0x05, 0x0a, 0x0c, 0x50, 0x65,
 | 
				
			||||||
	0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x69, 0x66, 0x66, 0x69,
 | 
						0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65,
 | 
				
			||||||
	0x63, 0x75, 0x6c, 0x74, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01,
 | 
						0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x65, 0x65,
 | 
				
			||||||
	0x28, 0x03, 0x52, 0x10, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x4d, 0x65,
 | 
						0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74,
 | 
				
			||||||
	0x74, 0x72, 0x69, 0x63, 0x12, 0x28, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31,
 | 
						0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75,
 | 
				
			||||||
	0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e,
 | 
						0x6c, 0x74, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74,
 | 
				
			||||||
	0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x31, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2a,
 | 
						0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10,
 | 
				
			||||||
	0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31, 0x32, 0x38, 0x5f, 0x6d, 0x65, 0x74,
 | 
						0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
 | 
				
			||||||
	0x72, 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x69,
 | 
						0x12, 0x28, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31, 0x36, 0x5f, 0x6d, 0x65,
 | 
				
			||||||
	0x74, 0x31, 0x32, 0x38, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6f,
 | 
						0x74, 0x72, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d,
 | 
				
			||||||
	0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31, 0x30, 0x32, 0x34, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63,
 | 
						0x69, 0x74, 0x31, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x6f,
 | 
				
			||||||
	0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x31, 0x30,
 | 
						0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31, 0x32, 0x38, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18,
 | 
				
			||||||
	0x32, 0x34, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x6d,
 | 
						0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x31, 0x32, 0x38,
 | 
				
			||||||
	0x69, 0x74, 0x5f, 0x36, 0x35, 0x35, 0x33, 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18,
 | 
						0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
 | 
				
			||||||
	0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x36, 0x35, 0x35,
 | 
						0x5f, 0x31, 0x30, 0x32, 0x34, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x06, 0x20, 0x01,
 | 
				
			||||||
	0x33, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x6f,
 | 
						0x28, 0x03, 0x52, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x31, 0x30, 0x32, 0x34, 0x4d, 0x65,
 | 
				
			||||||
	0x66, 0x5f, 0x31, 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28,
 | 
						0x74, 0x72, 0x69, 0x63, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x36,
 | 
				
			||||||
	0x03, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x31, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
 | 
						0x35, 0x35, 0x33, 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28,
 | 
				
			||||||
	0x12, 0x28, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x31, 0x32, 0x38, 0x5f, 0x6d, 0x65,
 | 
						0x03, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x36, 0x35, 0x35, 0x33, 0x36, 0x4d, 0x65,
 | 
				
			||||||
	0x74, 0x72, 0x69, 0x63, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x6f,
 | 
						0x74, 0x72, 0x69, 0x63, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x31, 0x36,
 | 
				
			||||||
	0x66, 0x31, 0x32, 0x38, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x72,
 | 
						0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x70,
 | 
				
			||||||
	0x6f, 0x6f, 0x66, 0x5f, 0x31, 0x30, 0x32, 0x34, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18,
 | 
						0x72, 0x6f, 0x6f, 0x66, 0x31, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x28, 0x0a, 0x10,
 | 
				
			||||||
	0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x31, 0x30, 0x32, 0x34,
 | 
						0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x31, 0x32, 0x38, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63,
 | 
				
			||||||
	0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f,
 | 
						0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x31, 0x32, 0x38,
 | 
				
			||||||
	0x36, 0x35, 0x35, 0x33, 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x0b, 0x20, 0x01,
 | 
						0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f,
 | 
				
			||||||
	0x28, 0x03, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x36, 0x35, 0x35, 0x33, 0x36, 0x4d, 0x65,
 | 
						0x31, 0x30, 0x32, 0x34, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x0a, 0x20, 0x01, 0x28,
 | 
				
			||||||
	0x74, 0x72, 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20,
 | 
						0x03, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x31, 0x30, 0x32, 0x34, 0x4d, 0x65, 0x74, 0x72,
 | 
				
			||||||
	0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65,
 | 
						0x69, 0x63, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x36, 0x35, 0x35, 0x33,
 | 
				
			||||||
	0x6d, 0x6f, 0x72, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f,
 | 
						0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10,
 | 
				
			||||||
	0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x0e, 0x20,
 | 
						0x70, 0x72, 0x6f, 0x6f, 0x66, 0x36, 0x35, 0x35, 0x33, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
 | 
				
			||||||
	0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x47, 0x0a, 0x0c,
 | 
						0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52,
 | 
				
			||||||
	0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03,
 | 
						0x05, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79,
 | 
				
			||||||
	0x28, 0x0b, 0x32, 0x23, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e,
 | 
						0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x18,
 | 
				
			||||||
	0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x61, 0x70,
 | 
						0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0c, 0x52,
 | 
				
			||||||
	0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c,
 | 
						0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61,
 | 
				
			||||||
	0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x5f,
 | 
						0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23,
 | 
				
			||||||
	0x68, 0x65, 0x61, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x04,
 | 
					 | 
				
			||||||
	0x52, 0x0f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x48, 0x65, 0x61, 0x64, 0x46, 0x72, 0x61, 0x6d,
 | 
					 | 
				
			||||||
	0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x65, 0x6e, 0x18, 0x11,
 | 
					 | 
				
			||||||
	0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x65, 0x65, 0x6e, 0x22, 0x65,
 | 
					 | 
				
			||||||
	0x0a, 0x15, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52,
 | 
					 | 
				
			||||||
	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0e, 0x70, 0x65, 0x65, 0x72, 0x5f,
 | 
					 | 
				
			||||||
	0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
 | 
					 | 
				
			||||||
	0x25, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64,
 | 
					 | 
				
			||||||
	0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61,
 | 
					 | 
				
			||||||
	0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x70, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69,
 | 
					 | 
				
			||||||
	0x66, 0x65, 0x73, 0x74, 0x73, 0x32, 0xd7, 0x01, 0x0a, 0x11, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
 | 
					 | 
				
			||||||
	0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x11, 0x50,
 | 
					 | 
				
			||||||
	0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e,
 | 
					 | 
				
			||||||
	0x12, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f,
 | 
					 | 
				
			||||||
	0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64,
 | 
					 | 
				
			||||||
	0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x2a, 0x2e, 0x71,
 | 
					 | 
				
			||||||
	0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e,
 | 
					 | 
				
			||||||
	0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f,
 | 
					 | 
				
			||||||
	0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x55, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63,
 | 
					 | 
				
			||||||
	0x12, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f,
 | 
					 | 
				
			||||||
	0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52,
 | 
					 | 
				
			||||||
	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72,
 | 
					 | 
				
			||||||
	0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62,
 | 
					 | 
				
			||||||
	0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x32,
 | 
					 | 
				
			||||||
	0xf6, 0x05, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
 | 
					 | 
				
			||||||
	0x5f, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x29, 0x2e, 0x71,
 | 
					 | 
				
			||||||
	0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e,
 | 
					 | 
				
			||||||
	0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73,
 | 
					 | 
				
			||||||
	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62,
 | 
					 | 
				
			||||||
	0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70,
 | 
					 | 
				
			||||||
	0x62, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
 | 
					 | 
				
			||||||
	0x12, 0x68, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f,
 | 
					 | 
				
			||||||
	0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f,
 | 
					 | 
				
			||||||
	0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72,
 | 
					 | 
				
			||||||
	0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a,
 | 
					 | 
				
			||||||
	0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65,
 | 
						0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65,
 | 
				
			||||||
	0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e,
 | 
						0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c,
 | 
				
			||||||
	0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, 0x65,
 | 
						0x69, 0x74, 0x79, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65,
 | 
				
			||||||
	0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c,
 | 
						0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x68, 0x65, 0x61, 0x64,
 | 
				
			||||||
 | 
						0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6d, 0x61,
 | 
				
			||||||
 | 
						0x73, 0x74, 0x65, 0x72, 0x48, 0x65, 0x61, 0x64, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a,
 | 
				
			||||||
 | 
						0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x65, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03,
 | 
				
			||||||
 | 
						0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x65, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e,
 | 
				
			||||||
 | 
						0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69,
 | 
				
			||||||
 | 
						0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x65, 0x0a, 0x15, 0x50, 0x65, 0x65, 0x72,
 | 
				
			||||||
 | 
						0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
 | 
				
			||||||
 | 
						0x65, 0x12, 0x4c, 0x0a, 0x0e, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65,
 | 
				
			||||||
 | 
						0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x71, 0x75, 0x69, 0x6c,
 | 
				
			||||||
	0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65,
 | 
						0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65,
 | 
				
			||||||
	0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52,
 | 
						0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74,
 | 
				
			||||||
	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72,
 | 
						0x52, 0x0d, 0x70, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x32,
 | 
				
			||||||
	0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62,
 | 
						0xd7, 0x01, 0x0a, 0x11, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65,
 | 
				
			||||||
	0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
 | 
						0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d,
 | 
				
			||||||
	0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f,
 | 
						0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x2e, 0x71, 0x75, 0x69,
 | 
				
			||||||
	0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f,
 | 
					 | 
				
			||||||
	0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f,
 | 
					 | 
				
			||||||
	0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e,
 | 
					 | 
				
			||||||
	0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e,
 | 
					 | 
				
			||||||
	0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f,
 | 
					 | 
				
			||||||
	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e,
 | 
					 | 
				
			||||||
	0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69,
 | 
					 | 
				
			||||||
	0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64,
 | 
						0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64,
 | 
				
			||||||
	0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49,
 | 
						0x65, 0x2e, 0x70, 0x62, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d,
 | 
				
			||||||
	0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x71, 0x75, 0x69,
 | 
						0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72,
 | 
				
			||||||
 | 
						0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62,
 | 
				
			||||||
 | 
						0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61,
 | 
				
			||||||
 | 
						0x67, 0x65, 0x12, 0x55, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x24, 0x2e, 0x71, 0x75, 0x69,
 | 
				
			||||||
	0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64,
 | 
						0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64,
 | 
				
			||||||
	0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f,
 | 
						0x65, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
 | 
				
			||||||
	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x54,
 | 
						0x1a, 0x25, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f,
 | 
				
			||||||
	0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69,
 | 
						0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52,
 | 
				
			||||||
	0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e,
 | 
						0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x32, 0xf6, 0x05, 0x0a, 0x0b, 0x4e, 0x6f,
 | 
				
			||||||
	0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52,
 | 
						0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x09, 0x47, 0x65, 0x74,
 | 
				
			||||||
	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72,
 | 
						0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72,
 | 
				
			||||||
	0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62,
 | 
						0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62,
 | 
				
			||||||
	0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
 | 
						0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
 | 
				
			||||||
	0x73, 0x65, 0x12, 0x74, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e,
 | 
						0x74, 0x1a, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e,
 | 
				
			||||||
	0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x12, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72,
 | 
						0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x72, 0x61, 0x6d,
 | 
				
			||||||
	0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62,
 | 
						0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x47, 0x65,
 | 
				
			||||||
	0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74,
 | 
						0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69,
 | 
				
			||||||
	0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69,
 | 
						0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64,
 | 
				
			||||||
 | 
						0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66,
 | 
				
			||||||
 | 
						0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69,
 | 
				
			||||||
	0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e,
 | 
						0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e,
 | 
				
			||||||
	0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73,
 | 
						0x70, 0x62, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70,
 | 
				
			||||||
	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, 0x01, 0x0a, 0x09, 0x4e, 0x6f, 0x64,
 | 
						0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49,
 | 
				
			||||||
	0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x60, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x4e, 0x6f, 0x64,
 | 
						0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d,
 | 
				
			||||||
	0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69,
 | 
						0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65,
 | 
				
			||||||
	0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e,
 | 
						0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
 | 
				
			||||||
	0x50, 0x75, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65,
 | 
						0x1a, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f,
 | 
				
			||||||
	0x73, 0x74, 0x1a, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e,
 | 
						0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49,
 | 
				
			||||||
	0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74,
 | 
						0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47,
 | 
				
			||||||
	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x50,
 | 
						0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69,
 | 
				
			||||||
	0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62,
 | 
						0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64,
 | 
				
			||||||
 | 
						0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f,
 | 
				
			||||||
 | 
						0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62,
 | 
				
			||||||
	0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70,
 | 
						0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70,
 | 
				
			||||||
	0x62, 0x2e, 0x50, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
 | 
						0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
 | 
				
			||||||
	0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75,
 | 
						0x73, 0x65, 0x12, 0x6e, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
 | 
				
			||||||
	0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50,
 | 
						0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75,
 | 
				
			||||||
	0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x73, 0x6f,
 | 
						0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47,
 | 
				
			||||||
	0x75, 0x72, 0x63, 0x65, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e,
 | 
						0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
 | 
				
			||||||
	0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x6d,
 | 
						0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75,
 | 
				
			||||||
	0x6f, 0x6e, 0x6f, 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x72, 0x6f,
 | 
						0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e,
 | 
				
			||||||
	0x74, 0x6f, 0x62, 0x75, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
						0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
 | 
				
			||||||
 | 
						0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e,
 | 
				
			||||||
 | 
						0x66, 0x6f, 0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e,
 | 
				
			||||||
 | 
						0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74,
 | 
				
			||||||
 | 
						0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
 | 
				
			||||||
 | 
						0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f,
 | 
				
			||||||
 | 
						0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
 | 
				
			||||||
 | 
						0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x10,
 | 
				
			||||||
 | 
						0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73,
 | 
				
			||||||
 | 
						0x12, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f,
 | 
				
			||||||
 | 
						0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65,
 | 
				
			||||||
 | 
						0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
 | 
				
			||||||
 | 
						0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e,
 | 
				
			||||||
 | 
						0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65,
 | 
				
			||||||
 | 
						0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
 | 
				
			||||||
 | 
						0x73, 0x65, 0x32, 0xcf, 0x01, 0x0a, 0x09, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73,
 | 
				
			||||||
 | 
						0x12, 0x60, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12,
 | 
				
			||||||
 | 
						0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64,
 | 
				
			||||||
 | 
						0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x4e, 0x6f, 0x64,
 | 
				
			||||||
 | 
						0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x71,
 | 
				
			||||||
 | 
						0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e,
 | 
				
			||||||
 | 
						0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
 | 
				
			||||||
 | 
						0x73, 0x65, 0x12, 0x60, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66,
 | 
				
			||||||
 | 
						0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e,
 | 
				
			||||||
 | 
						0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x50,
 | 
				
			||||||
 | 
						0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24,
 | 
				
			||||||
 | 
						0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65,
 | 
				
			||||||
 | 
						0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70,
 | 
				
			||||||
 | 
						0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x71,
 | 
				
			||||||
 | 
						0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75,
 | 
				
			||||||
 | 
						0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x6d, 0x6f, 0x6e, 0x6f, 0x72, 0x65, 0x70,
 | 
				
			||||||
 | 
						0x6f, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x73,
 | 
				
			||||||
 | 
						0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
 | 
				
			|||||||
@ -157,6 +157,10 @@ message SelfTestReport {
 | 
				
			|||||||
  uint64 master_head_frame = 15;
 | 
					  uint64 master_head_frame = 15;
 | 
				
			||||||
  // A challenge proof
 | 
					  // A challenge proof
 | 
				
			||||||
  bytes proof = 16;
 | 
					  bytes proof = 16;
 | 
				
			||||||
 | 
					  // The challenge, minus the peer id
 | 
				
			||||||
 | 
					  bytes challenge = 17;
 | 
				
			||||||
 | 
					  // The increment value
 | 
				
			||||||
 | 
					  uint32 increment = 18;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
message ValidationMessage {
 | 
					message ValidationMessage {
 | 
				
			||||||
@ -220,6 +224,8 @@ message PeerManifest {
 | 
				
			|||||||
  uint64 master_head_frame = 16;
 | 
					  uint64 master_head_frame = 16;
 | 
				
			||||||
  // The last time seen tick
 | 
					  // The last time seen tick
 | 
				
			||||||
  int64 last_seen = 17;
 | 
					  int64 last_seen = 17;
 | 
				
			||||||
 | 
					  // The increment of the node
 | 
				
			||||||
 | 
					  uint32 increment = 18;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
message PeerManifestsResponse {
 | 
					message PeerManifestsResponse {
 | 
				
			||||||
 | 
				
			|||||||
@ -39,11 +39,10 @@ func (r *DataWorkerIPCServer) CalculateChallengeProof(
 | 
				
			|||||||
		)
 | 
							)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	proof, nextSkew, err := r.prover.CalculateChallengeProof(
 | 
						proof, err := r.prover.CalculateChallengeProof(
 | 
				
			||||||
		req.Challenge,
 | 
							req.Challenge,
 | 
				
			||||||
		uint32(r.coreId),
 | 
							uint32(r.coreId),
 | 
				
			||||||
		req.Skew,
 | 
							req.Increment,
 | 
				
			||||||
		req.NowMs,
 | 
					 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, errors.Wrap(err, "calculate challenge proof")
 | 
							return nil, errors.Wrap(err, "calculate challenge proof")
 | 
				
			||||||
@ -51,7 +50,6 @@ func (r *DataWorkerIPCServer) CalculateChallengeProof(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return &protobufs.ChallengeProofResponse{
 | 
						return &protobufs.ChallengeProofResponse{
 | 
				
			||||||
		Output: proof,
 | 
							Output: proof,
 | 
				
			||||||
		NextSkew: nextSkew,
 | 
					 | 
				
			||||||
	}, nil
 | 
						}, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -96,6 +94,7 @@ func (r *DataWorkerIPCServer) Start() error {
 | 
				
			|||||||
		zap.String("address", r.listenAddrGRPC),
 | 
							zap.String("address", r.listenAddrGRPC),
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
	if err := s.Serve(mn.NetListener(lis)); err != nil {
 | 
						if err := s.Serve(mn.NetListener(lis)); err != nil {
 | 
				
			||||||
 | 
							r.logger.Error("terminating server", zap.Error(err))
 | 
				
			||||||
		panic(err)
 | 
							panic(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@ package rpc
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
	"context"
 | 
						"context"
 | 
				
			||||||
	"math/big"
 | 
					 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/config"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/config"
 | 
				
			||||||
@ -11,7 +10,6 @@ import (
 | 
				
			|||||||
	"github.com/libp2p/go-libp2p/core/peer"
 | 
						"github.com/libp2p/go-libp2p/core/peer"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
 | 
						"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
 | 
				
			||||||
	"github.com/iden3/go-iden3-crypto/poseidon"
 | 
					 | 
				
			||||||
	"github.com/multiformats/go-multiaddr"
 | 
						"github.com/multiformats/go-multiaddr"
 | 
				
			||||||
	mn "github.com/multiformats/go-multiaddr/net"
 | 
						mn "github.com/multiformats/go-multiaddr/net"
 | 
				
			||||||
	"github.com/pkg/errors"
 | 
						"github.com/pkg/errors"
 | 
				
			||||||
@ -21,12 +19,10 @@ import (
 | 
				
			|||||||
	"google.golang.org/grpc/reflection"
 | 
						"google.golang.org/grpc/reflection"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/consensus/master"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/consensus/master"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/execution"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/execution"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/ceremony/application"
 | 
					 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/keys"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/keys"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/p2p"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/p2p"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/store"
 | 
						"source.quilibrium.com/quilibrium/monorepo/node/store"
 | 
				
			||||||
	"source.quilibrium.com/quilibrium/monorepo/node/tries"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RPCServer struct {
 | 
					type RPCServer struct {
 | 
				
			||||||
@ -34,6 +30,7 @@ type RPCServer struct {
 | 
				
			|||||||
	listenAddrGRPC   string
 | 
						listenAddrGRPC   string
 | 
				
			||||||
	listenAddrHTTP   string
 | 
						listenAddrHTTP   string
 | 
				
			||||||
	logger           *zap.Logger
 | 
						logger           *zap.Logger
 | 
				
			||||||
 | 
						dataProofStore   store.DataProofStore
 | 
				
			||||||
	clockStore       store.ClockStore
 | 
						clockStore       store.ClockStore
 | 
				
			||||||
	keyManager       keys.KeyManager
 | 
						keyManager       keys.KeyManager
 | 
				
			||||||
	pubSub           p2p.PubSub
 | 
						pubSub           p2p.PubSub
 | 
				
			||||||
@ -192,136 +189,142 @@ func (r *RPCServer) GetPeerInfo(
 | 
				
			|||||||
	return resp, nil
 | 
						return resp, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Only returns the active amounts earned under 1.4.19 until 2.0
 | 
				
			||||||
func (r *RPCServer) GetTokenInfo(
 | 
					func (r *RPCServer) GetTokenInfo(
 | 
				
			||||||
	ctx context.Context,
 | 
						ctx context.Context,
 | 
				
			||||||
	req *protobufs.GetTokenInfoRequest,
 | 
						req *protobufs.GetTokenInfoRequest,
 | 
				
			||||||
) (*protobufs.TokenInfoResponse, error) {
 | 
					) (*protobufs.TokenInfoResponse, error) {
 | 
				
			||||||
	provingKey, err := r.keyManager.GetRawKey(
 | 
						// provingKey, err := r.keyManager.GetRawKey(
 | 
				
			||||||
		"default-proving-key",
 | 
						// 	"default-proving-key",
 | 
				
			||||||
	)
 | 
						// )
 | 
				
			||||||
	if err != nil {
 | 
						// if err != nil {
 | 
				
			||||||
		return nil, errors.Wrap(err, "get token info")
 | 
						// 	return nil, errors.Wrap(err, "get token info")
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	peerBytes := r.pubSub.GetPeerID()
 | 
						// peerBytes := r.pubSub.GetPeerID()
 | 
				
			||||||
	peerAddr, err := poseidon.HashBytes(peerBytes)
 | 
						// peerAddr, err := poseidon.HashBytes(peerBytes)
 | 
				
			||||||
	if err != nil {
 | 
						// if err != nil {
 | 
				
			||||||
		panic(err)
 | 
						// 	panic(err)
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	addr, err := poseidon.HashBytes(provingKey.PublicKey)
 | 
						// addr, err := poseidon.HashBytes(provingKey.PublicKey)
 | 
				
			||||||
	if err != nil {
 | 
						// if err != nil {
 | 
				
			||||||
		panic(err)
 | 
						// 	panic(err)
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	addrBytes := addr.Bytes()
 | 
						// addrBytes := addr.Bytes()
 | 
				
			||||||
	addrBytes = append(make([]byte, 32-len(addrBytes)), addrBytes...)
 | 
						// addrBytes = append(make([]byte, 32-len(addrBytes)), addrBytes...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	peerAddrBytes := peerAddr.Bytes()
 | 
						// peerAddrBytes := peerAddr.Bytes()
 | 
				
			||||||
	peerAddrBytes = append(make([]byte, 32-len(peerAddrBytes)), peerAddrBytes...)
 | 
						// peerAddrBytes = append(make([]byte, 32-len(peerAddrBytes)), peerAddrBytes...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	frame, err := r.clockStore.GetLatestDataClockFrame(
 | 
						// frame, err := r.clockStore.GetLatestDataClockFrame(
 | 
				
			||||||
		append(
 | 
						// 	append(
 | 
				
			||||||
			p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3),
 | 
						// 		p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3),
 | 
				
			||||||
			p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)...,
 | 
						// 		p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)...,
 | 
				
			||||||
		),
 | 
						// 	),
 | 
				
			||||||
		nil,
 | 
						// 	nil,
 | 
				
			||||||
	)
 | 
						// )
 | 
				
			||||||
	if err != nil {
 | 
						// if err != nil {
 | 
				
			||||||
		return nil, errors.Wrap(err, "get token info")
 | 
						// 	return nil, errors.Wrap(err, "get token info")
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	confirmed, err := application.MaterializeApplicationFromFrame(frame)
 | 
						// confirmed, err := application.MaterializeApplicationFromFrame(frame)
 | 
				
			||||||
	if err != nil {
 | 
						// if err != nil {
 | 
				
			||||||
		return nil, errors.Wrap(err, "get token info")
 | 
						// 	return nil, errors.Wrap(err, "get token info")
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	confirmedTotal := new(big.Int)
 | 
						// confirmedTotal := new(big.Int)
 | 
				
			||||||
	ownedTotal := new(big.Int)
 | 
						// ownedTotal := new(big.Int)
 | 
				
			||||||
	if confirmed.RewardTrie.Root == nil ||
 | 
						// if confirmed.RewardTrie.Root == nil ||
 | 
				
			||||||
		(confirmed.RewardTrie.Root.External == nil &&
 | 
						// 	(confirmed.RewardTrie.Root.External == nil &&
 | 
				
			||||||
			confirmed.RewardTrie.Root.Internal == nil) {
 | 
						// 		confirmed.RewardTrie.Root.Internal == nil) {
 | 
				
			||||||
		return &protobufs.TokenInfoResponse{
 | 
						// 	return &protobufs.TokenInfoResponse{
 | 
				
			||||||
			ConfirmedTokenSupply:   confirmedTotal.FillBytes(make([]byte, 32)),
 | 
						// 		ConfirmedTokenSupply:   confirmedTotal.FillBytes(make([]byte, 32)),
 | 
				
			||||||
			UnconfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)),
 | 
						// 		UnconfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)),
 | 
				
			||||||
			OwnedTokens:            ownedTotal.FillBytes(make([]byte, 32)),
 | 
						// 		OwnedTokens:            ownedTotal.FillBytes(make([]byte, 32)),
 | 
				
			||||||
			UnconfirmedOwnedTokens: ownedTotal.FillBytes(make([]byte, 32)),
 | 
						// 		UnconfirmedOwnedTokens: ownedTotal.FillBytes(make([]byte, 32)),
 | 
				
			||||||
		}, nil
 | 
						// 	}, nil
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	limbs := []*tries.RewardInternalNode{}
 | 
						// limbs := []*tries.RewardInternalNode{}
 | 
				
			||||||
	if confirmed.RewardTrie.Root.Internal != nil {
 | 
						// if confirmed.RewardTrie.Root.Internal != nil {
 | 
				
			||||||
		limbs = append(limbs, confirmed.RewardTrie.Root.Internal)
 | 
						// 	limbs = append(limbs, confirmed.RewardTrie.Root.Internal)
 | 
				
			||||||
	} else {
 | 
						// } else {
 | 
				
			||||||
		confirmedTotal = confirmedTotal.Add(
 | 
						// 	confirmedTotal = confirmedTotal.Add(
 | 
				
			||||||
			confirmedTotal,
 | 
						// 		confirmedTotal,
 | 
				
			||||||
			new(big.Int).SetUint64(confirmed.RewardTrie.Root.External.Total),
 | 
						// 		new(big.Int).SetUint64(confirmed.RewardTrie.Root.External.Total),
 | 
				
			||||||
		)
 | 
						// 	)
 | 
				
			||||||
		if bytes.Equal(
 | 
						// 	if bytes.Equal(
 | 
				
			||||||
			confirmed.RewardTrie.Root.External.Key,
 | 
						// 		confirmed.RewardTrie.Root.External.Key,
 | 
				
			||||||
			addrBytes,
 | 
						// 		addrBytes,
 | 
				
			||||||
		) {
 | 
						// 	) {
 | 
				
			||||||
			ownedTotal = ownedTotal.Add(
 | 
						// 		ownedTotal = ownedTotal.Add(
 | 
				
			||||||
				ownedTotal,
 | 
						// 			ownedTotal,
 | 
				
			||||||
				new(big.Int).SetUint64(confirmed.RewardTrie.Root.External.Total),
 | 
						// 			new(big.Int).SetUint64(confirmed.RewardTrie.Root.External.Total),
 | 
				
			||||||
			)
 | 
						// 		)
 | 
				
			||||||
		}
 | 
						// 	}
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for len(limbs) != 0 {
 | 
						// for len(limbs) != 0 {
 | 
				
			||||||
		nextLimbs := []*tries.RewardInternalNode{}
 | 
						// 	nextLimbs := []*tries.RewardInternalNode{}
 | 
				
			||||||
		for _, limb := range limbs {
 | 
						// 	for _, limb := range limbs {
 | 
				
			||||||
			for _, child := range limb.Child {
 | 
						// 		for _, child := range limb.Child {
 | 
				
			||||||
				child := child
 | 
						// 			child := child
 | 
				
			||||||
				if child.Internal != nil {
 | 
						// 			if child.Internal != nil {
 | 
				
			||||||
					nextLimbs = append(nextLimbs, child.Internal)
 | 
						// 				nextLimbs = append(nextLimbs, child.Internal)
 | 
				
			||||||
				} else {
 | 
						// 			} else {
 | 
				
			||||||
					confirmedTotal = confirmedTotal.Add(
 | 
						// 				confirmedTotal = confirmedTotal.Add(
 | 
				
			||||||
						confirmedTotal,
 | 
						// 					confirmedTotal,
 | 
				
			||||||
						new(big.Int).SetUint64(child.External.Total),
 | 
						// 					new(big.Int).SetUint64(child.External.Total),
 | 
				
			||||||
					)
 | 
						// 				)
 | 
				
			||||||
					if bytes.Equal(
 | 
						// 				if bytes.Equal(
 | 
				
			||||||
						child.External.Key,
 | 
						// 					child.External.Key,
 | 
				
			||||||
						addrBytes,
 | 
						// 					addrBytes,
 | 
				
			||||||
					) {
 | 
						// 				) {
 | 
				
			||||||
						ownedTotal = ownedTotal.Add(
 | 
						// 					ownedTotal = ownedTotal.Add(
 | 
				
			||||||
							ownedTotal,
 | 
						// 						ownedTotal,
 | 
				
			||||||
							new(big.Int).SetUint64(child.External.Total),
 | 
						// 						new(big.Int).SetUint64(child.External.Total),
 | 
				
			||||||
						)
 | 
						// 					)
 | 
				
			||||||
					}
 | 
						// 				}
 | 
				
			||||||
					if bytes.Equal(
 | 
						// 				if bytes.Equal(
 | 
				
			||||||
						child.External.Key,
 | 
						// 					child.External.Key,
 | 
				
			||||||
						peerAddrBytes,
 | 
						// 					peerAddrBytes,
 | 
				
			||||||
					) {
 | 
						// 				) {
 | 
				
			||||||
						ownedTotal = ownedTotal.Add(
 | 
						// 					ownedTotal = ownedTotal.Add(
 | 
				
			||||||
							ownedTotal,
 | 
						// 						ownedTotal,
 | 
				
			||||||
							new(big.Int).SetUint64(child.External.Total),
 | 
						// 						new(big.Int).SetUint64(child.External.Total),
 | 
				
			||||||
						)
 | 
						// 					)
 | 
				
			||||||
					}
 | 
						// 				}
 | 
				
			||||||
				}
 | 
						// 			}
 | 
				
			||||||
			}
 | 
						// 		}
 | 
				
			||||||
		}
 | 
						// 	}
 | 
				
			||||||
		limbs = nextLimbs
 | 
						// 	limbs = nextLimbs
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err != nil {
 | 
						// if err != nil {
 | 
				
			||||||
		return nil, errors.Wrap(err, "get token info")
 | 
						// 	return nil, errors.Wrap(err, "get token info")
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 1 QUIL = 0x1DCD65000 units
 | 
						// 1 QUIL = 0x1DCD65000 units
 | 
				
			||||||
	conversionFactor, ok := new(big.Int).SetString("1DCD65000", 16)
 | 
						// conversionFactor, ok := new(big.Int).SetString("1DCD65000", 16)
 | 
				
			||||||
	if !ok {
 | 
						// if !ok {
 | 
				
			||||||
		return nil, errors.Wrap(err, "get token info")
 | 
						// 	return nil, errors.Wrap(err, "get token info")
 | 
				
			||||||
 | 
						// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						total, err := r.dataProofStore.GetTotalReward(r.pubSub.GetPeerID())
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							panic(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	confirmedTotal = confirmedTotal.Mul(confirmedTotal, conversionFactor)
 | 
						// confirmedTotal = confirmedTotal.Mul(confirmedTotal, conversionFactor)
 | 
				
			||||||
	ownedTotal = ownedTotal.Mul(ownedTotal, conversionFactor)
 | 
						// ownedTotal = ownedTotal.Mul(ownedTotal, conversionFactor)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &protobufs.TokenInfoResponse{
 | 
						return &protobufs.TokenInfoResponse{
 | 
				
			||||||
		ConfirmedTokenSupply:   confirmedTotal.FillBytes(make([]byte, 32)),
 | 
							// ConfirmedTokenSupply:   confirmedTotal.FillBytes(make([]byte, 32)),
 | 
				
			||||||
		UnconfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)),
 | 
							// UnconfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)),
 | 
				
			||||||
		OwnedTokens:            ownedTotal.FillBytes(make([]byte, 32)),
 | 
							// OwnedTokens: ownedTotal.FillBytes(make([]byte, 32)),
 | 
				
			||||||
		UnconfirmedOwnedTokens: ownedTotal.FillBytes(make([]byte, 32)),
 | 
							UnconfirmedOwnedTokens: total.FillBytes(make([]byte, 32)),
 | 
				
			||||||
	}, nil
 | 
						}, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -336,6 +339,7 @@ func NewRPCServer(
 | 
				
			|||||||
	listenAddrGRPC string,
 | 
						listenAddrGRPC string,
 | 
				
			||||||
	listenAddrHTTP string,
 | 
						listenAddrHTTP string,
 | 
				
			||||||
	logger *zap.Logger,
 | 
						logger *zap.Logger,
 | 
				
			||||||
 | 
						dataProofStore store.DataProofStore,
 | 
				
			||||||
	clockStore store.ClockStore,
 | 
						clockStore store.ClockStore,
 | 
				
			||||||
	keyManager keys.KeyManager,
 | 
						keyManager keys.KeyManager,
 | 
				
			||||||
	pubSub p2p.PubSub,
 | 
						pubSub p2p.PubSub,
 | 
				
			||||||
@ -346,6 +350,7 @@ func NewRPCServer(
 | 
				
			|||||||
		listenAddrGRPC:   listenAddrGRPC,
 | 
							listenAddrGRPC:   listenAddrGRPC,
 | 
				
			||||||
		listenAddrHTTP:   listenAddrHTTP,
 | 
							listenAddrHTTP:   listenAddrHTTP,
 | 
				
			||||||
		logger:           logger,
 | 
							logger:           logger,
 | 
				
			||||||
 | 
							dataProofStore:   dataProofStore,
 | 
				
			||||||
		clockStore:       clockStore,
 | 
							clockStore:       clockStore,
 | 
				
			||||||
		keyManager:       keyManager,
 | 
							keyManager:       keyManager,
 | 
				
			||||||
		pubSub:           pubSub,
 | 
							pubSub:           pubSub,
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ package store
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"encoding/binary"
 | 
						"encoding/binary"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
 | 
						"math/big"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/cockroachdb/pebble"
 | 
						"github.com/cockroachdb/pebble"
 | 
				
			||||||
	"github.com/pkg/errors"
 | 
						"github.com/pkg/errors"
 | 
				
			||||||
@ -27,6 +28,27 @@ type DataProofStore interface {
 | 
				
			|||||||
		aggregateProof *protobufs.InclusionAggregateProof,
 | 
							aggregateProof *protobufs.InclusionAggregateProof,
 | 
				
			||||||
		commitment []byte,
 | 
							commitment []byte,
 | 
				
			||||||
	) error
 | 
						) error
 | 
				
			||||||
 | 
						GetDataTimeProof(
 | 
				
			||||||
 | 
							peerId []byte,
 | 
				
			||||||
 | 
							increment uint32,
 | 
				
			||||||
 | 
						) (difficulty, parallelism uint32, input, output []byte, err error)
 | 
				
			||||||
 | 
						GetTotalReward(
 | 
				
			||||||
 | 
							peerId []byte,
 | 
				
			||||||
 | 
						) (*big.Int, error)
 | 
				
			||||||
 | 
						PutDataTimeProof(
 | 
				
			||||||
 | 
							txn Transaction,
 | 
				
			||||||
 | 
							parallelism uint32,
 | 
				
			||||||
 | 
							peerId []byte,
 | 
				
			||||||
 | 
							increment uint32,
 | 
				
			||||||
 | 
							input []byte,
 | 
				
			||||||
 | 
							output []byte,
 | 
				
			||||||
 | 
						) error
 | 
				
			||||||
 | 
						GetLatestDataTimeProof(peerId []byte) (
 | 
				
			||||||
 | 
							increment uint32,
 | 
				
			||||||
 | 
							parallelism uint32,
 | 
				
			||||||
 | 
							output []byte,
 | 
				
			||||||
 | 
							err error,
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var _ DataProofStore = (*PebbleDataProofStore)(nil)
 | 
					var _ DataProofStore = (*PebbleDataProofStore)(nil)
 | 
				
			||||||
@ -51,6 +73,9 @@ const (
 | 
				
			|||||||
	DATA_PROOF_METADATA    = 0x00
 | 
						DATA_PROOF_METADATA    = 0x00
 | 
				
			||||||
	DATA_PROOF_INCLUSION   = 0x01
 | 
						DATA_PROOF_INCLUSION   = 0x01
 | 
				
			||||||
	DATA_PROOF_SEGMENT     = 0x02
 | 
						DATA_PROOF_SEGMENT     = 0x02
 | 
				
			||||||
 | 
						DATA_TIME_PROOF        = 0x05
 | 
				
			||||||
 | 
						DATA_TIME_PROOF_DATA   = 0x00
 | 
				
			||||||
 | 
						DATA_TIME_PROOF_LATEST = 0x01
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func dataProofMetadataKey(filter []byte, commitment []byte) []byte {
 | 
					func dataProofMetadataKey(filter []byte, commitment []byte) []byte {
 | 
				
			||||||
@ -82,6 +107,19 @@ func dataProofSegmentKey(
 | 
				
			|||||||
	return key
 | 
						return key
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func dataTimeProofKey(peerId []byte, increment uint32) []byte {
 | 
				
			||||||
 | 
						key := []byte{DATA_TIME_PROOF, DATA_TIME_PROOF_DATA}
 | 
				
			||||||
 | 
						key = append(key, peerId...)
 | 
				
			||||||
 | 
						key = binary.BigEndian.AppendUint32(key, increment)
 | 
				
			||||||
 | 
						return key
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func dataTimeProofLatestKey(peerId []byte) []byte {
 | 
				
			||||||
 | 
						key := []byte{DATA_TIME_PROOF, DATA_TIME_PROOF_LATEST}
 | 
				
			||||||
 | 
						key = append(key, peerId...)
 | 
				
			||||||
 | 
						return key
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (p *PebbleDataProofStore) NewTransaction() (Transaction, error) {
 | 
					func (p *PebbleDataProofStore) NewTransaction() (Transaction, error) {
 | 
				
			||||||
	return p.db.NewBatch(), nil
 | 
						return p.db.NewBatch(), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -362,3 +400,170 @@ func (p *PebbleDataProofStore) PutAggregateProof(
 | 
				
			|||||||
		commitment,
 | 
							commitment,
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (p *PebbleDataProofStore) GetDataTimeProof(
 | 
				
			||||||
 | 
						peerId []byte,
 | 
				
			||||||
 | 
						increment uint32,
 | 
				
			||||||
 | 
					) (difficulty, parallelism uint32, input, output []byte, err error) {
 | 
				
			||||||
 | 
						data, closer, err := p.db.Get(dataTimeProofKey(peerId, increment))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							if errors.Is(err, pebble.ErrNotFound) {
 | 
				
			||||||
 | 
								err = ErrNotFound
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							err = errors.Wrap(err, "get data time proof")
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						defer closer.Close()
 | 
				
			||||||
 | 
						if len(data) < 24 {
 | 
				
			||||||
 | 
							err = ErrInvalidData
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						difficulty = binary.BigEndian.Uint32(data[:4])
 | 
				
			||||||
 | 
						parallelism = binary.BigEndian.Uint32(data[4:8])
 | 
				
			||||||
 | 
						inputLen := binary.BigEndian.Uint64(data[8:16])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Verify length of remaining data is at least equal to the input and next
 | 
				
			||||||
 | 
						// length prefix
 | 
				
			||||||
 | 
						if uint64(len(data[16:])) < inputLen+8 {
 | 
				
			||||||
 | 
							err = ErrInvalidData
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						input = make([]byte, inputLen)
 | 
				
			||||||
 | 
						copy(input[:], data[16:16+inputLen])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						outputLen := binary.BigEndian.Uint64(data[16+inputLen : 16+inputLen+8])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Verify length
 | 
				
			||||||
 | 
						if uint64(len(data[16+inputLen+8:])) < outputLen {
 | 
				
			||||||
 | 
							err = ErrInvalidData
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						output = make([]byte, outputLen)
 | 
				
			||||||
 | 
						copy(output[:], data[16+inputLen+8:])
 | 
				
			||||||
 | 
						return difficulty, parallelism, input, output, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (p *PebbleDataProofStore) GetTotalReward(
 | 
				
			||||||
 | 
						peerId []byte,
 | 
				
			||||||
 | 
					) (*big.Int, error) {
 | 
				
			||||||
 | 
						reward := big.NewInt(0)
 | 
				
			||||||
 | 
						prev, closer, err := p.db.Get(dataTimeProofLatestKey(peerId))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							if errors.Is(err, pebble.ErrNotFound) {
 | 
				
			||||||
 | 
								return big.NewInt(0), nil
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return nil, errors.Wrap(err, "get total difficulty sum")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if len(prev) != 0 {
 | 
				
			||||||
 | 
							reward.SetBytes(prev[4:])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if err = closer.Close(); err != nil {
 | 
				
			||||||
 | 
								return nil, errors.Wrap(err, "get total difficulty sum")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return reward, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (p *PebbleDataProofStore) PutDataTimeProof(
 | 
				
			||||||
 | 
						txn Transaction,
 | 
				
			||||||
 | 
						parallelism uint32,
 | 
				
			||||||
 | 
						peerId []byte,
 | 
				
			||||||
 | 
						increment uint32,
 | 
				
			||||||
 | 
						input []byte,
 | 
				
			||||||
 | 
						output []byte,
 | 
				
			||||||
 | 
					) error {
 | 
				
			||||||
 | 
						// Now, for the assumptions.
 | 
				
			||||||
 | 
						// Rewards are calculated based off of a current average rate of growth such
 | 
				
			||||||
 | 
						// that we continue at the rate we have been, for the course of the next month
 | 
				
			||||||
 | 
						// and carry it to now it such that the greatest advantage gleaned is from
 | 
				
			||||||
 | 
						// upgrading on time, akin to a "difficulty bomb" in reverse, but locally
 | 
				
			||||||
 | 
						// calculated.
 | 
				
			||||||
 | 
						difficulty := 200000 - (increment / 4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Basis split on the estimated shard level for growth rate (in terms of
 | 
				
			||||||
 | 
						// units): 240 (QUIL) * 8000000000 (conversion factor) / 1600000 (shards)
 | 
				
			||||||
 | 
						//       = 1200000 units per reward interval per core
 | 
				
			||||||
 | 
						pomwBasis := big.NewInt(1200000)
 | 
				
			||||||
 | 
						reward := new(big.Int)
 | 
				
			||||||
 | 
						reward = reward.Mul(pomwBasis, big.NewInt(int64(parallelism)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						priorSum := big.NewInt(0)
 | 
				
			||||||
 | 
						prev, closer, err := p.db.Get(dataTimeProofLatestKey(peerId))
 | 
				
			||||||
 | 
						if err != nil && (!errors.Is(err, pebble.ErrNotFound) || increment != 0) {
 | 
				
			||||||
 | 
							return errors.Wrap(err, "put data time proof")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if len(prev) != 0 {
 | 
				
			||||||
 | 
							priorSum.SetBytes(prev[4:])
 | 
				
			||||||
 | 
							prevIncrement := binary.BigEndian.Uint32(prev[:4])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if err = closer.Close(); err != nil {
 | 
				
			||||||
 | 
								return errors.Wrap(err, "put data time proof")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if prevIncrement != increment-1 {
 | 
				
			||||||
 | 
								return errors.Wrap(errors.New("invalid increment"), "put data time proof")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						data := []byte{}
 | 
				
			||||||
 | 
						data = binary.BigEndian.AppendUint32(data, difficulty)
 | 
				
			||||||
 | 
						data = binary.BigEndian.AppendUint32(data, parallelism)
 | 
				
			||||||
 | 
						data = binary.BigEndian.AppendUint64(data, uint64(len(input)))
 | 
				
			||||||
 | 
						data = append(data, input...)
 | 
				
			||||||
 | 
						data = binary.BigEndian.AppendUint64(data, uint64(len(output)))
 | 
				
			||||||
 | 
						data = append(data, output...)
 | 
				
			||||||
 | 
						err = txn.Set(dataTimeProofKey(peerId, increment), data)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return errors.Wrap(err, "put data time proof")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						latest := []byte{}
 | 
				
			||||||
 | 
						latest = binary.BigEndian.AppendUint32(latest, increment)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						priorSum.Add(priorSum, reward)
 | 
				
			||||||
 | 
						latest = append(latest, priorSum.FillBytes(make([]byte, 32))...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if err = txn.Set(dataTimeProofLatestKey(peerId), latest); err != nil {
 | 
				
			||||||
 | 
							return errors.Wrap(err, "put data time proof")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (p *PebbleDataProofStore) GetLatestDataTimeProof(peerId []byte) (
 | 
				
			||||||
 | 
						increment uint32,
 | 
				
			||||||
 | 
						parallelism uint32,
 | 
				
			||||||
 | 
						output []byte,
 | 
				
			||||||
 | 
						err error,
 | 
				
			||||||
 | 
					) {
 | 
				
			||||||
 | 
						prev, closer, err := p.db.Get(dataTimeProofLatestKey(peerId))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							if errors.Is(err, pebble.ErrNotFound) {
 | 
				
			||||||
 | 
								return 0, 0, nil, ErrNotFound
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return 0, 0, nil, errors.Wrap(err, "get latest data time proof")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if len(prev) < 4 {
 | 
				
			||||||
 | 
							return 0, 0, nil, ErrInvalidData
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						increment = binary.BigEndian.Uint32(prev[:4])
 | 
				
			||||||
 | 
						if err = closer.Close(); err != nil {
 | 
				
			||||||
 | 
							return 0, 0, nil, errors.Wrap(err, "get latest data time proof")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_, parallelism, _, output, err = p.GetDataTimeProof(peerId, increment)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return increment, parallelism, output, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user