v2.0.3-b3

This commit is contained in:
Cassandra Heart 2024-11-06 21:43:55 -06:00
parent 84279f2b5c
commit 80be91d067
No known key found for this signature in database
GPG Key ID: 6352152859385958
10 changed files with 1378 additions and 1271 deletions

View File

@ -137,7 +137,7 @@ var unlock *SignedGenesisUnlock
func DownloadAndVerifyGenesis(network uint) (*SignedGenesisUnlock, error) {
if network != 0 {
unlock = &SignedGenesisUnlock{
GenesisSeedHex: "726573697374206d7563682c206f626579206c6974746c657c000000000000000000000008",
GenesisSeedHex: "726573697374206d7563682c206f626579206c6974746c657c000000000000000000000009",
Beacon: []byte{
0x58, 0xef, 0xd9, 0x7e, 0xdd, 0x0e, 0xb6, 0x2f,
0x51, 0xc7, 0x5d, 0x00, 0x29, 0x12, 0x45, 0x49,

View File

@ -40,5 +40,5 @@ func GetPatchNumber() byte {
}
func GetRCNumber() byte {
return 0x02
return 0x03
}

View File

@ -412,7 +412,20 @@ func (e *DataClockConsensusEngine) Start() <-chan error {
if frame.FrameNumber-100 >= nextFrame.FrameNumber ||
nextFrame.FrameNumber == 0 {
time.Sleep(60 * time.Second)
time.Sleep(120 * time.Second)
continue
}
e.peerMapMx.RLock()
beaconInfo, ok := e.peerMap[string(e.beaconPeerId)]
if !ok {
e.peerMapMx.RUnlock()
time.Sleep(120 * time.Second)
continue
}
if nextFrame.FrameNumber < beaconInfo.maxFrame-100 {
time.Sleep(120 * time.Second)
continue
}
@ -463,6 +476,18 @@ func (e *DataClockConsensusEngine) Start() <-chan error {
make([]byte, 256),
),
})
for _, v := range e.peerMap {
if v == nil {
continue
}
if v.timestamp <= time.Now().UnixMilli()-PEER_INFO_TTL {
deletes = append(deletes, v)
}
}
for _, v := range deletes {
delete(e.peerMap, string(v.peerId))
}
deletes = []*peerInfo{}
for _, v := range e.uncooperativePeersMap {
if v == nil {
continue

View File

@ -261,6 +261,13 @@ func (e *DataClockConsensusEngine) handleDataPeerListAnnounce(
continue
}
head, err := e.dataTimeReel.Head()
if err == nil {
if p.MaxFrame < head.FrameNumber {
continue
}
}
if p.PublicKey != nil && p.Signature != nil && p.Version != nil {
key, err := pcrypto.UnmarshalEd448PublicKey(p.PublicKey)
if err != nil {

View File

@ -1,6 +1,8 @@
package execution
import (
"math/big"
"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
)
@ -15,4 +17,6 @@ type ExecutionEngine interface {
) ([]*protobufs.Message, error)
GetPeerInfo() *protobufs.PeerInfoResponse
GetFrame() *protobufs.ClockFrame
GetSeniority() *big.Int
GetRingPosition() int
}

View File

@ -816,6 +816,39 @@ func (e *TokenExecutionEngine) GetFrame() *protobufs.ClockFrame {
return e.clock.GetFrame()
}
func (e *TokenExecutionEngine) GetSeniority() *big.Int {
altAddr, err := poseidon.HashBytes(e.pubSub.GetPeerID())
if err != nil {
return nil
}
sen, ok := (*e.peerSeniority)[string(
altAddr.FillBytes(make([]byte, 32)),
)]
if !ok {
return nil
}
return sen.Priority()
}
func (e *TokenExecutionEngine) GetRingPosition() int {
altAddr, err := poseidon.HashBytes(e.pubSub.GetPeerID())
if err != nil {
return -1
}
tries := e.clock.GetFrameProverTries()
for i, trie := range tries[1:] {
if trie.Contains(altAddr.FillBytes(make([]byte, 32))) {
return i
}
}
return -1
}
func (e *TokenExecutionEngine) getAddressFromSignature(
sig *protobufs.Ed448Signature,
) ([]byte, error) {

View File

@ -695,6 +695,16 @@ func printNodeInfo(cfg *config.Config) {
fmt.Println("Version: " + config.FormatVersion(nodeInfo.Version))
fmt.Println("Max Frame: " + strconv.FormatUint(nodeInfo.GetMaxFrame(), 10))
fmt.Println("Peer Score: " + strconv.FormatUint(nodeInfo.GetPeerScore(), 10))
if nodeInfo.ProverRing == -1 {
fmt.Println("Not in Prover Ring")
} else {
fmt.Println("Prover Ring: " + strconv.FormatUint(
uint64(nodeInfo.ProverRing),
10,
))
}
fmt.Println("Seniority: " + new(big.Int).SetBytes(
nodeInfo.PeerSeniority,
).String())
printBalance(cfg)
}

File diff suppressed because it is too large Load Diff

View File

@ -61,6 +61,8 @@ message NodeInfoResponse {
uint64 max_frame = 2;
uint64 peer_score = 3;
bytes version = 4;
bytes peer_seniority = 5;
int32 prover_ring = 6;
}
message PutPeerInfoRequest {

View File

@ -166,6 +166,9 @@ func (r *RPCServer) GetNodeInfo(
if head != nil {
frame = head.FrameNumber
}
seniority := r.executionEngines[0].GetSeniority()
ring := r.executionEngines[0].GetRingPosition()
return &protobufs.NodeInfoResponse{
PeerId: peerID.String(),
MaxFrame: frame,
@ -173,6 +176,8 @@ func (r *RPCServer) GetNodeInfo(
Version: append(
append([]byte{}, config.GetVersion()...), config.GetPatchNumber(),
),
PeerSeniority: seniority.FillBytes(make([]byte, 32)),
ProverRing: int32(ring),
}, nil
}