mirror of
https://github.com/luxfi/proto.git
synced 2026-07-26 22:54:49 +00:00
fix: gofmt -s across repo (CI format check)
This commit is contained in:
@@ -11,12 +11,12 @@ import (
|
||||
|
||||
// Message tags for ZAP encoding
|
||||
const (
|
||||
tagCompressedZstd = 1
|
||||
tagPing = 2
|
||||
tagPong = 3
|
||||
tagHandshake = 4
|
||||
tagGetPeerList = 5
|
||||
tagPeerList = 6
|
||||
tagCompressedZstd = 1
|
||||
tagPing = 2
|
||||
tagPong = 3
|
||||
tagHandshake = 4
|
||||
tagGetPeerList = 5
|
||||
tagPeerList = 6
|
||||
tagGetStateSummaryFrontier = 7
|
||||
tagStateSummaryFrontier = 8
|
||||
tagGetAcceptedStateSummary = 9
|
||||
@@ -36,13 +36,12 @@ const (
|
||||
tagResponse = 23
|
||||
tagGossip = 24
|
||||
tagError = 25
|
||||
tagBFT = 26
|
||||
tagBFT = 26
|
||||
)
|
||||
|
||||
var (
|
||||
ErrInvalidMessage = errors.New("invalid wire message")
|
||||
ErrUnknownTag = errors.New("unknown message tag")
|
||||
|
||||
)
|
||||
|
||||
// Buffer for zero-copy encoding
|
||||
|
||||
+229
-65
@@ -88,68 +88,198 @@ func (*Message_Request) isMessage_Message() {}
|
||||
func (*Message_Response) isMessage_Message() {}
|
||||
func (*Message_Gossip) isMessage_Message() {}
|
||||
func (*Message_Error) isMessage_Message() {}
|
||||
func (*Message_BFT) isMessage_Message() {}
|
||||
func (*Message_BFT) isMessage_Message() {}
|
||||
|
||||
func (m *Message) GetMessage() isMessage_Message { return m.Message }
|
||||
func (m *Message) GetCompressedZstd() []byte { if x, ok := m.Message.(*Message_CompressedZstd); ok { return x.CompressedZstd }; return nil }
|
||||
func (m *Message) GetPing() *Ping { if x, ok := m.Message.(*Message_Ping); ok { return x.Ping }; return nil }
|
||||
func (m *Message) GetPong() *Pong { if x, ok := m.Message.(*Message_Pong); ok { return x.Pong }; return nil }
|
||||
func (m *Message) GetHandshake() *Handshake { if x, ok := m.Message.(*Message_Handshake); ok { return x.Handshake }; return nil }
|
||||
func (m *Message) GetGetPeerList() *GetPeerList { if x, ok := m.Message.(*Message_GetPeerList); ok { return x.GetPeerList }; return nil }
|
||||
func (m *Message) GetPeerList() *PeerList { if x, ok := m.Message.(*Message_PeerList_); ok { return x.PeerList_ }; return nil }
|
||||
func (m *Message) GetGetStateSummaryFrontier() *GetStateSummaryFrontier { if x, ok := m.Message.(*Message_GetStateSummaryFrontier); ok { return x.GetStateSummaryFrontier }; return nil }
|
||||
func (m *Message) GetStateSummaryFrontier() *StateSummaryFrontier { if x, ok := m.Message.(*Message_StateSummaryFrontier_); ok { return x.StateSummaryFrontier_ }; return nil }
|
||||
func (m *Message) GetGetAcceptedStateSummary() *GetAcceptedStateSummary { if x, ok := m.Message.(*Message_GetAcceptedStateSummary); ok { return x.GetAcceptedStateSummary }; return nil }
|
||||
func (m *Message) GetAcceptedStateSummary() *AcceptedStateSummary { if x, ok := m.Message.(*Message_AcceptedStateSummary_); ok { return x.AcceptedStateSummary_ }; return nil }
|
||||
func (m *Message) GetGetAcceptedFrontier() *GetAcceptedFrontier { if x, ok := m.Message.(*Message_GetAcceptedFrontier); ok { return x.GetAcceptedFrontier }; return nil }
|
||||
func (m *Message) GetAcceptedFrontier() *AcceptedFrontier { if x, ok := m.Message.(*Message_AcceptedFrontier_); ok { return x.AcceptedFrontier_ }; return nil }
|
||||
func (m *Message) GetGetAccepted() *GetAccepted { if x, ok := m.Message.(*Message_GetAccepted); ok { return x.GetAccepted }; return nil }
|
||||
func (m *Message) GetAccepted() *Accepted { if x, ok := m.Message.(*Message_Accepted_); ok { return x.Accepted_ }; return nil }
|
||||
func (m *Message) GetGetAncestors() *GetAncestors { if x, ok := m.Message.(*Message_GetAncestors); ok { return x.GetAncestors }; return nil }
|
||||
func (m *Message) GetAncestors() *Ancestors { if x, ok := m.Message.(*Message_Ancestors_); ok { return x.Ancestors_ }; return nil }
|
||||
func (m *Message) GetGet() *Get { if x, ok := m.Message.(*Message_Get); ok { return x.Get }; return nil }
|
||||
func (m *Message) GetPut() *Put { if x, ok := m.Message.(*Message_Put); ok { return x.Put }; return nil }
|
||||
func (m *Message) GetPushQuery() *PushQuery { if x, ok := m.Message.(*Message_PushQuery); ok { return x.PushQuery }; return nil }
|
||||
func (m *Message) GetPullQuery() *PullQuery { if x, ok := m.Message.(*Message_PullQuery); ok { return x.PullQuery }; return nil }
|
||||
func (m *Message) GetChits() *Chits { if x, ok := m.Message.(*Message_Chits); ok { return x.Chits }; return nil }
|
||||
func (m *Message) GetRequest() *Request { if x, ok := m.Message.(*Message_Request); ok { return x.Request }; return nil }
|
||||
func (m *Message) GetResponse() *Response { if x, ok := m.Message.(*Message_Response); ok { return x.Response }; return nil }
|
||||
func (m *Message) GetGossip() *Gossip { if x, ok := m.Message.(*Message_Gossip); ok { return x.Gossip }; return nil }
|
||||
func (m *Message) GetError() *Error { if x, ok := m.Message.(*Message_Error); ok { return x.Error }; return nil }
|
||||
func (m *Message) GetBFT() *BFT { if x, ok := m.Message.(*Message_BFT); ok { return x.BFT }; return nil }
|
||||
func (m *Message) Reset() { *m = Message{} }
|
||||
func (m *Message) String() string { return fmt.Sprintf("%+v", m.Message) }
|
||||
func (m *Message) GetMessage() isMessage_Message { return m.Message }
|
||||
func (m *Message) GetCompressedZstd() []byte {
|
||||
if x, ok := m.Message.(*Message_CompressedZstd); ok {
|
||||
return x.CompressedZstd
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetPing() *Ping {
|
||||
if x, ok := m.Message.(*Message_Ping); ok {
|
||||
return x.Ping
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetPong() *Pong {
|
||||
if x, ok := m.Message.(*Message_Pong); ok {
|
||||
return x.Pong
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetHandshake() *Handshake {
|
||||
if x, ok := m.Message.(*Message_Handshake); ok {
|
||||
return x.Handshake
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetGetPeerList() *GetPeerList {
|
||||
if x, ok := m.Message.(*Message_GetPeerList); ok {
|
||||
return x.GetPeerList
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetPeerList() *PeerList {
|
||||
if x, ok := m.Message.(*Message_PeerList_); ok {
|
||||
return x.PeerList_
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetGetStateSummaryFrontier() *GetStateSummaryFrontier {
|
||||
if x, ok := m.Message.(*Message_GetStateSummaryFrontier); ok {
|
||||
return x.GetStateSummaryFrontier
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetStateSummaryFrontier() *StateSummaryFrontier {
|
||||
if x, ok := m.Message.(*Message_StateSummaryFrontier_); ok {
|
||||
return x.StateSummaryFrontier_
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetGetAcceptedStateSummary() *GetAcceptedStateSummary {
|
||||
if x, ok := m.Message.(*Message_GetAcceptedStateSummary); ok {
|
||||
return x.GetAcceptedStateSummary
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetAcceptedStateSummary() *AcceptedStateSummary {
|
||||
if x, ok := m.Message.(*Message_AcceptedStateSummary_); ok {
|
||||
return x.AcceptedStateSummary_
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetGetAcceptedFrontier() *GetAcceptedFrontier {
|
||||
if x, ok := m.Message.(*Message_GetAcceptedFrontier); ok {
|
||||
return x.GetAcceptedFrontier
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetAcceptedFrontier() *AcceptedFrontier {
|
||||
if x, ok := m.Message.(*Message_AcceptedFrontier_); ok {
|
||||
return x.AcceptedFrontier_
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetGetAccepted() *GetAccepted {
|
||||
if x, ok := m.Message.(*Message_GetAccepted); ok {
|
||||
return x.GetAccepted
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetAccepted() *Accepted {
|
||||
if x, ok := m.Message.(*Message_Accepted_); ok {
|
||||
return x.Accepted_
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetGetAncestors() *GetAncestors {
|
||||
if x, ok := m.Message.(*Message_GetAncestors); ok {
|
||||
return x.GetAncestors
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetAncestors() *Ancestors {
|
||||
if x, ok := m.Message.(*Message_Ancestors_); ok {
|
||||
return x.Ancestors_
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetGet() *Get {
|
||||
if x, ok := m.Message.(*Message_Get); ok {
|
||||
return x.Get
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetPut() *Put {
|
||||
if x, ok := m.Message.(*Message_Put); ok {
|
||||
return x.Put
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetPushQuery() *PushQuery {
|
||||
if x, ok := m.Message.(*Message_PushQuery); ok {
|
||||
return x.PushQuery
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetPullQuery() *PullQuery {
|
||||
if x, ok := m.Message.(*Message_PullQuery); ok {
|
||||
return x.PullQuery
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetChits() *Chits {
|
||||
if x, ok := m.Message.(*Message_Chits); ok {
|
||||
return x.Chits
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetRequest() *Request {
|
||||
if x, ok := m.Message.(*Message_Request); ok {
|
||||
return x.Request
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetResponse() *Response {
|
||||
if x, ok := m.Message.(*Message_Response); ok {
|
||||
return x.Response
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetGossip() *Gossip {
|
||||
if x, ok := m.Message.(*Message_Gossip); ok {
|
||||
return x.Gossip
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetError() *Error {
|
||||
if x, ok := m.Message.(*Message_Error); ok {
|
||||
return x.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) GetBFT() *BFT {
|
||||
if x, ok := m.Message.(*Message_BFT); ok {
|
||||
return x.BFT
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Message) Reset() { *m = Message{} }
|
||||
func (m *Message) String() string { return fmt.Sprintf("%+v", m.Message) }
|
||||
|
||||
// Ping message
|
||||
type Ping struct {
|
||||
Uptime uint32
|
||||
Uptime uint32
|
||||
ChainUptimes []*ChainUptime
|
||||
}
|
||||
|
||||
func (m *Ping) GetUptime() uint32 { return m.Uptime }
|
||||
func (m *Ping) GetUptime() uint32 { return m.Uptime }
|
||||
func (m *Ping) GetChainUptimes() []*ChainUptime { return m.ChainUptimes }
|
||||
func (m *Ping) Reset() { *m = Ping{} }
|
||||
func (m *Ping) String() string { return fmt.Sprintf("Ping{Uptime:%d}", m.Uptime) }
|
||||
func (m *Ping) Reset() { *m = Ping{} }
|
||||
func (m *Ping) String() string { return fmt.Sprintf("Ping{Uptime:%d}", m.Uptime) }
|
||||
|
||||
// ChainUptime for ping/pong
|
||||
type ChainUptime struct {
|
||||
ChainId []byte
|
||||
Uptime uint32
|
||||
Uptime uint32
|
||||
}
|
||||
|
||||
func (m *ChainUptime) GetChainId() []byte { return m.ChainId }
|
||||
func (m *ChainUptime) GetUptime() uint32 { return m.Uptime }
|
||||
func (m *ChainUptime) GetUptime() uint32 { return m.Uptime }
|
||||
|
||||
// Pong message
|
||||
type Pong struct {
|
||||
Uptime uint32
|
||||
Uptime uint32
|
||||
ChainUptimes []*ChainUptime
|
||||
}
|
||||
|
||||
func (m *Pong) GetUptime() uint32 { return m.Uptime }
|
||||
func (m *Pong) GetUptime() uint32 { return m.Uptime }
|
||||
func (m *Pong) GetChainUptimes() []*ChainUptime { return m.ChainUptimes }
|
||||
func (m *Pong) Reset() { *m = Pong{} }
|
||||
func (m *Pong) String() string { return fmt.Sprintf("Pong{Uptime:%d}", m.Uptime) }
|
||||
func (m *Pong) Reset() { *m = Pong{} }
|
||||
func (m *Pong) String() string { return fmt.Sprintf("Pong{Uptime:%d}", m.Uptime) }
|
||||
|
||||
// Handshake message
|
||||
type Handshake struct {
|
||||
@@ -189,8 +319,8 @@ func (m *Handshake) GetKnownPeers() *BloomFilter { return m.KnownPeers }
|
||||
func (m *Handshake) GetIpBlsSig() []byte { return m.IpBlsSig }
|
||||
func (m *Handshake) GetAllChains() bool { return m.AllChains }
|
||||
func (m *Handshake) GetIpMldsaSig() []byte { return m.IpMldsaSig }
|
||||
func (m *Handshake) Reset() { *m = Handshake{} }
|
||||
func (m *Handshake) String() string { return fmt.Sprintf("Handshake{NetworkId:%d}", m.NetworkId) }
|
||||
func (m *Handshake) Reset() { *m = Handshake{} }
|
||||
func (m *Handshake) String() string { return fmt.Sprintf("Handshake{NetworkId:%d}", m.NetworkId) }
|
||||
|
||||
// Client info
|
||||
type Client struct {
|
||||
@@ -262,7 +392,9 @@ func (m *GetStateSummaryFrontier) GetChainId() []byte { return m.ChainId }
|
||||
func (m *GetStateSummaryFrontier) GetRequestId() uint32 { return m.RequestId }
|
||||
func (m *GetStateSummaryFrontier) GetDeadline() uint64 { return m.Deadline }
|
||||
func (m *GetStateSummaryFrontier) Reset() { *m = GetStateSummaryFrontier{} }
|
||||
func (m *GetStateSummaryFrontier) String() string { return fmt.Sprintf("GetStateSummaryFrontier{RequestId:%d}", m.RequestId) }
|
||||
func (m *GetStateSummaryFrontier) String() string {
|
||||
return fmt.Sprintf("GetStateSummaryFrontier{RequestId:%d}", m.RequestId)
|
||||
}
|
||||
|
||||
// StateSummaryFrontier message
|
||||
type StateSummaryFrontier struct {
|
||||
@@ -275,7 +407,9 @@ func (m *StateSummaryFrontier) GetChainId() []byte { return m.ChainId }
|
||||
func (m *StateSummaryFrontier) GetRequestId() uint32 { return m.RequestId }
|
||||
func (m *StateSummaryFrontier) GetSummary() []byte { return m.Summary }
|
||||
func (m *StateSummaryFrontier) Reset() { *m = StateSummaryFrontier{} }
|
||||
func (m *StateSummaryFrontier) String() string { return fmt.Sprintf("StateSummaryFrontier{RequestId:%d}", m.RequestId) }
|
||||
func (m *StateSummaryFrontier) String() string {
|
||||
return fmt.Sprintf("StateSummaryFrontier{RequestId:%d}", m.RequestId)
|
||||
}
|
||||
|
||||
// GetAcceptedStateSummary message
|
||||
type GetAcceptedStateSummary struct {
|
||||
@@ -290,7 +424,9 @@ func (m *GetAcceptedStateSummary) GetRequestId() uint32 { return m.RequestId }
|
||||
func (m *GetAcceptedStateSummary) GetDeadline() uint64 { return m.Deadline }
|
||||
func (m *GetAcceptedStateSummary) GetHeights() []uint64 { return m.Heights }
|
||||
func (m *GetAcceptedStateSummary) Reset() { *m = GetAcceptedStateSummary{} }
|
||||
func (m *GetAcceptedStateSummary) String() string { return fmt.Sprintf("GetAcceptedStateSummary{RequestId:%d}", m.RequestId) }
|
||||
func (m *GetAcceptedStateSummary) String() string {
|
||||
return fmt.Sprintf("GetAcceptedStateSummary{RequestId:%d}", m.RequestId)
|
||||
}
|
||||
|
||||
// AcceptedStateSummary message
|
||||
type AcceptedStateSummary struct {
|
||||
@@ -303,7 +439,9 @@ func (m *AcceptedStateSummary) GetChainId() []byte { return m.ChainId }
|
||||
func (m *AcceptedStateSummary) GetRequestId() uint32 { return m.RequestId }
|
||||
func (m *AcceptedStateSummary) GetSummaryIds() [][]byte { return m.SummaryIds }
|
||||
func (m *AcceptedStateSummary) Reset() { *m = AcceptedStateSummary{} }
|
||||
func (m *AcceptedStateSummary) String() string { return fmt.Sprintf("AcceptedStateSummary{RequestId:%d}", m.RequestId) }
|
||||
func (m *AcceptedStateSummary) String() string {
|
||||
return fmt.Sprintf("AcceptedStateSummary{RequestId:%d}", m.RequestId)
|
||||
}
|
||||
|
||||
// GetAcceptedFrontier message
|
||||
type GetAcceptedFrontier struct {
|
||||
@@ -318,7 +456,9 @@ func (m *GetAcceptedFrontier) GetRequestId() uint32 { return m.RequestId }
|
||||
func (m *GetAcceptedFrontier) GetDeadline() uint64 { return m.Deadline }
|
||||
func (m *GetAcceptedFrontier) GetEngineType() EngineType { return m.EngineType }
|
||||
func (m *GetAcceptedFrontier) Reset() { *m = GetAcceptedFrontier{} }
|
||||
func (m *GetAcceptedFrontier) String() string { return fmt.Sprintf("GetAcceptedFrontier{RequestId:%d}", m.RequestId) }
|
||||
func (m *GetAcceptedFrontier) String() string {
|
||||
return fmt.Sprintf("GetAcceptedFrontier{RequestId:%d}", m.RequestId)
|
||||
}
|
||||
|
||||
// AcceptedFrontier message
|
||||
type AcceptedFrontier struct {
|
||||
@@ -331,7 +471,9 @@ func (m *AcceptedFrontier) GetChainId() []byte { return m.ChainId }
|
||||
func (m *AcceptedFrontier) GetRequestId() uint32 { return m.RequestId }
|
||||
func (m *AcceptedFrontier) GetContainerId() []byte { return m.ContainerId }
|
||||
func (m *AcceptedFrontier) Reset() { *m = AcceptedFrontier{} }
|
||||
func (m *AcceptedFrontier) String() string { return fmt.Sprintf("AcceptedFrontier{RequestId:%d}", m.RequestId) }
|
||||
func (m *AcceptedFrontier) String() string {
|
||||
return fmt.Sprintf("AcceptedFrontier{RequestId:%d}", m.RequestId)
|
||||
}
|
||||
|
||||
// GetAccepted message
|
||||
type GetAccepted struct {
|
||||
@@ -534,7 +676,9 @@ func (m *Error) GetRequestId() uint32 { return m.RequestId }
|
||||
func (m *Error) GetErrorCode() int32 { return m.ErrorCode }
|
||||
func (m *Error) GetErrorMessage() string { return m.ErrorMessage }
|
||||
func (m *Error) Reset() { *m = Error{} }
|
||||
func (m *Error) String() string { return fmt.Sprintf("Error{RequestId:%d,Code:%d}", m.RequestId, m.ErrorCode) }
|
||||
func (m *Error) String() string {
|
||||
return fmt.Sprintf("Error{RequestId:%d,Code:%d}", m.RequestId, m.ErrorCode)
|
||||
}
|
||||
|
||||
// BFT message
|
||||
type BFT struct {
|
||||
@@ -556,24 +700,44 @@ type BFT_Finalization struct{ Finalization *QuorumCertificate }
|
||||
type BFT_ReplicationRequest struct{ ReplicationRequest *ReplicationRequest }
|
||||
type BFT_ReplicationResponse struct{ ReplicationResponse *ReplicationResponse }
|
||||
|
||||
func (*BFT_BlockProposal) isBFT_Message() {}
|
||||
func (*BFT_Vote) isBFT_Message() {}
|
||||
func (*BFT_EmptyVote) isBFT_Message() {}
|
||||
func (*BFT_FinalizeVote) isBFT_Message() {}
|
||||
func (*BFT_Notarization) isBFT_Message() {}
|
||||
func (*BFT_EmptyNotarization) isBFT_Message() {}
|
||||
func (*BFT_Finalization) isBFT_Message() {}
|
||||
func (*BFT_ReplicationRequest) isBFT_Message() {}
|
||||
func (*BFT_ReplicationResponse) isBFT_Message() {}
|
||||
func (*BFT_BlockProposal) isBFT_Message() {}
|
||||
func (*BFT_Vote) isBFT_Message() {}
|
||||
func (*BFT_EmptyVote) isBFT_Message() {}
|
||||
func (*BFT_FinalizeVote) isBFT_Message() {}
|
||||
func (*BFT_Notarization) isBFT_Message() {}
|
||||
func (*BFT_EmptyNotarization) isBFT_Message() {}
|
||||
func (*BFT_Finalization) isBFT_Message() {}
|
||||
func (*BFT_ReplicationRequest) isBFT_Message() {}
|
||||
func (*BFT_ReplicationResponse) isBFT_Message() {}
|
||||
|
||||
func (m *BFT) GetChainId() []byte { return m.ChainId }
|
||||
func (m *BFT) GetChainId() []byte { return m.ChainId }
|
||||
func (m *BFT) GetMessage() isBFT_Message { return m.Message }
|
||||
func (m *BFT) GetBlockProposal() *BlockProposal { if x, ok := m.Message.(*BFT_BlockProposal); ok { return x.BlockProposal }; return nil }
|
||||
func (m *BFT) GetVote() *Vote { if x, ok := m.Message.(*BFT_Vote); ok { return x.Vote }; return nil }
|
||||
func (m *BFT) GetReplicationRequest() *ReplicationRequest { if x, ok := m.Message.(*BFT_ReplicationRequest); ok { return x.ReplicationRequest }; return nil }
|
||||
func (m *BFT) GetReplicationResponse() *ReplicationResponse { if x, ok := m.Message.(*BFT_ReplicationResponse); ok { return x.ReplicationResponse }; return nil }
|
||||
func (m *BFT) Reset() { *m = BFT{} }
|
||||
func (m *BFT) String() string { return "BFT{}" }
|
||||
func (m *BFT) GetBlockProposal() *BlockProposal {
|
||||
if x, ok := m.Message.(*BFT_BlockProposal); ok {
|
||||
return x.BlockProposal
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *BFT) GetVote() *Vote {
|
||||
if x, ok := m.Message.(*BFT_Vote); ok {
|
||||
return x.Vote
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *BFT) GetReplicationRequest() *ReplicationRequest {
|
||||
if x, ok := m.Message.(*BFT_ReplicationRequest); ok {
|
||||
return x.ReplicationRequest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *BFT) GetReplicationResponse() *ReplicationResponse {
|
||||
if x, ok := m.Message.(*BFT_ReplicationResponse); ok {
|
||||
return x.ReplicationResponse
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *BFT) Reset() { *m = BFT{} }
|
||||
func (m *BFT) String() string { return "BFT{}" }
|
||||
|
||||
// BlockProposal message
|
||||
type BlockProposal struct {
|
||||
|
||||
@@ -21,8 +21,10 @@ type L1ValidatorRegistrationJustification_RegisterL1ValidatorMessage struct {
|
||||
RegisterL1ValidatorMessage []byte
|
||||
}
|
||||
|
||||
func (*L1ValidatorRegistrationJustification_ConvertNetworkToL1TxData) isL1ValidatorRegistrationJustification_Preimage() {}
|
||||
func (*L1ValidatorRegistrationJustification_RegisterL1ValidatorMessage) isL1ValidatorRegistrationJustification_Preimage() {}
|
||||
func (*L1ValidatorRegistrationJustification_ConvertNetworkToL1TxData) isL1ValidatorRegistrationJustification_Preimage() {
|
||||
}
|
||||
func (*L1ValidatorRegistrationJustification_RegisterL1ValidatorMessage) isL1ValidatorRegistrationJustification_Preimage() {
|
||||
}
|
||||
|
||||
func (m *L1ValidatorRegistrationJustification) GetPreimage() isL1ValidatorRegistrationJustification_Preimage {
|
||||
return m.preimage
|
||||
@@ -59,7 +61,8 @@ type L1ValidatorWeightJustification_L1ValidatorWeightMessage struct {
|
||||
L1ValidatorWeightMessage []byte
|
||||
}
|
||||
|
||||
func (*L1ValidatorWeightJustification_L1ValidatorWeightMessage) isL1ValidatorWeightJustification_Preimage() {}
|
||||
func (*L1ValidatorWeightJustification_L1ValidatorWeightMessage) isL1ValidatorWeightJustification_Preimage() {
|
||||
}
|
||||
|
||||
func (m *L1ValidatorWeightJustification) GetPreimage() isL1ValidatorWeightJustification_Preimage {
|
||||
return m.preimage
|
||||
|
||||
@@ -171,9 +171,9 @@ func (rp *RangeProof) GetKeyValues() []*KeyValue {
|
||||
|
||||
// ChangeProof represents a change proof
|
||||
type ChangeProof struct {
|
||||
StartProof []*ProofNode
|
||||
EndProof []*ProofNode
|
||||
KeyChanges []*KeyChange
|
||||
StartProof []*ProofNode
|
||||
EndProof []*ProofNode
|
||||
KeyChanges []*KeyChange
|
||||
HadRootsInHistory bool
|
||||
}
|
||||
|
||||
|
||||
@@ -158,11 +158,11 @@ func newEnvironment(t *testing.T, f upgradetest.Fork) *environment { //nolint:un
|
||||
rewardsCalc := reward.NewCalculator(res.config.RewardConfig)
|
||||
// Convert testcontext.Context to runtime.Runtime for state
|
||||
stateConsensusCtx := &runtime.Runtime{
|
||||
NetworkID: res.ctx.NetworkID,
|
||||
ChainID: res.ctx.ChainID,
|
||||
NodeID: res.ctx.NodeID,
|
||||
UTXOAssetID: res.ctx.UTXOAssetID,
|
||||
Log: res.ctx.Log,
|
||||
NetworkID: res.ctx.NetworkID,
|
||||
ChainID: res.ctx.ChainID,
|
||||
NodeID: res.ctx.NodeID,
|
||||
UTXOAssetID: res.ctx.UTXOAssetID,
|
||||
Log: res.ctx.Log,
|
||||
}
|
||||
res.state = statetest.New(t, statetest.Config{
|
||||
DB: res.baseDB,
|
||||
@@ -181,7 +181,7 @@ func newEnvironment(t *testing.T, f upgradetest.Fork) *environment { //nolint:un
|
||||
NetworkID: res.ctx.NetworkID,
|
||||
ChainID: res.ctx.ChainID,
|
||||
NodeID: res.ctx.NodeID,
|
||||
UTXOAssetID: res.ctx.UTXOAssetID,
|
||||
UTXOAssetID: res.ctx.UTXOAssetID,
|
||||
Log: res.ctx.Log,
|
||||
ValidatorState: res.ctx.ValidatorState,
|
||||
SharedMemory: res.ctx.SharedMemory,
|
||||
@@ -286,7 +286,7 @@ func newWallet(t testing.TB, e *environment, c walletConfig) wallet.Wallet {
|
||||
NetworkID: e.ctx.NetworkID,
|
||||
ChainID: e.ctx.ChainID,
|
||||
NodeID: e.ctx.NodeID,
|
||||
UTXOAssetID: e.ctx.UTXOAssetID,
|
||||
UTXOAssetID: e.ctx.UTXOAssetID,
|
||||
SharedMemory: e.ctx.SharedMemory,
|
||||
}
|
||||
// Create a minimal Config for the wallet
|
||||
|
||||
@@ -90,7 +90,7 @@ type testContext struct {
|
||||
NodeID ids.NodeID
|
||||
XChainID ids.ID
|
||||
CChainID ids.ID
|
||||
UTXOAssetID ids.ID
|
||||
UTXOAssetID ids.ID
|
||||
Log log.Logger
|
||||
Lock *sync.RWMutex
|
||||
SharedMemory chainatomic.SharedMemory
|
||||
@@ -136,7 +136,7 @@ func newEnvironment(t *testing.T, ctrl *gomock.Controller, f upgradetest.Fork) *
|
||||
NodeID: rt.NodeID,
|
||||
XChainID: rt.XChainID,
|
||||
CChainID: rt.CChainID,
|
||||
UTXOAssetID: rt.UTXOAssetID,
|
||||
UTXOAssetID: rt.UTXOAssetID,
|
||||
Log: rt.Log.(log.Logger),
|
||||
Lock: &rt.Lock,
|
||||
SharedMemory: m.NewSharedMemory(rt.ChainID),
|
||||
|
||||
@@ -134,13 +134,13 @@ func TestRejectBlock(t *testing.T) {
|
||||
rejector := &rejector{
|
||||
backend: &backend{
|
||||
ctx: &runtime.Runtime{
|
||||
NetworkID: testCtx.NetworkID,
|
||||
ChainID: testCtx.ChainID,
|
||||
NodeID: testCtx.NodeID,
|
||||
XChainID: testCtx.XChainID,
|
||||
CChainID: testCtx.CChainID,
|
||||
UTXOAssetID: testCtx.UTXOAssetID,
|
||||
Log: testCtx.Log,
|
||||
NetworkID: testCtx.NetworkID,
|
||||
ChainID: testCtx.ChainID,
|
||||
NodeID: testCtx.NodeID,
|
||||
XChainID: testCtx.XChainID,
|
||||
CChainID: testCtx.CChainID,
|
||||
UTXOAssetID: testCtx.UTXOAssetID,
|
||||
Log: testCtx.Log,
|
||||
},
|
||||
blkIDToState: blkIDToState,
|
||||
Mempool: mempool,
|
||||
|
||||
@@ -34,7 +34,7 @@ const (
|
||||
var (
|
||||
// Use a fixed test asset ID for X-chain native asset
|
||||
UTXOAssetID = ids.ID{'l', 'u', 'x', ' ', 'a', 's', 's', 'e', 't', ' ', 'i', 'd'}
|
||||
XAsset = lux.Asset{ID: UTXOAssetID}
|
||||
XAsset = lux.Asset{ID: UTXOAssetID}
|
||||
|
||||
DefaultValidatorStartTime = upgrade.InitiallyActiveTime
|
||||
DefaultValidatorStartTimeUnix = uint64(DefaultValidatorStartTime.Unix())
|
||||
|
||||
@@ -25,7 +25,7 @@ type Context struct {
|
||||
XChainID ids.ID
|
||||
CChainID ids.ID
|
||||
DChainID ids.ID
|
||||
UTXOAssetID ids.ID // Primary asset ID (X-chain native)
|
||||
UTXOAssetID ids.ID // Primary asset ID (X-chain native)
|
||||
ValidatorState interface{}
|
||||
WarpSigner interface{}
|
||||
Log log.Logger
|
||||
|
||||
@@ -30,9 +30,9 @@ func TestAddDelegatorTxSyntacticVerify(t *testing.T) {
|
||||
rt := &runtime.Runtime{
|
||||
NetworkID: constants.UnitTestID,
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
NodeID: nodeID,
|
||||
NodeID: nodeID,
|
||||
}
|
||||
signers := [][]*secp256k1.PrivateKey{preFundedKeys}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ func testContext(networkID uint32, chainID, luxAssetID ids.ID) *runtime.Runtime
|
||||
return &runtime.Runtime{
|
||||
NetworkID: networkID,
|
||||
|
||||
ChainID: chainID,
|
||||
ChainID: chainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ func TestAddPermissionlessPrimaryDelegatorSerialization(t *testing.T) {
|
||||
rt := &runtime.Runtime{
|
||||
NetworkID: 1,
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(simpleAddPrimaryTx.SyntacticVerify(rt))
|
||||
@@ -391,7 +391,7 @@ func TestAddPermissionlessPrimaryDelegatorSerialization(t *testing.T) {
|
||||
rt = &runtime.Runtime{
|
||||
NetworkID: 1,
|
||||
|
||||
ChainID: constants.PlatformChainID,
|
||||
ChainID: constants.PlatformChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(complexAddPrimaryTx.SyntacticVerify(rt))
|
||||
@@ -624,7 +624,7 @@ func TestAddPermissionlessPrimaryDelegatorSerialization(t *testing.T) {
|
||||
ctx2 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID for "P-lux1..." address encoding
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
unsignedComplexAddPrimaryTx.InitRuntime(ctx2)
|
||||
@@ -882,7 +882,7 @@ func TestAddPermissionlessNetDelegatorSerialization(t *testing.T) {
|
||||
rt = &runtime.Runtime{
|
||||
NetworkID: 1,
|
||||
|
||||
ChainID: constants.PlatformChainID,
|
||||
ChainID: constants.PlatformChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(simpleAddNetTx.SyntacticVerify(rt))
|
||||
@@ -1159,7 +1159,7 @@ func TestAddPermissionlessNetDelegatorSerialization(t *testing.T) {
|
||||
rt = &runtime.Runtime{
|
||||
NetworkID: 1,
|
||||
|
||||
ChainID: constants.PlatformChainID,
|
||||
ChainID: constants.PlatformChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(complexAddNetTx.SyntacticVerify(rt))
|
||||
@@ -1392,7 +1392,7 @@ func TestAddPermissionlessNetDelegatorSerialization(t *testing.T) {
|
||||
ctx3 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID for "P-lux1..." address encoding
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
unsignedComplexAddNetTx.InitRuntime(ctx3)
|
||||
|
||||
@@ -139,7 +139,7 @@ func TestAddPermissionlessPrimaryValidator(t *testing.T) {
|
||||
rt := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID,
|
||||
|
||||
ChainID: constants.PlatformChainID,
|
||||
ChainID: constants.PlatformChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(simpleAddPrimaryTx.SyntacticVerify(rt))
|
||||
@@ -443,7 +443,7 @@ func TestAddPermissionlessPrimaryValidator(t *testing.T) {
|
||||
rt = &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID,
|
||||
|
||||
ChainID: constants.PlatformChainID,
|
||||
ChainID: constants.PlatformChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(complexAddPrimaryTx.SyntacticVerify(rt))
|
||||
@@ -834,7 +834,7 @@ func TestAddPermissionlessNetValidator(t *testing.T) {
|
||||
rt := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID,
|
||||
|
||||
ChainID: constants.PlatformChainID,
|
||||
ChainID: constants.PlatformChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(simpleAddNetTx.SyntacticVerify(rt))
|
||||
@@ -1136,7 +1136,7 @@ func TestAddPermissionlessNetValidator(t *testing.T) {
|
||||
ctx2 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID for "P-lux1..." address encoding
|
||||
|
||||
ChainID: constants.PlatformChainID,
|
||||
ChainID: constants.PlatformChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(complexAddNetTx.SyntacticVerify(ctx2))
|
||||
|
||||
@@ -33,9 +33,9 @@ func TestAddValidatorTxSyntacticVerify(t *testing.T) {
|
||||
}
|
||||
rt = &runtime.Runtime{
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
NodeID: nodeID,
|
||||
NodeID: nodeID,
|
||||
}
|
||||
signers := [][]*secp256k1.PrivateKey{preFundedKeys}
|
||||
|
||||
@@ -169,9 +169,9 @@ func TestAddValidatorTxSyntacticVerifyNotLUX(t *testing.T) {
|
||||
}
|
||||
rt = &runtime.Runtime{
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
NodeID: nodeID,
|
||||
NodeID: nodeID,
|
||||
}
|
||||
signers := [][]*secp256k1.PrivateKey{preFundedKeys}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ func TestBaseTxSerialization(t *testing.T) {
|
||||
rt := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(simpleBaseTx.SyntacticVerify(rt))
|
||||
@@ -222,7 +222,7 @@ func TestBaseTxSerialization(t *testing.T) {
|
||||
ctx2 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(complexBaseTx.SyntacticVerify(ctx2))
|
||||
@@ -372,7 +372,7 @@ func TestBaseTxSerialization(t *testing.T) {
|
||||
ctx3 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
unsignedComplexBaseTx.InitRuntime(ctx3)
|
||||
|
||||
@@ -215,7 +215,7 @@ func New(
|
||||
rt: rt,
|
||||
NetworkID: rt.NetworkID,
|
||||
ChainID: rt.ChainID,
|
||||
UTXOAssetID: rt.UTXOAssetID,
|
||||
UTXOAssetID: rt.UTXOAssetID,
|
||||
clk: clk,
|
||||
fx: fx,
|
||||
}
|
||||
@@ -226,13 +226,13 @@ type builder struct {
|
||||
utxo.Spender
|
||||
state state.State
|
||||
|
||||
cfg *config.Config
|
||||
rt *runtime.Runtime
|
||||
NetworkID uint32
|
||||
ChainID ids.ID
|
||||
UTXOAssetID ids.ID
|
||||
clk *mockable.Clock
|
||||
fx fx.Fx
|
||||
cfg *config.Config
|
||||
rt *runtime.Runtime
|
||||
NetworkID uint32
|
||||
ChainID ids.ID
|
||||
UTXOAssetID ids.ID
|
||||
clk *mockable.Clock
|
||||
fx fx.Fx
|
||||
}
|
||||
|
||||
func (b *builder) NewImportTx(
|
||||
|
||||
@@ -126,7 +126,7 @@ func newEnvironment(t *testing.T, f upgradetest.Fork) *environment {
|
||||
PublicKey: []byte{}, // Use empty bytes for test
|
||||
XChainID: ctx.XChainID,
|
||||
CChainID: ctx.CChainID,
|
||||
UTXOAssetID: ctx.UTXOAssetID,
|
||||
UTXOAssetID: ctx.UTXOAssetID,
|
||||
ValidatorState: ctx.ValidatorState,
|
||||
SharedMemory: ctx.SharedMemory,
|
||||
ChainDataDir: ctx.ChainDataDir,
|
||||
@@ -226,7 +226,7 @@ func newWallet(t testing.TB, e *environment, c walletConfig) wallet.Wallet {
|
||||
PublicKey: []byte{}, // Use empty bytes for test
|
||||
XChainID: e.ctx.XChainID,
|
||||
CChainID: e.ctx.CChainID,
|
||||
UTXOAssetID: e.ctx.UTXOAssetID,
|
||||
UTXOAssetID: e.ctx.UTXOAssetID,
|
||||
ValidatorState: e.ctx.ValidatorState,
|
||||
SharedMemory: e.ctx.SharedMemory,
|
||||
ChainDataDir: e.ctx.ChainDataDir,
|
||||
|
||||
@@ -548,7 +548,7 @@ func (e *standardTxExecutor) TransformChainTx(tx *txs.TransformChainTx) error {
|
||||
// second entry.
|
||||
map[ids.ID]uint64{
|
||||
e.backend.Rt.UTXOAssetID: fee,
|
||||
tx.AssetID: totalRewardAmount,
|
||||
tx.AssetID: totalRewardAmount,
|
||||
},
|
||||
); err != nil {
|
||||
return err
|
||||
|
||||
@@ -89,8 +89,8 @@ const (
|
||||
|
||||
intrinsicInputDBRead = 1
|
||||
|
||||
intrinsicInputDBWrite = 1
|
||||
intrinsicOutputDBWrite = 1
|
||||
intrinsicInputDBWrite = 1
|
||||
intrinsicOutputDBWrite = 1
|
||||
intrinsicConvertNetworkToL1ValidatorDBWrite = 4 // weight diff + pub key diff + chainID/nodeID + validationID
|
||||
)
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ func updateTestFile(testName, actualBytes string) {
|
||||
"TestAddPermissionlessPrimaryDelegatorSerialization": "add_permissionless_delegator_tx_test.go",
|
||||
"TestAddPermissionlessNetDelegatorSerialization": "add_permissionless_delegator_tx_test.go",
|
||||
"TestBaseTxSerialization": "base_tx_test.go",
|
||||
"TestConvertNetworkToL1TxSerialization": "convert_net_to_l1_tx_test.go",
|
||||
"TestConvertNetworkToL1TxSerialization": "convert_net_to_l1_tx_test.go",
|
||||
"TestDisableL1ValidatorTxSerialization": "disable_l1_validator_tx_test.go",
|
||||
"TestIncreaseL1ValidatorBalanceTxSerialization": "increase_l1_validator_balance_tx_test.go",
|
||||
"TestRegisterL1ValidatorTxSerialization": "register_l1_validator_tx_test.go",
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestRemoveChainValidatorTxSerialization(t *testing.T) {
|
||||
rt = &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID,
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(simpleRemoveValidatorTx.SyntacticVerify(rt))
|
||||
@@ -272,7 +272,7 @@ func TestRemoveChainValidatorTxSerialization(t *testing.T) {
|
||||
ctx2 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID,
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(complexRemoveValidatorTx.SyntacticVerify(ctx2))
|
||||
@@ -435,7 +435,7 @@ func TestRemoveChainValidatorTxSerialization(t *testing.T) {
|
||||
ctx3 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.ChainworkID for "P-lux1..." address encoding
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
unsignedComplexRemoveValidatorTx.InitRuntime(ctx3)
|
||||
|
||||
@@ -96,7 +96,7 @@ func TestTransferChainOwnershipTxSerialization(t *testing.T) {
|
||||
rt := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(simpleTransferChainOwnershipTx.SyntacticVerify(rt))
|
||||
@@ -280,7 +280,7 @@ func TestTransferChainOwnershipTxSerialization(t *testing.T) {
|
||||
ctx2 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID,
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(complexTransferChainOwnershipTx.SyntacticVerify(ctx2))
|
||||
@@ -451,7 +451,7 @@ func TestTransferChainOwnershipTxSerialization(t *testing.T) {
|
||||
ctx3 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID for "P-lux1..." address encoding
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
unsignedComplexTransferChainOwnershipTx.InitRuntime(ctx3)
|
||||
|
||||
@@ -117,7 +117,7 @@ func TestTransformChainTxSerialization(t *testing.T) {
|
||||
rt := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(simpleTransformTx.SyntacticVerify(rt))
|
||||
@@ -345,7 +345,7 @@ func TestTransformChainTxSerialization(t *testing.T) {
|
||||
ctx2 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
require.NoError(complexTransformTx.SyntacticVerify(ctx2))
|
||||
@@ -533,7 +533,7 @@ func TestTransformChainTxSerialization(t *testing.T) {
|
||||
ctx3 := &runtime.Runtime{
|
||||
NetworkID: constants.MainnetID, // Must match tx.NetworkID
|
||||
|
||||
ChainID: testChainID,
|
||||
ChainID: testChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
unsignedComplexTransformTx.InitRuntime(ctx3)
|
||||
@@ -650,7 +650,7 @@ func TestTransformChainTxSyntacticVerify(t *testing.T) {
|
||||
rt := &runtime.Runtime{
|
||||
NetworkID: networkID, // Must match tx.NetworkID
|
||||
|
||||
ChainID: chainID,
|
||||
ChainID: chainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
|
||||
|
||||
@@ -513,7 +513,7 @@ func (v *visitor) RemoveChainValidatorTx(*RemoveChainValidatorTx) error
|
||||
func (v *visitor) RewardValidatorTx(*RewardValidatorTx) error { return nil }
|
||||
func (v *visitor) TransferChainOwnershipTx(*TransferChainOwnershipTx) error { return nil }
|
||||
func (v *visitor) TransformChainTx(*TransformChainTx) error { return nil }
|
||||
func (v *visitor) ConvertNetworkToL1Tx(*ConvertNetworkToL1Tx) error { return nil }
|
||||
func (v *visitor) ConvertNetworkToL1Tx(*ConvertNetworkToL1Tx) error { return nil }
|
||||
func (v *visitor) RegisterL1ValidatorTx(*RegisterL1ValidatorTx) error { return nil }
|
||||
func (v *visitor) SetL1ValidatorWeightTx(*SetL1ValidatorWeightTx) error { return nil }
|
||||
func (v *visitor) DisableL1ValidatorTx(*DisableL1ValidatorTx) error { return nil }
|
||||
|
||||
@@ -23,9 +23,9 @@ func newContext(
|
||||
timestamp time.Time,
|
||||
) *builder.Context {
|
||||
builderContext := &builder.Context{
|
||||
NetworkID: networkID,
|
||||
ChainID: rt.ChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
NetworkID: networkID,
|
||||
ChainID: rt.ChainID,
|
||||
UTXOAssetID: luxAssetID,
|
||||
}
|
||||
|
||||
// For test purposes, populate the fee configuration
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ func init() {
|
||||
// Warp 1.0: Classical BLS signatures
|
||||
lc.RegisterType(&BitSetSignature{}),
|
||||
// Warp 1.5: Quantum-safe signatures
|
||||
lc.RegisterType(&CoronaSignature{}), // Recommended: RT-only (LWE-based threshold)
|
||||
lc.RegisterType(&CoronaSignature{}), // Recommended: RT-only (LWE-based threshold)
|
||||
lc.RegisterType(&EncryptedWarpPayload{}), // ML-KEM + AES-256-GCM encryption
|
||||
lc.RegisterType(&HybridBLSRTSignature{}), // Deprecated: BLS+RT hybrid
|
||||
// Teleport: Cross-chain bridging protocol
|
||||
|
||||
+8
-8
@@ -35,10 +35,10 @@ type ValidatorState interface {
|
||||
|
||||
// ValidatorData contains the data for a single validator
|
||||
type ValidatorData struct {
|
||||
NodeID ids.NodeID
|
||||
PublicKey []byte // BLS public key (classical)
|
||||
NodeID ids.NodeID
|
||||
PublicKey []byte // BLS public key (classical)
|
||||
CoronaPubKey []byte // Corona public key (post-quantum)
|
||||
Weight uint64
|
||||
Weight uint64
|
||||
}
|
||||
|
||||
type CanonicalValidatorSet struct {
|
||||
@@ -51,7 +51,7 @@ type CanonicalValidatorSet struct {
|
||||
type Validator struct {
|
||||
PublicKey *bls.PublicKey
|
||||
PublicKeyBytes []byte
|
||||
CoronaPubKey []byte // Post-quantum Corona public key
|
||||
CoronaPubKey []byte // Post-quantum Corona public key
|
||||
Weight uint64
|
||||
NodeIDs []ids.NodeID
|
||||
}
|
||||
@@ -124,7 +124,7 @@ func FlattenValidatorSet(vdrSet map[ids.NodeID]*ValidatorData) (CanonicalValidat
|
||||
newVdr := &Validator{
|
||||
PublicKey: blsPK,
|
||||
PublicKeyBytes: pkBytes,
|
||||
CoronaPubKey: vdr.CoronaPubKey, // Post-quantum key
|
||||
CoronaPubKey: vdr.CoronaPubKey, // Post-quantum key
|
||||
Weight: vdr.Weight,
|
||||
NodeIDs: []ids.NodeID{vdr.NodeID},
|
||||
}
|
||||
@@ -207,10 +207,10 @@ func (v *validatorStateAdapter) GetValidatorSet(ctx context.Context, height uint
|
||||
result := make(map[ids.NodeID]*ValidatorData, len(validatorSet))
|
||||
for nodeID, validator := range validatorSet {
|
||||
result[nodeID] = &ValidatorData{
|
||||
NodeID: validator.NodeID,
|
||||
PublicKey: validator.PublicKey,
|
||||
NodeID: validator.NodeID,
|
||||
PublicKey: validator.PublicKey,
|
||||
CoronaPubKey: validator.CoronaPubKey, // Post-quantum key
|
||||
Weight: validator.Weight,
|
||||
Weight: validator.Weight,
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
|
||||
@@ -23,7 +23,7 @@ func newContext(
|
||||
return &builder.Context{
|
||||
NetworkID: networkID,
|
||||
BlockchainID: chainID,
|
||||
UTXOAssetID: feeAssetID,
|
||||
UTXOAssetID: feeAssetID,
|
||||
BaseTxFee: cfg.TxFee,
|
||||
CreateAssetTxFee: cfg.CreateAssetTxFee,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user