diff --git a/cli/cmdargs/parser.go b/cli/cmdargs/parser.go index 12cf6b180..367a68baa 100644 --- a/cli/cmdargs/parser.go +++ b/cli/cmdargs/parser.go @@ -224,6 +224,7 @@ func parseCosigner(c string) (transaction.Signer, error) { res.AllowedGroups = append(res.AllowedGroups, pub) } + default: } } return res, nil diff --git a/pkg/compiler/codegen.go b/pkg/compiler/codegen.go index c0f670de3..0b75167ff 100644 --- a/pkg/compiler/codegen.go +++ b/pkg/compiler/codegen.go @@ -946,6 +946,7 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor { expectedLen = 20 case smartcontract.Hash256Type: expectedLen = 32 + default: } if expectedLen != -1 && expectedLen != len(n.Elts) { c.prog.Err = fmt.Errorf("%s type must have size %d", tn.Obj().Name(), expectedLen) @@ -1225,10 +1226,10 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor { case token.CONTINUE: post := c.getLabelOffset(labelPost, label) emit.Jmp(c.prog.BinWriter, opcode.JMPL, post) + default: + return nil } - return nil - case *ast.LabeledStmt: c.nextLabel = n.Label.Name @@ -1722,6 +1723,7 @@ func getJumpForToken(tok token.Token, typ types.Type) (opcode.Opcode, bool) { } return opcode.JMPNEL, true } + default: } return 0, false } @@ -2393,6 +2395,7 @@ func (c *codegen) writeJumps(b []byte) ([]byte, error) { return nil, fmt.Errorf("func '%s' has %d local variables (maximum is 255)", info.name, info.count) } b[nextIP-2] = byte(info.count) + default: } } @@ -2502,6 +2505,7 @@ func removeNOPs(b []byte, nopOffsets []int, sequencePoints map[string][]DebugSeq finallyOffset := int(int32(binary.LittleEndian.Uint32(arg))) finallyOffset += calcOffsetCorrection(ip, ip+finallyOffset, nopOffsets) binary.LittleEndian.PutUint32(arg, uint32(finallyOffset)) + default: } } diff --git a/pkg/compiler/inline_test.go b/pkg/compiler/inline_test.go index b3c21bcfb..610ad979a 100644 --- a/pkg/compiler/inline_test.go +++ b/pkg/compiler/inline_test.go @@ -47,6 +47,7 @@ func checkInstrCount(t *testing.T, src string, expectedSSlotCount, expectedCall, if ctx.IP() == mainStart && expectedLocalsMain >= 0 { require.Equal(t, expectedLocalsMain, int(param[0])) } + default: } if ctx.IP() == ctx.LenInstr() { break diff --git a/pkg/consensus/recovery_message.go b/pkg/consensus/recovery_message.go index 3f805f5a9..040add2b8 100644 --- a/pkg/consensus/recovery_message.go +++ b/pkg/consensus/recovery_message.go @@ -180,6 +180,7 @@ func (m *recoveryMessage) AddPayload(p dbft.ConsensusPayload[util.Uint256]) { Signature: p.GetCommit().(*commit).signature, InvocationScript: p.(*Payload).Witness.InvocationScript, }) + default: } } diff --git a/pkg/core/native/designate.go b/pkg/core/native/designate.go index b0d1f2296..de6a7b9be 100644 --- a/pkg/core/native/designate.go +++ b/pkg/core/native/designate.go @@ -272,6 +272,7 @@ func (s *Designate) notifyRoleChanged(v *roleData, r noderoles.Role) { if s.StateRootService != nil { s.StateRootService.UpdateStateValidators(v.height, v.nodes.Copy()) } + default: } } diff --git a/pkg/neorpc/rpcevent/filter.go b/pkg/neorpc/rpcevent/filter.go index 9b0bd0c69..744b59f39 100644 --- a/pkg/neorpc/rpcevent/filter.go +++ b/pkg/neorpc/rpcevent/filter.go @@ -89,6 +89,7 @@ func Matches(f Comparator, r Container) bool { } } return senderOk && signerOK && typeOk + default: + return false } - return false } diff --git a/pkg/network/server.go b/pkg/network/server.go index 6c9c3df64..4916eb4d5 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -1446,6 +1446,7 @@ func (s *Server) handleMessage(peer Peer, msg *Message) error { return s.handlePong(peer, pong) case CMDVersion, CMDVerack: return fmt.Errorf("received '%s' after the handshake", msg.Command.String()) + default: } } else { switch msg.Command { diff --git a/pkg/network/server_test.go b/pkg/network/server_test.go index 50d70d7f0..ea3fb47ba 100644 --- a/pkg/network/server_test.go +++ b/pkg/network/server_test.go @@ -536,6 +536,7 @@ func (s *Server) testHandleGetData(t *testing.T, invType payload.InventoryType, case CMDNotFound: require.Equal(t, notFound, msg.Payload.(*payload.Inventory).Hashes) recvNotFound.Store(true) + default: } } @@ -818,6 +819,7 @@ func TestHandleGetMPTData(t *testing.T) { case CMDMPTData: require.Equal(t, found, msg.Payload) recvResponse.Store(true) + default: } } hs := []util.Uint256{r1, r2} diff --git a/pkg/services/notary/core_test.go b/pkg/services/notary/core_test.go index 65758da14..412e7346a 100644 --- a/pkg/services/notary/core_test.go +++ b/pkg/services/notary/core_test.go @@ -232,6 +232,7 @@ func TestNotary(t *testing.T) { script, err = smartcontract.CreateMultiSigRedeemScript(requesters[i].m, pubs) require.NoError(t, err) nKeys += uint8(len(requesters[i].accounts)) + default: } signers[i] = transaction.Signer{ Account: hash.Hash160(script), @@ -294,6 +295,7 @@ func TestNotary(t *testing.T) { nSigs++ case notary.MultiSignature: nSigs += r.m + default: } } nSigners := len(requesters) + 1 diff --git a/pkg/services/oracle/jsonpath/jsonpath.go b/pkg/services/oracle/jsonpath/jsonpath.go index a43c7b62a..c46b270d0 100644 --- a/pkg/services/oracle/jsonpath/jsonpath.go +++ b/pkg/services/oracle/jsonpath/jsonpath.go @@ -64,6 +64,7 @@ func Get(path string, value any) ([]any, bool) { objs, ok = p.processDot(objs) case pathLeftBracket: objs, ok = p.processLeftBracket(objs) + default: } if !ok || maxObjects < len(objs) { diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index 2098a89ba..f25beae04 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -2758,6 +2758,7 @@ func (s *Server) subscribe(reqParams params.Params, sub *subscriber) (any, *neor flt := new(neorpc.ExecutionFilter) err = jd.Decode(flt) filter = *flt + default: } if err != nil { return nil, neorpc.WrapErrorWithData(neorpc.ErrInvalidParams, err.Error()) @@ -2832,6 +2833,7 @@ func (s *Server) subscribeToChannel(event neorpc.EventID) { s.chain.SubscribeForHeadersOfAddedBlocks(s.blockHeaderCh) } s.blockHeaderSubs++ + default: } } @@ -2892,6 +2894,7 @@ func (s *Server) unsubscribeFromChannel(event neorpc.EventID) { if s.blockHeaderSubs == 0 { s.chain.UnsubscribeFromHeadersOfAddedBlocks(s.blockHeaderCh) } + default: } } diff --git a/pkg/smartcontract/manifest/permission.go b/pkg/smartcontract/manifest/permission.go index 254391981..c8ac08d82 100644 --- a/pkg/smartcontract/manifest/permission.go +++ b/pkg/smartcontract/manifest/permission.go @@ -105,8 +105,9 @@ func (d PermissionDesc) Compare(d1 PermissionDesc) int { return d.Hash().Compare(d1.Hash()) case PermissionGroup: return d.Group().Cmp(d1.Group()) + default: + return 0 // wildcard or type that we can't compare. } - return 0 // wildcard or type that we can't compare. } // Equals returns true if both PermissionDesc values are the same. diff --git a/pkg/smartcontract/param_type.go b/pkg/smartcontract/param_type.go index cb32c72ab..80705ed7e 100644 --- a/pkg/smartcontract/param_type.go +++ b/pkg/smartcontract/param_type.go @@ -175,7 +175,7 @@ func (pt ParamType) EncodeDefaultValue(w *io.BinWriter) { emit.Bytes(w, b[:Hash256Len]) case PublicKeyType: emit.Bytes(w, b[:PublicKeyLen]) - case ArrayType, MapType, InteropInterfaceType, VoidType: + case ArrayType, MapType, InteropInterfaceType, VoidType, UnknownType: } } diff --git a/pkg/smartcontract/rpcbinding/binding.go b/pkg/smartcontract/rpcbinding/binding.go index 7736e2ed6..de8fb8668 100644 --- a/pkg/smartcontract/rpcbinding/binding.go +++ b/pkg/smartcontract/rpcbinding/binding.go @@ -564,8 +564,9 @@ func extendedTypeToGo(et binding.ExtendedType, named map[string]binding.Extended return "any", "" case smartcontract.VoidType: return "", "" + default: + panic("unreachable") } - panic("unreachable") } func etTypeConverter(et binding.ExtendedType, v string) string { @@ -686,8 +687,9 @@ func etTypeConverter(et binding.ExtendedType, v string) string { return "item.Value(), nil" case smartcontract.VoidType: return "" + default: + panic("unreachable") } - panic("unreachable") } func scTypeToGo(name string, typ smartcontract.ParamType, cfg *binding.Config) (string, string) { @@ -870,6 +872,7 @@ func addETImports(et binding.ExtendedType, named map[string]binding.ExtendedType case smartcontract.ArrayType: imports["errors"] = struct{}{} imports["fmt"] = struct{}{} + default: } if et.Value != nil { addETImports(*et.Value, named, imports) diff --git a/pkg/vm/contract_checks.go b/pkg/vm/contract_checks.go index 51bb68040..6a1d053ed 100644 --- a/pkg/vm/contract_checks.go +++ b/pkg/vm/contract_checks.go @@ -190,6 +190,7 @@ func IsScriptCorrect(script []byte, methods bitfield.Field) error { if typ == stackitem.AnyT && op != opcode.NEWARRAYT { return fmt.Errorf("using type ANY is incorrect at offset %d", ctx.ip) } + default: } } if !jumps.IsSubset(instrs) { diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index f9eac2e92..8db2004ca 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -914,6 +914,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro n = 4 case opcode.REVERSEN: n = toInt(v.estack.Pop().BigInt()) + default: } if err := v.estack.ReverseTop(n); err != nil { panic(err.Error()) @@ -1122,6 +1123,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro res = cmp == 1 case opcode.GE: res = cmp >= 0 + default: } } v.estack.PushItem(stackitem.Bool(res))