2019-11-08 15:40:21 +00:00
|
|
|
package consensus
|
|
|
|
|
|
|
|
import (
|
2020-08-06 14:44:08 +00:00
|
|
|
"errors"
|
|
|
|
|
2024-03-21 19:49:39 +00:00
|
|
|
"github.com/nspcc-dev/dbft"
|
2024-08-01 10:06:02 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
2021-01-14 11:17:00 +00:00
|
|
|
npayload "github.com/nspcc-dev/neo-go/pkg/network/payload"
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
2019-11-08 15:40:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
// recoveryMessage represents dBFT Recovery message.
|
|
|
|
recoveryMessage struct {
|
2019-11-15 10:32:40 +00:00
|
|
|
preparationHash *util.Uint256
|
|
|
|
preparationPayloads []*preparationCompact
|
|
|
|
commitPayloads []*commitCompact
|
|
|
|
changeViewPayloads []*changeViewCompact
|
2020-11-17 12:57:50 +00:00
|
|
|
stateRootEnabled bool
|
2020-02-18 12:12:20 +00:00
|
|
|
prepareRequest *message
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
changeViewCompact struct {
|
2020-08-23 13:44:56 +00:00
|
|
|
ValidatorIndex uint8
|
2019-11-08 15:40:21 +00:00
|
|
|
OriginalViewNumber byte
|
2020-07-11 07:48:25 +00:00
|
|
|
Timestamp uint64
|
2019-11-08 15:40:21 +00:00
|
|
|
InvocationScript []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
commitCompact struct {
|
|
|
|
ViewNumber byte
|
2020-08-23 13:44:56 +00:00
|
|
|
ValidatorIndex uint8
|
2019-11-15 10:32:40 +00:00
|
|
|
Signature [signatureSize]byte
|
2019-11-08 15:40:21 +00:00
|
|
|
InvocationScript []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
preparationCompact struct {
|
2020-08-23 13:44:56 +00:00
|
|
|
ValidatorIndex uint8
|
2019-11-08 15:40:21 +00:00
|
|
|
InvocationScript []byte
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2024-03-21 19:49:39 +00:00
|
|
|
var _ dbft.RecoveryMessage[util.Uint256] = (*recoveryMessage)(nil)
|
2019-11-08 15:40:21 +00:00
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// DecodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (m *recoveryMessage) DecodeBinary(r *io.BinReader) {
|
2019-11-15 10:32:40 +00:00
|
|
|
r.ReadArray(&m.changeViewPayloads)
|
2019-11-08 15:40:21 +00:00
|
|
|
|
2019-12-12 15:52:23 +00:00
|
|
|
var hasReq = r.ReadBool()
|
2019-11-08 15:40:21 +00:00
|
|
|
if hasReq {
|
2020-11-17 12:57:50 +00:00
|
|
|
m.prepareRequest = &message{stateRootEnabled: m.stateRootEnabled}
|
2019-11-15 10:32:40 +00:00
|
|
|
m.prepareRequest.DecodeBinary(r)
|
2020-02-18 12:12:20 +00:00
|
|
|
if r.Err == nil && m.prepareRequest.Type != prepareRequestType {
|
|
|
|
r.Err = errors.New("recovery message PrepareRequest has wrong type")
|
|
|
|
return
|
|
|
|
}
|
2019-11-08 15:40:21 +00:00
|
|
|
} else {
|
|
|
|
l := r.ReadVarUint()
|
|
|
|
if l != 0 {
|
2019-11-15 10:32:40 +00:00
|
|
|
if l == util.Uint256Size {
|
|
|
|
m.preparationHash = new(util.Uint256)
|
2019-12-06 15:37:46 +00:00
|
|
|
r.ReadBytes(m.preparationHash[:])
|
2019-11-08 15:40:21 +00:00
|
|
|
} else {
|
|
|
|
r.Err = errors.New("invalid data")
|
|
|
|
}
|
|
|
|
} else {
|
2019-11-15 10:32:40 +00:00
|
|
|
m.preparationHash = nil
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-15 10:32:40 +00:00
|
|
|
r.ReadArray(&m.preparationPayloads)
|
|
|
|
r.ReadArray(&m.commitPayloads)
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// EncodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (m *recoveryMessage) EncodeBinary(w *io.BinWriter) {
|
2019-11-15 10:32:40 +00:00
|
|
|
w.WriteArray(m.changeViewPayloads)
|
2019-11-08 15:40:21 +00:00
|
|
|
|
2019-11-15 10:32:40 +00:00
|
|
|
hasReq := m.prepareRequest != nil
|
2019-12-12 15:52:23 +00:00
|
|
|
w.WriteBool(hasReq)
|
2019-11-08 15:40:21 +00:00
|
|
|
if hasReq {
|
2019-11-15 10:32:40 +00:00
|
|
|
m.prepareRequest.EncodeBinary(w)
|
2019-11-08 15:40:21 +00:00
|
|
|
} else {
|
2019-11-15 10:32:40 +00:00
|
|
|
if m.preparationHash == nil {
|
2019-11-08 15:40:21 +00:00
|
|
|
w.WriteVarUint(0)
|
|
|
|
} else {
|
2019-11-15 10:32:40 +00:00
|
|
|
w.WriteVarUint(util.Uint256Size)
|
2019-12-06 15:22:21 +00:00
|
|
|
w.WriteBytes(m.preparationHash[:])
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-15 10:32:40 +00:00
|
|
|
|
|
|
|
w.WriteArray(m.preparationPayloads)
|
|
|
|
w.WriteArray(m.commitPayloads)
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// DecodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (p *changeViewCompact) DecodeBinary(r *io.BinReader) {
|
2020-08-23 13:44:56 +00:00
|
|
|
p.ValidatorIndex = r.ReadB()
|
2019-12-12 17:17:50 +00:00
|
|
|
p.OriginalViewNumber = r.ReadB()
|
2020-07-11 07:48:25 +00:00
|
|
|
p.Timestamp = r.ReadU64LE()
|
2020-06-22 12:14:34 +00:00
|
|
|
p.InvocationScript = r.ReadVarBytes(1024)
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// EncodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (p *changeViewCompact) EncodeBinary(w *io.BinWriter) {
|
2020-08-23 13:44:56 +00:00
|
|
|
w.WriteB(p.ValidatorIndex)
|
2019-12-12 17:17:50 +00:00
|
|
|
w.WriteB(p.OriginalViewNumber)
|
2020-07-11 07:48:25 +00:00
|
|
|
w.WriteU64LE(p.Timestamp)
|
2019-11-22 10:34:06 +00:00
|
|
|
w.WriteVarBytes(p.InvocationScript)
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// DecodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (p *commitCompact) DecodeBinary(r *io.BinReader) {
|
2019-12-12 17:17:50 +00:00
|
|
|
p.ViewNumber = r.ReadB()
|
2020-08-23 13:44:56 +00:00
|
|
|
p.ValidatorIndex = r.ReadB()
|
2019-12-06 15:37:46 +00:00
|
|
|
r.ReadBytes(p.Signature[:])
|
2020-06-22 12:14:34 +00:00
|
|
|
p.InvocationScript = r.ReadVarBytes(1024)
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// EncodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (p *commitCompact) EncodeBinary(w *io.BinWriter) {
|
2019-12-12 17:17:50 +00:00
|
|
|
w.WriteB(p.ViewNumber)
|
2020-08-23 13:44:56 +00:00
|
|
|
w.WriteB(p.ValidatorIndex)
|
2019-12-06 15:22:21 +00:00
|
|
|
w.WriteBytes(p.Signature[:])
|
2019-11-22 10:34:06 +00:00
|
|
|
w.WriteVarBytes(p.InvocationScript)
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// DecodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (p *preparationCompact) DecodeBinary(r *io.BinReader) {
|
2020-08-23 13:44:56 +00:00
|
|
|
p.ValidatorIndex = r.ReadB()
|
2020-06-22 12:14:34 +00:00
|
|
|
p.InvocationScript = r.ReadVarBytes(1024)
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// EncodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (p *preparationCompact) EncodeBinary(w *io.BinWriter) {
|
2020-08-23 13:44:56 +00:00
|
|
|
w.WriteB(p.ValidatorIndex)
|
2019-11-22 10:34:06 +00:00
|
|
|
w.WriteVarBytes(p.InvocationScript)
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
2019-11-15 10:32:40 +00:00
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// AddPayload implements the payload.RecoveryMessage interface.
|
2024-03-21 19:49:39 +00:00
|
|
|
func (m *recoveryMessage) AddPayload(p dbft.ConsensusPayload[util.Uint256]) {
|
2020-08-23 13:44:56 +00:00
|
|
|
validator := uint8(p.ValidatorIndex())
|
|
|
|
|
2019-11-15 10:32:40 +00:00
|
|
|
switch p.Type() {
|
2024-03-21 19:49:39 +00:00
|
|
|
case dbft.PrepareRequestType:
|
2020-02-18 12:12:20 +00:00
|
|
|
m.prepareRequest = &message{
|
2020-11-17 12:57:50 +00:00
|
|
|
Type: prepareRequestType,
|
|
|
|
ViewNumber: p.ViewNumber(),
|
|
|
|
payload: p.GetPrepareRequest().(*prepareRequest),
|
|
|
|
stateRootEnabled: m.stateRootEnabled,
|
2020-02-18 12:12:20 +00:00
|
|
|
}
|
2019-12-02 13:18:54 +00:00
|
|
|
h := p.Hash()
|
|
|
|
m.preparationHash = &h
|
2019-12-02 15:32:14 +00:00
|
|
|
m.preparationPayloads = append(m.preparationPayloads, &preparationCompact{
|
2020-08-23 13:44:56 +00:00
|
|
|
ValidatorIndex: validator,
|
2019-12-02 15:32:14 +00:00
|
|
|
InvocationScript: p.(*Payload).Witness.InvocationScript,
|
|
|
|
})
|
2024-03-21 19:49:39 +00:00
|
|
|
case dbft.PrepareResponseType:
|
2019-11-15 10:32:40 +00:00
|
|
|
m.preparationPayloads = append(m.preparationPayloads, &preparationCompact{
|
2020-08-23 13:44:56 +00:00
|
|
|
ValidatorIndex: validator,
|
2019-11-15 10:32:40 +00:00
|
|
|
InvocationScript: p.(*Payload).Witness.InvocationScript,
|
|
|
|
})
|
2019-12-02 13:18:54 +00:00
|
|
|
|
|
|
|
if m.preparationHash == nil {
|
2024-03-21 19:49:39 +00:00
|
|
|
h := p.GetPrepareResponse().(*prepareResponse).preparationHash
|
2019-12-02 13:18:54 +00:00
|
|
|
m.preparationHash = &h
|
|
|
|
}
|
2024-03-21 19:49:39 +00:00
|
|
|
case dbft.ChangeViewType:
|
2019-11-15 10:32:40 +00:00
|
|
|
m.changeViewPayloads = append(m.changeViewPayloads, &changeViewCompact{
|
2020-08-23 13:44:56 +00:00
|
|
|
ValidatorIndex: validator,
|
2019-11-15 10:32:40 +00:00
|
|
|
OriginalViewNumber: p.ViewNumber(),
|
2024-03-21 19:49:39 +00:00
|
|
|
Timestamp: p.GetChangeView().(*changeView).timestamp,
|
2019-11-15 10:32:40 +00:00
|
|
|
InvocationScript: p.(*Payload).Witness.InvocationScript,
|
|
|
|
})
|
2024-03-21 19:49:39 +00:00
|
|
|
case dbft.CommitType:
|
2019-11-15 10:32:40 +00:00
|
|
|
m.commitPayloads = append(m.commitPayloads, &commitCompact{
|
2020-08-23 13:44:56 +00:00
|
|
|
ValidatorIndex: validator,
|
2019-11-15 10:32:40 +00:00
|
|
|
ViewNumber: p.ViewNumber(),
|
|
|
|
Signature: p.GetCommit().(*commit).signature,
|
|
|
|
InvocationScript: p.(*Payload).Witness.InvocationScript,
|
|
|
|
})
|
*: fix linter exhaustive errors
```
pkg/smartcontract/rpcbinding/binding.go:523:2 exhaustive missing
cases in switch of type smartcontract.ParamType: smartcontract
.UnknownType
pkg/smartcontract/rpcbinding/binding.go:572:2 exhaustive missing
cases in switch of type smartcontract.ParamType: smartcontract
.UnknownType
pkg/smartcontract/rpcbinding/binding.go:862:2 exhaustive missing
cases in switch of type smartcontract.ParamType: smartcontract
.UnknownType, smartcontract.AnyType, smartcontract.BoolType,
smartcontract.IntegerType, smartcontract.ByteArrayType, smartcontract
.Hash160Type, smartcontract.Hash256Type, smartcontract.SignatureType,
smartcontract.InteropInterfaceType, smartcontract.VoidType
pkg/smartcontract/param_type.go:165:2 exhaustive missing
cases in switch of type smartcontract.ParamType: smartcontract
.UnknownType
pkg/smartcontract/manifest/permission.go:103:2 exhaustive missing
cases in switch of type manifest.PermissionType: manifest
.PermissionWildcard
pkg/services/notary/core_test.go:223:4 exhaustive missing
cases in switch of type notary.RequestType: notary.Contract
pkg/services/notary/core_test.go:292:4 exhaustive missing
cases in switch of type notary.RequestType: notary.Contract
pkg/services/oracle/jsonpath/jsonpath.go:62:3 exhaustive missing
cases in switch of type jsonpath.pathTokenType: jsonpath.pathInvalid,
jsonpath.pathRoot, jsonpath.pathRightBracket, jsonpath.pathAsterisk,
jsonpath.pathComma, jsonpath.pathColon, jsonpath.pathIdentifier,
jsonpath.pathString, jsonpath.pathNumber
pkg/services/rpcsrv/server.go:2740:3 exhaustive missing
cases in switch of type neorpc.EventID: neorpc.InvalidEventID, neorpc
.MissedEventID
pkg/services/rpcsrv/server.go:2804:2 exhaustive missing
cases in switch of type neorpc.EventID: neorpc.InvalidEventID, neorpc
.MissedEventID
pkg/services/rpcsrv/server.go:2864:2 exhaustive missing
cases in switch of type neorpc.EventID: neorpc.InvalidEventID, neorpc
.MissedEventID
pkg/vm/contract_checks.go:153:3 exhaustive missing
cases in switch of type opcode.Opcode: opcode.PUSHINT8, opcode
.PUSHINT16, opcode.PUSHINT32, opcode.PUSHINT64, opcode.PUSHINT128,
opcode.PUSHINT256, opcode.PUSHT, opcode.PUSHF, opcode.PUSHNULL, opcode
.PUSHDATA1, opcode.PUSHDATA2, opcode.PUSHDATA4, opcode.PUSHM1, opcode
.PUSH0, opcode.PUSH1, opcode.PUSH2, opcode.PUSH3, opcode.PUSH4, opcode
.PUSH5, opcode.PUSH6, opcode.PUSH7, opcode.PUSH8, opcode.PUSH9, opcode
.PUSH10, opcode.PUSH11, opcode.PUSH12, opcode.PUSH13, opcode.PUSH14,
opcode.PUSH15, opcode.PUSH16, opcode.NOP, opcode.CALLA, opcode.CALLT,
opcode.ABORT, opcode.ASSERT, opcode.THROW, opcode.ENDFINALLY, opcode
.RET, opcode.SYSCALL, opcode.DEPTH, opcode.DROP, opcode.NIP, opcode
.XDROP, opcode.CLEAR, opcode.DUP, opcode.OVER, opcode.PICK, opcode.TUCK,
opcode.SWAP, opcode.ROT, opcode.ROLL, opcode.REVERSE3, opcode.REVERSE4,
opcode.REVERSEN, opcode.INITSSLOT, opcode.INITSLOT, opcode.LDSFLD0,
opcode.LDSFLD1, opcode.LDSFLD2, opcode.LDSFLD3, opcode.LDSFLD4, opcode
.LDSFLD5, opcode.LDSFLD6, opcode.LDSFLD, opcode.STSFLD0, opcode
.STSFLD1, opcode.STSFLD2, opcode.STSFLD3, opcode.STSFLD4, opcode
.STSFLD5, opcode.STSFLD6, opcode.STSFLD, opcode.LDLOC0, opcode.LDLOC1,
opcode.LDLOC2, opcode.LDLOC3, opcode.LDLOC4, opcode.LDLOC5, opcode
.LDLOC6, opcode.LDLOC, opcode.STLOC0, opcode.STLOC1, opcode.STLOC2,
opcode.STLOC3, opcode.STLOC4, opcode.STLOC5, opcode.STLOC6, opcode
.STLOC, opcode.LDARG0, opcode.LDARG1, opcode.LDARG2, opcode.LDARG3,
opcode.LDARG4, opcode.LDARG5, opcode.LDARG6, opcode.LDARG, opcode
.STARG0, opcode.STARG1, opcode.STARG2, opcode.STARG3, opcode.STARG4,
opcode.STARG5, opcode.STARG6, opcode.STARG, opcode.NEWBUFFER, opcode
.MEMCPY, opcode.CAT, opcode.SUBSTR, opcode.LEFT, opcode.RIGHT, opcode
.INVERT, opcode.AND, opcode.OR, opcode.XOR, opcode.EQUAL, opcode
.NOTEQUAL, opcode.SIGN, opcode.ABS, opcode.NEGATE, opcode.INC, opcode
.DEC, opcode.ADD, opcode.SUB, opcode.MUL, opcode.DIV, opcode.MOD,
opcode.POW, opcode.SQRT, opcode.MODMUL, opcode.MODPOW, opcode.SHL,
opcode.SHR, opcode.NOT, opcode.BOOLAND, opcode.BOOLOR, opcode.NZ,
opcode.NUMEQUAL, opcode.NUMNOTEQUAL, opcode.LT, opcode.LE, opcode.GT,
opcode.GE, opcode.MIN, opcode.MAX, opcode.WITHIN, opcode.PACKMAP,
opcode.PACKSTRUCT, opcode.PACK, opcode.UNPACK, opcode.NEWARRAY0,
opcode.NEWARRAY, opcode.NEWSTRUCT0, opcode.NEWSTRUCT, opcode.NEWMAP,
opcode.SIZE, opcode.HASKEY, opcode.KEYS, opcode.VALUES, opcode
.PICKITEM, opcode.APPEND, opcode.SETITEM, opcode.REVERSEITEMS,
opcode.REMOVE, opcode.CLEARITEMS, opcode.POPITEM, opcode.ISNULL,
opcode.ABORTMSG, opcode.ASSERTMSG
pkg/vm/vm.go:912:3 exhaustive missing
cases in switch of type opcode.Opcode: opcode.PUSHINT8, opcode
.PUSHINT16, opcode.PUSHINT32, opcode.PUSHINT64, opcode.PUSHINT128,
opcode.PUSHINT256, opcode.PUSHT, opcode.PUSHF, opcode.PUSHA, opcode
.PUSHNULL, opcode.PUSHDATA1, opcode.PUSHDATA2, opcode.PUSHDATA4, opcode
.PUSHM1, opcode.PUSH0, opcode.PUSH1, opcode.PUSH2, opcode.PUSH3, opcode
.PUSH4, opcode.PUSH5, opcode.PUSH6, opcode.PUSH7, opcode.PUSH8, opcode
.PUSH9, opcode.PUSH10, opcode.PUSH11, opcode.PUSH12, opcode.PUSH13,
opcode.PUSH14, opcode.PUSH15, opcode.PUSH16, opcode.NOP, opcode.JMP,
opcode.JMPL, opcode.JMPIF, opcode.JMPIFL, opcode.JMPIFNOT, opcode
.JMPIFNOTL, opcode.JMPEQ, opcode.JMPEQL, opcode.JMPNE, opcode.JMPNEL,
opcode.JMPGT, opcode.JMPGTL, opcode.JMPGE, opcode.JMPGEL, opcode.JMPLT,
opcode.JMPLTL, opcode.JMPLE, opcode.JMPLEL, opcode.CALL, opcode.CALLL,
opcode.CALLA, opcode.CALLT, opcode.ABORT, opcode.ASSERT, opcode.THROW,
opcode.TRY, opcode.TRYL, opcode.ENDTRY, opcode.ENDTRYL, opcode
.ENDFINALLY, opcode.RET, opcode.SYSCALL, opcode.DEPTH, opcode.DROP,
opcode.NIP, opcode.XDROP, opcode.CLEAR, opcode.DUP, opcode.OVER, opcode
.PICK, opcode.TUCK, opcode.SWAP, opcode.ROT, opcode.ROLL, opcode
.REVERSE3, opcode.INITSSLOT, opcode.INITSLOT, opcode.LDSFLD0, opcode
.LDSFLD1, opcode.LDSFLD2, opcode.LDSFLD3, opcode.LDSFLD4, opcode
.LDSFLD5, opcode.LDSFLD6, opcode.LDSFLD, opcode.STSFLD0, opcode.STSFLD1,
opcode.STSFLD2, opcode.STSFLD3, opcode.STSFLD4, opcode.STSFLD5, opcode
.STSFLD6, opcode.STSFLD, opcode.LDLOC0, opcode.LDLOC1, opcode.LDLOC2,
opcode.LDLOC3, opcode.LDLOC4, opcode.LDLOC5, opcode.LDLOC6, opcode
.LDLOC, opcode.STLOC0, opcode.STLOC1, opcode.STLOC2, opcode.STLOC3,
opcode.STLOC4, opcode.STLOC5, opcode.STLOC6, opcode.STLOC, opcode
.LDARG0, opcode.LDARG1, opcode.LDARG2, opcode.LDARG3, opcode.LDARG4,
opcode.LDARG5, opcode.LDARG6, opcode.LDARG, opcode.STARG0, opcode
.STARG1, opcode.STARG2, opcode.STARG3, opcode.STARG4, opcode.STARG5,
opcode.STARG6, opcode.STARG, opcode.NEWBUFFER, opcode.MEMCPY, opcode
.CAT, opcode.SUBSTR, opcode.LEFT, opcode.RIGHT, opcode.INVERT, opcode
.AND, opcode.OR, opcode.XOR, opcode.EQUAL, opcode.NOTEQUAL, opcode
.SIGN, opcode.ABS, opcode.NEGATE, opcode.INC, opcode.DEC, opcode.ADD,
opcode.SUB, opcode.MUL, opcode.DIV, opcode.MOD, opcode.POW, opcode
.SQRT, opcode.MODMUL, opcode.MODPOW, opcode.SHL, opcode.SHR, opcode
.NOT, opcode.BOOLAND, opcode.BOOLOR, opcode.NZ, opcode.NUMEQUAL, opcode
.NUMNOTEQUAL, opcode.LT, opcode.LE, opcode.GT, opcode.GE, opcode.MIN,
opcode.MAX, opcode.WITHIN, opcode.PACKMAP, opcode.PACKSTRUCT, opcode
.PACK, opcode.UNPACK, opcode.NEWARRAY0, opcode.NEWARRAY, opcode
.NEWARRAYT, opcode.NEWSTRUCT0, opcode.NEWSTRUCT, opcode.NEWMAP, opcode
.SIZE, opcode.HASKEY, opcode.KEYS, opcode.VALUES, opcode.PICKITEM,
opcode.APPEND, opcode.SETITEM, opcode.REVERSEITEMS, opcode.REMOVE,
opcode.CLEARITEMS, opcode.POPITEM, opcode.ISNULL, opcode.ISTYPE, opcode
.CONVERT, opcode.ABORTMSG, opcode.ASSERTMSG
pkg/vm/vm.go:1116:4 exhaustive missing
cases in switch of type opcode.Opcode: opcode.PUSHINT8, opcode
.PUSHINT16, opcode.PUSHINT32, opcode.PUSHINT64, opcode.PUSHINT128,
opcode.PUSHINT256, opcode.PUSHT, opcode.PUSHF, opcode.PUSHA, opcode
.PUSHNULL, opcode.PUSHDATA1, opcode.PUSHDATA2, opcode.PUSHDATA4, opcode
.PUSHM1, opcode.PUSH0, opcode.PUSH1, opcode.PUSH2, opcode.PUSH3, opcode
.PUSH4, opcode.PUSH5, opcode.PUSH6, opcode.PUSH7, opcode.PUSH8, opcode
.PUSH9, opcode.PUSH10, opcode.PUSH11, opcode.PUSH12, opcode.PUSH13,
opcode.PUSH14, opcode.PUSH15, opcode.PUSH16, opcode.NOP, opcode.JMP,
opcode.JMPL, opcode.JMPIF, opcode.JMPIFL, opcode.JMPIFNOT, opcode
.JMPIFNOTL, opcode.JMPEQ, opcode.JMPEQL, opcode.JMPNE, opcode.JMPNEL,
opcode.JMPGT, opcode.JMPGTL, opcode.JMPGE, opcode.JMPGEL, opcode.JMPLT,
opcode.JMPLTL, opcode.JMPLE, opcode.JMPLEL, opcode.CALL, opcode.CALLL,
opcode.CALLA, opcode.CALLT, opcode.ABORT, opcode.ASSERT, opcode.THROW,
opcode.TRY, opcode.TRYL, opcode.ENDTRY, opcode.ENDTRYL, opcode
.ENDFINALLY, opcode.RET, opcode.SYSCALL, opcode.DEPTH, opcode.DROP,
opcode.NIP, opcode.XDROP, opcode.CLEAR, opcode.DUP, opcode.OVER, opcode
.PICK, opcode.TUCK, opcode.SWAP, opcode.ROT, opcode.ROLL, opcode
.REVERSE3, opcode.REVERSE4, opcode.REVERSEN, opcode.INITSSLOT, opcode
.INITSLOT, opcode.LDSFLD0, opcode.LDSFLD1, opcode.LDSFLD2, opcode
.LDSFLD3, opcode.LDSFLD4, opcode.LDSFLD5, opcode.LDSFLD6, opcode.LDSFLD,
opcode.STSFLD0, opcode.STSFLD1, opcode.STSFLD2, opcode.STSFLD3, opcode
.STSFLD4, opcode.STSFLD5, opcode.STSFLD6, opcode.STSFLD, opcode.LDLOC0,
opcode.LDLOC1, opcode.LDLOC2, opcode.LDLOC3, opcode.LDLOC4, opcode
.LDLOC5, opcode.LDLOC6, opcode.LDLOC, opcode.STLOC0, opcode.STLOC1,
opcode.STLOC2, opcode.STLOC3, opcode.STLOC4, opcode.STLOC5, opcode
.STLOC6, opcode.STLOC, opcode.LDARG0, opcode.LDARG1, opcode.LDARG2,
opcode.LDARG3, opcode.LDARG4, opcode.LDARG5, opcode.LDARG6, opcode
.LDARG, opcode.STARG0, opcode.STARG1, opcode.STARG2, opcode.STARG3,
opcode.STARG4, opcode.STARG5, opcode.STARG6, opcode.STARG, opcode
.NEWBUFFER, opcode.MEMCPY, opcode.CAT, opcode.SUBSTR, opcode.LEFT,
opcode.RIGHT, opcode.INVERT, opcode.AND, opcode.OR, opcode.XOR, opcode
.EQUAL, opcode.NOTEQUAL, opcode.SIGN, opcode.ABS, opcode.NEGATE,
opcode.INC, opcode.DEC, opcode.ADD, opcode.SUB, opcode.MUL, opcode
.DIV, opcode.MOD, opcode.POW, opcode.SQRT, opcode.MODMUL, opcode
.MODPOW, opcode.SHL, opcode.SHR, opcode.NOT, opcode.BOOLAND, opcode
.BOOLOR, opcode.NZ, opcode.NUMEQUAL, opcode.NUMNOTEQUAL, opcode.MIN,
opcode.MAX, opcode.WITHIN, opcode.PACKMAP, opcode.PACKSTRUCT, opcode
.PACK, opcode.UNPACK, opcode.NEWARRAY0, opcode.NEWARRAY, opcode
.NEWARRAYT, opcode.NEWSTRUCT0, opcode.NEWSTRUCT, opcode.NEWMAP, opcode
.SIZE, opcode.HASKEY, opcode.KEYS, opcode.VALUES, opcode.PICKITEM,
opcode.APPEND, opcode.SETITEM, opcode.REVERSEITEMS, opcode.REMOVE,
opcode.CLEARITEMS, opcode.POPITEM, opcode.ISNULL, opcode.ISTYPE,
opcode.CONVERT, opcode.ABORTMSG, opcode.ASSERTMSG
pkg/compiler/codegen.go:944:5 exhaustive missing
cases in switch of type smartcontract.ParamType: smartcontract
.UnknownType, smartcontract.AnyType, smartcontract.BoolType,
smartcontract.IntegerType, smartcontract.ByteArrayType, smartcontract
.StringType, smartcontract.PublicKeyType, smartcontract.SignatureType,
smartcontract.ArrayType, smartcontract.MapType, smartcontract
.InteropInterfaceType, smartcontract.VoidType
pkg/compiler/codegen.go:1221:3 exhaustive missing
cases in switch of type token.Token: token.ILLEGAL, token.EOF, token
.COMMENT, token.IDENT, token.INT, token.FLOAT, token.IMAG, token.CHAR,
token.STRING, token.ADD, token.SUB, token.MUL, token.QUO, token.REM,
token.AND, token.OR, token.XOR, token.SHL, token.SHR, token.AND_NOT,
token.ADD_ASSIGN, token.SUB_ASSIGN, token.MUL_ASSIGN, token.QUO_ASSIGN,
token.REM_ASSIGN, token.AND_ASSIGN, token.OR_ASSIGN, token.XOR_ASSIGN,
token.SHL_ASSIGN, token.SHR_ASSIGN, token.AND_NOT_ASSIGN, token.LAND,
token.LOR, token.ARROW, token.INC, token.DEC, token.EQL, token.LSS,
token.GTR, token.ASSIGN, token.NOT, token.NEQ, token.LEQ, token.GEQ,
token.DEFINE, token.ELLIPSIS, token.LPAREN, token.LBRACK, token.LBRACE,
token.COMMA, token.PERIOD, token.RPAREN, token.RBRACK, token.RBRACE,
token.SEMICOLON, token.COLON, token.CASE, token.CHAN, token.CONST, token
.DEFAULT, token.DEFER, token.ELSE, token.FALLTHROUGH, token.FOR, token
.FUNC, token.GO, token.GOTO, token.IF, token.IMPORT, token.INTERFACE,
token.MAP, token.PACKAGE, token.RANGE, token.RETURN, token.SELECT, token
.STRUCT, token.SWITCH, token.TYPE, token.VAR, token.TILDE
pkg/compiler/codegen.go:1709:2 exhaustive missing
cases in switch of type token.Token: token.ILLEGAL, token.EOF, token
.COMMENT, token.IDENT, token.INT, token.FLOAT, token.IMAG, token.CHAR,
token.STRING, token.ADD, token.SUB, token.MUL, token.QUO, token.REM,
token.AND, token.OR, token.XOR, token.SHL, token.SHR, token.AND_NOT,
token.ADD_ASSIGN, token.SUB_ASSIGN, token.MUL_ASSIGN, token.QUO_ASSIGN,
token.REM_ASSIGN, token.AND_ASSIGN, token.OR_ASSIGN, token.XOR_ASSIGN,
token.SHL_ASSIGN, token.SHR_ASSIGN, token.AND_NOT_ASSIGN, token.LAND,
token.LOR, token.ARROW, token.INC, token.DEC, token.ASSIGN, token.NOT,
token.DEFINE, token.ELLIPSIS, token.LPAREN, token.LBRACK, token.LBRACE,
token.COMMA, token.PERIOD, token.RPAREN, token.RBRACK, token.RBRACE,
token.SEMICOLON, token.COLON, token.BREAK, token.CASE, token.CHAN, token
.CONST, token.CONTINUE, token.DEFAULT, token.DEFER, token.ELSE, token
.FALLTHROUGH, token.FOR, token.FUNC, token.GO, token.GOTO, token.IF,
token.IMPORT, token.INTERFACE, token.MAP, token.PACKAGE, token.RANGE,
token.RETURN, token.SELECT, token.STRUCT, token.SWITCH, token.TYPE,
token.VAR, token.TILDE
pkg/compiler/codegen.go:2353:3 exhaustive missing
cases in switch of type opcode.Opcode: opcode.PUSHINT8, opcode
.PUSHINT16, opcode.PUSHINT32, opcode.PUSHINT64, opcode.PUSHINT128,
opcode.PUSHINT256, opcode.PUSHT, opcode.PUSHF, opcode.PUSHNULL, opcode
.PUSHDATA1, opcode.PUSHDATA2, opcode.PUSHDATA4, opcode.PUSHM1, opcode
.PUSH0, opcode.PUSH1, opcode.PUSH2, opcode.PUSH3, opcode.PUSH4, opcode
.PUSH5, opcode.PUSH6, opcode.PUSH7, opcode.PUSH8, opcode.PUSH9, opcode
.PUSH10, opcode.PUSH11, opcode.PUSH12, opcode.PUSH13, opcode.PUSH14,
opcode.PUSH15, opcode.PUSH16, opcode.NOP, opcode.CALLA, opcode.CALLT,
opcode.ABORT, opcode.ASSERT, opcode.THROW, opcode.TRY, opcode.ENDTRY,
opcode.ENDFINALLY, opcode.RET, opcode.SYSCALL, opcode.DEPTH, opcode
.DROP, opcode.NIP, opcode.XDROP, opcode.CLEAR, opcode.DUP, opcode.OVER,
opcode.PICK, opcode.TUCK, opcode.SWAP, opcode.ROT, opcode.ROLL, opcode
.REVERSE3, opcode.REVERSE4, opcode.REVERSEN, opcode.INITSSLOT, opcode
.LDSFLD0, opcode.LDSFLD1, opcode.LDSFLD2, opcode.LDSFLD3, opcode
.LDSFLD4, opcode.LDSFLD5, opcode.LDSFLD6, opcode.LDSFLD, opcode.STSFLD0,
opcode.STSFLD1, opcode.STSFLD2, opcode.STSFLD3, opcode.STSFLD4, opcode
.STSFLD5, opcode.STSFLD6, opcode.STSFLD, opcode.LDLOC0, opcode.LDLOC1,
opcode.LDLOC2, opcode.LDLOC3, opcode.LDLOC4, opcode.LDLOC5, opcode
.LDLOC6, opcode.LDLOC, opcode.STLOC0, opcode.STLOC1, opcode.STLOC2,
opcode.STLOC3, opcode.STLOC4, opcode.STLOC5, opcode.STLOC6, opcode
.STLOC, opcode.LDARG0, opcode.LDARG1, opcode.LDARG2, opcode.LDARG3,
opcode.LDARG4, opcode.LDARG5, opcode.LDARG6, opcode.LDARG, opcode
.STARG0, opcode.STARG1, opcode.STARG2, opcode.STARG3, opcode.STARG4,
opcode.STARG5, opcode.STARG6, opcode.STARG, opcode.NEWBUFFER, opcode
.MEMCPY, opcode.CAT, opcode.SUBSTR, opcode.LEFT, opcode.RIGHT, opcode
.INVERT, opcode.AND, opcode.OR, opcode.XOR, opcode.EQUAL, opcode
.NOTEQUAL, opcode.SIGN, opcode.ABS, opcode.NEGATE, opcode.INC, opcode
.DEC, opcode.ADD, opcode.SUB, opcode.MUL, opcode.DIV, opcode.MOD,
opcode.POW, opcode.SQRT, opcode.MODMUL, opcode.MODPOW, opcode.SHL,
opcode.SHR, opcode.NOT, opcode.BOOLAND, opcode.BOOLOR, opcode.NZ,
opcode.NUMEQUAL, opcode.NUMNOTEQUAL, opcode.LT, opcode.LE, opcode.GT,
opcode.GE, opcode.MIN, opcode.MAX, opcode.WITHIN, opcode.PACKMAP,
opcode.PACKSTRUCT, opcode.PACK, opcode.UNPACK, opcode.NEWARRAY0, opcode
.NEWARRAY, opcode.NEWARRAYT, opcode.NEWSTRUCT0, opcode.NEWSTRUCT,
opcode.NEWMAP, opcode.SIZE, opcode.HASKEY, opcode.KEYS, opcode.VALUES,
opcode.PICKITEM, opcode.APPEND, opcode.SETITEM, opcode.REVERSEITEMS,
opcode.REMOVE, opcode.CLEARITEMS, opcode.POPITEM, opcode.ISNULL, opcode
.ISTYPE, opcode.CONVERT, opcode.ABORTMSG, opcode.ASSERTMSG
pkg/compiler/codegen.go:2474:3 exhaustive missing
cases in switch of type opcode.Opcode: opcode.PUSHINT8, opcode
.PUSHINT16, opcode.PUSHINT32, opcode.PUSHINT64, opcode.PUSHINT128,
opcode.PUSHINT256, opcode.PUSHT, opcode.PUSHF, opcode.PUSHNULL, opcode
.PUSHDATA1, opcode.PUSHDATA2, opcode.PUSHDATA4, opcode.PUSHM1, opcode
.PUSH0, opcode.PUSH1, opcode.PUSH2, opcode.PUSH3, opcode.PUSH4, opcode
.PUSH5, opcode.PUSH6, opcode.PUSH7, opcode.PUSH8, opcode.PUSH9, opcode
.PUSH10, opcode.PUSH11, opcode.PUSH12, opcode.PUSH13, opcode.PUSH14,
opcode.PUSH15, opcode.PUSH16, opcode.NOP, opcode.CALLA, opcode.CALLT,
opcode.ABORT, opcode.ASSERT, opcode.THROW, opcode.ENDFINALLY, opcode
.RET, opcode.SYSCALL, opcode.DEPTH, opcode.DROP, opcode.NIP, opcode
.XDROP, opcode.CLEAR, opcode.DUP, opcode.OVER, opcode.PICK, opcode.TUCK,
opcode.SWAP, opcode.ROT, opcode.ROLL, opcode.REVERSE3, opcode.REVERSE4,
opcode.REVERSEN, opcode.INITSSLOT, opcode.INITSLOT, opcode.LDSFLD0,
opcode.LDSFLD1, opcode.LDSFLD2, opcode.LDSFLD3, opcode.LDSFLD4, opcode
.LDSFLD5, opcode.LDSFLD6, opcode.LDSFLD, opcode.STSFLD0, opcode
.STSFLD1, opcode.STSFLD2, opcode.STSFLD3, opcode.STSFLD4, opcode
.STSFLD5, opcode.STSFLD6, opcode.STSFLD, opcode.LDLOC0, opcode.LDLOC1,
opcode.LDLOC2, opcode.LDLOC3, opcode.LDLOC4, opcode.LDLOC5, opcode
.LDLOC6, opcode.LDLOC, opcode.STLOC0, opcode.STLOC1, opcode.STLOC2,
opcode.STLOC3, opcode.STLOC4, opcode.STLOC5, opcode.STLOC6, opcode
.STLOC, opcode.LDARG0, opcode.LDARG1, opcode.LDARG2, opcode.LDARG3,
opcode.LDARG4, opcode.LDARG5, opcode.LDARG6, opcode.LDARG, opcode
.STARG0, opcode.STARG1, opcode.STARG2, opcode.STARG3, opcode.STARG4,
opcode.STARG5, opcode.STARG6, opcode.STARG, opcode.NEWBUFFER, opcode
.MEMCPY, opcode.CAT, opcode.SUBSTR, opcode.LEFT, opcode.RIGHT, opcode
.INVERT, opcode.AND, opcode.OR, opcode.XOR, opcode.EQUAL, opcode
.NOTEQUAL, opcode.SIGN, opcode.ABS, opcode.NEGATE, opcode.INC, opcode
.DEC, opcode.ADD, opcode.SUB, opcode.MUL, opcode.DIV, opcode.MOD,
opcode.POW, opcode.SQRT, opcode.MODMUL, opcode.MODPOW, opcode.SHL,
opcode.SHR, opcode.NOT, opcode.BOOLAND, opcode.BOOLOR, opcode.NZ,
opcode.NUMEQUAL, opcode.NUMNOTEQUAL, opcode.LT, opcode.LE, opcode.GT,
opcode.GE, opcode.MIN, opcode.MAX, opcode.WITHIN, opcode.PACKMAP,
opcode.PACKSTRUCT, opcode.PACK, opcode.UNPACK, opcode.NEWARRAY0,
opcode.NEWARRAY, opcode.NEWARRAYT, opcode.NEWSTRUCT0, opcode
.NEWSTRUCT, opcode.NEWMAP, opcode.SIZE, opcode.HASKEY, opcode.KEYS,
opcode.VALUES, opcode.PICKITEM, opcode.APPEND, opcode.SETITEM,
opcode.REVERSEITEMS, opcode.REMOVE, opcode.CLEARITEMS, opcode
.POPITEM, opcode.ISNULL, opcode.ISTYPE, opcode.CONVERT, opcode
.ABORTMSG, opcode.ASSERTMSG
pkg/compiler/inline_test.go:34:3 exhaustive missing
cases in switch of type opcode.Opcode: opcode.PUSHINT8, opcode
.PUSHINT16, opcode.PUSHINT32, opcode.PUSHINT64, opcode.PUSHINT128,
opcode.PUSHINT256, opcode.PUSHT, opcode.PUSHF, opcode.PUSHA, opcode
.PUSHNULL, opcode.PUSHDATA1, opcode.PUSHDATA2, opcode.PUSHDATA4, opcode
.PUSHM1, opcode.PUSH0, opcode.PUSH1, opcode.PUSH2, opcode.PUSH3, opcode
.PUSH4, opcode.PUSH5, opcode.PUSH6, opcode.PUSH7, opcode.PUSH8, opcode
.PUSH9, opcode.PUSH10, opcode.PUSH11, opcode.PUSH12, opcode.PUSH13,
opcode.PUSH14, opcode.PUSH15, opcode.PUSH16, opcode.NOP, opcode.JMP,
opcode.JMPL, opcode.JMPIF, opcode.JMPIFL, opcode.JMPIFNOT, opcode
.JMPIFNOTL, opcode.JMPEQ, opcode.JMPEQL, opcode.JMPNE, opcode.JMPNEL,
opcode.JMPGT, opcode.JMPGTL, opcode.JMPGE, opcode.JMPGEL, opcode.JMPLT,
opcode.JMPLTL, opcode.JMPLE, opcode.JMPLEL, opcode.CALLA, opcode.CALLT,
opcode.ABORT, opcode.ASSERT, opcode.THROW, opcode.TRY, opcode.TRYL,
opcode.ENDTRY, opcode.ENDTRYL, opcode.ENDFINALLY, opcode.RET, opcode
.SYSCALL, opcode.DEPTH, opcode.DROP, opcode.NIP, opcode.XDROP, opcode
.CLEAR, opcode.DUP, opcode.OVER, opcode.PICK, opcode.TUCK, opcode.SWAP,
opcode.ROT, opcode.ROLL, opcode.REVERSE3, opcode.REVERSE4, opcode
.REVERSEN, opcode.LDSFLD0, opcode.LDSFLD1, opcode.LDSFLD2, opcode
.LDSFLD3, opcode.LDSFLD4, opcode.LDSFLD5, opcode.LDSFLD6, opcode.LDSFLD,
opcode.STSFLD0, opcode.STSFLD1, opcode.STSFLD2, opcode.STSFLD3, opcode
.STSFLD4, opcode.STSFLD5, opcode.STSFLD6, opcode.STSFLD, opcode.LDLOC0,
opcode.LDLOC1, opcode.LDLOC2, opcode.LDLOC3, opcode.LDLOC4, opcode
.LDLOC5, opcode.LDLOC6, opcode.LDLOC, opcode.STLOC0, opcode.STLOC1,
opcode.STLOC2, opcode.STLOC3, opcode.STLOC4, opcode.STLOC5, opcode
.STLOC6, opcode.STLOC, opcode.LDARG0, opcode.LDARG1, opcode.LDARG2,
opcode.LDARG3, opcode.LDARG4, opcode.LDARG5, opcode.LDARG6, opcode
.LDARG, opcode.STARG0, opcode.STARG1, opcode.STARG2, opcode.STARG3,
opcode.STARG4, opcode.STARG5, opcode.STARG6, opcode.STARG, opcode
.NEWBUFFER, opcode.MEMCPY, opcode.CAT, opcode.SUBSTR, opcode.LEFT,
opcode.RIGHT, opcode.INVERT, opcode.AND, opcode.OR, opcode.XOR, opcode
.EQUAL, opcode.NOTEQUAL, opcode.SIGN, opcode.ABS, opcode.NEGATE,
opcode.INC, opcode.DEC, opcode.ADD, opcode.SUB, opcode.MUL, opcode
.DIV, opcode.MOD, opcode.POW, opcode.SQRT, opcode.MODMUL, opcode
.MODPOW, opcode.SHL, opcode.SHR, opcode.NOT, opcode.BOOLAND, opcode
.BOOLOR, opcode.NZ, opcode.NUMEQUAL, opcode.NUMNOTEQUAL, opcode.LT,
opcode.LE, opcode.GT, opcode.GE, opcode.MIN, opcode.MAX, opcode
.WITHIN, opcode.PACKMAP, opcode.PACKSTRUCT, opcode.PACK, opcode
.UNPACK, opcode.NEWARRAY0, opcode.NEWARRAY, opcode.NEWARRAYT, opcode
.NEWSTRUCT0, opcode.NEWSTRUCT, opcode.NEWMAP, opcode.SIZE, opcode
.HASKEY, opcode.KEYS, opcode.VALUES, opcode.PICKITEM, opcode.APPEND,
opcode.SETITEM, opcode.REVERSEITEMS, opcode.REMOVE, opcode.CLEARITEMS,
opcode.POPITEM, opcode.ISNULL, opcode.ISTYPE, opcode.CONVERT, opcode
.ABORTMSG, opcode.ASSERTMSG
pkg/network/server.go:1395:3 exhaustive missing
cases in switch of type network.CommandType: network.CMDNotFound,
network.CMDReject, network.CMDFilterLoad, network.CMDFilterAdd, network
.CMDFilterClear, network.CMDMerkleBlock, network.CMDAlert
pkg/network/server_test.go:532:3 exhaustive missing
cases in switch of type network.CommandType: network.CMDVersion, network
.CMDVerack, network.CMDGetAddr, network.CMDAddr, network.CMDPing,
network.CMDPong, network.CMDGetHeaders, network.CMDHeaders, network
.CMDGetBlocks, network.CMDMempool, network.CMDInv, network.CMDGetData,
network.CMDGetBlockByIndex, network.CMDGetMPTData, network.CMDMPTData,
network.CMDReject, network.CMDFilterLoad, network.CMDFilterAdd, network
.CMDFilterClear, network.CMDMerkleBlock, network.CMDAlert
pkg/network/server_test.go:817:4 exhaustive missing
cases in switch of type network.CommandType: network.CMDVersion, network
.CMDVerack, network.CMDGetAddr, network.CMDAddr, network.CMDPing,
network.CMDPong, network.CMDGetHeaders, network.CMDHeaders, network
.CMDGetBlocks, network.CMDMempool, network.CMDInv, network.CMDGetData,
network.CMDGetBlockByIndex, network.CMDNotFound, network.CMDTX, network
.CMDBlock, network.CMDExtensible, network.CMDP2PNotaryRequest, network
.CMDGetMPTData, network.CMDReject, network.CMDFilterLoad, network
.CMDFilterAdd, network.CMDFilterClear, network.CMDMerkleBlock, network
.CMDAlert
pkg/core/native/designate.go:262:2 exhaustive missing
cases in switch of type noderoles.Role: noderoles.NeoFSAlphabet
pkg/neorpc/rpcevent/filter.go:36:2 exhaustive missing cases in switch
of type neorpc.EventID: neorpc.InvalidEventID, neorpc.MissedEventID
pkg/consensus/recovery_message.go:145:2 exhaustive missing
cases in switch of type dbft.MessageType: dbft.PreCommitType, dbft
.RecoveryRequestType, dbft.RecoveryMessageType
cli/cmdargs/parser.go:202:3 exhaustive missing cases in switch of type
transaction.WitnessScope: transaction.None, transaction.CalledByEntry,
transaction.Rules, transaction.Global
```
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-09-26 08:30:54 +00:00
|
|
|
default:
|
2019-11-15 10:32:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// GetPrepareRequest implements the payload.RecoveryMessage interface.
|
2024-03-21 19:49:39 +00:00
|
|
|
func (m *recoveryMessage) GetPrepareRequest(p dbft.ConsensusPayload[util.Uint256], validators []dbft.PublicKey, primary uint16) dbft.ConsensusPayload[util.Uint256] {
|
2019-11-15 10:32:40 +00:00
|
|
|
if m.prepareRequest == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-12-02 15:32:14 +00:00
|
|
|
var compact *preparationCompact
|
|
|
|
for _, p := range m.preparationPayloads {
|
2020-08-23 13:44:56 +00:00
|
|
|
if p != nil && p.ValidatorIndex == uint8(primary) {
|
2019-12-02 15:32:14 +00:00
|
|
|
compact = p
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if compact == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-18 12:12:20 +00:00
|
|
|
req := fromPayload(prepareRequestType, p.(*Payload), m.prepareRequest.payload)
|
2024-03-21 20:38:24 +00:00
|
|
|
req.message.ValidatorIndex = byte(primary)
|
2024-08-01 10:06:02 +00:00
|
|
|
req.Sender = validators[primary].(*keys.PublicKey).GetScriptHash()
|
2019-12-02 15:32:14 +00:00
|
|
|
req.Witness.InvocationScript = compact.InvocationScript
|
2020-08-23 13:44:56 +00:00
|
|
|
req.Witness.VerificationScript = getVerificationScript(uint8(primary), validators)
|
2019-12-02 15:32:14 +00:00
|
|
|
|
|
|
|
return req
|
2019-11-15 10:32:40 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// GetPrepareResponses implements the payload.RecoveryMessage interface.
|
2024-03-21 19:49:39 +00:00
|
|
|
func (m *recoveryMessage) GetPrepareResponses(p dbft.ConsensusPayload[util.Uint256], validators []dbft.PublicKey) []dbft.ConsensusPayload[util.Uint256] {
|
2019-11-15 10:32:40 +00:00
|
|
|
if m.preparationHash == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-03-21 19:49:39 +00:00
|
|
|
ps := make([]dbft.ConsensusPayload[util.Uint256], len(m.preparationPayloads))
|
2019-11-15 10:32:40 +00:00
|
|
|
|
|
|
|
for i, resp := range m.preparationPayloads {
|
2019-12-02 15:32:14 +00:00
|
|
|
r := fromPayload(prepareResponseType, p.(*Payload), &prepareResponse{
|
2019-11-15 10:32:40 +00:00
|
|
|
preparationHash: *m.preparationHash,
|
|
|
|
})
|
2024-03-21 20:38:24 +00:00
|
|
|
r.message.ValidatorIndex = resp.ValidatorIndex
|
2024-08-01 10:06:02 +00:00
|
|
|
r.Sender = validators[resp.ValidatorIndex].(*keys.PublicKey).GetScriptHash()
|
2019-12-02 15:32:14 +00:00
|
|
|
r.Witness.InvocationScript = resp.InvocationScript
|
|
|
|
r.Witness.VerificationScript = getVerificationScript(resp.ValidatorIndex, validators)
|
|
|
|
|
|
|
|
ps[i] = r
|
2019-11-15 10:32:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ps
|
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// GetChangeViews implements the payload.RecoveryMessage interface.
|
2024-03-21 19:49:39 +00:00
|
|
|
func (m *recoveryMessage) GetChangeViews(p dbft.ConsensusPayload[util.Uint256], validators []dbft.PublicKey) []dbft.ConsensusPayload[util.Uint256] {
|
|
|
|
ps := make([]dbft.ConsensusPayload[util.Uint256], len(m.changeViewPayloads))
|
2019-11-15 10:32:40 +00:00
|
|
|
|
|
|
|
for i, cv := range m.changeViewPayloads {
|
2019-12-02 15:32:14 +00:00
|
|
|
c := fromPayload(changeViewType, p.(*Payload), &changeView{
|
2019-11-15 10:32:40 +00:00
|
|
|
newViewNumber: cv.OriginalViewNumber + 1,
|
|
|
|
timestamp: cv.Timestamp,
|
|
|
|
})
|
2020-06-09 14:26:21 +00:00
|
|
|
c.message.ViewNumber = cv.OriginalViewNumber
|
2024-03-21 20:38:24 +00:00
|
|
|
c.message.ValidatorIndex = cv.ValidatorIndex
|
2024-08-01 10:06:02 +00:00
|
|
|
c.Sender = validators[cv.ValidatorIndex].(*keys.PublicKey).GetScriptHash()
|
2019-12-02 15:32:14 +00:00
|
|
|
c.Witness.InvocationScript = cv.InvocationScript
|
|
|
|
c.Witness.VerificationScript = getVerificationScript(cv.ValidatorIndex, validators)
|
|
|
|
|
|
|
|
ps[i] = c
|
2019-11-15 10:32:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ps
|
|
|
|
}
|
|
|
|
|
2024-08-01 10:06:02 +00:00
|
|
|
// GetPreCommits implements the payload.RecoveryMessage interface. It's a stub
|
|
|
|
// since N3 doesn't use extension enabling them.
|
|
|
|
func (m *recoveryMessage) GetPreCommits(p dbft.ConsensusPayload[util.Uint256], validators []dbft.PublicKey) []dbft.ConsensusPayload[util.Uint256] {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// GetCommits implements the payload.RecoveryMessage interface.
|
2024-03-21 19:49:39 +00:00
|
|
|
func (m *recoveryMessage) GetCommits(p dbft.ConsensusPayload[util.Uint256], validators []dbft.PublicKey) []dbft.ConsensusPayload[util.Uint256] {
|
|
|
|
ps := make([]dbft.ConsensusPayload[util.Uint256], len(m.commitPayloads))
|
2019-11-15 10:32:40 +00:00
|
|
|
|
|
|
|
for i, c := range m.commitPayloads {
|
2019-12-02 15:32:14 +00:00
|
|
|
cc := fromPayload(commitType, p.(*Payload), &commit{signature: c.Signature})
|
2024-03-21 20:38:24 +00:00
|
|
|
cc.message.ValidatorIndex = c.ValidatorIndex
|
2024-08-01 10:06:02 +00:00
|
|
|
cc.Sender = validators[c.ValidatorIndex].(*keys.PublicKey).GetScriptHash()
|
2019-12-02 15:32:14 +00:00
|
|
|
cc.Witness.InvocationScript = c.InvocationScript
|
|
|
|
cc.Witness.VerificationScript = getVerificationScript(c.ValidatorIndex, validators)
|
|
|
|
|
|
|
|
ps[i] = cc
|
2019-11-15 10:32:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ps
|
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// PreparationHash implements the payload.RecoveryMessage interface.
|
2019-11-15 10:32:40 +00:00
|
|
|
func (m *recoveryMessage) PreparationHash() *util.Uint256 {
|
|
|
|
return m.preparationHash
|
|
|
|
}
|
|
|
|
|
2024-03-21 19:49:39 +00:00
|
|
|
func getVerificationScript(i uint8, validators []dbft.PublicKey) []byte {
|
2019-12-02 15:32:14 +00:00
|
|
|
if int(i) >= len(validators) {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-08-01 10:06:02 +00:00
|
|
|
pub, ok := validators[i].(*keys.PublicKey)
|
2019-12-02 15:32:14 +00:00
|
|
|
if !ok {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return pub.GetVerificationScript()
|
|
|
|
}
|
|
|
|
|
2019-11-15 10:32:40 +00:00
|
|
|
func fromPayload(t messageType, recovery *Payload, p io.Serializable) *Payload {
|
|
|
|
return &Payload{
|
2021-01-14 11:17:00 +00:00
|
|
|
Extensible: npayload.Extensible{
|
2022-07-28 15:30:14 +00:00
|
|
|
Category: npayload.ConsensusCategory,
|
2021-01-14 11:17:00 +00:00
|
|
|
ValidBlockEnd: recovery.BlockIndex,
|
|
|
|
},
|
|
|
|
message: message{
|
2020-11-17 12:57:50 +00:00
|
|
|
Type: t,
|
2021-01-14 11:17:00 +00:00
|
|
|
BlockIndex: recovery.BlockIndex,
|
2020-11-17 12:57:50 +00:00
|
|
|
ViewNumber: recovery.message.ViewNumber,
|
|
|
|
payload: p,
|
|
|
|
stateRootEnabled: recovery.stateRootEnabled,
|
2019-11-15 10:32:40 +00:00
|
|
|
},
|
2021-03-25 18:59:54 +00:00
|
|
|
network: recovery.network,
|
2019-11-15 10:32:40 +00:00
|
|
|
}
|
|
|
|
}
|