diff --git a/go-libp2p-blossomsub/blossomsub.go b/go-libp2p-blossomsub/blossomsub.go index b7c280a..2f3a521 100644 --- a/go-libp2p-blossomsub/blossomsub.go +++ b/go-libp2p-blossomsub/blossomsub.go @@ -26,7 +26,7 @@ const ( var ( BlossomSubD = 6 BlossomSubDlo = 5 - BlossomSubDhi = 24 + BlossomSubDhi = 10 BlossomSubDscore = 4 BlossomSubDout = 2 BlossomSubHistoryLength = 5 diff --git a/node/app/wire.go b/node/app/wire.go index 13371e1..35aacd3 100644 --- a/node/app/wire.go +++ b/node/app/wire.go @@ -27,10 +27,23 @@ func logger() *zap.Logger { return log } +func debugLogger() *zap.Logger { + log, err := zap.NewDevelopment() + if err != nil { + panic(err) + } + + return log +} + var loggerSet = wire.NewSet( logger, ) +var debugLoggerSet = wire.NewSet( + debugLogger, +) + var keyManagerSet = wire.NewSet( wire.FieldsOf(new(*config.Config), "Key"), keys.NewFileKeyManager, @@ -75,6 +88,18 @@ var consensusSet = wire.NewSet( ), ) +func NewDebugNode(*config.Config, *protobufs.SelfTestReport) (*Node, error) { + panic(wire.Build( + debugLoggerSet, + keyManagerSet, + storeSet, + pubSubSet, + engineSet, + consensusSet, + newNode, + )) +} + func NewNode(*config.Config, *protobufs.SelfTestReport) (*Node, error) { panic(wire.Build( loggerSet, diff --git a/node/app/wire_gen.go b/node/app/wire_gen.go index d06f173..398b707 100644 --- a/node/app/wire_gen.go +++ b/node/app/wire_gen.go @@ -23,6 +23,30 @@ import ( // Injectors from wire.go: +func NewDebugNode(configConfig *config.Config, selfTestReport *protobufs.SelfTestReport) (*Node, error) { + zapLogger := debugLogger() + dbConfig := configConfig.DB + pebbleDB := store.NewPebbleDB(dbConfig) + pebbleClockStore := store.NewPebbleClockStore(pebbleDB, zapLogger) + keyConfig := configConfig.Key + fileKeyManager := keys.NewFileKeyManager(keyConfig, zapLogger) + p2PConfig := configConfig.P2P + blossomSub := p2p.NewBlossomSub(p2PConfig, zapLogger) + engineConfig := configConfig.Engine + wesolowskiFrameProver := crypto.NewWesolowskiFrameProver(zapLogger) + kzgInclusionProver := crypto.NewKZGInclusionProver(zapLogger) + masterTimeReel := time.NewMasterTimeReel(zapLogger, pebbleClockStore, engineConfig, wesolowskiFrameProver) + inMemoryPeerInfoManager := p2p.NewInMemoryPeerInfoManager(zapLogger) + pebbleKeyStore := store.NewPebbleKeyStore(pebbleDB, zapLogger) + ceremonyExecutionEngine := ceremony.NewCeremonyExecutionEngine(zapLogger, engineConfig, fileKeyManager, blossomSub, wesolowskiFrameProver, kzgInclusionProver, pebbleClockStore, masterTimeReel, inMemoryPeerInfoManager, pebbleKeyStore) + masterClockConsensusEngine := master.NewMasterClockConsensusEngine(engineConfig, zapLogger, pebbleClockStore, fileKeyManager, blossomSub, wesolowskiFrameProver, masterTimeReel, inMemoryPeerInfoManager, selfTestReport) + node, err := newNode(zapLogger, pebbleClockStore, fileKeyManager, blossomSub, ceremonyExecutionEngine, masterClockConsensusEngine) + if err != nil { + return nil, err + } + return node, nil +} + func NewNode(configConfig *config.Config, selfTestReport *protobufs.SelfTestReport) (*Node, error) { zapLogger := logger() dbConfig := configConfig.DB @@ -74,10 +98,23 @@ func logger() *zap.Logger { return log } +func debugLogger() *zap.Logger { + log, err := zap.NewDevelopment() + if err != nil { + panic(err) + } + + return log +} + var loggerSet = wire.NewSet( logger, ) +var debugLoggerSet = wire.NewSet( + debugLogger, +) + var keyManagerSet = wire.NewSet(wire.FieldsOf(new(*config.Config), "Key"), keys.NewFileKeyManager, wire.Bind(new(keys.KeyManager), new(*keys.FileKeyManager))) var storeSet = wire.NewSet(wire.FieldsOf(new(*config.Config), "DB"), store.NewPebbleDB, wire.Bind(new(store.KVDB), new(*store.PebbleDB)), store.NewPebbleClockStore, store.NewPebbleKeyStore, store.NewPebbleDataProofStore, wire.Bind(new(store.ClockStore), new(*store.PebbleClockStore)), wire.Bind(new(store.KeyStore), new(*store.PebbleKeyStore)), wire.Bind(new(store.DataProofStore), new(*store.PebbleDataProofStore))) diff --git a/node/config/version.go b/node/config/version.go index 7d23753..c1706b9 100644 --- a/node/config/version.go +++ b/node/config/version.go @@ -6,15 +6,15 @@ import ( ) func GetMinimumVersionCutoff() time.Time { - return time.Date(2024, time.March, 21, 5, 00, 0, 0, time.UTC) + return time.Date(2024, time.March, 27, 8, 30, 0, 0, time.UTC) } func GetMinimumVersion() []byte { - return []byte{0x01, 0x04, 0x0B} + return []byte{0x01, 0x04, 0x0D} } func GetVersion() []byte { - return []byte{0x01, 0x04, 0x0C} + return []byte{0x01, 0x04, 0x0D} } func GetVersionString() string { diff --git a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go index e97f6f4..0894162 100644 --- a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go +++ b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go @@ -242,7 +242,7 @@ func NewCeremonyDataClockConsensusEngine( dataTimeReel: dataTimeReel, peerInfoManager: peerInfoManager, statsClient: statsClient, - messageProcessorCh: make(chan *pb.Message, 128), + messageProcessorCh: make(chan *pb.Message), } logger.Info("constructing consensus engine") @@ -280,9 +280,7 @@ func (e *CeremonyDataClockConsensusEngine) Start() <-chan error { panic(err) } - go func() { - e.runMessageHandler() - }() + go e.runMessageHandler() e.logger.Info("subscribing to pubsub messages") e.pubSub.Subscribe(e.filter, e.handleMessage, true) @@ -309,8 +307,6 @@ func (e *CeremonyDataClockConsensusEngine) Start() <-chan error { thresholdBeforeConfirming := 4 for { - time.Sleep(120 * time.Second) - list := &protobufs.CeremonyPeerListAnnounce{ PeerList: []*protobufs.CeremonyPeer{}, } @@ -413,12 +409,12 @@ func (e *CeremonyDataClockConsensusEngine) Start() <-chan error { if thresholdBeforeConfirming > 0 { thresholdBeforeConfirming-- } + + time.Sleep(120 * time.Second) } }() - go func() { - e.runLoop() - }() + go e.runLoop() go func() { errChan <- nil @@ -467,7 +463,10 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() { if e.latestFrameReceived < latestFrame.FrameNumber { e.latestFrameReceived = latestFrame.FrameNumber go func() { - e.frameChan <- latestFrame + select { + case e.frameChan <- latestFrame: + default: + } }() } @@ -512,7 +511,10 @@ func (e *CeremonyDataClockConsensusEngine) runLoop() { if e.latestFrameReceived < latestFrame.FrameNumber { e.latestFrameReceived = latestFrame.FrameNumber go func() { - e.frameChan <- latestFrame + select { + case e.frameChan <- latestFrame: + default: + } }() } diff --git a/node/consensus/ceremony/consensus_frames.go b/node/consensus/ceremony/consensus_frames.go index ae33ec9..073143d 100644 --- a/node/consensus/ceremony/consensus_frames.go +++ b/node/consensus/ceremony/consensus_frames.go @@ -3,8 +3,6 @@ package ceremony import ( "bytes" "context" - "encoding/binary" - "io" "time" "source.quilibrium.com/quilibrium/monorepo/node/config" @@ -161,6 +159,13 @@ func (e *CeremonyDataClockConsensusEngine) GetMostAheadPeer( var peer []byte = nil e.peerMapMx.RLock() for _, v := range e.peerMap { + e.logger.Debug( + "checking peer info", + zap.Binary("peer_id", v.peerId), + zap.Uint64("max_frame_number", v.maxFrame), + zap.Int64("timestamp", v.timestamp), + zap.Binary("version", v.version), + ) _, ok := e.uncooperativePeersMap[string(v.peerId)] if v.maxFrame > max && v.timestamp > config.GetMinimumVersionCutoff().UnixMilli() && @@ -203,52 +208,16 @@ func (e *CeremonyDataClockConsensusEngine) sync( client := protobufs.NewCeremonyServiceClient(cc) - from := latest.FrameNumber - if from == 0 { - from = 1 - } - - rangeParentSelectors := []*protobufs.ClockFrameParentSelectors{} - if from > 128 { - rangeSubtract := uint64(16) - for { - if from <= rangeSubtract { - break - } - - parentNumber := from - uint64(rangeSubtract) - rangeSubtract *= 2 - parent, _, err := e.clockStore.GetDataClockFrame( - e.filter, - parentNumber, - true, - ) - if err != nil { - break - } - - parentSelector, err := parent.GetSelector() - if err != nil { - panic(err) - } - - rangeParentSelectors = append( - rangeParentSelectors, - &protobufs.ClockFrameParentSelectors{ - FrameNumber: parentNumber, - ParentSelector: parentSelector.FillBytes(make([]byte, 32)), - }, - ) - } - } - - s, err := client.NegotiateCompressedSyncFrames( - context.Background(), + response, err := client.GetDataFrame( + context.TODO(), + &protobufs.GetDataFrameRequest{ + FrameNumber: 0, + }, grpc.MaxCallRecvMsgSize(600*1024*1024), ) if err != nil { - e.logger.Debug( - "received error from peer", + e.logger.Error( + "could not get frame", zap.Error(err), ) e.peerMapMx.Lock() @@ -258,249 +227,31 @@ func (e *CeremonyDataClockConsensusEngine) sync( delete(e.peerMap, string(peerId)) } e.peerMapMx.Unlock() - return latest, errors.Wrap(err, "sync") - } - - challenge := binary.BigEndian.AppendUint64( - append([]byte{}, peerId...), - uint64(time.Now().UnixMilli()), - ) - signature, err := e.pubSub.SignMessage(challenge) - if err != nil { - panic(err) - } - - err = s.Send(&protobufs.CeremonyCompressedSyncRequestMessage{ - SyncMessage: &protobufs.CeremonyCompressedSyncRequestMessage_Authentication{ - Authentication: &protobufs.SyncRequestAuthentication{ - PeerId: e.pubSub.GetPeerID(), - Challenge: challenge, - Response: &protobufs.Ed448Signature{ - Signature: signature, - PublicKey: &protobufs.Ed448PublicKey{ - KeyValue: e.pubSub.GetPublicKey(), - }, - }, - }, - }, - }) - if err != nil { - e.peerMapMx.Lock() - if _, ok := e.peerMap[string(peerId)]; ok { - e.uncooperativePeersMap[string(peerId)] = e.peerMap[string(peerId)] - e.uncooperativePeersMap[string(peerId)].timestamp = time.Now().UnixMilli() - delete(e.peerMap, string(peerId)) - } - e.peerMapMx.Unlock() - return latest, errors.Wrap(err, "sync") - } - - err = s.Send(&protobufs.CeremonyCompressedSyncRequestMessage{ - SyncMessage: &protobufs.CeremonyCompressedSyncRequestMessage_Preflight{ - Preflight: &protobufs.ClockFramesPreflight{ - RangeParentSelectors: rangeParentSelectors, - }, - }, - }) - if err != nil { - e.peerMapMx.Lock() - if _, ok := e.peerMap[string(peerId)]; ok { - e.uncooperativePeersMap[string(peerId)] = e.peerMap[string(peerId)] - e.uncooperativePeersMap[string(peerId)].timestamp = time.Now().UnixMilli() - delete(e.peerMap, string(peerId)) - } - e.peerMapMx.Unlock() - return latest, errors.Wrap(err, "sync") - } - - syncMsg, err := s.Recv() - if err != nil { - e.peerMapMx.Lock() - if _, ok := e.peerMap[string(peerId)]; ok { - e.uncooperativePeersMap[string(peerId)] = e.peerMap[string(peerId)] - e.uncooperativePeersMap[string(peerId)].timestamp = time.Now().UnixMilli() - delete(e.peerMap, string(peerId)) - } - e.peerMapMx.Unlock() - return latest, errors.Wrap(err, "sync") - } - preflight, ok := syncMsg. - SyncMessage.(*protobufs.CeremonyCompressedSyncResponseMessage_Preflight) - if !ok { - e.peerMapMx.Lock() - if _, ok := e.peerMap[string(peerId)]; ok { - e.uncooperativePeersMap[string(peerId)] = e.peerMap[string(peerId)] - e.uncooperativePeersMap[string(peerId)].timestamp = time.Now().UnixMilli() - delete(e.peerMap, string(peerId)) - } - e.peerMapMx.Unlock() - s.CloseSend() - return latest, errors.Wrap( - errors.New("preflight message invalid"), - "sync", - ) - } - - // loop through parent selectors, set found to first match, and if subsequent - // matches fail to be found, cancel the search, start from 1. - found := uint64(0) - parentSelector := make([]byte, 32) - - for _, selector := range preflight.Preflight.RangeParentSelectors { - match, err := e.clockStore.GetStagedDataClockFrame( - e.filter, - selector.FrameNumber, - selector.ParentSelector, - true, - ) - if err != nil && found == 0 { - continue - } - if err != nil && found != 0 { - found = 1 - e.logger.Info("could not find interstitial frame, setting search to 1") - break - } - if match != nil && found == 0 { - found = match.FrameNumber - parentSelector = match.ParentSelector - break - } - } - if found != 0 && !bytes.Equal(parentSelector, make([]byte, 32)) { - check, err := e.clockStore.GetStagedDataClockFrame( - e.filter, - found, - parentSelector, - true, - ) - if err != nil { - from = 1 - } else { - e.logger.Info("checking interstitial continuity") - for check.FrameNumber > 1 { - check, err = e.clockStore.GetStagedDataClockFrame( - e.filter, - check.FrameNumber-1, - check.ParentSelector, - true, - ) - if err != nil { - from = 1 - e.logger.Info( - "could not confirm interstitial continuity, setting search to 1", - ) - break - } - } - from = found - } - } - - err = s.Send(&protobufs.CeremonyCompressedSyncRequestMessage{ - SyncMessage: &protobufs.CeremonyCompressedSyncRequestMessage_Request{ - Request: &protobufs.ClockFramesRequest{ - Filter: e.filter, - FromFrameNumber: from, - ToFrameNumber: 0, - ParentSelector: parentSelector, - }, - }, - }) - if err != nil { - return latest, errors.Wrap(err, "sync") - } - - for syncMsg, err = s.Recv(); err == nil; syncMsg, err = s.Recv() { - sync, ok := syncMsg. - SyncMessage.(*protobufs.CeremonyCompressedSyncResponseMessage_Response) - if !ok { - return latest, errors.Wrap( - errors.New("response message invalid"), - "sync", - ) - } - - response := sync.Response - - e.logger.Info( - "received compressed sync frame", - zap.Uint64("from", response.FromFrameNumber), - zap.Uint64("to", response.ToFrameNumber), - zap.Int("frames", len(response.TruncatedClockFrames)), - zap.Int("proofs", len(response.Proofs)), - ) - - // This can only happen if we get a peer with state that was initially - // farther ahead, but something happened. However, this has a sticking - // effect that doesn't go away for them until they're caught up again, - // so let's not penalize their score and make everyone else suffer, - // let's just move on: - if response.FromFrameNumber == 0 && response.ToFrameNumber == 0 { - if err := cc.Close(); err != nil { - e.logger.Error("error while closing connection", zap.Error(err)) - } - - return currentLatest, errors.Wrap(ErrNoNewFrames, "sync") - } - - var next *protobufs.ClockFrame - if next, err = e.decompressAndStoreCandidates( - peerId, - response, - ); err != nil && !errors.Is(err, ErrNoNewFrames) { - e.logger.Error( - "could not decompress and store candidate", - zap.Error(err), - ) - e.peerMapMx.Lock() - if _, ok := e.peerMap[string(peerId)]; ok { - e.uncooperativePeersMap[string(peerId)] = e.peerMap[string(peerId)] - e.uncooperativePeersMap[string(peerId)].timestamp = time.Now(). - UnixMilli() - delete(e.peerMap, string(peerId)) - } - e.peerMapMx.Unlock() - - if err := cc.Close(); err != nil { - e.logger.Error("error while closing connection", zap.Error(err)) - } - - return currentLatest, errors.Wrap(err, "sync") - } - if next != nil { - latest = next - } - } - if err != nil && err != io.EOF && !errors.Is(err, ErrNoNewFrames) { - e.logger.Debug("error while receiving sync", zap.Error(err)) - if err := cc.Close(); err != nil { e.logger.Error("error while closing connection", zap.Error(err)) } - - e.peerMapMx.Lock() - if _, ok := e.peerMap[string(peerId)]; ok { - e.uncooperativePeersMap[string(peerId)] = e.peerMap[string(peerId)] - e.uncooperativePeersMap[string(peerId)].timestamp = time.Now().UnixMilli() - delete(e.peerMap, string(peerId)) - } - e.peerMapMx.Unlock() - return latest, errors.Wrap(err, "sync") } + if response == nil { + e.logger.Error("received no response from peer") + if err := cc.Close(); err != nil { + e.logger.Error("error while closing connection", zap.Error(err)) + } + return latest, nil + } + e.logger.Info( "received new leading frame", - zap.Uint64("frame_number", latest.FrameNumber), + zap.Uint64("frame_number", response.ClockFrame.FrameNumber), ) if err := cc.Close(); err != nil { e.logger.Error("error while closing connection", zap.Error(err)) } - e.dataTimeReel.Insert(latest, false) + e.dataTimeReel.Insert(response.ClockFrame, false) - return latest, nil + return response.ClockFrame, nil } func (e *CeremonyDataClockConsensusEngine) collect( diff --git a/node/consensus/ceremony/message_handler.go b/node/consensus/ceremony/message_handler.go index dc27bab..1d753f2 100644 --- a/node/consensus/ceremony/message_handler.go +++ b/node/consensus/ceremony/message_handler.go @@ -20,6 +20,7 @@ func (e *CeremonyDataClockConsensusEngine) runMessageHandler() { for { select { case message := <-e.messageProcessorCh: + e.logger.Debug("handling message") msg := &protobufs.Message{} if err := proto.Unmarshal(message.Data, msg); err != nil { @@ -84,6 +85,7 @@ func (e *CeremonyDataClockConsensusEngine) runMessageHandler() { any := &anypb.Any{} if err := proto.Unmarshal(msg.Payload, any); err != nil { + e.logger.Error("error while unmarshaling", zap.Error(err)) continue } @@ -94,6 +96,7 @@ func (e *CeremonyDataClockConsensusEngine) runMessageHandler() { peer.version, config.GetMinimumVersion(), ) < 0 { + e.logger.Debug("received frame from unknown or outdated peer") return } if err := e.handleClockFrameData( @@ -334,7 +337,10 @@ func (e *CeremonyDataClockConsensusEngine) handleClockFrameData( if e.latestFrameReceived < frame.FrameNumber { e.latestFrameReceived = frame.FrameNumber go func() { - e.frameChan <- frame + select { + case e.frameChan <- frame: + default: + } }() } e.dataTimeReel.Insert(frame, isSync) diff --git a/node/consensus/ceremony/peer_messaging.go b/node/consensus/ceremony/peer_messaging.go index 85e4b19..81a2bfa 100644 --- a/node/consensus/ceremony/peer_messaging.go +++ b/node/consensus/ceremony/peer_messaging.go @@ -3,14 +3,9 @@ package ceremony import ( "bytes" "context" - "encoding/binary" - "io" "time" - pcrypto "github.com/libp2p/go-libp2p/core/crypto" - "github.com/libp2p/go-libp2p/core/peer" "github.com/mr-tron/base58" - "github.com/pbnjay/memory" "github.com/pkg/errors" "go.uber.org/zap" "google.golang.org/grpc" @@ -24,347 +19,63 @@ import ( var ErrNoNewFrames = errors.New("peer reported no frames") -// Compressed sync negotiation: -// Recipients of the sync Servers providing sync -// | | -// |---------[Preflight{HEAD, HEAD-16, HEAD-32, HEAD-64, ..., 1}]------------->| -// |<--------[Preflight{HEAD, HEAD-16, HEAD-32, HEAD-64, ..., M}]--------------| -// | M = matching selector or 1 | -// |------------------------------[Request{N}]-------------------------------->| -// | N = matching higher selector or M | -// |<-------------------------[Response{N...N+16}]-----------------------------| -// |<--------------------------[Response{N+17...}]-----------------------------| -// |<--------------------------[Response{...HEAD}]-----------------------------| +func (e *CeremonyDataClockConsensusEngine) GetDataFrame( + ctx context.Context, + request *protobufs.GetDataFrameRequest, +) (*protobufs.DataFrameResponse, error) { + e.logger.Debug( + "received frame request", + zap.Uint64("frame_number", request.FrameNumber), + ) + var frame *protobufs.ClockFrame + var err error + if request.FrameNumber == 0 { + frame, err = e.dataTimeReel.Head() + } else { + frame, _, err = e.clockStore.GetDataClockFrame( + e.filter, + request.FrameNumber, + false, + ) + } + + if err != nil { + e.logger.Error( + "received error while fetching time reel head", + zap.Error(err), + ) + return nil, errors.Wrap(err, "get data frame") + } + + idx, err := e.frameProver.GenerateWeakRecursiveProofIndex(frame) + if err != nil { + return nil, errors.Wrap(err, "get data frame") + } + + indexFrame, _, err := e.clockStore.GetDataClockFrame(e.filter, idx, false) + if err != nil { + return &protobufs.DataFrameResponse{ + ClockFrame: frame, + }, nil + } + + proof := e.frameProver.FetchRecursiveProof(indexFrame) + + e.logger.Debug( + "sending frame response", + zap.Uint64("frame_number", frame.FrameNumber), + ) + + return &protobufs.DataFrameResponse{ + ClockFrame: frame, + Proof: proof, + }, nil +} + func (e *CeremonyDataClockConsensusEngine) NegotiateCompressedSyncFrames( server protobufs.CeremonyService_NegotiateCompressedSyncFramesServer, ) error { - e.currentReceivingSyncPeersMx.Lock() - if e.currentReceivingSyncPeers > int( - memory.TotalMemory()/uint64(4294967296)-4, - ) { - e.currentReceivingSyncPeersMx.Unlock() - - e.logger.Debug( - "currently processing maximum sync requests, returning", - ) - - if err := server.SendMsg( - &protobufs.CeremonyCompressedSyncResponseMessage{ - SyncMessage: &protobufs.CeremonyCompressedSyncResponseMessage_Response{ - Response: &protobufs.CeremonyCompressedSync{ - FromFrameNumber: 0, - ToFrameNumber: 0, - }, - }, - }, - ); err != nil { - return errors.Wrap(err, "negotiate compressed sync frames") - } - - return nil - } - - request, err := server.Recv() - if err == io.EOF { - return nil - } - - if err != nil { - return errors.Wrap(err, "negotiate compressed sync frames") - } - - authentication, ok := request. - SyncMessage.(*protobufs.CeremonyCompressedSyncRequestMessage_Authentication) - if !ok { - return nil - } - - if authentication.Authentication == nil || - authentication.Authentication.Challenge == nil || - authentication.Authentication.PeerId == nil || - authentication.Authentication.Response == nil || - authentication.Authentication.Response.PublicKey == nil || - authentication.Authentication.Response.PublicKey.KeyValue == nil || - authentication.Authentication.Response.Signature == nil || - len(authentication.Authentication.Challenge) < 8 { - return nil - } - - if !bytes.Equal( - authentication.Authentication.Challenge[:len( - authentication.Authentication.Challenge, - )-8], - e.pubSub.GetPeerID(), - ) { - e.logger.Warn( - "peer provided invalid challenge", - ) - return nil - } - - // probably some remark to make about chronometers here, whether one or three - challenge := int64( - binary.BigEndian.Uint64( - authentication.Authentication.Challenge[len( - authentication.Authentication.Challenge, - )-8:], - ), - ) - dist := time.Now().UnixMilli() - challenge - if dist < 0 { - dist *= -1 - } - - // account for skew - if dist > 30000 { - e.logger.Debug( - "peer provided challenge with too great of a distance", - zap.Int64("distance", dist), - ) - return nil - } - - key, err := pcrypto.UnmarshalEd448PublicKey( - authentication.Authentication.Response.PublicKey.KeyValue, - ) - if err != nil { - e.logger.Debug( - "peer provided invalid pubkey", - zap.Binary( - "public_key", - authentication.Authentication.Response.PublicKey.KeyValue, - ), - ) - return errors.Wrap(err, "negotiate compressed sync frames") - } - - if !(peer.ID(authentication.Authentication.PeerId)).MatchesPublicKey(key) { - e.logger.Debug( - "peer id does not match pubkey", - zap.Binary("peer_id", authentication.Authentication.PeerId), - zap.Binary( - "public_key", - authentication.Authentication.Response.PublicKey.KeyValue, - ), - ) - return nil - } - - b, err := key.Verify( - authentication.Authentication.Challenge, - authentication.Authentication.Response.Signature, - ) - if err != nil || !b { - e.logger.Debug( - "peer provided invalid signature", - zap.Binary("peer_id", authentication.Authentication.PeerId), - zap.Binary( - "public_key", - authentication.Authentication.Response.PublicKey.KeyValue, - ), - zap.Binary( - "signature", - authentication.Authentication.Response.Signature, - ), - ) - return nil - } - - manifest := e.peerInfoManager.GetPeerInfo( - authentication.Authentication.PeerId, - ) - if manifest == nil || manifest.Bandwidth <= 1048576 { - e.logger.Debug( - "peer manifest was null or bandwidth was low", - zap.Binary("peer_id", authentication.Authentication.PeerId), - ) - return nil - } - - // TODO: should give this more tlc, but should remap into blossomsub - // heuristics - - e.currentReceivingSyncPeers++ - e.currentReceivingSyncPeersMx.Unlock() - - defer func() { - e.currentReceivingSyncPeersMx.Lock() - e.currentReceivingSyncPeers-- - e.currentReceivingSyncPeersMx.Unlock() - }() - - for { - request, err := server.Recv() - if err == io.EOF { - return nil - } - - if err != nil { - return errors.Wrap(err, "negotiate compressed sync frames") - } - - switch msg := request.SyncMessage.(type) { - case *protobufs.CeremonyCompressedSyncRequestMessage_Preflight: - e.logger.Debug( - "received clock frame preflight", - zap.Int("selector_count", len(msg.Preflight.RangeParentSelectors)), - ) - - from := uint64(1) - - preflightResponse := []*protobufs.ClockFrameParentSelectors{} - for _, selector := range msg.Preflight.RangeParentSelectors { - frame, _, err := e.clockStore.GetDataClockFrame( - e.filter, - selector.FrameNumber, - true, - ) - if err == nil && frame != nil { - from = selector.FrameNumber - break - } - } - - head, err := e.dataTimeReel.Head() - if err != nil { - return errors.Wrap(err, "negotiate compressed sync frames") - } - - to := head.FrameNumber - selector, err := head.GetSelector() - if err != nil { - return errors.Wrap(err, "negotiate compressed sync frames") - } - - preflightResponse = append( - preflightResponse, - &protobufs.ClockFrameParentSelectors{ - FrameNumber: to, - ParentSelector: selector.FillBytes(make([]byte, 32)), - }, - ) - rangeSubtract := uint64(4) - for { - parentNumber := to - uint64(rangeSubtract) - - if parentNumber < from { - break - } - rangeSubtract *= 2 - parent, _, err := e.clockStore.GetDataClockFrame( - e.filter, - parentNumber, - true, - ) - if err != nil { - break - } - - parentSelector, err := parent.GetSelector() - if err != nil { - return errors.Wrap(err, "negotiate compressed sync frames") - } - - preflightResponse = append( - preflightResponse, - &protobufs.ClockFrameParentSelectors{ - FrameNumber: parent.FrameNumber, - ParentSelector: parentSelector.FillBytes(make([]byte, 32)), - }, - ) - } - err = server.Send(&protobufs.CeremonyCompressedSyncResponseMessage{ - SyncMessage: &protobufs.CeremonyCompressedSyncResponseMessage_Preflight{ - Preflight: &protobufs.ClockFramesPreflight{ - RangeParentSelectors: preflightResponse, - }, - }, - }) - if err != nil { - return errors.Wrap(err, "negotiate compressed sync frames") - } - case *protobufs.CeremonyCompressedSyncRequestMessage_Request: - e.logger.Info( - "received clock frame request", - zap.Uint64("from_frame_number", msg.Request.FromFrameNumber), - zap.Uint64("to_frame_number", msg.Request.ToFrameNumber), - ) - from := msg.Request.FromFrameNumber - _, _, err := e.clockStore.GetDataClockFrame( - e.filter, - from, - true, - ) - if err != nil { - if !errors.Is(err, store.ErrNotFound) { - e.logger.Error( - "peer asked for frame that returned error", - zap.Uint64("frame_number", msg.Request.FromFrameNumber), - ) - - return errors.Wrap(err, "negotiate compressed sync frames") - } else { - from = 1 - } - } - - head, err := e.dataTimeReel.Head() - if err != nil { - panic(err) - } - - max := head.FrameNumber - to := msg.Request.ToFrameNumber - - // We need to slightly rewind, to compensate for unconfirmed frame heads - // on a given branch - if from >= 2 { - from-- - } - - for { - if to == 0 || to-from > 4 { - if max > from+3 { - to = from + 4 - } else { - to = max + 1 - } - } - - syncMsg, err := e.clockStore.GetCompressedDataClockFrames( - e.filter, - from, - to, - ) - if err != nil { - return errors.Wrap(err, "negotiate compressed sync frames") - } - - if err := server.Send(&protobufs.CeremonyCompressedSyncResponseMessage{ - SyncMessage: &protobufs. - CeremonyCompressedSyncResponseMessage_Response{ - Response: syncMsg, - }, - }); err != nil { - return errors.Wrap(err, "negotiate compressed sync frames") - } - - if (msg.Request.ToFrameNumber == 0 || msg.Request.ToFrameNumber > to) && - max > to { - from = to + 1 - if msg.Request.ToFrameNumber > to { - to = msg.Request.ToFrameNumber - } else { - to = 0 - } - } else { - break - } - } - - return nil - } - } + return nil } // Deprecated: Use NegotiateCompressedSyncFrames. diff --git a/node/consensus/master/master_clock_consensus_engine.go b/node/consensus/master/master_clock_consensus_engine.go index b89ffb9..8cc0b83 100644 --- a/node/consensus/master/master_clock_consensus_engine.go +++ b/node/consensus/master/master_clock_consensus_engine.go @@ -123,7 +123,7 @@ func NewMasterClockConsensusEngine( masterTimeReel: masterTimeReel, peerInfoManager: peerInfoManager, report: report, - frameValidationCh: make(chan *protobufs.ClockFrame, 10), + frameValidationCh: make(chan *protobufs.ClockFrame), bandwidthTestCh: make(chan []byte), } diff --git a/node/consensus/time/data_time_reel.go b/node/consensus/time/data_time_reel.go index a8178e5..79d5d2c 100644 --- a/node/consensus/time/data_time_reel.go +++ b/node/consensus/time/data_time_reel.go @@ -135,9 +135,9 @@ func (d *DataTimeReel) Start() error { if err != nil { panic(err) } + d.totalDistance = big.NewInt(0) d.proverTrie = trie d.headDistance, err = d.GetDistance(frame) - d.totalDistance = d.getTotalDistance(frame) } go d.runLoop() @@ -287,7 +287,11 @@ func (d *DataTimeReel) runLoop() { case frame := <-d.frames: // Most common scenario: in order – new frame is higher number if d.head.FrameNumber < frame.frameNumber { - d.logger.Debug("frame is higher") + d.logger.Debug( + "frame is higher", + zap.Uint64("head_frame_number", d.head.FrameNumber), + zap.Uint64("frame_number", frame.frameNumber), + ) // tag: equinox – master filter changes _, err := d.clockStore.GetMasterClockFrame( @@ -302,17 +306,9 @@ func (d *DataTimeReel) runLoop() { if !errors.Is(err, store.ErrNotFound) { panic(err) } - - d.addPending(frame.selector, frame.parentSelector, frame.frameNumber) - d.processPending(d.head, frame) continue } - headSelector, err := d.head.GetSelector() - if err != nil { - panic(err) - } - rawFrame, err := d.clockStore.GetStagedDataClockFrame( d.filter, frame.frameNumber, @@ -328,25 +324,8 @@ func (d *DataTimeReel) runLoop() { panic(err) } - // If the frame has a gap from the head or is not descendent, mark it as - // pending: - if frame.frameNumber-d.head.FrameNumber != 1 || - frame.parentSelector.Cmp(headSelector) != 0 { - d.logger.Debug( - "frame has has gap or is non-descendent, fork choice", - zap.Bool("has_gap", frame.frameNumber-d.head.FrameNumber != 1), - zap.String("parent_selector", frame.parentSelector.Text(16)), - zap.String("head_selector", headSelector.Text(16)), - ) - - d.forkChoice(rawFrame, distance) - d.processPending(d.head, frame) - continue - } - // Otherwise set it as the next and process all pending d.setHead(rawFrame, distance) - d.processPending(d.head, frame) } else if d.head.FrameNumber == frame.frameNumber { // frames are equivalent, no need to act headSelector, err := d.head.GetSelector() @@ -356,7 +335,6 @@ func (d *DataTimeReel) runLoop() { if headSelector.Cmp(frame.selector) == 0 { d.logger.Debug("equivalent frame") - d.processPending(d.head, frame) continue } @@ -383,44 +361,11 @@ func (d *DataTimeReel) runLoop() { d.logger.Debug( "frame shares parent, has shorter distance, short circuit", ) - d.totalDistance.Sub(d.totalDistance, d.headDistance) d.setHead(rawFrame, distance) - d.processPending(d.head, frame) continue } - - // Choose fork - d.forkChoice(rawFrame, distance) - d.processPending(d.head, frame) } else { d.logger.Debug("frame is lower height") - - // tag: dusk – we should have some kind of check here to avoid brutal - // thrashing - existing, _, err := d.clockStore.GetDataClockFrame( - d.filter, - frame.frameNumber, - true, - ) - if err != nil { - // if this returns an error it's either not found (which shouldn't - // happen without corruption) or pebble is borked, either way, panic - panic(err) - } - - existingSelector, err := existing.GetSelector() - if err != nil { - panic(err) - } - - // It's a fork, but it's behind. We need to stash it until it catches - // up (or dies off) - if existingSelector.Cmp(frame.selector) != 0 { - d.logger.Debug("is fork, add pending") - - d.addPending(frame.selector, frame.parentSelector, frame.frameNumber) - d.processPending(d.head, frame) - } } case <-d.done: return @@ -616,14 +561,6 @@ func (d *DataTimeReel) setHead(frame *protobufs.ClockFrame, distance *big.Int) { } d.head = frame - d.totalDistance.Add(d.totalDistance, distance) - - d.clockStore.SetTotalDistance( - d.filter, - frame.FrameNumber, - selector.FillBytes(make([]byte, 32)), - d.totalDistance, - ) d.headDistance = distance go func() { diff --git a/node/crypto/frame_prover.go b/node/crypto/frame_prover.go index 8cf2ef2..ea57e95 100644 --- a/node/crypto/frame_prover.go +++ b/node/crypto/frame_prover.go @@ -40,4 +40,15 @@ type FrameProver interface { VerifyDataClockFrame( frame *protobufs.ClockFrame, ) error + GenerateWeakRecursiveProofIndex( + frame *protobufs.ClockFrame, + ) (uint64, error) + FetchRecursiveProof( + frame *protobufs.ClockFrame, + ) []byte + VerifyWeakRecursiveProof( + frame *protobufs.ClockFrame, + proof []byte, + deepVerifier *protobufs.ClockFrame, + ) bool } diff --git a/node/crypto/wesolowski_frame_prover.go b/node/crypto/wesolowski_frame_prover.go index dcb36a9..868471c 100644 --- a/node/crypto/wesolowski_frame_prover.go +++ b/node/crypto/wesolowski_frame_prover.go @@ -481,3 +481,115 @@ func (w *WesolowskiFrameProver) VerifyDataClockFrame( return nil } + +func (w *WesolowskiFrameProver) GenerateWeakRecursiveProofIndex( + frame *protobufs.ClockFrame, +) (uint64, error) { + hash, err := poseidon.HashBytes(frame.Output) + if err != nil { + return 0, errors.Wrap(err, "generate weak recursive proof") + } + + return hash.Mod( + hash, + new(big.Int).SetUint64(frame.FrameNumber), + ).Uint64(), nil +} + +func (w *WesolowskiFrameProver) FetchRecursiveProof( + frame *protobufs.ClockFrame, +) []byte { + var pubkey []byte + ed448PublicKey := frame.GetPublicKeySignatureEd448() + if ed448PublicKey != nil { + pubkey = ed448PublicKey.PublicKey.KeyValue + } else { + return nil + } + + h, err := poseidon.HashBytes(pubkey) + if err != nil { + return nil + } + + address := h.Bytes() + input := []byte{} + input = append(input, frame.Filter...) + input = binary.BigEndian.AppendUint64(input, frame.FrameNumber) + input = binary.BigEndian.AppendUint64(input, uint64(frame.Timestamp)) + input = binary.BigEndian.AppendUint32(input, frame.Difficulty) + input = append(input, address...) + input = append(input, frame.Input...) + input = append(input, frame.Output...) + + return input +} + +func (w *WesolowskiFrameProver) VerifyWeakRecursiveProof( + frame *protobufs.ClockFrame, + proof []byte, + deepVerifier *protobufs.ClockFrame, +) bool { + hash, err := poseidon.HashBytes(frame.Output) + if err != nil { + w.logger.Debug("could not hash output") + return false + } + + frameNumber := hash.Mod( + hash, + new(big.Int).SetUint64(frame.FrameNumber), + ).Uint64() + + if len(proof) < 1084 { + w.logger.Debug("invalid proof size") + return false + } + + filter := proof[:len(frame.Filter)] + check := binary.BigEndian.Uint64(proof[len(frame.Filter) : len(frame.Filter)+8]) + timestamp := binary.BigEndian.Uint64( + proof[len(frame.Filter)+8 : len(frame.Filter)+16], + ) + difficulty := binary.BigEndian.Uint32( + proof[len(frame.Filter)+16 : len(frame.Filter)+20], + ) + input := proof[len(frame.Filter)+52:] + + if check != frameNumber || + !bytes.Equal(filter, frame.Filter) || + int64(timestamp) >= frame.Timestamp || + difficulty > frame.Difficulty || + len(input) < 1032 { + w.logger.Debug( + "check failed", + zap.Bool("failed_frame_number", check != frameNumber), + zap.Bool("failed_filter", !bytes.Equal(filter, frame.Filter)), + zap.Bool("failed_timestamp", int64(timestamp) >= frame.Timestamp), + zap.Bool("failed_difficulty", difficulty > frame.Difficulty), + zap.Bool("failed_input_size", len(input) < 1032), + ) + return false + } + + if deepVerifier != nil && (check != deepVerifier.FrameNumber || + !bytes.Equal(filter, deepVerifier.Filter) || + int64(timestamp) != deepVerifier.Timestamp || + difficulty != deepVerifier.Difficulty || + !bytes.Equal(input[:len(input)-516], deepVerifier.Input)) { + return false + } + + b := sha3.Sum256(input[:len(input)-516]) + v := vdf.New(difficulty, b) + output := [516]byte{} + copy(output[:], input[len(input)-516:]) + + if v.Verify(output) { + w.logger.Debug("verification succeeded") + return true + } else { + w.logger.Debug("verification failed") + return false + } +} diff --git a/node/execution/intrinsics/ceremony/ceremony_execution_engine.go b/node/execution/intrinsics/ceremony/ceremony_execution_engine.go index 502d297..33fcb60 100644 --- a/node/execution/intrinsics/ceremony/ceremony_execution_engine.go +++ b/node/execution/intrinsics/ceremony/ceremony_execution_engine.go @@ -447,9 +447,7 @@ func (e *CeremonyExecutionEngine) Start() <-chan error { panic(err) } - go func() { - e.RunWorker() - }() + go e.RunWorker() errChan <- nil }() diff --git a/node/main.go b/node/main.go index 7adcbfc..b667c7e 100644 --- a/node/main.go +++ b/node/main.go @@ -79,6 +79,11 @@ var ( false, "print node related information", ) + debug = flag.Bool( + "debug", + false, + "sets log output to debug (verbose)", + ) ) func main() { @@ -180,7 +185,12 @@ func main() { report := RunSelfTestIfNeeded(*configDirectory, nodeConfig) - node, err := app.NewNode(nodeConfig, report) + var node *app.Node + if *debug { + node, err = app.NewDebugNode(nodeConfig, report) + } else { + node, err = app.NewNode(nodeConfig, report) + } if err != nil { panic(err) } diff --git a/node/protobufs/ceremony.pb.go b/node/protobufs/ceremony.pb.go index e1f9a8b..1e015ab 100644 --- a/node/protobufs/ceremony.pb.go +++ b/node/protobufs/ceremony.pb.go @@ -1634,6 +1634,108 @@ func (x *InclusionCommitmentsMap) GetSegmentHashes() [][]byte { return nil } +type GetDataFrameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FrameNumber uint64 `protobuf:"varint,1,opt,name=frame_number,json=frameNumber,proto3" json:"frame_number,omitempty"` +} + +func (x *GetDataFrameRequest) Reset() { + *x = GetDataFrameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ceremony_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDataFrameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDataFrameRequest) ProtoMessage() {} + +func (x *GetDataFrameRequest) ProtoReflect() protoreflect.Message { + mi := &file_ceremony_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDataFrameRequest.ProtoReflect.Descriptor instead. +func (*GetDataFrameRequest) Descriptor() ([]byte, []int) { + return file_ceremony_proto_rawDescGZIP(), []int{22} +} + +func (x *GetDataFrameRequest) GetFrameNumber() uint64 { + if x != nil { + return x.FrameNumber + } + return 0 +} + +type DataFrameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ClockFrame *ClockFrame `protobuf:"bytes,1,opt,name=clock_frame,json=clockFrame,proto3" json:"clock_frame,omitempty"` + Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (x *DataFrameResponse) Reset() { + *x = DataFrameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ceremony_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DataFrameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataFrameResponse) ProtoMessage() {} + +func (x *DataFrameResponse) ProtoReflect() protoreflect.Message { + mi := &file_ceremony_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataFrameResponse.ProtoReflect.Descriptor instead. +func (*DataFrameResponse) Descriptor() ([]byte, []int) { + return file_ceremony_proto_rawDescGZIP(), []int{23} +} + +func (x *DataFrameResponse) GetClockFrame() *ClockFrame { + if x != nil { + return x.ClockFrame + } + return nil +} + +func (x *DataFrameResponse) GetProof() []byte { + if x != nil { + return x.Proof + } + return nil +} + var File_ceremony_proto protoreflect.FileDescriptor var file_ceremony_proto_rawDesc = []byte{ @@ -2036,39 +2138,56 @@ var file_ceremony_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0d, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x61, - 0x73, 0x68, 0x65, 0x73, 0x32, 0xb6, 0x03, 0x0a, 0x0f, 0x43, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, - 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7e, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x43, - 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x53, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, - 0x6d, 0x65, 0x73, 0x12, 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, 0x1a, 0x33, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, - 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x70, 0x62, 0x2e, - 0x43, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, 0x79, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, - 0x65, 0x64, 0x53, 0x79, 0x6e, 0x63, 0x30, 0x01, 0x12, 0xaa, 0x01, 0x0a, 0x1d, 0x4e, 0x65, 0x67, - 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, - 0x53, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x41, 0x2e, 0x71, 0x75, 0x69, - 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x65, 0x72, - 0x65, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, - 0x79, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x53, 0x79, 0x6e, 0x63, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x42, 0x2e, + 0x73, 0x68, 0x65, 0x73, 0x22, 0x38, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x46, + 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x66, + 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0b, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x70, + 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x66, 0x72, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 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, 0x52, 0x0a, + 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x32, 0xa8, 0x04, 0x0a, 0x0f, 0x43, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, 0x79, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x7e, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x72, + 0x65, 0x73, 0x73, 0x65, 0x64, 0x53, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, + 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, 0x1a, 0x33, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, 0x79, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x53, 0x79, - 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x28, 0x01, 0x30, 0x01, 0x12, 0x76, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, - 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x32, 0x50, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x1a, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, - 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x32, 0x50, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x28, 0x01, 0x30, 0x01, 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, + 0x6e, 0x63, 0x30, 0x01, 0x12, 0xaa, 0x01, 0x0a, 0x1d, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, + 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x53, 0x79, 0x6e, 0x63, + 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x41, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, + 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, + 0x79, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, 0x79, 0x43, 0x6f, 0x6d, + 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x42, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x65, 0x72, 0x65, + 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x65, 0x72, 0x65, 0x6d, 0x6f, 0x6e, 0x79, + 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, + 0x01, 0x12, 0x76, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x43, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, + 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, + 0x70, 0x62, 0x2e, 0x50, 0x32, 0x50, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x45, 0x6e, 0x76, + 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x1a, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, + 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, + 0x70, 0x62, 0x2e, 0x50, 0x32, 0x50, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x45, 0x6e, 0x76, + 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x28, 0x01, 0x30, 0x01, 0x12, 0x70, 0x0a, 0x0c, 0x47, 0x65, 0x74, + 0x44, 0x61, 0x74, 0x61, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x65, 0x72, 0x65, + 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x46, + 0x72, 0x61, 0x6d, 0x65, 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, 0x63, 0x65, + 0x72, 0x65, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x46, 0x72, + 0x61, 0x6d, 0x65, 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 ( @@ -2083,7 +2202,7 @@ func file_ceremony_proto_rawDescGZIP() []byte { return file_ceremony_proto_rawDescData } -var file_ceremony_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_ceremony_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_ceremony_proto_goTypes = []interface{}{ (*CeremonyTranscript)(nil), // 0: quilibrium.node.ceremony.pb.CeremonyTranscript (*CeremonyLobbyState)(nil), // 1: quilibrium.node.ceremony.pb.CeremonyLobbyState @@ -2107,80 +2226,85 @@ var file_ceremony_proto_goTypes = []interface{}{ (*InclusionProofsMap)(nil), // 19: quilibrium.node.ceremony.pb.InclusionProofsMap (*InclusionSegmentsMap)(nil), // 20: quilibrium.node.ceremony.pb.InclusionSegmentsMap (*InclusionCommitmentsMap)(nil), // 21: quilibrium.node.ceremony.pb.InclusionCommitmentsMap - (*BLS48581G1PublicKey)(nil), // 22: quilibrium.node.keys.pb.BLS48581G1PublicKey - (*BLS48581G2PublicKey)(nil), // 23: quilibrium.node.keys.pb.BLS48581G2PublicKey - (*Ed448PublicKey)(nil), // 24: quilibrium.node.keys.pb.Ed448PublicKey - (*Ed448Signature)(nil), // 25: quilibrium.node.keys.pb.Ed448Signature - (*BLS48581Signature)(nil), // 26: quilibrium.node.keys.pb.BLS48581Signature - (*X448PublicKey)(nil), // 27: quilibrium.node.keys.pb.X448PublicKey - (*ClockFrame)(nil), // 28: quilibrium.node.clock.pb.ClockFrame - (*ClockFramesPreflight)(nil), // 29: quilibrium.node.clock.pb.ClockFramesPreflight - (*ClockFramesRequest)(nil), // 30: quilibrium.node.clock.pb.ClockFramesRequest - (*P2PChannelEnvelope)(nil), // 31: quilibrium.node.channel.pb.P2PChannelEnvelope + (*GetDataFrameRequest)(nil), // 22: quilibrium.node.ceremony.pb.GetDataFrameRequest + (*DataFrameResponse)(nil), // 23: quilibrium.node.ceremony.pb.DataFrameResponse + (*BLS48581G1PublicKey)(nil), // 24: quilibrium.node.keys.pb.BLS48581G1PublicKey + (*BLS48581G2PublicKey)(nil), // 25: quilibrium.node.keys.pb.BLS48581G2PublicKey + (*Ed448PublicKey)(nil), // 26: quilibrium.node.keys.pb.Ed448PublicKey + (*Ed448Signature)(nil), // 27: quilibrium.node.keys.pb.Ed448Signature + (*BLS48581Signature)(nil), // 28: quilibrium.node.keys.pb.BLS48581Signature + (*X448PublicKey)(nil), // 29: quilibrium.node.keys.pb.X448PublicKey + (*ClockFrame)(nil), // 30: quilibrium.node.clock.pb.ClockFrame + (*ClockFramesPreflight)(nil), // 31: quilibrium.node.clock.pb.ClockFramesPreflight + (*ClockFramesRequest)(nil), // 32: quilibrium.node.clock.pb.ClockFramesRequest + (*P2PChannelEnvelope)(nil), // 33: quilibrium.node.channel.pb.P2PChannelEnvelope } var file_ceremony_proto_depIdxs = []int32{ - 22, // 0: quilibrium.node.ceremony.pb.CeremonyTranscript.g1_powers:type_name -> quilibrium.node.keys.pb.BLS48581G1PublicKey - 23, // 1: quilibrium.node.ceremony.pb.CeremonyTranscript.g2_powers:type_name -> quilibrium.node.keys.pb.BLS48581G2PublicKey - 22, // 2: quilibrium.node.ceremony.pb.CeremonyTranscript.running_g1_256_witnesses:type_name -> quilibrium.node.keys.pb.BLS48581G1PublicKey - 23, // 3: quilibrium.node.ceremony.pb.CeremonyTranscript.running_g2_256_powers:type_name -> quilibrium.node.keys.pb.BLS48581G2PublicKey + 24, // 0: quilibrium.node.ceremony.pb.CeremonyTranscript.g1_powers:type_name -> quilibrium.node.keys.pb.BLS48581G1PublicKey + 25, // 1: quilibrium.node.ceremony.pb.CeremonyTranscript.g2_powers:type_name -> quilibrium.node.keys.pb.BLS48581G2PublicKey + 24, // 2: quilibrium.node.ceremony.pb.CeremonyTranscript.running_g1_256_witnesses:type_name -> quilibrium.node.keys.pb.BLS48581G1PublicKey + 25, // 3: quilibrium.node.ceremony.pb.CeremonyTranscript.running_g2_256_powers:type_name -> quilibrium.node.keys.pb.BLS48581G2PublicKey 9, // 4: quilibrium.node.ceremony.pb.CeremonyLobbyState.ceremony_open_state:type_name -> quilibrium.node.ceremony.pb.CeremonyOpenState 10, // 5: quilibrium.node.ceremony.pb.CeremonyLobbyState.ceremony_in_progress_state:type_name -> quilibrium.node.ceremony.pb.CeremonyInProgressState 11, // 6: quilibrium.node.ceremony.pb.CeremonyLobbyState.ceremony_finalizing_state:type_name -> quilibrium.node.ceremony.pb.CeremonyFinalizingState 12, // 7: quilibrium.node.ceremony.pb.CeremonyLobbyState.ceremony_validating_state:type_name -> quilibrium.node.ceremony.pb.CeremonyValidatingState 0, // 8: quilibrium.node.ceremony.pb.CeremonyLobbyState.latest_transcript:type_name -> quilibrium.node.ceremony.pb.CeremonyTranscript - 24, // 9: quilibrium.node.ceremony.pb.CeremonySeenProverAttestation.seen_prover_key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey - 25, // 10: quilibrium.node.ceremony.pb.CeremonySeenProverAttestation.prover_signature:type_name -> quilibrium.node.keys.pb.Ed448Signature - 24, // 11: quilibrium.node.ceremony.pb.CeremonyDroppedProverAttestation.dropped_prover_key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey - 25, // 12: quilibrium.node.ceremony.pb.CeremonyDroppedProverAttestation.prover_signature:type_name -> quilibrium.node.keys.pb.Ed448Signature - 22, // 13: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.additive_g1_powers:type_name -> quilibrium.node.keys.pb.BLS48581G1PublicKey - 23, // 14: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.additive_g2_powers:type_name -> quilibrium.node.keys.pb.BLS48581G2PublicKey - 22, // 15: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.additive_g1_256_witness:type_name -> quilibrium.node.keys.pb.BLS48581G1PublicKey - 23, // 16: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.additive_g2_256_witness:type_name -> quilibrium.node.keys.pb.BLS48581G2PublicKey - 25, // 17: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.prover_signature:type_name -> quilibrium.node.keys.pb.Ed448Signature - 25, // 18: quilibrium.node.ceremony.pb.CeremonyTranscriptCommit.prover_signature:type_name -> quilibrium.node.keys.pb.Ed448Signature - 26, // 19: quilibrium.node.ceremony.pb.CeremonyTranscriptCommit.contribution_signature:type_name -> quilibrium.node.keys.pb.BLS48581Signature + 26, // 9: quilibrium.node.ceremony.pb.CeremonySeenProverAttestation.seen_prover_key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey + 27, // 10: quilibrium.node.ceremony.pb.CeremonySeenProverAttestation.prover_signature:type_name -> quilibrium.node.keys.pb.Ed448Signature + 26, // 11: quilibrium.node.ceremony.pb.CeremonyDroppedProverAttestation.dropped_prover_key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey + 27, // 12: quilibrium.node.ceremony.pb.CeremonyDroppedProverAttestation.prover_signature:type_name -> quilibrium.node.keys.pb.Ed448Signature + 24, // 13: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.additive_g1_powers:type_name -> quilibrium.node.keys.pb.BLS48581G1PublicKey + 25, // 14: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.additive_g2_powers:type_name -> quilibrium.node.keys.pb.BLS48581G2PublicKey + 24, // 15: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.additive_g1_256_witness:type_name -> quilibrium.node.keys.pb.BLS48581G1PublicKey + 25, // 16: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.additive_g2_256_witness:type_name -> quilibrium.node.keys.pb.BLS48581G2PublicKey + 27, // 17: quilibrium.node.ceremony.pb.CeremonyTranscriptShare.prover_signature:type_name -> quilibrium.node.keys.pb.Ed448Signature + 27, // 18: quilibrium.node.ceremony.pb.CeremonyTranscriptCommit.prover_signature:type_name -> quilibrium.node.keys.pb.Ed448Signature + 28, // 19: quilibrium.node.ceremony.pb.CeremonyTranscriptCommit.contribution_signature:type_name -> quilibrium.node.keys.pb.BLS48581Signature 5, // 20: quilibrium.node.ceremony.pb.CeremonyAdvanceRound.commits:type_name -> quilibrium.node.ceremony.pb.CeremonyTranscriptCommit - 27, // 21: quilibrium.node.ceremony.pb.CeremonyLobbyJoin.identity_key:type_name -> quilibrium.node.keys.pb.X448PublicKey - 27, // 22: quilibrium.node.ceremony.pb.CeremonyLobbyJoin.signed_pre_key:type_name -> quilibrium.node.keys.pb.X448PublicKey - 25, // 23: quilibrium.node.ceremony.pb.CeremonyLobbyJoin.public_key_signature_ed448:type_name -> quilibrium.node.keys.pb.Ed448Signature + 29, // 21: quilibrium.node.ceremony.pb.CeremonyLobbyJoin.identity_key:type_name -> quilibrium.node.keys.pb.X448PublicKey + 29, // 22: quilibrium.node.ceremony.pb.CeremonyLobbyJoin.signed_pre_key:type_name -> quilibrium.node.keys.pb.X448PublicKey + 27, // 23: quilibrium.node.ceremony.pb.CeremonyLobbyJoin.public_key_signature_ed448:type_name -> quilibrium.node.keys.pb.Ed448Signature 7, // 24: quilibrium.node.ceremony.pb.CeremonyOpenState.joined_participants:type_name -> quilibrium.node.ceremony.pb.CeremonyLobbyJoin - 24, // 25: quilibrium.node.ceremony.pb.CeremonyOpenState.preferred_participants:type_name -> quilibrium.node.keys.pb.Ed448PublicKey + 26, // 25: quilibrium.node.ceremony.pb.CeremonyOpenState.preferred_participants:type_name -> quilibrium.node.keys.pb.Ed448PublicKey 7, // 26: quilibrium.node.ceremony.pb.CeremonyInProgressState.active_participants:type_name -> quilibrium.node.ceremony.pb.CeremonyLobbyJoin 2, // 27: quilibrium.node.ceremony.pb.CeremonyInProgressState.latest_seen_prover_attestations:type_name -> quilibrium.node.ceremony.pb.CeremonySeenProverAttestation 3, // 28: quilibrium.node.ceremony.pb.CeremonyInProgressState.dropped_participant_attestations:type_name -> quilibrium.node.ceremony.pb.CeremonyDroppedProverAttestation 6, // 29: quilibrium.node.ceremony.pb.CeremonyInProgressState.transcript_round_advance_commits:type_name -> quilibrium.node.ceremony.pb.CeremonyAdvanceRound - 24, // 30: quilibrium.node.ceremony.pb.CeremonyInProgressState.next_round_participants:type_name -> quilibrium.node.keys.pb.Ed448PublicKey + 26, // 30: quilibrium.node.ceremony.pb.CeremonyInProgressState.next_round_participants:type_name -> quilibrium.node.keys.pb.Ed448PublicKey 7, // 31: quilibrium.node.ceremony.pb.CeremonyFinalizingState.active_participants:type_name -> quilibrium.node.ceremony.pb.CeremonyLobbyJoin 2, // 32: quilibrium.node.ceremony.pb.CeremonyFinalizingState.latest_seen_prover_attestations:type_name -> quilibrium.node.ceremony.pb.CeremonySeenProverAttestation 3, // 33: quilibrium.node.ceremony.pb.CeremonyFinalizingState.dropped_participant_attestations:type_name -> quilibrium.node.ceremony.pb.CeremonyDroppedProverAttestation 5, // 34: quilibrium.node.ceremony.pb.CeremonyFinalizingState.commits:type_name -> quilibrium.node.ceremony.pb.CeremonyTranscriptCommit 4, // 35: quilibrium.node.ceremony.pb.CeremonyFinalizingState.shares:type_name -> quilibrium.node.ceremony.pb.CeremonyTranscriptShare - 24, // 36: quilibrium.node.ceremony.pb.CeremonyFinalizingState.next_round_participants:type_name -> quilibrium.node.keys.pb.Ed448PublicKey + 26, // 36: quilibrium.node.ceremony.pb.CeremonyFinalizingState.next_round_participants:type_name -> quilibrium.node.keys.pb.Ed448PublicKey 5, // 37: quilibrium.node.ceremony.pb.CeremonyValidatingState.commits:type_name -> quilibrium.node.ceremony.pb.CeremonyTranscriptCommit 0, // 38: quilibrium.node.ceremony.pb.CeremonyValidatingState.updated_transcript:type_name -> quilibrium.node.ceremony.pb.CeremonyTranscript - 24, // 39: quilibrium.node.ceremony.pb.CeremonyValidatingState.next_round_participants:type_name -> quilibrium.node.keys.pb.Ed448PublicKey + 26, // 39: quilibrium.node.ceremony.pb.CeremonyValidatingState.next_round_participants:type_name -> quilibrium.node.keys.pb.Ed448PublicKey 14, // 40: quilibrium.node.ceremony.pb.CeremonyPeerListAnnounce.peer_list:type_name -> quilibrium.node.ceremony.pb.CeremonyPeer - 28, // 41: quilibrium.node.ceremony.pb.CeremonyCompressedSync.truncated_clock_frames:type_name -> quilibrium.node.clock.pb.ClockFrame + 30, // 41: quilibrium.node.ceremony.pb.CeremonyCompressedSync.truncated_clock_frames:type_name -> quilibrium.node.clock.pb.ClockFrame 19, // 42: quilibrium.node.ceremony.pb.CeremonyCompressedSync.proofs:type_name -> quilibrium.node.ceremony.pb.InclusionProofsMap 20, // 43: quilibrium.node.ceremony.pb.CeremonyCompressedSync.segments:type_name -> quilibrium.node.ceremony.pb.InclusionSegmentsMap - 25, // 44: quilibrium.node.ceremony.pb.SyncRequestAuthentication.response:type_name -> quilibrium.node.keys.pb.Ed448Signature - 29, // 45: quilibrium.node.ceremony.pb.CeremonyCompressedSyncRequestMessage.preflight:type_name -> quilibrium.node.clock.pb.ClockFramesPreflight - 30, // 46: quilibrium.node.ceremony.pb.CeremonyCompressedSyncRequestMessage.request:type_name -> quilibrium.node.clock.pb.ClockFramesRequest + 27, // 44: quilibrium.node.ceremony.pb.SyncRequestAuthentication.response:type_name -> quilibrium.node.keys.pb.Ed448Signature + 31, // 45: quilibrium.node.ceremony.pb.CeremonyCompressedSyncRequestMessage.preflight:type_name -> quilibrium.node.clock.pb.ClockFramesPreflight + 32, // 46: quilibrium.node.ceremony.pb.CeremonyCompressedSyncRequestMessage.request:type_name -> quilibrium.node.clock.pb.ClockFramesRequest 16, // 47: quilibrium.node.ceremony.pb.CeremonyCompressedSyncRequestMessage.authentication:type_name -> quilibrium.node.ceremony.pb.SyncRequestAuthentication - 29, // 48: quilibrium.node.ceremony.pb.CeremonyCompressedSyncResponseMessage.preflight:type_name -> quilibrium.node.clock.pb.ClockFramesPreflight + 31, // 48: quilibrium.node.ceremony.pb.CeremonyCompressedSyncResponseMessage.preflight:type_name -> quilibrium.node.clock.pb.ClockFramesPreflight 15, // 49: quilibrium.node.ceremony.pb.CeremonyCompressedSyncResponseMessage.response:type_name -> quilibrium.node.ceremony.pb.CeremonyCompressedSync 21, // 50: quilibrium.node.ceremony.pb.InclusionProofsMap.commitments:type_name -> quilibrium.node.ceremony.pb.InclusionCommitmentsMap - 30, // 51: quilibrium.node.ceremony.pb.CeremonyService.GetCompressedSyncFrames:input_type -> quilibrium.node.clock.pb.ClockFramesRequest - 17, // 52: quilibrium.node.ceremony.pb.CeremonyService.NegotiateCompressedSyncFrames:input_type -> quilibrium.node.ceremony.pb.CeremonyCompressedSyncRequestMessage - 31, // 53: quilibrium.node.ceremony.pb.CeremonyService.GetPublicChannel:input_type -> quilibrium.node.channel.pb.P2PChannelEnvelope - 15, // 54: quilibrium.node.ceremony.pb.CeremonyService.GetCompressedSyncFrames:output_type -> quilibrium.node.ceremony.pb.CeremonyCompressedSync - 18, // 55: quilibrium.node.ceremony.pb.CeremonyService.NegotiateCompressedSyncFrames:output_type -> quilibrium.node.ceremony.pb.CeremonyCompressedSyncResponseMessage - 31, // 56: quilibrium.node.ceremony.pb.CeremonyService.GetPublicChannel:output_type -> quilibrium.node.channel.pb.P2PChannelEnvelope - 54, // [54:57] is the sub-list for method output_type - 51, // [51:54] is the sub-list for method input_type - 51, // [51:51] is the sub-list for extension type_name - 51, // [51:51] is the sub-list for extension extendee - 0, // [0:51] is the sub-list for field type_name + 30, // 51: quilibrium.node.ceremony.pb.DataFrameResponse.clock_frame:type_name -> quilibrium.node.clock.pb.ClockFrame + 32, // 52: quilibrium.node.ceremony.pb.CeremonyService.GetCompressedSyncFrames:input_type -> quilibrium.node.clock.pb.ClockFramesRequest + 17, // 53: quilibrium.node.ceremony.pb.CeremonyService.NegotiateCompressedSyncFrames:input_type -> quilibrium.node.ceremony.pb.CeremonyCompressedSyncRequestMessage + 33, // 54: quilibrium.node.ceremony.pb.CeremonyService.GetPublicChannel:input_type -> quilibrium.node.channel.pb.P2PChannelEnvelope + 22, // 55: quilibrium.node.ceremony.pb.CeremonyService.GetDataFrame:input_type -> quilibrium.node.ceremony.pb.GetDataFrameRequest + 15, // 56: quilibrium.node.ceremony.pb.CeremonyService.GetCompressedSyncFrames:output_type -> quilibrium.node.ceremony.pb.CeremonyCompressedSync + 18, // 57: quilibrium.node.ceremony.pb.CeremonyService.NegotiateCompressedSyncFrames:output_type -> quilibrium.node.ceremony.pb.CeremonyCompressedSyncResponseMessage + 33, // 58: quilibrium.node.ceremony.pb.CeremonyService.GetPublicChannel:output_type -> quilibrium.node.channel.pb.P2PChannelEnvelope + 23, // 59: quilibrium.node.ceremony.pb.CeremonyService.GetDataFrame:output_type -> quilibrium.node.ceremony.pb.DataFrameResponse + 56, // [56:60] is the sub-list for method output_type + 52, // [52:56] is the sub-list for method input_type + 52, // [52:52] is the sub-list for extension type_name + 52, // [52:52] is the sub-list for extension extendee + 0, // [0:52] is the sub-list for field type_name } func init() { file_ceremony_proto_init() } @@ -2456,6 +2580,30 @@ func file_ceremony_proto_init() { return nil } } + file_ceremony_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDataFrameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ceremony_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DataFrameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_ceremony_proto_msgTypes[1].OneofWrappers = []interface{}{ (*CeremonyLobbyState_CeremonyOpenState)(nil), @@ -2478,7 +2626,7 @@ func file_ceremony_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_ceremony_proto_rawDesc, NumEnums: 0, - NumMessages: 22, + NumMessages: 24, NumExtensions: 0, NumServices: 1, }, diff --git a/node/protobufs/ceremony.pb.gw.go b/node/protobufs/ceremony.pb.gw.go index be3ec9b..f9a45d7 100644 --- a/node/protobufs/ceremony.pb.gw.go +++ b/node/protobufs/ceremony.pb.gw.go @@ -142,6 +142,40 @@ func request_CeremonyService_GetPublicChannel_0(ctx context.Context, marshaler r return stream, metadata, nil } +func request_CeremonyService_GetDataFrame_0(ctx context.Context, marshaler runtime.Marshaler, client CeremonyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetDataFrameRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetDataFrame(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_CeremonyService_GetDataFrame_0(ctx context.Context, marshaler runtime.Marshaler, server CeremonyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetDataFrameRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetDataFrame(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterCeremonyServiceHandlerServer registers the http handlers for service CeremonyService to "mux". // UnaryRPC :call CeremonyServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -169,6 +203,31 @@ func RegisterCeremonyServiceHandlerServer(ctx context.Context, mux *runtime.Serv return }) + mux.Handle("POST", pattern_CeremonyService_GetDataFrame_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/quilibrium.node.ceremony.pb.CeremonyService/GetDataFrame", runtime.WithHTTPPathPattern("/quilibrium.node.ceremony.pb.CeremonyService/GetDataFrame")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_CeremonyService_GetDataFrame_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_CeremonyService_GetDataFrame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -276,6 +335,28 @@ func RegisterCeremonyServiceHandlerClient(ctx context.Context, mux *runtime.Serv }) + mux.Handle("POST", pattern_CeremonyService_GetDataFrame_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/quilibrium.node.ceremony.pb.CeremonyService/GetDataFrame", runtime.WithHTTPPathPattern("/quilibrium.node.ceremony.pb.CeremonyService/GetDataFrame")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_CeremonyService_GetDataFrame_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_CeremonyService_GetDataFrame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -285,6 +366,8 @@ var ( pattern_CeremonyService_NegotiateCompressedSyncFrames_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.ceremony.pb.CeremonyService", "NegotiateCompressedSyncFrames"}, "")) pattern_CeremonyService_GetPublicChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.ceremony.pb.CeremonyService", "GetPublicChannel"}, "")) + + pattern_CeremonyService_GetDataFrame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.ceremony.pb.CeremonyService", "GetDataFrame"}, "")) ) var ( @@ -293,4 +376,6 @@ var ( forward_CeremonyService_NegotiateCompressedSyncFrames_0 = runtime.ForwardResponseStream forward_CeremonyService_GetPublicChannel_0 = runtime.ForwardResponseStream + + forward_CeremonyService_GetDataFrame_0 = runtime.ForwardResponseMessage ) diff --git a/node/protobufs/ceremony.proto b/node/protobufs/ceremony.proto index 8b657f7..cef09c9 100644 --- a/node/protobufs/ceremony.proto +++ b/node/protobufs/ceremony.proto @@ -189,8 +189,18 @@ message InclusionCommitmentsMap { repeated bytes segment_hashes = 3; } +message GetDataFrameRequest { + uint64 frame_number = 1; +} + +message DataFrameResponse { + quilibrium.node.clock.pb.ClockFrame clock_frame = 1; + bytes proof = 2; +} + service CeremonyService { rpc GetCompressedSyncFrames (quilibrium.node.clock.pb.ClockFramesRequest) returns (stream CeremonyCompressedSync); rpc NegotiateCompressedSyncFrames (stream CeremonyCompressedSyncRequestMessage) returns (stream CeremonyCompressedSyncResponseMessage); rpc GetPublicChannel (stream quilibrium.node.channel.pb.P2PChannelEnvelope) returns (stream quilibrium.node.channel.pb.P2PChannelEnvelope); + rpc GetDataFrame (GetDataFrameRequest) returns (DataFrameResponse); } \ No newline at end of file diff --git a/node/protobufs/ceremony_grpc.pb.go b/node/protobufs/ceremony_grpc.pb.go index f5294c2..5dadc0f 100644 --- a/node/protobufs/ceremony_grpc.pb.go +++ b/node/protobufs/ceremony_grpc.pb.go @@ -22,6 +22,7 @@ const ( CeremonyService_GetCompressedSyncFrames_FullMethodName = "/quilibrium.node.ceremony.pb.CeremonyService/GetCompressedSyncFrames" CeremonyService_NegotiateCompressedSyncFrames_FullMethodName = "/quilibrium.node.ceremony.pb.CeremonyService/NegotiateCompressedSyncFrames" CeremonyService_GetPublicChannel_FullMethodName = "/quilibrium.node.ceremony.pb.CeremonyService/GetPublicChannel" + CeremonyService_GetDataFrame_FullMethodName = "/quilibrium.node.ceremony.pb.CeremonyService/GetDataFrame" ) // CeremonyServiceClient is the client API for CeremonyService service. @@ -31,6 +32,7 @@ type CeremonyServiceClient interface { GetCompressedSyncFrames(ctx context.Context, in *ClockFramesRequest, opts ...grpc.CallOption) (CeremonyService_GetCompressedSyncFramesClient, error) NegotiateCompressedSyncFrames(ctx context.Context, opts ...grpc.CallOption) (CeremonyService_NegotiateCompressedSyncFramesClient, error) GetPublicChannel(ctx context.Context, opts ...grpc.CallOption) (CeremonyService_GetPublicChannelClient, error) + GetDataFrame(ctx context.Context, in *GetDataFrameRequest, opts ...grpc.CallOption) (*DataFrameResponse, error) } type ceremonyServiceClient struct { @@ -135,6 +137,15 @@ func (x *ceremonyServiceGetPublicChannelClient) Recv() (*P2PChannelEnvelope, err return m, nil } +func (c *ceremonyServiceClient) GetDataFrame(ctx context.Context, in *GetDataFrameRequest, opts ...grpc.CallOption) (*DataFrameResponse, error) { + out := new(DataFrameResponse) + err := c.cc.Invoke(ctx, CeremonyService_GetDataFrame_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // CeremonyServiceServer is the server API for CeremonyService service. // All implementations must embed UnimplementedCeremonyServiceServer // for forward compatibility @@ -142,6 +153,7 @@ type CeremonyServiceServer interface { GetCompressedSyncFrames(*ClockFramesRequest, CeremonyService_GetCompressedSyncFramesServer) error NegotiateCompressedSyncFrames(CeremonyService_NegotiateCompressedSyncFramesServer) error GetPublicChannel(CeremonyService_GetPublicChannelServer) error + GetDataFrame(context.Context, *GetDataFrameRequest) (*DataFrameResponse, error) mustEmbedUnimplementedCeremonyServiceServer() } @@ -158,6 +170,9 @@ func (UnimplementedCeremonyServiceServer) NegotiateCompressedSyncFrames(Ceremony func (UnimplementedCeremonyServiceServer) GetPublicChannel(CeremonyService_GetPublicChannelServer) error { return status.Errorf(codes.Unimplemented, "method GetPublicChannel not implemented") } +func (UnimplementedCeremonyServiceServer) GetDataFrame(context.Context, *GetDataFrameRequest) (*DataFrameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDataFrame not implemented") +} func (UnimplementedCeremonyServiceServer) mustEmbedUnimplementedCeremonyServiceServer() {} // UnsafeCeremonyServiceServer may be embedded to opt out of forward compatibility for this service. @@ -244,13 +259,36 @@ func (x *ceremonyServiceGetPublicChannelServer) Recv() (*P2PChannelEnvelope, err return m, nil } +func _CeremonyService_GetDataFrame_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDataFrameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CeremonyServiceServer).GetDataFrame(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CeremonyService_GetDataFrame_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CeremonyServiceServer).GetDataFrame(ctx, req.(*GetDataFrameRequest)) + } + return interceptor(ctx, in, info, handler) +} + // CeremonyService_ServiceDesc is the grpc.ServiceDesc for CeremonyService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var CeremonyService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "quilibrium.node.ceremony.pb.CeremonyService", HandlerType: (*CeremonyServiceServer)(nil), - Methods: []grpc.MethodDesc{}, + Methods: []grpc.MethodDesc{ + { + MethodName: "GetDataFrame", + Handler: _CeremonyService_GetDataFrame_Handler, + }, + }, Streams: []grpc.StreamDesc{ { StreamName: "GetCompressedSyncFrames",