Skip to content

Commit

Permalink
update v1.4.20
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhi committed Jun 22, 2024
1 parent 7a99ef9 commit 017e8a3
Show file tree
Hide file tree
Showing 31 changed files with 3,135 additions and 235 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Quilibrium - Betelgeuse
# Quilibrium - Solstice

Quilibrium is a decentralized alternative to platform as a service providers.
This release is part of the phases of the Dusk release, which finalizes with
Expand Down
2 changes: 1 addition & 1 deletion client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/cloudflare/circl v1.3.8
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/libp2p/go-libp2p v0.33.2
github.com/libp2p/go-libp2p v0.35.1
github.com/pkg/errors v0.9.1
github.com/shopspring/decimal v1.4.0
github.com/spf13/cobra v1.8.0
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: quilibrium
services:
node:
# image: ${QUILIBRIUM_IMAGE_NAME:-quilibrium}
image: eth2dev/quilibrium:v1.4.19-p1-signed
image: eth2dev/quilibrium:v1.4.20-signed
container_name: "quil"
restart: unless-stopped
# command: ["--signature-check=false"]
Expand Down
6 changes: 3 additions & 3 deletions go-libp2p-blossomsub/blossomsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
)

const (
// BlossomSubID_v12 is the protocol ID for version 1.2.0 of the BlossomSub protocol.
BlossomSubID_v12 = protocol.ID("/blossomsub/1.2.0")
// BlossomSubID_v12 is the protocol ID for version 1.2.1 of the BlossomSub protocol.
BlossomSubID_v12 = protocol.ID("/blossomsub/1.2.1")
)

// Defines the default BlossomSub parameters.
Expand Down Expand Up @@ -52,7 +52,7 @@ var (
BlossomSubOpportunisticGraftPeers = 2
BlossomSubGraftFloodThreshold = 10 * time.Second
BlossomSubMaxIHaveLength = 5000
BlossomSubMaxIHaveMessages = 100
BlossomSubMaxIHaveMessages = 10
BlossomSubIWantFollowupTime = 3 * time.Second
)

Expand Down
5 changes: 1 addition & 4 deletions go-libp2p/p2p/host/peerstore/pstoreds/deprecate.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
// Deprecated: The database-backed peerstore will be removed from go-libp2p in the future.
// Use the memory peerstore (pstoremem) instead.
// For more details see https://github.com/libp2p/go-libp2p/issues/2329
// and https://github.com/libp2p/go-libp2p/issues/2355.
// libp2p deprecated this, we disagree
package pstoreds
4 changes: 2 additions & 2 deletions node/app/db_console.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,11 +725,11 @@ func logoVersion(width int) string {
out += " ''---.. ...---'' ##\n"
out += " ''----------''\n"
out += " \n"
out += " Quilibrium Node - v" + config.GetVersionString() + " – Betelgeuse\n"
out += " Quilibrium Node - v" + config.GetVersionString() + " – Solstice\n"
out += " \n"
out += " DB Console\n"
} else {
out = "Quilibrium Node - v" + config.GetVersionString() + " – Betelgeuse - DB Console\n"
out = "Quilibrium Node - v" + config.GetVersionString() + " – Solstice - DB Console\n"
}
return out
}
4 changes: 2 additions & 2 deletions node/app/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ func (n *Node) VerifyProofIntegrity() {
}

