From 58456c1057eb1be224ed9b125495603a727a5471 Mon Sep 17 00:00:00 2001 From: Cassandra Heart <7929478+CassOnMars@users.noreply.github.com> Date: Wed, 29 May 2024 12:51:47 -0500 Subject: [PATCH] v1.4.18-patch-2 (#230) * feat: IPC for wesolowski * update self peer info * remove digests and signatures * add new binaries and digests * Signatory #13 added * Signatory #4 added (#231) * added sig.6 files (#232) * Signatory #9 added (#233) * Added signatories #1, #2, #3, #5, #8, #12, #14, #15, #16, #17 * remove binaries, release ready --------- Co-authored-by: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Co-authored-by: Demipoet <161999657+demipoet@users.noreply.github.com> Co-authored-by: Freekers <1370857+Freekers@users.noreply.github.com> --- nekryptology/pkg/vdf/wesolowski.go | 33 ++- node/config/engine.go | 8 + node/config/version.go | 2 +- node/consensus/master/broadcast_messaging.go | 12 +- .../master/master_clock_consensus_engine.go | 118 +++++++- node/crypto/frame_prover.go | 5 +- node/crypto/wesolowski_frame_prover.go | 39 +-- node/crypto/wesolowski_frame_prover_test.go | 10 +- node/main.go | 111 +++++++- node/node-1.4.18-darwin-arm64.dgst | 2 +- node/node-1.4.18-darwin-arm64.dgst.sig.1 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.12 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.13 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.14 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.15 | Bin 0 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.16 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.17 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.2 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.3 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.4 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.5 | Bin 0 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.6 | Bin 0 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.8 | Bin 114 -> 114 bytes node/node-1.4.18-darwin-arm64.dgst.sig.9 | Bin 0 -> 114 bytes node/node-1.4.18-linux-amd64.dgst | 2 +- node/node-1.4.18-linux-amd64.dgst.sig.1 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.12 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.13 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.14 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.15 | Bin 0 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.16 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.17 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.2 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.3 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.4 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.5 | Bin 0 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.6 | Bin 0 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.8 | Bin 114 -> 114 bytes node/node-1.4.18-linux-amd64.dgst.sig.9 | Bin 0 -> 114 bytes node/node-1.4.18-linux-arm64.dgst | 2 +- node/node-1.4.18-linux-arm64.dgst.sig.1 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.12 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.13 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.14 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.15 | Bin 0 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.16 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.17 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.2 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.3 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.4 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.5 | Bin 0 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.6 | Bin 0 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.8 | Bin 114 -> 114 bytes node/node-1.4.18-linux-arm64.dgst.sig.9 | Bin 0 -> 114 bytes node/protobufs/data.pb.go | 258 ++++++++++++++++++ node/protobufs/data.pb.gw.go | 171 ++++++++++++ node/protobufs/data.proto | 21 ++ node/protobufs/data_grpc.pb.go | 109 ++++++++ node/rpc/data_worker_ipc_server.go | 119 ++++++++ .../rpc/{rpc_server.go => node_rpc_server.go} | 0 60 files changed, 966 insertions(+), 56 deletions(-) create mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.15 create mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.5 create mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.6 create mode 100644 node/node-1.4.18-darwin-arm64.dgst.sig.9 create mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.15 create mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.5 create mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.6 create mode 100644 node/node-1.4.18-linux-amd64.dgst.sig.9 create mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.15 create mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.5 create mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.6 create mode 100644 node/node-1.4.18-linux-arm64.dgst.sig.9 create mode 100644 node/protobufs/data.pb.go create mode 100644 node/protobufs/data.pb.gw.go create mode 100644 node/protobufs/data.proto create mode 100644 node/protobufs/data_grpc.pb.go create mode 100644 node/rpc/data_worker_ipc_server.go rename node/rpc/{rpc_server.go => node_rpc_server.go} (100%) diff --git a/nekryptology/pkg/vdf/wesolowski.go b/nekryptology/pkg/vdf/wesolowski.go index 2051cc3..6c5bc68 100644 --- a/nekryptology/pkg/vdf/wesolowski.go +++ b/nekryptology/pkg/vdf/wesolowski.go @@ -89,7 +89,10 @@ func GenerateVDFWithStopChan(seed []byte, iterations, int_size_bits uint32, stop func GenerateVDFIteration(seed, x_blob []byte, iterations, int_size_bits uint32) ([]byte, []byte) { int_size := (int_size_bits + 16) >> 4 D := iqc.CreateDiscriminant(seed, int_size_bits) - x, _ := iqc.NewClassGroupFromBytesDiscriminant(x_blob[:(2*int_size)], D) + x, ok := iqc.NewClassGroupFromBytesDiscriminant(x_blob[:(2*int_size)], D) + if !ok { + return nil, nil + } y, proof := calculateVDF(D, x, iterations, int_size_bits, nil) @@ -105,8 +108,15 @@ func VerifyVDF(seed, proof_blob []byte, iterations, int_size_bits uint32) bool { D := iqc.CreateDiscriminant(seed, int_size_bits) x := iqc.NewClassGroupFromAbDiscriminant(big.NewInt(2), big.NewInt(1), D) - y, _ := iqc.NewClassGroupFromBytesDiscriminant(proof_blob[:(2*int_size)], D) - proof, _ := iqc.NewClassGroupFromBytesDiscriminant(proof_blob[2*int_size:], D) + y, ok := iqc.NewClassGroupFromBytesDiscriminant(proof_blob[:(2*int_size)], D) + if !ok { + return false + } + + proof, ok := iqc.NewClassGroupFromBytesDiscriminant(proof_blob[2*int_size:], D) + if !ok { + return false + } return verifyProof(x, y, proof, iterations) } @@ -114,9 +124,20 @@ func VerifyVDF(seed, proof_blob []byte, iterations, int_size_bits uint32) bool { func VerifyVDFIteration(seed, x_blob, proof_blob []byte, iterations, int_size_bits uint32) bool { int_size := (int_size_bits + 16) >> 4 D := iqc.CreateDiscriminant(seed, int_size_bits) - x, _ := iqc.NewClassGroupFromBytesDiscriminant(x_blob[:(2*int_size)], D) - y, _ := iqc.NewClassGroupFromBytesDiscriminant(proof_blob[:(2*int_size)], D) - proof, _ := iqc.NewClassGroupFromBytesDiscriminant(proof_blob[2*int_size:], D) + x, ok := iqc.NewClassGroupFromBytesDiscriminant(x_blob[:(2*int_size)], D) + if !ok { + return false + } + + y, ok := iqc.NewClassGroupFromBytesDiscriminant(proof_blob[:(2*int_size)], D) + if !ok { + return false + } + + proof, ok := iqc.NewClassGroupFromBytesDiscriminant(proof_blob[2*int_size:], D) + if !ok { + return false + } return verifyProof(x, y, proof, iterations) } diff --git a/node/config/engine.go b/node/config/engine.go index 546e157..14d2f98 100644 --- a/node/config/engine.go +++ b/node/config/engine.go @@ -8,6 +8,14 @@ type EngineConfig struct { PendingCommitWorkers int64 `yaml:"pendingCommitWorkers"` MinimumPeersRequired int `yaml:"minimumPeersRequired"` StatsMultiaddr string `yaml:"statsMultiaddr"` + // Sets the fmt.Sprintf format string to use as the listen multiaddrs for + // data worker processes + DataWorkerBaseListenMultiaddr string `yaml:"dataWorkerBaseListenMultiaddr"` + // Sets the starting port number to use as the listen port for data worker + // processes, incrementing by 1 until n-1, n = cores. (Example: a 4 core + // system, base listen port of 40000 will listen on 40000, 40001, 40002) + DataWorkerBaseListenPort uint16 `yaml:"dataWorkerBaseListenPort"` + DataWorkerMemoryLimit int64 `yaml:"dataWorkerMemoryLimit"` // Values used only for testing – do not override these in production, your // node will get kicked out diff --git a/node/config/version.go b/node/config/version.go index f9a1fe2..b9289de 100644 --- a/node/config/version.go +++ b/node/config/version.go @@ -29,5 +29,5 @@ func FormatVersion(version []byte) string { } func GetPatchNumber() byte { - return 0x01 + return 0x02 } diff --git a/node/consensus/master/broadcast_messaging.go b/node/consensus/master/broadcast_messaging.go index 7d66767..18d8d87 100644 --- a/node/consensus/master/broadcast_messaging.go +++ b/node/consensus/master/broadcast_messaging.go @@ -116,15 +116,19 @@ func (e *MasterClockConsensusEngine) handleSelfTestReport( peerID []byte, any *anypb.Any, ) error { - if bytes.Equal(peerID, e.pubSub.GetPeerID()) { - return nil - } - report := &protobufs.SelfTestReport{} if err := any.UnmarshalTo(report); err != nil { return errors.Wrap(err, "handle self test report") } + if bytes.Equal(peerID, e.pubSub.GetPeerID()) { + info := e.peerInfoManager.GetPeerInfo(peerID) + info.LastSeen = time.Now().UnixMilli() + info.DifficultyMetric = report.DifficultyMetric + info.MasterHeadFrame = report.MasterHeadFrame + return nil + } + // minimum proof size is one timestamp, one vdf proof, must match one fewer // than core count if len(report.Proof) < 516+8 || diff --git a/node/consensus/master/master_clock_consensus_engine.go b/node/consensus/master/master_clock_consensus_engine.go index bf47b52..6f21464 100644 --- a/node/consensus/master/master_clock_consensus_engine.go +++ b/node/consensus/master/master_clock_consensus_engine.go @@ -7,6 +7,7 @@ import ( "crypto/rand" "encoding/binary" "encoding/hex" + "fmt" "io" "math/big" "sync" @@ -15,9 +16,12 @@ import ( "github.com/iden3/go-iden3-crypto/poseidon" "github.com/libp2p/go-libp2p/core/peer" "github.com/mr-tron/base58" + "github.com/multiformats/go-multiaddr" + mn "github.com/multiformats/go-multiaddr/net" "github.com/pkg/errors" "go.uber.org/zap" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "source.quilibrium.com/quilibrium/monorepo/node/config" "source.quilibrium.com/quilibrium/monorepo/node/consensus" qtime "source.quilibrium.com/quilibrium/monorepo/node/consensus/time" @@ -68,6 +72,7 @@ type MasterClockConsensusEngine struct { verifyTestCh chan verifyChallenge currentReceivingSyncPeers int currentReceivingSyncPeersMx sync.Mutex + engineConfig *config.EngineConfig } var _ consensus.ConsensusEngine = (*MasterClockConsensusEngine)(nil) @@ -131,6 +136,7 @@ func NewMasterClockConsensusEngine( frameValidationCh: make(chan *protobufs.ClockFrame), bandwidthTestCh: make(chan []byte), verifyTestCh: make(chan verifyChallenge), + engineConfig: engineConfig, } e.addPeerManifestReport(e.pubSub.GetPeerID(), report) @@ -241,6 +247,16 @@ func (e *MasterClockConsensusEngine) Start() <-chan error { time.Sleep(30 * time.Second) difficultyMetric := int64(100000) skew := (difficultyMetric * 12) / 10 + parallelism := e.report.Cores - 1 + + if parallelism < 3 { + panic("invalid system configuration, minimum system configuration must be four cores") + } + + clients, err := e.createParallelDataClients(int(parallelism)) + if err != nil { + panic(err) + } for { head, err := e.masterTimeReel.Head() @@ -250,7 +266,6 @@ func (e *MasterClockConsensusEngine) Start() <-chan error { e.report.MasterHeadFrame = head.FrameNumber e.report.DifficultyMetric = difficultyMetric - parallelism := e.report.Cores - 1 challenge := binary.BigEndian.AppendUint64( []byte{}, @@ -258,15 +273,42 @@ func (e *MasterClockConsensusEngine) Start() <-chan error { ) challenge = append(challenge, e.pubSub.GetPeerID()...) - ts, proofs, nextDifficultyMetric, err := - e.frameProver.CalculateChallengeProof( - challenge, - parallelism, - skew, - ) - if err != nil { - panic(err) + proofs := make([][]byte, parallelism) + nextMetrics := make([]int64, parallelism) + + 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, + }, + ) + 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]) + } + + nextDifficultyMetric := int64(nextDifficultySum / uint64(parallelism)) + e.logger.Info( "recalibrating difficulty metric", zap.Int64("previous_difficulty_metric", difficultyMetric), @@ -336,6 +378,64 @@ func (e *MasterClockConsensusEngine) Start() <-chan error { return errChan } +func (e *MasterClockConsensusEngine) createParallelDataClients( + paralellism int, +) ([]protobufs.DataIPCServiceClient, error) { + e.logger.Info( + "connecting to data worker processes", + zap.Int("parallelism", paralellism), + ) + + if e.engineConfig.DataWorkerBaseListenMultiaddr == "" { + e.engineConfig.DataWorkerBaseListenMultiaddr = "/ip4/127.0.0.1/tcp/%d" + } + + if e.engineConfig.DataWorkerBaseListenPort == 0 { + e.engineConfig.DataWorkerBaseListenPort = 40000 + } + + clients := make([]protobufs.DataIPCServiceClient, paralellism) + + for i := 0; i < paralellism; i++ { + ma, err := multiaddr.NewMultiaddr( + fmt.Sprintf( + e.engineConfig.DataWorkerBaseListenMultiaddr, + int(e.engineConfig.DataWorkerBaseListenPort)+i, + ), + ) + if err != nil { + panic(err) + } + + _, addr, err := mn.DialArgs(ma) + if err != nil { + panic(err) + } + + conn, err := grpc.Dial( + addr, + grpc.WithTransportCredentials( + insecure.NewCredentials(), + ), + grpc.WithDefaultCallOptions( + grpc.MaxCallSendMsgSize(10*1024*1024), + grpc.MaxCallRecvMsgSize(10*1024*1024), + ), + ) + if err != nil { + panic(err) + } + + clients[i] = protobufs.NewDataIPCServiceClient(conn) + } + + e.logger.Info( + "connected to data worker processes", + zap.Int("parallelism", paralellism), + ) + return clients, nil +} + func (e *MasterClockConsensusEngine) PerformValidation( ctx context.Context, msg *protobufs.ValidationMessage, diff --git a/node/crypto/frame_prover.go b/node/crypto/frame_prover.go index 778e233..9c6f4a3 100644 --- a/node/crypto/frame_prover.go +++ b/node/crypto/frame_prover.go @@ -53,9 +53,10 @@ type FrameProver interface { ) bool CalculateChallengeProof( challenge []byte, - parallelism uint32, + core uint32, skew int64, - ) (int64, [][]byte, int64, error) + nowMs int64, + ) ([]byte, int64, error) VerifyChallengeProof( challenge []byte, timestamp int64, diff --git a/node/crypto/wesolowski_frame_prover.go b/node/crypto/wesolowski_frame_prover.go index ede59b5..6b1915d 100644 --- a/node/crypto/wesolowski_frame_prover.go +++ b/node/crypto/wesolowski_frame_prover.go @@ -6,7 +6,6 @@ import ( "crypto/rand" "encoding/binary" "math/big" - "sync" "time" "github.com/cloudflare/circl/sign/ed448" @@ -601,43 +600,31 @@ func (w *WesolowskiFrameProver) VerifyWeakRecursiveProof( func (w *WesolowskiFrameProver) CalculateChallengeProof( challenge []byte, - parallelism uint32, + core uint32, skew int64, -) (int64, [][]byte, int64, error) { - now := time.Now() - nowMs := now.UnixMilli() + nowMs int64, +) ([]byte, int64, error) { input := binary.BigEndian.AppendUint64([]byte{}, uint64(nowMs)) input = append(input, challenge...) - outputs := make([][]byte, parallelism) - - wg := sync.WaitGroup{} - wg.Add(int(parallelism)) // 4.5 minutes = 270 seconds, one increment should be ten seconds proofDuration := 270 * 1000 calibratedDifficulty := (int64(proofDuration) * 10000) / skew - for i := uint32(0); i < parallelism; i++ { - i := i - go func() { - instanceInput := binary.BigEndian.AppendUint32([]byte{}, i) - instanceInput = append(instanceInput, input...) - b := sha3.Sum256(instanceInput) - v := vdf.New(uint32(calibratedDifficulty), b) + instanceInput := binary.BigEndian.AppendUint32([]byte{}, core) + instanceInput = append(instanceInput, input...) + b := sha3.Sum256(instanceInput) + v := vdf.New(uint32(calibratedDifficulty), b) - v.Execute() - o := v.GetOutput() + v.Execute() + o := v.GetOutput() - outputs[i] = make([]byte, 516) - copy(outputs[i][:], o[:]) - wg.Done() - }() - } - - wg.Wait() + output := make([]byte, 516) + copy(output[:], o[:]) + now := time.UnixMilli(nowMs) after := time.Since(now) nextSkew := (skew * after.Milliseconds()) / int64(proofDuration) - return nowMs, outputs, nextSkew, nil + return output, nextSkew, nil } func (w *WesolowskiFrameProver) VerifyChallengeProof( diff --git a/node/crypto/wesolowski_frame_prover_test.go b/node/crypto/wesolowski_frame_prover_test.go index 6bc039c..eb57fbc 100644 --- a/node/crypto/wesolowski_frame_prover_test.go +++ b/node/crypto/wesolowski_frame_prover_test.go @@ -30,10 +30,12 @@ func TestMasterProve(t *testing.T) { func TestChallengeProof(t *testing.T) { l, _ := zap.NewProduction() w := crypto.NewWesolowskiFrameProver(l) - now, proofs, nextSkew, err := w.CalculateChallengeProof([]byte{0x01, 0x02, 0x03}, 3, 120000) + now := time.Now().UnixMilli() + proofs, nextSkew, err := w.CalculateChallengeProof([]byte{0x01, 0x02, 0x03}, 0, 120000, now) assert.NoError(t, err) - assert.True(t, w.VerifyChallengeProof([]byte{0x01, 0x02, 0x03}, now, 100000, proofs)) - now, proofs, _, err = w.CalculateChallengeProof([]byte{0x01, 0x02, 0x03}, 3, nextSkew*12/10) + 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, proofs)) + assert.True(t, w.VerifyChallengeProof([]byte{0x01, 0x02, 0x03}, now, nextSkew, [][]byte{proofs})) } diff --git a/node/main.go b/node/main.go index 9d52c0a..137f556 100644 --- a/node/main.go +++ b/node/main.go @@ -12,9 +12,11 @@ import ( "io/fs" "log" "os" + "os/exec" "os/signal" "path/filepath" "runtime" + rdebug "runtime/debug" "runtime/pprof" "strconv" "strings" @@ -103,6 +105,16 @@ var ( true, "enables or disables signature validation (default true)", ) + core = flag.Int( + "core", + 0, + "specifies the core of the process (defaults to zero, the initial launcher)", + ) + parentProcess = flag.Int( + "parent-process", + 0, + "specifies the parent process pid for a data worker", + ) ) var signatories = []string{ @@ -264,7 +276,7 @@ func main() { done := make(chan os.Signal, 1) signal.Notify(done, syscall.SIGINT, syscall.SIGTERM) - if !*dbConsole { + if !*dbConsole && *core == 0 { printLogo() printVersion() fmt.Println(" ") @@ -322,7 +334,58 @@ func main() { return } + if *core != 0 { + runtime.GOMAXPROCS(1) + rdebug.SetGCPercent(9999) + + if nodeConfig.Engine.DataWorkerMemoryLimit == 0 { + nodeConfig.Engine.DataWorkerMemoryLimit = 1792 * 1024 * 1024 // 1.75GiB + } + + rdebug.SetMemoryLimit(nodeConfig.Engine.DataWorkerMemoryLimit) + + if nodeConfig.Engine.DataWorkerBaseListenMultiaddr == "" { + nodeConfig.Engine.DataWorkerBaseListenMultiaddr = "/ip4/127.0.0.1/tcp/%d" + } + + if nodeConfig.Engine.DataWorkerBaseListenPort == 0 { + nodeConfig.Engine.DataWorkerBaseListenPort = 40000 + } + + if *parentProcess == 0 { + panic("parent process pid not specified") + } + + l, err := zap.NewProduction() + if err != nil { + panic(err) + } + + rpcMultiaddr := fmt.Sprintf( + nodeConfig.Engine.DataWorkerBaseListenMultiaddr, + int(nodeConfig.Engine.DataWorkerBaseListenPort)+*core-1, + ) + srv, err := rpc.NewDataWorkerIPCServer( + rpcMultiaddr, + l, + uint32(*core)-1, + qcrypto.NewWesolowskiFrameProver(l), + *parentProcess, + ) + if err != nil { + panic(err) + } + + err = srv.Start() + if err != nil { + panic(err) + } + return + } + fmt.Println("Loading ceremony state and starting node...") + go spawnDataWorkers() + kzg.Init() report := RunSelfTestIfNeeded(*configDirectory, nodeConfig) @@ -365,9 +428,55 @@ func main() { node.Start() <-done + stopDataWorkers() node.Stop() } +var dataWorkers []*exec.Cmd + +func spawnDataWorkers() { + process, err := os.Executable() + if err != nil { + panic(err) + } + + cores := runtime.GOMAXPROCS(0) + dataWorkers = make([]*exec.Cmd, cores-1) + fmt.Printf("Spawning %d data workers...\n", cores-1) + + for i := 1; i <= cores-1; i++ { + i := i + go func() { + args := []string{ + fmt.Sprintf("--core=%d", i), + fmt.Sprintf("--parent-process=%d", os.Getpid()), + } + args = append(args, os.Args[1:]...) + cmd := exec.Command(process, args...) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err := cmd.Start() + if err != nil { + panic(err) + } + + dataWorkers[i-1] = cmd + }() + } +} + +func stopDataWorkers() { + for i := 0; i < len(dataWorkers); i++ { + err := dataWorkers[i].Process.Signal(os.Kill) + if err != nil { + fmt.Printf( + "fatal: unable to kill worker with pid %d, please kill this process!\n", + dataWorkers[i].Process.Pid, + ) + } + } +} + // Reintroduce at a later date func RunCompaction(clockStore *store.PebbleClockStore) { intrinsicFilter := append( diff --git a/node/node-1.4.18-darwin-arm64.dgst b/node/node-1.4.18-darwin-arm64.dgst index 93db326..c8d67e2 100644 --- a/node/node-1.4.18-darwin-arm64.dgst +++ b/node/node-1.4.18-darwin-arm64.dgst @@ -1 +1 @@ -SHA3-256(node-1.4.18-darwin-arm64)= dc14a02268d88540bb364259775743c536d7541011bf26d4630f7fed425b5986 +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 index 2f8bc8a657015af1c83cc79c071166d5c118bc9a..f2f6a14e0d8c97c19c27eb8412e733771d0727a3 100644 GIT binary patch literal 114 zcmV-&0FD3rrQJ6BvYe7!8qb@U@+_GaHimM@DDPyh(F!_tflQevjVd|L@lQ?-O(I7{ zFs2BGX}z>% literal 114 zcmV-&0FD0@n`{}9ybJ@ghxFMOQm51&!K8eqIC>0}laQOodGoD5=}hEKSM37^7Zv`z zE+-~2$(ziPaen217!)IDPXyOk2xYnQxEdic)zDOo?nJr@;z)CnbtQ=c_2{X$-w?~V U7~(I(9{x^>DQX)96Wjp-01h8CB>(^b diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.12 b/node/node-1.4.18-darwin-arm64.dgst.sig.12 index 6cf3d7405dabdcdb71522fc995a43285a547825d..d3137d91b0749ca313fb359461322776293330e7 100644 GIT binary patch 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 literal 114 zcmV-&0FD1}wD`l8f5m*b{KV$Q+C~(`D9XMH*(P}lL43g}`FjSLUG4`_ywH<;Zk=vQ zFj(feGic#E%?Z>1-H$m-0GZu5B>(^b diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.13 b/node/node-1.4.18-darwin-arm64.dgst.sig.13 index b51946df7562f52115db566cac57b6ed199d4f63..8e00e26591344897eb5da9d4e523ec4d4781ece6 100644 GIT binary patch literal 114 zcmV-&0FD1CLP8zs>PzPghV&KN4nfM(ZmfSWoW5AW5iNt;%!iZhjOaLaPzfNb&RTZR zk#)MVQ_S0Nt}UWdHyG literal 114 zcmV-&0FD1%?5w)EN%%LugHJ#v{L&vR;ivBft3X*FO%dv?GD1X#{Q@_~SU`<|l^^nT z0j}o$oGE$9D}~^IdW&KUyJCvq?#59lo~bo}O~2tUWFOA*7)Yei<@T;<9}EfUW}mrElG0OajA$^ZZW diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.14 b/node/node-1.4.18-darwin-arm64.dgst.sig.14 index 0be47388d84e4fe3f274f207a1bd34388e28e316..939b0996f7e85fc50135d63dc7269ef5fc0f842f 100644 GIT binary patch literal 114 zcmV-&0FD1dAHN2*8`mMwezw|<9}=Dack2-hV!Z literal 114 zcmV-&0FD1%A5jZUlQdSt?vFOi&esHgXX$tgq3&U22I9N|PDi3z7KWxf;i)WHN(?3* zlS(hd+0>2j7$p(_ssw%TJcgQzYI?A-&l2FL1n+!<5!(8?rJAFf$JtS;3l(tckeu3y U_1Y8FfgRNS44qr14xx`Q0O5-_82|tP diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.15 b/node/node-1.4.18-darwin-arm64.dgst.sig.15 new file mode 100644 index 0000000000000000000000000000000000000000..fff4facb6a09f506115e1e968b76fc79e69496fe GIT binary patch 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 literal 0 HcmV?d00001 diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.16 b/node/node-1.4.18-darwin-arm64.dgst.sig.16 index d6ad923f9dae08221c6208dac6b48078f8a9fd99..9807929cca6e9e0b64e7673e483ceb52bac32f08 100644 GIT binary patch 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 literal 114 zcmV-&0FD3LHA2-tkScSMV-dm?H~xtN1$@#6QyK-hsUgwvW!=54`+-t&Y{U|}!y#+v zfgC@mkYPrzcQ`x%Z~Xsm!zj;7$>rqYVW4$Ii5cY!XRD0ZavW+=A`_JbAmgI~P2Lpv UVgtwRjU?%80Uk`X6Xsbe00JB|d;kCd diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.17 b/node/node-1.4.18-darwin-arm64.dgst.sig.17 index a36964f050e332509811cc4500ae5f249fea263d..c719e16b78d7ea71f1b4efe30f348e04f55fb2a2 100644 GIT binary patch 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 literal 114 zcmV-&0FD0&WB(=0j4~iu`>^t%)^4;FZ(sX@g<|rk?$J2h z0@EXeH&9wx%ix{>p^OiEVKW(vah_fl40)#`#3pSq6vb{0y^!g$wCb8di~C@pG0vv^ U`?k$H_5EEhfFN@C?QRJs06dvDWB>pF diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.2 b/node/node-1.4.18-darwin-arm64.dgst.sig.2 index 7859d1a898f7bd567a34f4527f52421945872ab4..9e05512b22a9ebf18387393e73145256abbdce4f 100644 GIT binary patch literal 114 zcmV-&0FD1LiwYsyB*jVz8W_6?8`rAYbrnE3A24vwLON4#>{0av+)fzd~#5R>p Ud_?d;QWpS3M@65;@l#AA09r^j00000 diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.3 b/node/node-1.4.18-darwin-arm64.dgst.sig.3 index 8f13dc52ae677c39446fdc30eb4f93fef9a6e425..901b0adc61d4e1b73c462fc6246d4926701f7466 100644 GIT binary patch literal 114 zcmV-&0FD0;zak&8U3!)+)|E}n*F#x+5b^~dx(35A%i$-v)SoP11Tt0=3!3|IISRU0 zzNJM2W`sEjgqu2m+|j-W&hM=6d5xhL<~uabc130ZuIDchm8+z}MF-vnKp3;m92{r>Q?vSM3mWr#rbTb@(SETSk_`am^W8$b`43{F&7^4M7Pyv!1LfzT U>%6aa3T^BN4M3#*WwYS7`$Q)@x~A#ZVc z`PITk7l!puIzD;;BAljei<9B6e~AGYlAfhl)`BcxVlhxw-@e0BMUf?EnA( literal 114 zcmV-&0FD1JmwiGyu%H*XUK$?wV~zm^)Iew{qFk(KiN>URtk-M110cyYBLWEJ#6;9Fw Us?z3yoyK__P|nqsW1q4Q06{-E`Tzg` diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.5 b/node/node-1.4.18-darwin-arm64.dgst.sig.5 new file mode 100644 index 0000000000000000000000000000000000000000..0e526492e068978314ca6cc5b255b1142a19932e GIT binary patch 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 literal 0 HcmV?d00001 diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.6 b/node/node-1.4.18-darwin-arm64.dgst.sig.6 new file mode 100644 index 0000000000000000000000000000000000000000..d4d68d957a6254b3b4437207cfe34fd2a7926ed1 GIT binary patch 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 literal 0 HcmV?d00001 diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.8 b/node/node-1.4.18-darwin-arm64.dgst.sig.8 index 4deec94354621d4e97aba3ef5d636d817815a80e..cbf75a3713047f716b467815941464cbed3df70d 100644 GIT binary patch literal 114 zcmV-&0FD1?fySD7`zJ>`7!EeMq#nTHRJ$n8MPc&>lT?kwn&|G;I=3 Ux9&=Q7bwl)P;ts>+5AE;04Jk3xc~qF literal 114 zcmV-&0FD0vf#>5L7o}JaA6YNm7HpK=UUiHWx^gGr@{f@{sk#ba-UPnhMK_)%MMtf| z@{5D~Pv-4#l6RwkU~**uj(C|6-(oH}x?k Ue9E{0SB)7^(lsUa0c7GU07bMm3;+NC diff --git a/node/node-1.4.18-darwin-arm64.dgst.sig.9 b/node/node-1.4.18-darwin-arm64.dgst.sig.9 new file mode 100644 index 0000000000000000000000000000000000000000..71573858d5bc6a32ebb53498a84e6b7e65e48eab GIT binary patch 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 literal 114 zcmV-&0FD1_>nKs4b`g-YwEI;>Da{3>L(+gK(23cglsTjwg_Sy?6YR<0!~Q1l?~!ri zdRkVtU@UT6@9*>gbs@XMa^fxs5I{$s<>1!Z=Y)d1kr3s7L}jj#r3?o)tWYAOL=JKX UiF?AfVC2EMqa3&NF*x=g08vRg4FCWD diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.13 b/node/node-1.4.18-linux-amd64.dgst.sig.13 index 320de721f707f4d3475793ddc694a8cede71c58b..bd9c141cf131ce89d62fe2f3695e55dabf757894 100644 GIT binary patch literal 114 zcmV-&0FD2;84k_Vt$!pXqH|L~^38vxVi83-FmXzoeUn+f(%xd~G0vM}o>sQ>@~ literal 114 zcmV-&0FD0&c2H(zm6}Pg?O3~9JL&M(1Nk5utmL}xi(}RNaI-5GlbQn+lg^Sbp6Btk|O{Z>{4#JveKf)*gx8AnZXKA)KD=z`R$X5zbt3v-&3S}=lg8i U7l?1|NeaO3+?O_E#R2a!0ML;-2mk;8 diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.14 b/node/node-1.4.18-linux-amd64.dgst.sig.14 index 3b45334ecab9edfd71ae3691e42b60132d8e3386..206197d5552b709708746b20b008636e1f77d967 100644 GIT binary patch literal 114 zcmV-&0FD12p1l-9iIE(}XA{h36P00_Hrp??U3lAuSb=lc`5|{`q2K=|=`~GjJ%m77aMh%MbplZ%)l#_ z((<^ff}d=2^K-BO?jHU}2@L0P-!+&KZO>&wDi>i4m3A@S3%IAY-bp=_$}r^<=Atlj U8-0E?`&JpmaEBeD{dsH)09}+d_W%F@ diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.15 b/node/node-1.4.18-linux-amd64.dgst.sig.15 new file mode 100644 index 0000000000000000000000000000000000000000..32ee7f45246b6a5f696e87be93cfa730d9a2cd64 GIT binary patch literal 114 zcmV-&0FD38vOd~Is47-*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~& literal 114 zcmV-&0FD0{4!?c$+<+*9+-dBfA>_MEC+Ykov!K7JLqbgUG>a!GVu5q_RE61S;w;l#g(ff9f(Bgq1}6 UzSo^sn|+0_`Tbx%O4tx106`5pAOHXW diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.17 b/node/node-1.4.18-linux-amd64.dgst.sig.17 index a05a3f16c51826f4de982aa849d4f09783ee32ce..ea5e17f25b936ad5c89f0d47894e5a82a1d6a2c9 100644 GIT binary patch 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 literal 114 zcmV-&0FD20ZF>^K#1H{1V&NX}w9Sf!+x233b}Y5Z;|8=Y%FLn>L%MeVcRyLX31~xr zez%NkC9g<0gpn_R%Qrs1X?C}Az)K!v`c%YS4LfAj|ILhT`qRStkEMYPs^3{R^ug`o U=9#kNz%rk2?H`w7Vt@=N0Qwv|1^@s6 diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.2 b/node/node-1.4.18-linux-amd64.dgst.sig.2 index 20b81086cac115dfde73b25ecad6909cde4b6905..0e07cb98bb81ba32de43d9bf3a76c5c4ccad2c3c 100644 GIT binary patch literal 114 zcmV-&0FD1I_a4$cZzR350zyxFl#_`S67_~LZ>r=O0)yj&=htR4zW7{h$IO)&Ii_I= zAC_c!ME}QqZPEY$R-?nRS33CRUXbK@4prtNSQZ{ikxKcq4g<|0{ z)toE%B5!J~N%VOD=T1UyAW_L%{9SIVof;P2dqGFD%xP0+#q@{nV&RWW5VlWOstkB% UXYb$aOL@>bidVD=$s}w90Q{;rX#fBK diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.3 b/node/node-1.4.18-linux-amd64.dgst.sig.3 index 4bdf22e24fcbbbf1a2e0e3957679730fbd2049e8..825eca9ae25f8207233e00c17806fe6907cc076e 100644 GIT binary patch literal 114 zcmV-&0FD2RyD?dx4+)T{&5Bdo->j7n#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 literal 114 zcmV-&0FD11zvmylx~&W2$1%PFao&!z-{{#?!mGI>IY~py^wcTsMEfmS{25rX?7vmf9%Rq93#7WM? UvPLxkS5S|!%+6F6SchCB0GVYu&j0`b diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.4 b/node/node-1.4.18-linux-amd64.dgst.sig.4 index 027bbd4c82a0bff41f31b2b0047534f8b0b2f548..dc59ed7fa10df3fbf69859085ec8f87a17361f65 100644 GIT binary patch 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@`> literal 0 HcmV?d00001 diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.6 b/node/node-1.4.18-linux-amd64.dgst.sig.6 new file mode 100644 index 0000000000000000000000000000000000000000..3ea21bcee3ce7f656b88004187572b40447f75d2 GIT binary patch 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 literal 0 HcmV?d00001 diff --git a/node/node-1.4.18-linux-amd64.dgst.sig.8 b/node/node-1.4.18-linux-amd64.dgst.sig.8 index 5afcbf839a545ff14a15c88bc6b1cef3535d2ce8..435ff71b2c8b5fd38dc52347177f8c9816c3c1d4 100644 GIT binary patch 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 literal 114 zcmV-&0FD1*gRq zeQ4jr0u^*p~@^KqXPbQAHuxg9hObGy5Nig#Y3g777djDaw!>!n7o=v UW_|SXWy2aR2Yd%6Pw&4H00NLV*#H0l diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.12 b/node/node-1.4.18-linux-arm64.dgst.sig.12 index 0c7c5339fb38f2acabe244165a2805649aa8a5bb..a5bd10d4dfac2c26e74eb559f7c4e7cc90d157ea 100644 GIT binary patch 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 literal 114 zcmV-&0FD35dibsA(oD@rJg&bw=En%{1>l=RkY^tn-287b5rd(bJFAnIGD$?H>pXDT zyUbT2E~?1Bav?APK|mVTpH;8hG@mKu9jdyF6lM&V^(T1*4DB_$8Rj<0xSgFHmJZnI UfR}rHF8ao#;YJxvV}+$T0QFNhu>b%7 diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.13 b/node/node-1.4.18-linux-arm64.dgst.sig.13 index c38670b4285eb318c67a36f84b54e15c94b04bb5..70d157c854f42646613ad52b4c2d55133456534f 100644 GIT binary patch literal 114 zcmV-&0FD1u|EB1fFyY55Pb4z_-PJ7lf%*rGHai^$>J^9}Os&5q(9rs9cLqca{{PaV z+xZQiMwaS_n8pBr1#R literal 114 zcmV-&0FD2Z;%8}xk%ePs`q*GtBG;C)GguwK`g+oDxuz$QB?%jyRQzMoxrs9} zMgaPGS|5Ee-;@J@l(-{$&sr;fZCJR3XO$EL<#BAiOCY-?P9m()j%h@MJZh8x^GdzO U3^el<_-5j^&nuc2RwfH60AK$!WB>pF diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.14 b/node/node-1.4.18-linux-arm64.dgst.sig.14 index 9d207f7c90f259f204e2f64039a1f581548ea503..3ee2e94ebc5e2ba541d09e3935078913ff754ea4 100644 GIT binary patch literal 114 zcmV-&0FD1g1@GOf&rTc(|A)_Q=tYDW)_)IyZcDBZZSoaGqSy;Hon;+=;2#!~`qA_}nyOlFxmRJ;z2qNIJB}%sIbk+gMcxkqGlsvFN2* UuI&ng@d5eyG1=B{*2%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 literal 114 zcmV-&0FD1(Jmc|Ace<1}f9YvOX*bFmj4(B_i@w<=?~CU zz&{ge4l|YudjqxrWgFvi8P!;1Y2?77D#P!W5>&x_Cvn%#+58BNEPsY U8tAu1%!iT(#E8f<;&QP!0FPWZQ~&?~ diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.17 b/node/node-1.4.18-linux-arm64.dgst.sig.17 index a7afc9960bc646b9751cdd901483bfeab0fcc9f3..aacb133a4fb4c5d930108050c23aee3c5178da7b 100644 GIT binary patch literal 114 zcmV-&0FD2IW>;eVN zRvz9V0Uu`oIO%HuZ1;?aLFSOg%}RF5m`uB1VwJD?$;tY_o11I#8NSX|x3Zm^~r)Rs6v@1F<}o{o2dnD3SW8MOO6jF+GD%B2m|)%oSd!VL#%r U9Y}6a8yX1ki*IKG13Et>0LHm8i2wiq literal 114 zcmV-&0FD2~v$<|i1`xP55Q^`PCH@IFSe5cHoAgYUrZ#qO4AR8O;tq=fFOp#Vs^Bs% zBb2Z!kLe}!E$}MNmP U(fMHC9dspjy57|XZGMdn078*A-~a#s diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.3 b/node/node-1.4.18-linux-arm64.dgst.sig.3 index 170a8da530a5a6e677f970f1236e899b7290093a..293207a341261b5a42ef1eb0d87dc0e1409ad8fb 100644 GIT binary patch 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( literal 114 zcmV-&0FD1K5!xuED)){bw6fL#8P~TUX|pW+Q%F64RVQOf_UA_?Xl@x|Amyk;FDY$# z7Kw;mX0pfq`S|&OhOX((>%?^6XjwUrrn-&}k>!p;jZw2sJ|-xtQ~;Brz)RE%I_J<3 UFtDfm(x+L+HvlhfJPw6708XDaN&o-= diff --git a/node/node-1.4.18-linux-arm64.dgst.sig.4 b/node/node-1.4.18-linux-arm64.dgst.sig.4 index 9b53b070e79bcd0e0115af8ad45bd767d17f50aa..c8376d0cb9150a3c8509ecb2a95b76fc851b535a 100644 GIT binary patch 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)%BXZ3bX32j?~OLoP*wp(ebhWQiQ7u&j`{)WryBzq3Z4axCaRLZXnh;a4D2nl7eHlVPbo~mNojQnl*90@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 literal 0 HcmV?d00001 diff --git a/node/protobufs/data.pb.go b/node/protobufs/data.pb.go new file mode 100644 index 0000000..538d8ab --- /dev/null +++ b/node/protobufs/data.pb.go @@ -0,0 +1,258 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: data.proto + +package protobufs + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ChallengeProofRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` +} + +func (x *ChallengeProofRequest) Reset() { + *x = ChallengeProofRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_data_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChallengeProofRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChallengeProofRequest) ProtoMessage() {} + +func (x *ChallengeProofRequest) ProtoReflect() protoreflect.Message { + mi := &file_data_proto_msgTypes[0] + 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 ChallengeProofRequest.ProtoReflect.Descriptor instead. +func (*ChallengeProofRequest) Descriptor() ([]byte, []int) { + return file_data_proto_rawDescGZIP(), []int{0} +} + +func (x *ChallengeProofRequest) GetChallenge() []byte { + if x != nil { + return x.Challenge + } + return nil +} + +func (x *ChallengeProofRequest) GetCore() uint32 { + if x != nil { + return x.Core + } + return 0 +} + +func (x *ChallengeProofRequest) GetSkew() int64 { + if x != nil { + return x.Skew + } + return 0 +} + +func (x *ChallengeProofRequest) GetNowMs() int64 { + if x != nil { + return x.NowMs + } + return 0 +} + +type ChallengeProofResponse struct { + state protoimpl.MessageState + 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"` +} + +func (x *ChallengeProofResponse) Reset() { + *x = ChallengeProofResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_data_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChallengeProofResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChallengeProofResponse) ProtoMessage() {} + +func (x *ChallengeProofResponse) ProtoReflect() protoreflect.Message { + mi := &file_data_proto_msgTypes[1] + 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 ChallengeProofResponse.ProtoReflect.Descriptor instead. +func (*ChallengeProofResponse) Descriptor() ([]byte, []int) { + return file_data_proto_rawDescGZIP(), []int{1} +} + +func (x *ChallengeProofResponse) GetOutput() []byte { + if x != nil { + return x.Output + } + 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, + 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, +} + +var ( + file_data_proto_rawDescOnce sync.Once + file_data_proto_rawDescData = file_data_proto_rawDesc +) + +func file_data_proto_rawDescGZIP() []byte { + file_data_proto_rawDescOnce.Do(func() { + file_data_proto_rawDescData = protoimpl.X.CompressGZIP(file_data_proto_rawDescData) + }) + return file_data_proto_rawDescData +} + +var file_data_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_data_proto_goTypes = []interface{}{ + (*ChallengeProofRequest)(nil), // 0: quilibrium.node.data.pb.ChallengeProofRequest + (*ChallengeProofResponse)(nil), // 1: quilibrium.node.data.pb.ChallengeProofResponse +} +var file_data_proto_depIdxs = []int32{ + 0, // 0: quilibrium.node.data.pb.DataIPCService.CalculateChallengeProof:input_type -> quilibrium.node.data.pb.ChallengeProofRequest + 1, // 1: quilibrium.node.data.pb.DataIPCService.CalculateChallengeProof:output_type -> quilibrium.node.data.pb.ChallengeProofResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_data_proto_init() } +func file_data_proto_init() { + if File_data_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_data_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChallengeProofRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_data_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChallengeProofResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_data_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_data_proto_goTypes, + DependencyIndexes: file_data_proto_depIdxs, + MessageInfos: file_data_proto_msgTypes, + }.Build() + File_data_proto = out.File + file_data_proto_rawDesc = nil + file_data_proto_goTypes = nil + file_data_proto_depIdxs = nil +} diff --git a/node/protobufs/data.pb.gw.go b/node/protobufs/data.pb.gw.go new file mode 100644 index 0000000..769dcd8 --- /dev/null +++ b/node/protobufs/data.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: data.proto + +/* +Package protobufs is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package protobufs + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_DataIPCService_CalculateChallengeProof_0(ctx context.Context, marshaler runtime.Marshaler, client DataIPCServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ChallengeProofRequest + 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.CalculateChallengeProof(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_DataIPCService_CalculateChallengeProof_0(ctx context.Context, marshaler runtime.Marshaler, server DataIPCServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ChallengeProofRequest + 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.CalculateChallengeProof(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterDataIPCServiceHandlerServer registers the http handlers for service DataIPCService to "mux". +// UnaryRPC :call DataIPCServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterDataIPCServiceHandlerFromEndpoint instead. +func RegisterDataIPCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DataIPCServiceServer) error { + + mux.Handle("POST", pattern_DataIPCService_CalculateChallengeProof_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.data.pb.DataIPCService/CalculateChallengeProof", runtime.WithHTTPPathPattern("/quilibrium.node.data.pb.DataIPCService/CalculateChallengeProof")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_DataIPCService_CalculateChallengeProof_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_DataIPCService_CalculateChallengeProof_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterDataIPCServiceHandlerFromEndpoint is same as RegisterDataIPCServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterDataIPCServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterDataIPCServiceHandler(ctx, mux, conn) +} + +// RegisterDataIPCServiceHandler registers the http handlers for service DataIPCService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterDataIPCServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterDataIPCServiceHandlerClient(ctx, mux, NewDataIPCServiceClient(conn)) +} + +// RegisterDataIPCServiceHandlerClient registers the http handlers for service DataIPCService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DataIPCServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DataIPCServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "DataIPCServiceClient" to call the correct interceptors. +func RegisterDataIPCServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DataIPCServiceClient) error { + + mux.Handle("POST", pattern_DataIPCService_CalculateChallengeProof_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.data.pb.DataIPCService/CalculateChallengeProof", runtime.WithHTTPPathPattern("/quilibrium.node.data.pb.DataIPCService/CalculateChallengeProof")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_DataIPCService_CalculateChallengeProof_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_DataIPCService_CalculateChallengeProof_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_DataIPCService_CalculateChallengeProof_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.data.pb.DataIPCService", "CalculateChallengeProof"}, "")) +) + +var ( + forward_DataIPCService_CalculateChallengeProof_0 = runtime.ForwardResponseMessage +) diff --git a/node/protobufs/data.proto b/node/protobufs/data.proto new file mode 100644 index 0000000..1e959c6 --- /dev/null +++ b/node/protobufs/data.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package quilibrium.node.data.pb; + +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; +} + +message ChallengeProofResponse { + bytes output = 1; + int64 next_skew = 2; +} + +service DataIPCService { + rpc CalculateChallengeProof(ChallengeProofRequest) returns (ChallengeProofResponse); +} \ No newline at end of file diff --git a/node/protobufs/data_grpc.pb.go b/node/protobufs/data_grpc.pb.go new file mode 100644 index 0000000..c1c24e8 --- /dev/null +++ b/node/protobufs/data_grpc.pb.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.21.12 +// source: data.proto + +package protobufs + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + DataIPCService_CalculateChallengeProof_FullMethodName = "/quilibrium.node.data.pb.DataIPCService/CalculateChallengeProof" +) + +// DataIPCServiceClient is the client API for DataIPCService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type DataIPCServiceClient interface { + CalculateChallengeProof(ctx context.Context, in *ChallengeProofRequest, opts ...grpc.CallOption) (*ChallengeProofResponse, error) +} + +type dataIPCServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewDataIPCServiceClient(cc grpc.ClientConnInterface) DataIPCServiceClient { + return &dataIPCServiceClient{cc} +} + +func (c *dataIPCServiceClient) CalculateChallengeProof(ctx context.Context, in *ChallengeProofRequest, opts ...grpc.CallOption) (*ChallengeProofResponse, error) { + out := new(ChallengeProofResponse) + err := c.cc.Invoke(ctx, DataIPCService_CalculateChallengeProof_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DataIPCServiceServer is the server API for DataIPCService service. +// All implementations must embed UnimplementedDataIPCServiceServer +// for forward compatibility +type DataIPCServiceServer interface { + CalculateChallengeProof(context.Context, *ChallengeProofRequest) (*ChallengeProofResponse, error) + mustEmbedUnimplementedDataIPCServiceServer() +} + +// UnimplementedDataIPCServiceServer must be embedded to have forward compatible implementations. +type UnimplementedDataIPCServiceServer struct { +} + +func (UnimplementedDataIPCServiceServer) CalculateChallengeProof(context.Context, *ChallengeProofRequest) (*ChallengeProofResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CalculateChallengeProof not implemented") +} +func (UnimplementedDataIPCServiceServer) mustEmbedUnimplementedDataIPCServiceServer() {} + +// UnsafeDataIPCServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DataIPCServiceServer will +// result in compilation errors. +type UnsafeDataIPCServiceServer interface { + mustEmbedUnimplementedDataIPCServiceServer() +} + +func RegisterDataIPCServiceServer(s grpc.ServiceRegistrar, srv DataIPCServiceServer) { + s.RegisterService(&DataIPCService_ServiceDesc, srv) +} + +func _DataIPCService_CalculateChallengeProof_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ChallengeProofRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DataIPCServiceServer).CalculateChallengeProof(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DataIPCService_CalculateChallengeProof_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DataIPCServiceServer).CalculateChallengeProof(ctx, req.(*ChallengeProofRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// DataIPCService_ServiceDesc is the grpc.ServiceDesc for DataIPCService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var DataIPCService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "quilibrium.node.data.pb.DataIPCService", + HandlerType: (*DataIPCServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CalculateChallengeProof", + Handler: _DataIPCService_CalculateChallengeProof_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "data.proto", +} diff --git a/node/rpc/data_worker_ipc_server.go b/node/rpc/data_worker_ipc_server.go new file mode 100644 index 0000000..068979a --- /dev/null +++ b/node/rpc/data_worker_ipc_server.go @@ -0,0 +1,119 @@ +package rpc + +import ( + "context" + "os" + "runtime" + "syscall" + "time" + + "source.quilibrium.com/quilibrium/monorepo/node/crypto" + + "github.com/multiformats/go-multiaddr" + mn "github.com/multiformats/go-multiaddr/net" + "github.com/pkg/errors" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" + "source.quilibrium.com/quilibrium/monorepo/node/protobufs" +) + +type DataWorkerIPCServer struct { + protobufs.UnimplementedDataIPCServiceServer + listenAddrGRPC string + logger *zap.Logger + coreId uint32 + prover crypto.FrameProver + parentProcessId int +} + +// GetFrameInfo implements protobufs.NodeServiceServer. +func (r *DataWorkerIPCServer) CalculateChallengeProof( + ctx context.Context, + req *protobufs.ChallengeProofRequest, +) (*protobufs.ChallengeProofResponse, error) { + if r.coreId != req.Core { + return nil, errors.Wrap( + errors.New("invalid core id"), + "calculate challenge proof", + ) + } + + proof, nextSkew, err := r.prover.CalculateChallengeProof( + req.Challenge, + uint32(r.coreId), + req.Skew, + req.NowMs, + ) + if err != nil { + return nil, errors.Wrap(err, "calculate challenge proof") + } + + return &protobufs.ChallengeProofResponse{ + Output: proof, + NextSkew: nextSkew, + }, nil +} + +func NewDataWorkerIPCServer( + listenAddrGRPC string, + logger *zap.Logger, + coreId uint32, + prover crypto.FrameProver, + parentProcessId int, +) (*DataWorkerIPCServer, error) { + return &DataWorkerIPCServer{ + listenAddrGRPC: listenAddrGRPC, + logger: logger, + coreId: coreId, + prover: prover, + parentProcessId: parentProcessId, + }, nil +} + +func (r *DataWorkerIPCServer) Start() error { + s := grpc.NewServer( + grpc.MaxRecvMsgSize(10*1024*1024), + grpc.MaxSendMsgSize(10*1024*1024), + ) + protobufs.RegisterDataIPCServiceServer(s, r) + reflection.Register(s) + + mg, err := multiaddr.NewMultiaddr(r.listenAddrGRPC) + if err != nil { + return errors.Wrap(err, "start") + } + + lis, err := mn.Listen(mg) + if err != nil { + return errors.Wrap(err, "start") + } + + go r.monitorParent() + + if err := s.Serve(mn.NetListener(lis)); err != nil { + panic(err) + } + + return nil +} + +func (r *DataWorkerIPCServer) monitorParent() { + for { + time.Sleep(1 * time.Second) + proc, err := os.FindProcess(r.parentProcessId) + if err != nil { + r.logger.Error("parent process not found, terminating") + os.Exit(1) + } + + // Windows returns an error if the process is dead, nobody else does + if runtime.GOOS != "windows" { + err := proc.Signal(syscall.Signal(0)) + if err != nil { + r.logger.Error("parent process not found, terminating") + os.Exit(1) + } + } + } +} diff --git a/node/rpc/rpc_server.go b/node/rpc/node_rpc_server.go similarity index 100% rename from node/rpc/rpc_server.go rename to node/rpc/node_rpc_server.go