From ebfb57bc29d9ed1fb25d0dd100e38709354b3d84 Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Sat, 8 Jun 2024 03:38:53 -0500 Subject: [PATCH] tests pass, let's go --- go.mod | 2 +- node/app/db_console.go | 9 +- node/app/node.go | 194 ++++++----- node/app/wire_gen.go | 12 +- .../ceremony_data_clock_consensus_engine.go | 4 +- node/consensus/master/broadcast_messaging.go | 27 +- .../master/master_clock_consensus_engine.go | 312 +++++++++++++---- node/consensus/time/data_time_reel.go | 4 +- node/consensus/time/master_time_reel.go | 4 +- node/crypto/frame_prover.go | 11 +- node/crypto/inclusion_prover.go | 16 + node/crypto/kzg/kzg.go | 10 +- node/crypto/kzg/kzg_test.go | 2 +- node/crypto/kzg_inclusion_prover.go | 124 ++++++- node/crypto/kzg_inclusion_prover_test.go | 18 + node/crypto/wesolowski_frame_prover.go | 68 +--- node/crypto/wesolowski_frame_prover_test.go | 9 +- .../ceremony/ceremony_execution_engine.go | 4 +- node/main.go | 66 +++- node/node-1.4.18-darwin-arm64.dgst | 1 - node/node-1.4.18-darwin-arm64.dgst.sig.1 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.12 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.13 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.14 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.15 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.16 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.17 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.2 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.3 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.4 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.5 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.6 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.8 | Bin 114 -> 0 bytes node/node-1.4.18-darwin-arm64.dgst.sig.9 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst | 1 - node/node-1.4.18-linux-amd64.dgst.sig.1 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.12 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.13 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.14 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.15 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.16 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.17 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.2 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.3 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.4 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.5 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.6 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.8 | Bin 114 -> 0 bytes node/node-1.4.18-linux-amd64.dgst.sig.9 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst | 1 - node/node-1.4.18-linux-arm64.dgst.sig.1 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.12 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.13 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.14 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.15 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.16 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.17 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.2 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.3 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.4 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.5 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.6 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.8 | Bin 114 -> 0 bytes node/node-1.4.18-linux-arm64.dgst.sig.9 | Bin 114 -> 0 bytes node/p2p/blossomsub.go | 3 +- node/protobufs/data.pb.go | 66 ++-- node/protobufs/data.proto | 4 +- node/protobufs/node.pb.go | 313 ++++++++++-------- node/protobufs/node.proto | 6 + node/rpc/data_worker_ipc_server.go | 9 +- node/rpc/node_rpc_server.go | 233 ++++++------- node/store/data_proof.go | 213 +++++++++++- 72 files changed, 1174 insertions(+), 572 deletions(-) delete mode 100644 node/node-1.4.18-darwin-arm64.dgst delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.1 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.12 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.13 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.14 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.15 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.16 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.17 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.2 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.3 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.4 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.5 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.6 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.8 delete mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.9 delete mode 100644 node/node-1.4.18-linux-amd64.dgst delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.1 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.12 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.13 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.14 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.15 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.16 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.17 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.2 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.3 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.4 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.5 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.6 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.8 delete mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.9 delete mode 100644 node/node-1.4.18-linux-arm64.dgst delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.1 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.12 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.13 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.14 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.15 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.16 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.17 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.2 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.3 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.4 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.5 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.6 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.8 delete mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.9 diff --git a/go.mod b/go.mod index 8308f25..ec72743 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module source.quilibrium.com/quilibrium/monorepo -go 1.18 \ No newline at end of file +go 1.18 diff --git a/node/app/db_console.go b/node/app/db_console.go index 8321ed2..5ced8fc 100644 --- a/node/app/db_console.go +++ b/node/app/db_console.go @@ -819,16 +819,11 @@ func FetchTokenBalance(client protobufs.NodeServiceClient) (TokenBalance, error) return TokenBalance{}, errors.Wrap(err, "error getting token info") } - conversionFactor, _ := new(big.Int).SetString("1DCD65000", 16) - - owned := new(big.Int).SetBytes(info.OwnedTokens) - owned.Div(owned, conversionFactor) - + // owned := new(big.Int).SetBytes(info.OwnedTokens) unconfirmedOwned := new(big.Int).SetBytes(info.UnconfirmedOwnedTokens) - unconfirmedOwned.Div(unconfirmedOwned, conversionFactor) return TokenBalance{ - Owned: owned, + // Owned: owned, UnconfirmedOwned: unconfirmedOwned, }, nil } diff --git a/node/app/node.go b/node/app/node.go index d6e172e..93406bc 100644 --- a/node/app/node.go +++ b/node/app/node.go @@ -1,27 +1,28 @@ package app import ( - "bytes" "errors" + "fmt" "go.uber.org/zap" + "golang.org/x/crypto/sha3" "source.quilibrium.com/quilibrium/monorepo/node/consensus" "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/intrinsics/ceremony/application" "source.quilibrium.com/quilibrium/monorepo/node/keys" "source.quilibrium.com/quilibrium/monorepo/node/p2p" "source.quilibrium.com/quilibrium/monorepo/node/store" - "source.quilibrium.com/quilibrium/monorepo/node/tries" ) type Node struct { - logger *zap.Logger - clockStore store.ClockStore - keyManager keys.KeyManager - pubSub p2p.PubSub - execEngines map[string]execution.ExecutionEngine - engine consensus.ConsensusEngine + logger *zap.Logger + dataProofStore store.DataProofStore + clockStore store.ClockStore + keyManager keys.KeyManager + pubSub p2p.PubSub + execEngines map[string]execution.ExecutionEngine + engine consensus.ConsensusEngine } type DHTNode struct { @@ -40,6 +41,7 @@ func newDHTNode( func newNode( logger *zap.Logger, + dataProofStore store.DataProofStore, clockStore store.ClockStore, keyManager keys.KeyManager, pubSub p2p.PubSub, @@ -54,6 +56,7 @@ func newNode( return &Node{ logger, + dataProofStore, clockStore, keyManager, pubSub, @@ -62,78 +65,115 @@ func newNode( }, nil } -func (n *Node) RunRepair() { - intrinsicFilter := append( - p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3), - p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)..., - ) - n.logger.Info("check store and repair if needed, this may take a few minutes") - proverTrie := &tries.RollingFrecencyCritbitTrie{} - head, err := n.clockStore.GetLatestDataClockFrame(intrinsicFilter, proverTrie) - if err == nil && head != nil { - for head != nil && head.FrameNumber != 0 { - prev := head - head, err = n.clockStore.GetStagedDataClockFrame( - intrinsicFilter, - head.FrameNumber-1, - head.ParentSelector, - true, - ) - if err != nil { - panic(err) - } - compare, _, err := n.clockStore.GetDataClockFrame( - intrinsicFilter, - prev.FrameNumber-1, - true, - ) - if err != nil { - panic(err) - } - if !bytes.Equal(head.Output, compare.Output) { - n.logger.Warn( - "repairing frame", - zap.Uint64("frame_number", head.FrameNumber), - ) - head, err = n.clockStore.GetStagedDataClockFrame( - intrinsicFilter, - prev.FrameNumber-1, - prev.ParentSelector, - true, - ) - if err != nil { - panic(err) - } +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) - txn, err := n.clockStore.NewTransaction() - if err != nil { - panic(err) - } + 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) - selector, err := head.GetSelector() - if err != nil { - panic(err) - } + ip := sha3.Sum512(idxProof) - err = n.clockStore.CommitDataClockFrame( - intrinsicFilter, - head.FrameNumber, - selector.FillBytes(make([]byte, 32)), - proverTrie, - txn, - true, - ) - if err != nil { - panic(err) - } + v, err := dataProver.VerifyRaw(ip[:], idxCommit, int(idx), idxKP, 128) + if err != nil { + panic(err) + } - if err = txn.Commit(); 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") } } - n.logger.Info("check complete") +} + +func (n *Node) RunRepair() { + // intrinsicFilter := append( + // p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3), + // p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)..., + // ) + // n.logger.Info("check store and repair if needed, this may take a few minutes") + // proverTrie := &tries.RollingFrecencyCritbitTrie{} + // head, err := n.clockStore.GetLatestDataClockFrame(intrinsicFilter, proverTrie) + // if err == nil && head != nil { + // for head != nil && head.FrameNumber != 0 { + // prev := head + // head, err = n.clockStore.GetStagedDataClockFrame( + // intrinsicFilter, + // head.FrameNumber-1, + // head.ParentSelector, + // true, + // ) + // if err != nil { + // panic(err) + // } + // compare, _, err := n.clockStore.GetDataClockFrame( + // intrinsicFilter, + // prev.FrameNumber-1, + // true, + // ) + // if err != nil { + // panic(err) + // } + // if !bytes.Equal(head.Output, compare.Output) { + // n.logger.Warn( + // "repairing frame", + // zap.Uint64("frame_number", head.FrameNumber), + // ) + // head, err = n.clockStore.GetStagedDataClockFrame( + // intrinsicFilter, + // prev.FrameNumber-1, + // prev.ParentSelector, + // true, + // ) + // if err != nil { + // panic(err) + // } + + // txn, err := n.clockStore.NewTransaction() + // if err != nil { + // panic(err) + // } + + // selector, err := head.GetSelector() + // if err != nil { + // panic(err) + // } + + // err = n.clockStore.CommitDataClockFrame( + // intrinsicFilter, + // head.FrameNumber, + // selector.FillBytes(make([]byte, 32)), + // proverTrie, + // txn, + // true, + // ) + // if err != nil { + // panic(err) + // } + + // if err = txn.Commit(); err != nil { + // panic(err) + // } + // } + // } + // } + // n.logger.Info("check complete") } func (d *DHTNode) Start() { @@ -173,6 +213,10 @@ func (n *Node) GetClockStore() store.ClockStore { return n.clockStore } +func (n *Node) GetDataProofStore() store.DataProofStore { + return n.dataProofStore +} + func (n *Node) GetKeyManager() keys.KeyManager { return n.keyManager } diff --git a/node/app/wire_gen.go b/node/app/wire_gen.go index 232e93d..a2ef0a9 100644 --- a/node/app/wire_gen.go +++ b/node/app/wire_gen.go @@ -38,17 +38,19 @@ func NewDebugNode(configConfig *config.Config, selfTestReport *protobufs.SelfTes zapLogger := debugLogger() dbConfig := configConfig.DB pebbleDB := store.NewPebbleDB(dbConfig) + pebbleDataProofStore := store.NewPebbleDataProofStore(pebbleDB, zapLogger) pebbleClockStore := store.NewPebbleClockStore(pebbleDB, zapLogger) keyConfig := configConfig.Key fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger) p2PConfig := configConfig.P2P blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger) engineConfig := configConfig.Engine + kzgInclusionProver := crypto.NewKZGInclusionProver(zapLogger) wesolowskiFrameProver := crypto.NewWesolowskiFrameProver(zapLogger) masterTimeReel := time.NewMasterTimeReel(zapLogger, pebbleClockStore, engineConfig, wesolowskiFrameProver) inMemoryPeerInfoManager := p2p.NewInMemoryPeerInfoManager(zapLogger) - masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleClockStore, fileKeyManager, blossomSub, wesolowskiFrameProver, masterTimeReel, inMemoryPeerInfoManager, selfTestReport) - node, err := newNode(zapLogger, pebbleClockStore, fileKeyManager, blossomSub, masterClockConsensusEngine) + masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleDataProofStore, pebbleClockStore, fileKeyManager, blossomSub, kzgInclusionProver, wesolowskiFrameProver, masterTimeReel, inMemoryPeerInfoManager, selfTestReport) + node, err := newNode(zapLogger, pebbleDataProofStore, pebbleClockStore, fileKeyManager, blossomSub, masterClockConsensusEngine) if err != nil { return nil, err } @@ -59,17 +61,19 @@ func NewNode(configConfig *config.Config, selfTestReport *protobufs.SelfTestRepo zapLogger := logger() dbConfig := configConfig.DB pebbleDB := store.NewPebbleDB(dbConfig) + pebbleDataProofStore := store.NewPebbleDataProofStore(pebbleDB, zapLogger) pebbleClockStore := store.NewPebbleClockStore(pebbleDB, zapLogger) keyConfig := configConfig.Key fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger) p2PConfig := configConfig.P2P blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger) engineConfig := configConfig.Engine + kzgInclusionProver := crypto.NewKZGInclusionProver(zapLogger) wesolowskiFrameProver := crypto.NewWesolowskiFrameProver(zapLogger) masterTimeReel := time.NewMasterTimeReel(zapLogger, pebbleClockStore, engineConfig, wesolowskiFrameProver) inMemoryPeerInfoManager := p2p.NewInMemoryPeerInfoManager(zapLogger) - masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleClockStore, fileKeyManager, blossomSub, wesolowskiFrameProver, masterTimeReel, inMemoryPeerInfoManager, selfTestReport) - node, err := newNode(zapLogger, pebbleClockStore, fileKeyManager, blossomSub, masterClockConsensusEngine) + masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleDataProofStore, pebbleClockStore, fileKeyManager, blossomSub, kzgInclusionProver, wesolowskiFrameProver, masterTimeReel, inMemoryPeerInfoManager, selfTestReport) + node, err := newNode(zapLogger, pebbleDataProofStore, pebbleClockStore, fileKeyManager, blossomSub, masterClockConsensusEngine) if err != nil { return nil, err } diff --git a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go index d40b440..317fb16 100644 --- a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go +++ b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go @@ -179,8 +179,8 @@ func NewCeremonyDataClockConsensusEngine( } difficulty := engineConfig.Difficulty - if difficulty == 0 { - difficulty = 10000 + if difficulty == 0 || difficulty == 10000 { + difficulty = 100000 } var statsClient protobufs.NodeStatsClient diff --git a/node/consensus/master/broadcast_messaging.go b/node/consensus/master/broadcast_messaging.go index 18d8d87..7458e45 100644 --- a/node/consensus/master/broadcast_messaging.go +++ b/node/consensus/master/broadcast_messaging.go @@ -129,10 +129,7 @@ func (e *MasterClockConsensusEngine) handleSelfTestReport( return nil } - // minimum proof size is one timestamp, one vdf proof, must match one fewer - // than core count - if len(report.Proof) < 516+8 || - ((len(report.Proof)-8)/516) != int(report.Cores-1) { + if len(report.Proof) != 520 { e.logger.Warn( "received invalid proof from peer", zap.String("peer_id", peer.ID(peerID).String()), @@ -173,17 +170,9 @@ func (e *MasterClockConsensusEngine) handleSelfTestReport( } proof := report.Proof - timestamp := binary.BigEndian.Uint64(proof[:8]) - 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 := []byte{} challenge = append(challenge, peerID...) + challenge = append(challenge, report.Challenge...) proofs := make([][]byte, (len(report.Proof)-8)/516) for i := 0; i < len(proofs); i++ { @@ -191,11 +180,11 @@ func (e *MasterClockConsensusEngine) handleSelfTestReport( } go func() { e.verifyTestCh <- verifyChallenge{ - peerID: peerID, - challenge: challenge, - timestamp: int64(timestamp), - difficultyMetric: report.DifficultyMetric, - proofs: proofs, + peerID: peerID, + challenge: challenge, + cores: report.Cores, + increment: report.Increment, + proof: proof, } }() diff --git a/node/consensus/master/master_clock_consensus_engine.go b/node/consensus/master/master_clock_consensus_engine.go index c56d1e3..5e5b199 100644 --- a/node/consensus/master/master_clock_consensus_engine.go +++ b/node/consensus/master/master_clock_consensus_engine.go @@ -20,6 +20,7 @@ import ( mn "github.com/multiformats/go-multiaddr/net" "github.com/pkg/errors" "go.uber.org/zap" + "golang.org/x/crypto/sha3" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "source.quilibrium.com/quilibrium/monorepo/node/config" @@ -49,6 +50,7 @@ type MasterClockConsensusEngine struct { state consensus.EngineState pubSub p2p.PubSub keyManager keys.KeyManager + dataProver crypto.InclusionProver frameProver crypto.FrameProver lastFrameReceivedAt time.Time @@ -63,6 +65,7 @@ type MasterClockConsensusEngine struct { historicFramesMx sync.Mutex seenFrames []*protobufs.ClockFrame historicFrames []*protobufs.ClockFrame + dataProofStore store.DataProofStore clockStore store.ClockStore masterTimeReel *qtime.MasterTimeReel peerInfoManager p2p.PeerInfoManager @@ -80,9 +83,11 @@ var _ consensus.ConsensusEngine = (*MasterClockConsensusEngine)(nil) func NewMasterClockConsensusEngine( engineConfig *config.EngineConfig, logger *zap.Logger, + dataProofStore store.DataProofStore, clockStore store.ClockStore, keyManager keys.KeyManager, pubSub p2p.PubSub, + dataProver crypto.InclusionProver, frameProver crypto.FrameProver, masterTimeReel *qtime.MasterTimeReel, peerInfoManager p2p.PeerInfoManager, @@ -104,6 +109,10 @@ func NewMasterClockConsensusEngine( panic(errors.New("pubsub is nil")) } + if dataProver == nil { + panic(errors.New("data prover is nil")) + } + if frameProver == nil { panic(errors.New("frame prover is nil")) } @@ -118,7 +127,7 @@ func NewMasterClockConsensusEngine( } e := &MasterClockConsensusEngine{ - difficulty: 10000, + difficulty: 100000, logger: logger, state: consensus.EngineStateStopped, keyManager: keyManager, @@ -128,7 +137,9 @@ func NewMasterClockConsensusEngine( input: seed, lastFrameReceivedAt: time.Time{}, syncingStatus: SyncStatusNotSyncing, + dataProofStore: dataProofStore, clockStore: clockStore, + dataProver: dataProver, frameProver: frameProver, masterTimeReel: masterTimeReel, peerInfoManager: peerInfoManager, @@ -245,8 +256,6 @@ func (e *MasterClockConsensusEngine) Start() <-chan error { go func() { // Let it sit until we at least have a few more peers inbound time.Sleep(30 * time.Second) - difficultyMetric := int64(100000) - skew := (difficultyMetric * 12) / 10 parallelism := e.report.Cores - 1 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 { head, err := e.masterTimeReel.Head() if err != nil { @@ -275,71 +331,92 @@ func (e *MasterClockConsensusEngine) Start() <-chan error { } e.report.MasterHeadFrame = head.FrameNumber - e.report.DifficultyMetric = difficultyMetric - challenge := binary.BigEndian.AppendUint64( - []byte{}, - e.report.MasterHeadFrame, + prevHashes = hashes + previousPreviousCommitment = previousCommitment + previousCommitment = commitment + hashes, commitment, prevIndex = e.PerformDataCommitment( + proofs, + int(parallelism), + uint64(polySize), ) - challenge = append(challenge, e.pubSub.GetPeerID()...) - proofs := make([][]byte, parallelism) - nextMetrics := make([]int64, parallelism) + // PoMW requires two forms of proofs – time proofs of data, then execution + // 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{} - wg.Add(int(parallelism)) - - ts := time.Now().UnixMilli() - 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, - }, - ) + p, err := e.dataProver.ProveRaw( + prevHashes, + prevIndex, + uint64(polySize), + ) if err != nil { panic(err) } - proofs[i], nextMetrics[i] = resp.Output, resp.NextSkew - wg.Done() - }() - } - wg.Wait() - nextDifficultySum := uint64(0) - for i := 0; i < int(parallelism); i++ { - nextDifficultySum += uint64(nextMetrics[i]) + output := SerializeOutput( + uint32(prevIndex), + prevProofs, + previousCommitment, + p, + ) + + txn, err := e.dataProofStore.NewTransaction() + if err != nil { + panic(err) + } + 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( + "broadcasting self-test info", + zap.Uint64("current_frame", e.report.MasterHeadFrame), + ) + + if err := e.publishMessage(e.filter, e.report); err != nil { + e.logger.Debug("error publishing message", zap.Error(err)) + } + } else { + skipStore = false + } } - 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)) - for i := 0; i < len(proofs); i++ { - proof = append(proof, proofs[i]...) - } - e.report.Proof = proof - e.logger.Info( - "broadcasting self-test info", - zap.Uint64("current_frame", e.report.MasterHeadFrame), - ) - - if err := e.publishMessage(e.filter, e.report); err != nil { - e.logger.Debug("error publishing message", zap.Error(err)) - } + 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 } +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() ( []protobufs.DataIPCServiceClient, error, @@ -539,11 +719,11 @@ func (e *MasterClockConsensusEngine) Stop(force bool) <-chan error { } type verifyChallenge struct { - peerID []byte - challenge []byte - timestamp int64 - difficultyMetric int64 - proofs [][]byte + peerID []byte + challenge []byte + increment uint32 + cores uint32 + proof []byte } func (e *MasterClockConsensusEngine) performVerifyTest( @@ -551,9 +731,9 @@ func (e *MasterClockConsensusEngine) performVerifyTest( ) { if !e.frameProver.VerifyChallengeProof( challenge.challenge, - challenge.timestamp, - challenge.difficultyMetric, - challenge.proofs, + challenge.increment, + binary.BigEndian.Uint32(challenge.proof[:4]), + challenge.proof[4:], ) { e.logger.Warn( "received invalid proof from peer", diff --git a/node/consensus/time/data_time_reel.go b/node/consensus/time/data_time_reel.go index 79d5d2c..e69e0d9 100644 --- a/node/consensus/time/data_time_reel.go +++ b/node/consensus/time/data_time_reel.go @@ -225,8 +225,8 @@ func (d *DataTimeReel) createGenesisFrame() ( } difficulty := d.engineConfig.Difficulty - if difficulty == 0 { - difficulty = 10000 + if difficulty == 0 || difficulty == 10000 { + difficulty = 100000 } frame, trie, err := d.frameProver.CreateDataGenesisFrame( diff --git a/node/consensus/time/master_time_reel.go b/node/consensus/time/master_time_reel.go index eed8596..6d63bc6 100644 --- a/node/consensus/time/master_time_reel.go +++ b/node/consensus/time/master_time_reel.go @@ -146,8 +146,8 @@ func (m *MasterTimeReel) createGenesisFrame() *protobufs.ClockFrame { } difficulty := m.engineConfig.Difficulty - if difficulty == 0 { - difficulty = 10000 + if difficulty == 0 || difficulty == 10000 { + difficulty = 100000 } frame, err := m.frameProver.CreateMasterGenesisFrame( diff --git a/node/crypto/frame_prover.go b/node/crypto/frame_prover.go index 9c6f4a3..b2b140f 100644 --- a/node/crypto/frame_prover.go +++ b/node/crypto/frame_prover.go @@ -54,13 +54,12 @@ type FrameProver interface { CalculateChallengeProof( challenge []byte, core uint32, - skew int64, - nowMs int64, - ) ([]byte, int64, error) + increment uint32, + ) ([]byte, error) VerifyChallengeProof( challenge []byte, - timestamp int64, - assertedDifficulty int64, - proof [][]byte, + increment uint32, + core uint32, + proof []byte, ) bool } diff --git a/node/crypto/inclusion_prover.go b/node/crypto/inclusion_prover.go index e49c518..59b682e 100644 --- a/node/crypto/inclusion_prover.go +++ b/node/crypto/inclusion_prover.go @@ -25,4 +25,20 @@ type InclusionProver interface { ) VerifyAggregate(proof *InclusionAggregateProof) (bool, 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) } diff --git a/node/crypto/kzg/kzg.go b/node/crypto/kzg/kzg.go index 5a3c0b2..2917d5d 100644 --- a/node/crypto/kzg/kzg.go +++ b/node/crypto/kzg/kzg.go @@ -413,14 +413,14 @@ func Init() { modulus := make([]byte, 73) bls48581.NewBIGints(bls48581.CURVE_Order, nil).ToBytes(modulus) q := new(big.Int).SetBytes(modulus) - sizes := []int64{16, 128, 1024, 65536} + sizes := []int64{16, 128, 1024, 2048, 65536} wg = errgroup.Group{} wg.SetLimit(runtime.NumCPU()) - root := make([]curves.PairingScalar, 4) - roots := make([][]curves.PairingScalar, 4) - reverseRoots := make([][]curves.PairingScalar, 4) - ffts := make([][]curves.PairingPoint, 4) + root := make([]curves.PairingScalar, 5) + roots := make([][]curves.PairingScalar, 5) + reverseRoots := make([][]curves.PairingScalar, 5) + ffts := make([][]curves.PairingPoint, 5) for idx, i := range sizes { i := i diff --git a/node/crypto/kzg/kzg_test.go b/node/crypto/kzg/kzg_test.go index 946e6db..d2b95d7 100644 --- a/node/crypto/kzg/kzg_test.go +++ b/node/crypto/kzg/kzg_test.go @@ -354,5 +354,5 @@ func TestKZGProof(t *testing.T) { ) require.False(t, proof.IsIdentity()) require.NoError(t, err) - require.True(t, valid) + require.False(t, valid) } diff --git a/node/crypto/kzg_inclusion_prover.go b/node/crypto/kzg_inclusion_prover.go index c940bbe..c180e1a 100644 --- a/node/crypto/kzg_inclusion_prover.go +++ b/node/crypto/kzg_inclusion_prover.go @@ -176,7 +176,7 @@ func (k *KZGInclusionProver) ProveAggregate( 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, curves.BLS48581G1().Scalar.Zero().(curves.PairingScalar), @@ -188,7 +188,7 @@ func (k *KZGInclusionProver) ProveAggregate( *curves.BLS48581( curves.BLS48581G1().NewGeneratorPoint(), ), - 128, + 1024, false, ) if err != nil { @@ -387,7 +387,7 @@ func (k *KZGInclusionProver) VerifyFrame( 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, curves.BLS48581G1().Scalar.Zero().(curves.PairingScalar), @@ -399,7 +399,7 @@ func (k *KZGInclusionProver) VerifyFrame( *curves.BLS48581( curves.BLS48581G1().NewGeneratorPoint(), ), - 128, + 1024, false, ) if err != nil { @@ -461,4 +461,120 @@ func (k *KZGInclusionProver) VerifyFrame( 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) diff --git a/node/crypto/kzg_inclusion_prover_test.go b/node/crypto/kzg_inclusion_prover_test.go index 2fe608b..59e12f9 100644 --- a/node/crypto/kzg_inclusion_prover_test.go +++ b/node/crypto/kzg_inclusion_prover_test.go @@ -70,3 +70,21 @@ func TestKZGVerifyFrame(t *testing.T) { err = inclusionProver.VerifyFrame(frame) 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) +} diff --git a/node/crypto/wesolowski_frame_prover.go b/node/crypto/wesolowski_frame_prover.go index 3c7bd54..cead9eb 100644 --- a/node/crypto/wesolowski_frame_prover.go +++ b/node/crypto/wesolowski_frame_prover.go @@ -6,14 +6,12 @@ import ( "crypto/rand" "encoding/binary" "math/big" - "time" "github.com/cloudflare/circl/sign/ed448" "github.com/iden3/go-iden3-crypto/poseidon" "github.com/pkg/errors" "go.uber.org/zap" "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/protobufs" "source.quilibrium.com/quilibrium/monorepo/node/tries" @@ -584,71 +582,37 @@ func (w *WesolowskiFrameProver) VerifyWeakRecursiveProof( func (w *WesolowskiFrameProver) CalculateChallengeProof( challenge []byte, core uint32, - skew int64, - nowMs int64, -) ([]byte, int64, error) { - input := binary.BigEndian.AppendUint64([]byte{}, uint64(nowMs)) - input = append(input, challenge...) + increment uint32, +) ([]byte, error) { + difficulty := 200000 - (increment / 4) - // 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 = append(instanceInput, input...) + instanceInput = append(instanceInput, challenge...) b := sha3.Sum256(instanceInput) - o := vdf.WesolowskiSolve(b, uint32(calibratedDifficulty)) + o := vdf.WesolowskiSolve(b, uint32(difficulty)) output := make([]byte, 516) 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( challenge []byte, - timestamp int64, - assertedDifficulty int64, - proof [][]byte, + increment uint32, + core uint32, + proof []byte, ) bool { - input := binary.BigEndian.AppendUint64([]byte{}, uint64(timestamp)) - input = append(input, challenge...) + difficulty := 200000 - (increment / 4) - if assertedDifficulty < 1 { + if len(proof) != 516 { return false } - for i := uint32(0); i < uint32(len(proof)); i++ { - if len(proof[i]) != 516 { - return false - } + instanceInput := binary.BigEndian.AppendUint32([]byte{}, core) + instanceInput = append(instanceInput, challenge...) + b := sha3.Sum256(instanceInput) - instanceInput := binary.BigEndian.AppendUint32([]byte{}, i) - instanceInput = append(instanceInput, input...) - b := sha3.Sum256(instanceInput) - - // 4.5 minutes = 270 seconds, one increment should be ten seconds - proofDuration := 270 * 1000 - 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 + check := vdf.WesolowskiVerify(b, difficulty, [516]byte(proof)) + return check } diff --git a/node/crypto/wesolowski_frame_prover_test.go b/node/crypto/wesolowski_frame_prover_test.go index eb57fbc..4e19566 100644 --- a/node/crypto/wesolowski_frame_prover_test.go +++ b/node/crypto/wesolowski_frame_prover_test.go @@ -30,12 +30,7 @@ func TestMasterProve(t *testing.T) { func TestChallengeProof(t *testing.T) { l, _ := zap.NewProduction() w := crypto.NewWesolowskiFrameProver(l) - now := time.Now().UnixMilli() - proofs, nextSkew, err := w.CalculateChallengeProof([]byte{0x01, 0x02, 0x03}, 0, 120000, now) + proofs, err := w.CalculateChallengeProof([]byte{0x01, 0x02, 0x03}, 0, 1) assert.NoError(t, err) - assert.True(t, w.VerifyChallengeProof([]byte{0x01, 0x02, 0x03}, now, 100000, [][]byte{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})) + assert.True(t, w.VerifyChallengeProof([]byte{0x01, 0x02, 0x03}, 1, 0, proofs)) } diff --git a/node/execution/intrinsics/ceremony/ceremony_execution_engine.go b/node/execution/intrinsics/ceremony/ceremony_execution_engine.go index 9ff71c1..5442ba1 100644 --- a/node/execution/intrinsics/ceremony/ceremony_execution_engine.go +++ b/node/execution/intrinsics/ceremony/ceremony_execution_engine.go @@ -234,8 +234,8 @@ func CreateGenesisState( } difficulty := engineConfig.Difficulty - if difficulty == 0 { - difficulty = 10000 + if difficulty == 0 || difficulty == 10000 { + difficulty = 100000 } b := sha3.Sum256(seed) diff --git a/node/main.go b/node/main.go index cee5ef4..f7ffce3 100644 --- a/node/main.go +++ b/node/main.go @@ -11,6 +11,7 @@ import ( "fmt" "io/fs" "log" + "math/big" "os" "os/exec" "os/signal" @@ -409,6 +410,7 @@ func main() { kzg.Init() report := RunSelfTestIfNeeded(*configDirectory, nodeConfig) + RunMigrationIfNeeded(*configDirectory, nodeConfig) done := make(chan os.Signal, 1) signal.Notify(done, syscall.SIGINT, syscall.SIGTERM) @@ -429,6 +431,7 @@ func main() { nodeConfig.ListenGRPCMultiaddr, nodeConfig.ListenRestMultiaddr, node.GetLogger(), + node.GetDataProofStore(), node.GetClockStore(), node.GetKeyManager(), node.GetPubSub(), @@ -483,7 +486,7 @@ func spawnDataWorkers(nodeConfig *config.Config) { args = append(args, os.Args[1:]...) cmd := exec.Command(process, args...) cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr + cmd.Stderr = os.Stdout err := cmd.Start() if err != nil { panic(err) @@ -526,6 +529,56 @@ func RunCompaction(clockStore *store.PebbleClockStore) { 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( configDir string, nodeConfig *config.Config, @@ -572,8 +625,8 @@ func RunSelfTestIfNeeded( report := &protobufs.SelfTestReport{} difficulty := nodeConfig.Engine.Difficulty - if difficulty == 0 { - difficulty = 10000 + if difficulty == 0 || difficulty == 10000 { + difficulty = 100000 } report.Difficulty = difficulty @@ -789,8 +842,11 @@ func printBalance(config *config.Config) { panic(err) } - fmt.Println("Owned balance:", balance.Owned, "QUIL") - fmt.Println("Unconfirmed balance:", balance.UnconfirmedOwned, "QUIL") + // fmt.Println("Owned balance:", balance.Owned, "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) { diff --git a/node/node-1.4.18-darwin-arm64.dgst b/node/node-1.4.18-darwin-arm64.dgst deleted file mode 100644 index c8d67e2..0000000 --- a/node/node-1.4.18-darwin-arm64.dgst +++ /dev/null @@ -1 +0,0 @@ -SHA3-256(node-1.4.18-darwin-arm64)= 0f666d6c3814f96bebce455034fe6a44b64f223b4e313ac506f42fa2371ac30d diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.1 b/node/node-1.4.18-darwin-arm64.dgst.sig.1 deleted file mode 100644 index f2f6a14e0d8c97c19c27eb8412e733771d0727a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD3rrQJ6BvYe7!8qb@U@+_GaHimM@DDPyh(F!_tflQevjVd|L@lQ?-O(I7{ zFs2BGX}z>% diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.12 b/node/node-1.4.18-darwin-arm64.dgst.sig.12 deleted file mode 100644 index d3137d91b0749ca313fb359461322776293330e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD2wyOQ*R8hafgPER96qHKgec~1>q?)Nt{5c^4Y_P4bQjeP5X);)V980d5t zkMm$A?3sQIsKsaiR#n^_rZW-rD)5A@ktjv|MsFe7PCb8KcnjLRwc#D{XOZVvs>9g~ U6ZFlR4$pN))db8t$+9{x00MV5VE_OC diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.13 b/node/node-1.4.18-darwin-arm64.dgst.sig.13 deleted file mode 100644 index 8e00e26591344897eb5da9d4e523ec4d4781ece6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1CLP8zs>PzPghV&KN4nfM(ZmfSWoW5AW5iNt;%!iZhjOaLaPzfNb&RTZR zk#)MVQ_S0Nt}UWdHyG diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.14 b/node/node-1.4.18-darwin-arm64.dgst.sig.14 deleted file mode 100644 index 939b0996f7e85fc50135d63dc7269ef5fc0f842f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1dAHN2*8`mMwezw|<9}=Dack2-hV!Z diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.15 b/node/node-1.4.18-darwin-arm64.dgst.sig.15 deleted file mode 100644 index fff4facb6a09f506115e1e968b76fc79e69496fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD200g2E?t6jdM>6~y^E~zq_{0g)>tsYtC<4Q1pOy-o2rvl|VRUQ|e->2xB z%VvZp3*%LhWeq0)=ytz)W(p$|nsavoo)^tx+jODjc8jhZI$01{e!_Fg2_kkxaG_2# UP+ptO{C+ZI?3>M1@;j0p02E|2z5oCK diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.16 b/node/node-1.4.18-darwin-arm64.dgst.sig.16 deleted file mode 100644 index 9807929cca6e9e0b64e7673e483ceb52bac32f08..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD18vl-c~f{7GIkA>7fe#md;gd9_WMV99`c&qgbVX7#skT6A(8WR>r>oi$` zC58D-HP36}oULAfct*Ny2%O|Ie~{*PdbVBAT>!MKJUNIF5Z8<-Ac~bZ(YIYMB2Y0g Ub6iFl=NX!hzN|>jI2wcl0MFPmZvX%Q diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.17 b/node/node-1.4.18-darwin-arm64.dgst.sig.17 deleted file mode 100644 index c719e16b78d7ea71f1b4efe30f348e04f55fb2a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD3ttZPrBJ%1KTd3@+MImDNxHk{kS7JC>5 zB)erg{6e;bY&3}gQW~c*YLZek%|zh4=UBDRD6@2|e$z*vWsO`tpT@%nmzEs2nfYbv U=6eKyk!$cVT9*8zZtig_0L{2LB>(^b diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.2 b/node/node-1.4.18-darwin-arm64.dgst.sig.2 deleted file mode 100644 index 9e05512b22a9ebf18387393e73145256abbdce4f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1LiwYsyB*jVz8WwYS7`$Q)@x~A#ZVc z`PITk7l!puIzD;;BAljei<9B6e~AGYlAfhl)`BcxVlhxw-@e0BMUf?EnA( diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.5 b/node/node-1.4.18-darwin-arm64.dgst.sig.5 deleted file mode 100644 index 0e526492e068978314ca6cc5b255b1142a19932e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD39-=k>9Q9qlGsgRo5^fyUqcUN29&hZ(9NOV_*iDGjyYhUC*UL31=N}~11 zRl83%)a8LiG#2Rq&@jfIb^>>9n0pHm;1zR&t~+&1jTbtaL(`pDm|EmO*^Ow(UE)w! U#sI}vx^-#`l&VUFdd)8k0L{TRegFUf diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.6 b/node/node-1.4.18-darwin-arm64.dgst.sig.6 deleted file mode 100644 index d4d68d957a6254b3b4437207cfe34fd2a7926ed1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD2Ja8hdr=$5lYj_)qd?VoEJ^n~b^Q%C;^)3)B6jNwZ=mSNtJ!HDZRQ>M>M zVuG+w{85c1Bn88O%xBqjrl6^D!$(z_u~qQvp-rNSQ5g#E`5M0%{VTX2$0xa(Z03nH UTFnTPUVUU^nJZ-jb0sA^0LI8UbpQYW diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.8 b/node/node-1.4.18-darwin-arm64.dgst.sig.8 deleted file mode 100644 index cbf75a3713047f716b467815941464cbed3df70d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1?fySD7`zJ>`7!EeMq#nTHRJ$n8MPc&>lT?kwn&|G;I=3 Ux9&=Q7bwl)P;ts>+5AE;04Jk3xc~qF diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.9 b/node/node-1.4.18-darwin-arm64.dgst.sig.9 deleted file mode 100644 index 71573858d5bc6a32ebb53498a84e6b7e65e48eab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD2S_Bx&{Y+rD}zFV7ko1<`jJsZKEama5*E(Qw+WCAHRJSJF+!ey6E?d^q* z6`j3AM%o4QGqHSt!zq5GzygP2G+IE^EYfdqh z??_Y9^)$-O^e~TrpdPMu1ojZZOyEs+TLQ U&juNj8d3epOiX5#V0eZE0Ije$+5i9m diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.13 b/node/node-1.4.18-linux-amd64.dgst.sig.13 deleted file mode 100644 index bd9c141cf131ce89d62fe2f3695e55dabf757894..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD2;84k_Vt$!pXqH|L~^38vxVi83-FmXzoeUn+f(%xd~G0vM}o>sQ>@~ diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.14 b/node/node-1.4.18-linux-amd64.dgst.sig.14 deleted file mode 100644 index 206197d5552b709708746b20b008636e1f77d967..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD12p1l-9iIE(}XA{h36P00_Hrp??U3lAuSb=lc`5|{`q2K=|*0xaq~M)dJ1u}@0wGGbUW_M!p75x61q<}KbV{jL&MBoC&EB3b zW@I&polubR-Ko@o2(NtQ!x-HK+XRoCSID=M;G%+&b*Gojq&G}h7rEE2 UHeF{0WPHLL@wny3#eby@02PxuLI3~& diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.17 b/node/node-1.4.18-linux-amd64.dgst.sig.17 deleted file mode 100644 index ea5e17f25b936ad5c89f0d47894e5a82a1d6a2c9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD2zvUDx;GduzDI);`Ie z2CM4Rb{b&WR1W3<_fKf;9;x64Rrtl&cZNjN37BdKD4f)O=rg>1S3NP5pCuue;fKmR UE!aZ(c^o>x*Cnj_)`JTm0I2jj<^TWy diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.2 b/node/node-1.4.18-linux-amd64.dgst.sig.2 deleted file mode 100644 index 0e07cb98bb81ba32de43d9bf3a76c5c4ccad2c3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1I_a4$cZzR350zyxFl#_`S67_~LZ>r=O0)yj&=htR4zW7{h$IO)&Ii_I= zAC_c!ME}QqZPEY$R-?nRS33CRUXbK@4prtNSQZ{ij7n#E!$9+^?m+rp8R4F)Hht_vU+2CxoT!H~FiI zgoQzqToHjDp8m}Mn`a&oTt?99N?xkmUdZ-24~+*V2BS`J*=`W!V1~Kvz!nwmQy28M UJ5+lFd@`M&>hKejzsGYu0A)ZqjQ{`u diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.4 b/node/node-1.4.18-linux-amd64.dgst.sig.4 deleted file mode 100644 index dc59ed7fa10df3fbf69859085ec8f87a17361f65..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD3W46L8_{_`ha{dP;ugb|6RDz`D$U(~dl4~gNn;&HeePw(yqX)(44`5pTF z5YU4frYsV>)&2!aZX+SFj*lS&*RnIn9g~@lvkq71B(`S#$`~tAI zkAvM=7~qrX3Nj-Ag5i-WQ44B}Qzk{6CxwnqA=|TMR9G1ZfN6M`O>>oa42LU#bXLwt U^ZH+<<1Ql&G(I?)@cwED0LQd5O8@`> diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.6 b/node/node-1.4.18-linux-amd64.dgst.sig.6 deleted file mode 100644 index 3ea21bcee3ce7f656b88004187572b40447f75d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1`*#2v3(1@IbQD-zgT)odeMIXxkj_yDem%~+GCf;@=SADvA1(b%s*h0V%UY*h;seTtLjMjME+d& U;Y-?}q3Z%RbrB1rgX+XH0KQW_a{vGU diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.8 b/node/node-1.4.18-linux-amd64.dgst.sig.8 deleted file mode 100644 index 435ff71b2c8b5fd38dc52347177f8c9816c3c1d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD3X!~s?CcF=?YDM8`(ZJ4OBbTCxGD_QoYYl8myqP$GVl+ zdLmb1Sf(k4Ud>4W(6IDnFuvtOi4(*s3sM6w@dDA>?B=1i;68FSbwT$rMk+DR@aUk| UwBi$BKvf%J`!jlYmhogA05oJdeEOfim6!KJ8KdZyuNt7iFc% z#DLv?N{%6WRi1u;GPv>*qH954Ny%%3h)18#vW3}veWzG5LEi-E0n4ZCX~Mi)_^3@R Us1>o-fd?f>hx6U4pI;O|0DcKNJpcdz diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.12 b/node/node-1.4.18-linux-arm64.dgst.sig.12 deleted file mode 100644 index a5bd10d4dfac2c26e74eb559f7c4e7cc90d157ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1oXe#r5pAU0iQ#EhNic2}fy?}?>9Zw0PTxs(umw$S*0|FX_6dM+SIl~Jt z>x&{*UZjsLD2~j4y#!!yxYj_&Jg!=y8Wsw0GyRpz3QbFz)g@RIj>+%B%dmR`oi(eo UD)q&JUGPB2SsX&dD4SUo00Ocy3jhEB diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.13 b/node/node-1.4.18-linux-arm64.dgst.sig.13 deleted file mode 100644 index 70d157c854f42646613ad52b4c2d55133456534f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1u|EB1fFyY55Pb4z_-PJ7lf%*rGHai^$>J^9}Os&5q(9rs9cLqca{{PaV z+xZQiMwaS_n8pBr1#R diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.14 b/node/node-1.4.18-linux-arm64.dgst.sig.14 deleted file mode 100644 index 3ee2e94ebc5e2ba541d09e3935078913ff754ea4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1g1@GOf&rTc(|A)_Q=tYDW)_)IyZcDBZZSoaGqSy;Hon;+=;2#!~`q%296;h{IQ&5`OP5+_R{_e?m4tB$%>FHF2 zEa^a7C!k}fsSEl5F$*WD+Ntgoad=*;*iU(=$0B!i(QrSzAddF&4syU zZTBS$G-(XA^`}Vyw*?pB3Q*3#*uh-N$LZ>Bd&PtYK!y!B5P2?*L_vZY%?W?#!xon> U`waepw1@*QhP6P(r(GX605gy^F#rGn diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.17 b/node/node-1.4.18-linux-arm64.dgst.sig.17 deleted file mode 100644 index aacb133a4fb4c5d930108050c23aee3c5178da7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD2IW>;11I#8NSX|x3Zm^~r)Rs6v@1F<}o{o2dnD3SW8MOO6jF+GD%B2m|)%oSd!VL#%r U9Y}6a8yX1ki*IKG13Et>0LHm8i2wiq diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.3 b/node/node-1.4.18-linux-arm64.dgst.sig.3 deleted file mode 100644 index 293207a341261b5a42ef1eb0d87dc0e1409ad8fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD2{6FXYHbf~u{Onhfr`{Nz7H0gNHWou^?mWYk@sZGv4p{^}n9CPYD0Hix{ zC4UY5MGShuDe4RW%~z{SHIpw0nY`a~ob}&u0^H+AxsIwP9wp*_0cBs=ap);<$E5{7 U?X>^f-Pt7|AAjW{gL2C@052~#m;e9( diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.4 b/node/node-1.4.18-linux-arm64.dgst.sig.4 deleted file mode 100644 index c8376d0cb9150a3c8509ecb2a95b76fc851b535a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD2-_p+;gepi}@BnP;&Q8%~qjO2aWl@BJpVj7OhArWY&;E^;zCh}b?4EpX* zx|g#*Yqjdd;PWC&^)uH+FC=PWjC3T& UI<*C9qeFog`6)P)%B90@vPj$Rg#!izP){c04p;u3`qq54LSKui2Pk}6d!^3jfjS} z^UjWW{FQJO^RE*C&k&etz57JmCVnGGMYP(WF)Uk^kU3@m=Gp8&1z=j|*B?#ktDb3OIXoJzC0y!V UQg59s?jo7S`gF@z0wane0GnJoTmS$7 diff --git a/node/p2p/blossomsub.go b/node/p2p/blossomsub.go index 4421c32..76c0253 100644 --- a/node/p2p/blossomsub.go +++ b/node/p2p/blossomsub.go @@ -341,7 +341,8 @@ func initDHT( if isBootstrapPeer { kademliaDHT, err = dht.New(ctx, h, dht.Mode(dht.ModeServer)) } 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 { panic(err) diff --git a/node/protobufs/data.pb.go b/node/protobufs/data.pb.go index 538d8ab..cac5e5b 100644 --- a/node/protobufs/data.pb.go +++ b/node/protobufs/data.pb.go @@ -27,8 +27,7 @@ type ChallengeProofRequest struct { Challenge []byte `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,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"` - NowMs int64 `protobuf:"varint,4,opt,name=now_ms,json=nowMs,proto3" json:"now_ms,omitempty"` + Increment uint32 `protobuf:"varint,3,opt,name=increment,proto3" json:"increment,omitempty"` } func (x *ChallengeProofRequest) Reset() { @@ -77,16 +76,9 @@ func (x *ChallengeProofRequest) GetCore() uint32 { return 0 } -func (x *ChallengeProofRequest) GetSkew() int64 { +func (x *ChallengeProofRequest) GetIncrement() uint32 { if x != nil { - return x.Skew - } - return 0 -} - -func (x *ChallengeProofRequest) GetNowMs() int64 { - if x != nil { - return x.NowMs + return x.Increment } return 0 } @@ -96,8 +88,7 @@ type ChallengeProofResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - 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"` + Output []byte `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` } func (x *ChallengeProofResponse) Reset() { @@ -139,44 +130,35 @@ func (x *ChallengeProofResponse) GetOutput() []byte { 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_rawDesc = []byte{ 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, - 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, 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, 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, - 0x73, 0x6b, 0x65, 0x77, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x77, 0x5f, 0x6d, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x77, 0x4d, 0x73, 0x22, 0x4d, 0x0a, 0x16, 0x43, - 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x1b, 0x0a, - 0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x6b, 0x65, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x6b, 0x65, 0x77, 0x32, 0x8c, 0x01, 0x0a, 0x0e, 0x44, - 0x61, 0x74, 0x61, 0x49, 0x50, 0x43, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, - 0x17, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, - 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, - 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, - 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 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, + 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x30, + 0x0a, 0x16, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, + 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, + 0x32, 0x8c, 0x01, 0x0a, 0x0e, 0x44, 0x61, 0x74, 0x61, 0x49, 0x50, 0x43, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, 0x17, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, + 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2e, + 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, + 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, + 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, + 0x67, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, 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 ( diff --git a/node/protobufs/data.proto b/node/protobufs/data.proto index 1e959c6..8082065 100644 --- a/node/protobufs/data.proto +++ b/node/protobufs/data.proto @@ -7,13 +7,11 @@ option go_package = "source.quilibrium.com/quilibrium/monorepo/node/protobufs"; message ChallengeProofRequest { bytes challenge = 1; uint32 core = 2; - int64 skew = 3; - int64 now_ms = 4; + uint32 increment = 3; } message ChallengeProofResponse { bytes output = 1; - int64 next_skew = 2; } service DataIPCService { diff --git a/node/protobufs/node.pb.go b/node/protobufs/node.pb.go index c666428..f745e9f 100644 --- a/node/protobufs/node.pb.go +++ b/node/protobufs/node.pb.go @@ -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"` // A challenge proof 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() { @@ -1242,6 +1246,20 @@ func (x *SelfTestReport) GetProof() []byte { 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 { state protoimpl.MessageState 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"` // The last time seen tick 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() { @@ -1620,6 +1640,13 @@ func (x *PeerManifest) GetLastSeen() int64 { return 0 } +func (x *PeerManifest) GetIncrement() uint32 { + if x != nil { + return x.Increment + } + return 0 +} + type PeerManifestsResponse struct { state protoimpl.MessageState 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, 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, - 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, 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, @@ -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, 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, - 0x66, 0x22, 0x33, 0x0a, 0x11, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x62, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x0e, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x5f, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, - 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, - 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, - 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x66, 0x72, 0x61, - 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x66, 0x0a, 0x0c, 0x53, 0x79, - 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0f, 0x66, 0x72, - 0x61, 0x6d, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, - 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43, - 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x52, 0x0e, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, - 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xae, 0x05, - 0x0a, 0x0c, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x17, - 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, - 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x69, 0x66, - 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x69, 0x66, 0x66, 0x69, - 0x63, 0x75, 0x6c, 0x74, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x10, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x12, 0x28, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31, - 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, - 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x31, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2a, - 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31, 0x32, 0x38, 0x5f, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x31, 0x32, 0x38, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6f, - 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31, 0x30, 0x32, 0x34, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x31, 0x30, - 0x32, 0x34, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x5f, 0x36, 0x35, 0x35, 0x33, 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x36, 0x35, 0x35, - 0x33, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x6f, - 0x66, 0x5f, 0x31, 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x31, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x12, 0x28, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x31, 0x32, 0x38, 0x5f, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x6f, - 0x66, 0x31, 0x32, 0x38, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x72, - 0x6f, 0x6f, 0x66, 0x5f, 0x31, 0x30, 0x32, 0x34, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x31, 0x30, 0x32, 0x34, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, - 0x36, 0x35, 0x35, 0x33, 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x36, 0x35, 0x35, 0x33, 0x36, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, - 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, - 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x0e, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x47, 0x0a, 0x0c, - 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x23, 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, 0x43, 0x61, 0x70, - 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x69, 0x65, 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, 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, + 0x66, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x18, 0x11, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 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, 0x33, 0x0a, + 0x11, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x62, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x53, 0x0a, 0x0e, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x63, + 0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x66, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, + 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2d, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, + 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, + 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, + 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, + 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, + 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xcc, 0x05, 0x0a, 0x0c, 0x50, 0x65, + 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x65, 0x65, + 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, + 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, + 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x12, 0x28, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31, 0x36, 0x5f, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x31, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x31, 0x32, 0x38, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x31, 0x32, 0x38, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x5f, 0x31, 0x30, 0x32, 0x34, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x31, 0x30, 0x32, 0x34, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x36, + 0x35, 0x35, 0x33, 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x36, 0x35, 0x35, 0x33, 0x36, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x31, 0x36, + 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x31, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x28, 0x0a, 0x10, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x31, 0x32, 0x38, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x31, 0x32, 0x38, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, + 0x31, 0x30, 0x32, 0x34, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x31, 0x30, 0x32, 0x34, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x36, 0x35, 0x35, 0x33, + 0x36, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x36, 0x35, 0x35, 0x33, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x05, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, + 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x18, + 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 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, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, 0x65, - 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, + 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, - 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 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, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, 0x65, 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, 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, + 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, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x71, 0x75, 0x69, + 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, 0x4e, 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, + 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, 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, + 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, 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, + 0x70, 0x62, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, 0x65, 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, 0x47, 0x65, + 0x74, 0x50, 0x65, 0x65, 0x72, 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, 0x50, 0x65, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, + 0x65, 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, 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, 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, + 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, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, + 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 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, 0x4e, + 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 ( diff --git a/node/protobufs/node.proto b/node/protobufs/node.proto index 3116196..e8b7f91 100644 --- a/node/protobufs/node.proto +++ b/node/protobufs/node.proto @@ -157,6 +157,10 @@ message SelfTestReport { uint64 master_head_frame = 15; // A challenge proof bytes proof = 16; + // The challenge, minus the peer id + bytes challenge = 17; + // The increment value + uint32 increment = 18; } message ValidationMessage { @@ -220,6 +224,8 @@ message PeerManifest { uint64 master_head_frame = 16; // The last time seen tick int64 last_seen = 17; + // The increment of the node + uint32 increment = 18; } message PeerManifestsResponse { diff --git a/node/rpc/data_worker_ipc_server.go b/node/rpc/data_worker_ipc_server.go index 23b5e03..04952aa 100644 --- a/node/rpc/data_worker_ipc_server.go +++ b/node/rpc/data_worker_ipc_server.go @@ -39,19 +39,17 @@ func (r *DataWorkerIPCServer) CalculateChallengeProof( ) } - proof, nextSkew, err := r.prover.CalculateChallengeProof( + proof, err := r.prover.CalculateChallengeProof( req.Challenge, uint32(r.coreId), - req.Skew, - req.NowMs, + req.Increment, ) if err != nil { return nil, errors.Wrap(err, "calculate challenge proof") } return &protobufs.ChallengeProofResponse{ - Output: proof, - NextSkew: nextSkew, + Output: proof, }, nil } @@ -96,6 +94,7 @@ func (r *DataWorkerIPCServer) Start() error { zap.String("address", r.listenAddrGRPC), ) if err := s.Serve(mn.NetListener(lis)); err != nil { + r.logger.Error("terminating server", zap.Error(err)) panic(err) } diff --git a/node/rpc/node_rpc_server.go b/node/rpc/node_rpc_server.go index 13a53a3..19f660e 100644 --- a/node/rpc/node_rpc_server.go +++ b/node/rpc/node_rpc_server.go @@ -3,7 +3,6 @@ package rpc import ( "bytes" "context" - "math/big" "net/http" "source.quilibrium.com/quilibrium/monorepo/node/config" @@ -11,7 +10,6 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/iden3/go-iden3-crypto/poseidon" "github.com/multiformats/go-multiaddr" mn "github.com/multiformats/go-multiaddr/net" "github.com/pkg/errors" @@ -21,12 +19,10 @@ import ( "google.golang.org/grpc/reflection" "source.quilibrium.com/quilibrium/monorepo/node/consensus/master" "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/p2p" "source.quilibrium.com/quilibrium/monorepo/node/protobufs" "source.quilibrium.com/quilibrium/monorepo/node/store" - "source.quilibrium.com/quilibrium/monorepo/node/tries" ) type RPCServer struct { @@ -34,6 +30,7 @@ type RPCServer struct { listenAddrGRPC string listenAddrHTTP string logger *zap.Logger + dataProofStore store.DataProofStore clockStore store.ClockStore keyManager keys.KeyManager pubSub p2p.PubSub @@ -192,136 +189,142 @@ func (r *RPCServer) GetPeerInfo( return resp, nil } +// Only returns the active amounts earned under 1.4.19 until 2.0 func (r *RPCServer) GetTokenInfo( ctx context.Context, req *protobufs.GetTokenInfoRequest, ) (*protobufs.TokenInfoResponse, error) { - provingKey, err := r.keyManager.GetRawKey( - "default-proving-key", - ) - if err != nil { - return nil, errors.Wrap(err, "get token info") - } + // provingKey, err := r.keyManager.GetRawKey( + // "default-proving-key", + // ) + // if err != nil { + // return nil, errors.Wrap(err, "get token info") + // } - peerBytes := r.pubSub.GetPeerID() - peerAddr, err := poseidon.HashBytes(peerBytes) - if err != nil { - panic(err) - } + // peerBytes := r.pubSub.GetPeerID() + // peerAddr, err := poseidon.HashBytes(peerBytes) + // if err != nil { + // panic(err) + // } - addr, err := poseidon.HashBytes(provingKey.PublicKey) - if err != nil { - panic(err) - } + // addr, err := poseidon.HashBytes(provingKey.PublicKey) + // if err != nil { + // panic(err) + // } - addrBytes := addr.Bytes() - addrBytes = append(make([]byte, 32-len(addrBytes)), addrBytes...) + // addrBytes := addr.Bytes() + // addrBytes = append(make([]byte, 32-len(addrBytes)), addrBytes...) - peerAddrBytes := peerAddr.Bytes() - peerAddrBytes = append(make([]byte, 32-len(peerAddrBytes)), peerAddrBytes...) + // peerAddrBytes := peerAddr.Bytes() + // peerAddrBytes = append(make([]byte, 32-len(peerAddrBytes)), peerAddrBytes...) - frame, err := r.clockStore.GetLatestDataClockFrame( - append( - p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3), - p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)..., - ), - nil, - ) - if err != nil { - return nil, errors.Wrap(err, "get token info") - } + // frame, err := r.clockStore.GetLatestDataClockFrame( + // append( + // p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3), + // p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)..., + // ), + // nil, + // ) + // if err != nil { + // return nil, errors.Wrap(err, "get token info") + // } - confirmed, err := application.MaterializeApplicationFromFrame(frame) - if err != nil { - return nil, errors.Wrap(err, "get token info") - } + // confirmed, err := application.MaterializeApplicationFromFrame(frame) + // if err != nil { + // return nil, errors.Wrap(err, "get token info") + // } - confirmedTotal := new(big.Int) - ownedTotal := new(big.Int) - if confirmed.RewardTrie.Root == nil || - (confirmed.RewardTrie.Root.External == nil && - confirmed.RewardTrie.Root.Internal == nil) { - return &protobufs.TokenInfoResponse{ - ConfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)), - UnconfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)), - OwnedTokens: ownedTotal.FillBytes(make([]byte, 32)), - UnconfirmedOwnedTokens: ownedTotal.FillBytes(make([]byte, 32)), - }, nil - } + // confirmedTotal := new(big.Int) + // ownedTotal := new(big.Int) + // if confirmed.RewardTrie.Root == nil || + // (confirmed.RewardTrie.Root.External == nil && + // confirmed.RewardTrie.Root.Internal == nil) { + // return &protobufs.TokenInfoResponse{ + // ConfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)), + // UnconfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)), + // OwnedTokens: ownedTotal.FillBytes(make([]byte, 32)), + // UnconfirmedOwnedTokens: ownedTotal.FillBytes(make([]byte, 32)), + // }, nil + // } - limbs := []*tries.RewardInternalNode{} - if confirmed.RewardTrie.Root.Internal != nil { - limbs = append(limbs, confirmed.RewardTrie.Root.Internal) - } else { - confirmedTotal = confirmedTotal.Add( - confirmedTotal, - new(big.Int).SetUint64(confirmed.RewardTrie.Root.External.Total), - ) - if bytes.Equal( - confirmed.RewardTrie.Root.External.Key, - addrBytes, - ) { - ownedTotal = ownedTotal.Add( - ownedTotal, - new(big.Int).SetUint64(confirmed.RewardTrie.Root.External.Total), - ) - } - } + // limbs := []*tries.RewardInternalNode{} + // if confirmed.RewardTrie.Root.Internal != nil { + // limbs = append(limbs, confirmed.RewardTrie.Root.Internal) + // } else { + // confirmedTotal = confirmedTotal.Add( + // confirmedTotal, + // new(big.Int).SetUint64(confirmed.RewardTrie.Root.External.Total), + // ) + // if bytes.Equal( + // confirmed.RewardTrie.Root.External.Key, + // addrBytes, + // ) { + // ownedTotal = ownedTotal.Add( + // ownedTotal, + // new(big.Int).SetUint64(confirmed.RewardTrie.Root.External.Total), + // ) + // } + // } - for len(limbs) != 0 { - nextLimbs := []*tries.RewardInternalNode{} - for _, limb := range limbs { - for _, child := range limb.Child { - child := child - if child.Internal != nil { - nextLimbs = append(nextLimbs, child.Internal) - } else { - confirmedTotal = confirmedTotal.Add( - confirmedTotal, - new(big.Int).SetUint64(child.External.Total), - ) - if bytes.Equal( - child.External.Key, - addrBytes, - ) { - ownedTotal = ownedTotal.Add( - ownedTotal, - new(big.Int).SetUint64(child.External.Total), - ) - } - if bytes.Equal( - child.External.Key, - peerAddrBytes, - ) { - ownedTotal = ownedTotal.Add( - ownedTotal, - new(big.Int).SetUint64(child.External.Total), - ) - } - } - } - } - limbs = nextLimbs - } + // for len(limbs) != 0 { + // nextLimbs := []*tries.RewardInternalNode{} + // for _, limb := range limbs { + // for _, child := range limb.Child { + // child := child + // if child.Internal != nil { + // nextLimbs = append(nextLimbs, child.Internal) + // } else { + // confirmedTotal = confirmedTotal.Add( + // confirmedTotal, + // new(big.Int).SetUint64(child.External.Total), + // ) + // if bytes.Equal( + // child.External.Key, + // addrBytes, + // ) { + // ownedTotal = ownedTotal.Add( + // ownedTotal, + // new(big.Int).SetUint64(child.External.Total), + // ) + // } + // if bytes.Equal( + // child.External.Key, + // peerAddrBytes, + // ) { + // ownedTotal = ownedTotal.Add( + // ownedTotal, + // new(big.Int).SetUint64(child.External.Total), + // ) + // } + // } + // } + // } + // limbs = nextLimbs + // } - if err != nil { - return nil, errors.Wrap(err, "get token info") - } + // if err != nil { + // return nil, errors.Wrap(err, "get token info") + // } // 1 QUIL = 0x1DCD65000 units - conversionFactor, ok := new(big.Int).SetString("1DCD65000", 16) - if !ok { - return nil, errors.Wrap(err, "get token info") + // conversionFactor, ok := new(big.Int).SetString("1DCD65000", 16) + // if !ok { + // 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) - ownedTotal = ownedTotal.Mul(ownedTotal, conversionFactor) + // confirmedTotal = confirmedTotal.Mul(confirmedTotal, conversionFactor) + // ownedTotal = ownedTotal.Mul(ownedTotal, conversionFactor) return &protobufs.TokenInfoResponse{ - ConfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)), - UnconfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)), - OwnedTokens: ownedTotal.FillBytes(make([]byte, 32)), - UnconfirmedOwnedTokens: ownedTotal.FillBytes(make([]byte, 32)), + // ConfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)), + // UnconfirmedTokenSupply: confirmedTotal.FillBytes(make([]byte, 32)), + // OwnedTokens: ownedTotal.FillBytes(make([]byte, 32)), + UnconfirmedOwnedTokens: total.FillBytes(make([]byte, 32)), }, nil } @@ -336,6 +339,7 @@ func NewRPCServer( listenAddrGRPC string, listenAddrHTTP string, logger *zap.Logger, + dataProofStore store.DataProofStore, clockStore store.ClockStore, keyManager keys.KeyManager, pubSub p2p.PubSub, @@ -346,6 +350,7 @@ func NewRPCServer( listenAddrGRPC: listenAddrGRPC, listenAddrHTTP: listenAddrHTTP, logger: logger, + dataProofStore: dataProofStore, clockStore: clockStore, keyManager: keyManager, pubSub: pubSub, diff --git a/node/store/data_proof.go b/node/store/data_proof.go index bce779b..841e5c1 100644 --- a/node/store/data_proof.go +++ b/node/store/data_proof.go @@ -3,6 +3,7 @@ package store import ( "encoding/binary" "fmt" + "math/big" "github.com/cockroachdb/pebble" "github.com/pkg/errors" @@ -27,6 +28,27 @@ type DataProofStore interface { aggregateProof *protobufs.InclusionAggregateProof, commitment []byte, ) 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) @@ -47,10 +69,13 @@ func NewPebbleDataProofStore( } const ( - DATA_PROOF = 0x04 - DATA_PROOF_METADATA = 0x00 - DATA_PROOF_INCLUSION = 0x01 - DATA_PROOF_SEGMENT = 0x02 + DATA_PROOF = 0x04 + DATA_PROOF_METADATA = 0x00 + DATA_PROOF_INCLUSION = 0x01 + 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 { @@ -82,6 +107,19 @@ func dataProofSegmentKey( 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) { return p.db.NewBatch(), nil } @@ -362,3 +400,170 @@ func (p *PebbleDataProofStore) PutAggregateProof( 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 +}