if !v {
panic("bad kzg proof")
panic(fmt.Sprintf("bad kzg proof at increment %d", i))
}
wp := []byte{}
wp = append(wp, n.pubSub.GetPeerID()...)
wp = append(wp, input...)
fmt.Printf("%x\n", wp)
v = wesoProver.VerifyChallengeProof(wp, uint32(j), idx, idxProof)
if !v {
panic("bad weso proof")
panic(fmt.Sprintf("bad weso proof at increment %d", i))
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions node/app/wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ var storeSet = wire.NewSet(
store.NewPebbleClockStore,
store.NewPebbleKeyStore,
store.NewPebbleDataProofStore,
store.NewPeerstoreDatastore,
wire.Bind(new(store.ClockStore), new(*store.PebbleClockStore)),
wire.Bind(new(store.KeyStore), new(*store.PebbleKeyStore)),
wire.Bind(new(store.DataProofStore), new(*store.PebbleDataProofStore)),
wire.Bind(new(store.Peerstore), new(*store.PeerstoreDatastore)),
)

var pubSubSet = wire.NewSet(
Expand Down Expand Up @@ -89,6 +91,7 @@ var consensusSet = wire.NewSet(
func NewDHTNode(*config.Config) (*DHTNode, error) {
panic(wire.Build(
debugLoggerSet,
storeSet,
pubSubSet,
newDHTNode,
))
Expand Down
22 changes: 18 additions & 4 deletions node/app/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions node/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ var BootstrapPeers = []string{
"/ip4/65.108.194.84/udp/8336/quic-v1/p2p/QmP8C7g9ZRiWzhqN2AgFu5onS6HwHzR6Vv1TCHxAhnCSnq",
"/dns/quil.dfcnodes.eu/udp/8336/quic-v1/p2p/QmQaFmbYVrKSwoen5UQdaqyDq4QhXfSSLDVnYpYD4SF9tX",
"/ip4/87.98.167.207/udp/8336/quic-v1/p2p/QmafiAXLu1JWktyfzDtD67i78GRBYCfQ4doTfq7pp7wfQ1",
"/ip4/216.244.76.122/udp/8336/quic-v1/p2p/QmUSbMytVBUYiiGE266aZHrHrP17vLx5UJFd7o74HkDoaV",
"/ip4/216.244.79.194/udp/8336/quic-v1/p2p/QmQn3bWk5aqaNSv9dwPjBg4qdeGBGNEB72tvuhgEc64Ki5",
// purged peers (keep your node online to return to this list)
// "/ip4/204.186.74.47/udp/8317/quic-v1/p2p/Qmd233pLUDvcDW3ama27usfbG1HxKNh1V9dmWVW1SXp1pd",
// "/ip4/186.233.184.181/udp/8336/quic-v1/p2p/QmW6QDvKuYqJYYMP5tMZSp12X3nexywK28tZNgqtqNpEDL",
Expand Down
19 changes: 13 additions & 6 deletions node/config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,27 @@ func GetMinimumVersion() []byte {
}

func GetVersion() []byte {
return []byte{0x01, 0x04, 0x13}
return []byte{0x01, 0x04, 0x14}
}

func GetVersionString() string {
return FormatVersion(GetVersion())
}

func FormatVersion(version []byte) string {
return fmt.Sprintf(
"%d.%d.%d",
version[0], version[1], version[2],
)
if len(version) == 3 {
return fmt.Sprintf(
"%d.%d.%d",
version[0], version[1], version[2],
)
} else {
return fmt.Sprintf(
"%d.%d.%d-p%d",
version[0], version[1], version[2], version[3],
)
}
}

func GetPatchNumber() byte {
return 0x01
return 0x00
}
63 changes: 0 additions & 63 deletions node/consensus/master/broadcast_messaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ func (e *MasterClockConsensusEngine) handleMessage(message *pb.Message) error {
}

switch any.TypeUrl {
case protobufs.ClockFrameType:
if err := e.handleClockFrameData(
message.From,
any,
); err != nil {
return errors.Wrap(err, "handle message")
}
return nil
case protobufs.SelfTestReportType:
if err := e.handleSelfTestReport(
message.From,
Expand All @@ -58,60 +50,6 @@ func (e *MasterClockConsensusEngine) handleMessage(message *pb.Message) error {
return errors.Wrap(errors.New("invalid message"), "handle message")
}

func (e *MasterClockConsensusEngine) handleClockFrameData(
peerID []byte,
any *anypb.Any,
) error {
frame := &protobufs.ClockFrame{}
if err := any.UnmarshalTo(frame); err != nil {
return errors.Wrap(err, "handle clock frame data")
}

head, err := e.masterTimeReel.Head()
if err != nil {
panic(err)
}

if frame.FrameNumber < head.FrameNumber {
return nil
}

if e.difficulty != frame.Difficulty {
e.logger.Debug(
"frame difficulty mismatched",
zap.Uint32("difficulty", frame.Difficulty),
)
return errors.Wrap(
errors.New("frame difficulty"),
"handle clock frame data",
)
}

e.logger.Debug(
"got clock frame",
zap.Binary("sender", peerID),
zap.Binary("filter", frame.Filter),
zap.Uint64("frame_number", frame.FrameNumber),
zap.Int("proof_count", len(frame.AggregateProofs)),
)

go func() {
select {
case e.frameValidationCh <- frame:
default:
e.logger.Debug(
"dropped frame due to overwhelmed queue",
zap.Binary("sender", peerID),
zap.Binary("filter", frame.Filter),
zap.Uint64("frame_number", frame.FrameNumber),
zap.Int("proof_count", len(frame.AggregateProofs)),
)
}
}()

return nil
}

func (e *MasterClockConsensusEngine) handleSelfTestReport(
peerID []byte,
any *anypb.Any,
Expand Down Expand Up @@ -252,7 +190,6 @@ func (e *MasterClockConsensusEngine) handleSelfTestReport(
return nil
}

// This does not publish any longer, frames strictly are picked up from sync
func (e *MasterClockConsensusEngine) publishProof(
frame *protobufs.ClockFrame,
) error {
Expand Down
80 changes: 0 additions & 80 deletions node/consensus/master/consensus_frames.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package master

import (
"context"
"time"

"github.com/mr-tron/base58"
"github.com/pkg/errors"
"go.uber.org/zap"
"source.quilibrium.com/quilibrium/monorepo/node/consensus"
"source.quilibrium.com/quilibrium/monorepo/node/p2p"
"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
Expand Down Expand Up @@ -65,87 +62,10 @@ func (e *MasterClockConsensusEngine) GetMostAheadPeers() (
func (e *MasterClockConsensusEngine) collect(
currentFramePublished *protobufs.ClockFrame,
) (*protobufs.ClockFrame, error) {
e.logger.Debug("collecting vdf proofs")

latest, err := e.masterTimeReel.Head()
if err != nil {
panic(err)
}

// With the increase of network size, constrain down to top thirty
peers, err := e.GetMostAheadPeers()
if err != nil {
return latest, nil
}

for i := 0; i < len(peers); i++ {
peer := peers[i]
e.logger.Info("setting syncing target", zap.Binary("peer_id", peer))

cc, err := e.pubSub.GetDirectChannel(peer, "validation")
if err != nil {
e.logger.Error(
"could not connect for sync",
zap.String("peer_id", base58.Encode(peer)),
)
continue
}
client := protobufs.NewValidationServiceClient(cc)
syncClient, err := client.Sync(
context.Background(),
&protobufs.SyncRequest{
FramesRequest: &protobufs.ClockFramesRequest{
Filter: e.filter,
FromFrameNumber: latest.FrameNumber,
ToFrameNumber: 0,
},
},
)
if err != nil {
cc.Close()
continue
}

for msg, err := syncClient.Recv(); msg != nil &&
err == nil; msg, err = syncClient.Recv() {
if msg.FramesResponse == nil {
break
}

for _, frame := range msg.FramesResponse.ClockFrames {
frame := frame

if frame.FrameNumber < latest.FrameNumber {
continue
}

if e.difficulty != frame.Difficulty {
e.logger.Debug(
"frame difficulty mismatched",
zap.Uint32("difficulty", frame.Difficulty),
)
break
}

if err := e.frameProver.VerifyMasterClockFrame(frame); err != nil {
e.logger.Error(
"peer returned invalid frame",
zap.String("peer_id", base58.Encode(peer)))
e.pubSub.SetPeerScore(peer, -1000)
break
}

e.masterTimeReel.Insert(frame, false)
latest = frame
}
}
if err != nil {
cc.Close()
break
}
cc.Close()
break
}

return latest, nil
}
Loading

0 comments on commit 017e8a3

Please sign in to comment.