From 82221b0ca74bb19402622d22c029a474d317425a Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 7 Dec 2022 16:51:03 +0300 Subject: [PATCH 1/2] *: fix Neo and NeoGo misuses --- cli/server/server.go | 4 ++-- cli/vm/cli.go | 2 +- cli/wallet/legacy.go | 4 ++-- cli/wallet/wallet.go | 6 +++--- docs/compiler.md | 6 +++--- docs/node-configuration.md | 2 +- docs/rpc.md | 2 +- examples/README.md | 12 ++++++------ examples/token/nep17/nep17.go | 2 +- pkg/compiler/compiler.go | 2 +- pkg/config/netmode/netmode.go | 6 +++--- pkg/consensus/consensus.go | 2 +- pkg/core/interop/runtime/engine.go | 2 +- pkg/core/state/contract.go | 2 +- pkg/core/transaction/transaction.go | 2 +- pkg/crypto/keys/private_key.go | 2 +- pkg/io/size.go | 2 +- pkg/network/server_config.go | 4 ++-- pkg/services/rpcsrv/server.go | 6 +++--- pkg/vm/opcode/opcode.go | 2 +- pkg/vm/vm.go | 2 +- 21 files changed, 37 insertions(+), 37 deletions(-) diff --git a/cli/server/server.go b/cli/server/server.go index 7c2df3ef3..c15c7bd13 100644 --- a/cli/server/server.go +++ b/cli/server/server.go @@ -84,7 +84,7 @@ func NewCommands() []cli.Command { return []cli.Command{ { Name: "node", - Usage: "start a NEO node", + Usage: "start a NeoGo node", UsageText: "neo-go node [--config-path path] [-d] [-p/-m/-t]", Action: startServer, Flags: cfgFlags, @@ -673,7 +673,7 @@ func initBlockChain(cfg config.Config, log *zap.Logger) (*core.Blockchain, stora return chain, store, nil } -// Logo returns Neo-Go logo. +// Logo returns NeoGo logo. func Logo() string { return ` _ ____________ __________ diff --git a/cli/vm/cli.go b/cli/vm/cli.go index e2c988bd5..0747473ea 100644 --- a/cli/vm/cli.go +++ b/cli/vm/cli.go @@ -434,7 +434,7 @@ func NewWithConfig(printLogotype bool, onExit func(int), c *readline.Config, cfg ctl.Writer = l.Stdout() ctl.ErrWriter = l.Stderr() ctl.Version = config.Version - ctl.Usage = "Official VM CLI for Neo-Go" + ctl.Usage = "Official VM CLI for NeoGo" // Override default error handler in order not to exit on error. ctl.ExitErrHandler = func(context *cli.Context, err error) {} diff --git a/cli/wallet/legacy.go b/cli/wallet/legacy.go index 4f12ce256..c490dbf72 100644 --- a/cli/wallet/legacy.go +++ b/cli/wallet/legacy.go @@ -35,7 +35,7 @@ type ( } ) -// newWalletV2FromFile reads a NEO2 wallet from the file. +// newWalletV2FromFile reads a Neo Legacy wallet from the file. // This should be used read-only, no operations are supported on the returned wallet. func newWalletV2FromFile(path string, configPath string) (*walletV2, *string, error) { if len(path) != 0 && len(configPath) != 0 { @@ -127,7 +127,7 @@ func getNumOfThingsFromInstr(script []byte) (int, int, bool) { const minMultisigLen = 37 -// parseMultisigContract accepts a multisig verification script from NEO2 +// parseMultisigContract accepts a multisig verification script from Neo2 // and returns a list of public keys in the same order as in the script. func parseMultisigContract(script []byte) (int, keys.PublicKeys, bool) { // It should contain at least 1 public key. diff --git a/cli/wallet/wallet.go b/cli/wallet/wallet.go index b824b15e2..bc89e05b6 100644 --- a/cli/wallet/wallet.go +++ b/cli/wallet/wallet.go @@ -107,7 +107,7 @@ func NewCommands() []cli.Command { signFlags = append(signFlags, options.RPC...) return []cli.Command{{ Name: "wallet", - Usage: "create, open and manage a NEO wallet", + Usage: "create, open and manage a Neo wallet", Subcommands: []cli.Command{ { Name: "claim", @@ -145,7 +145,7 @@ func NewCommands() []cli.Command { }, { Name: "convert", - Usage: "convert addresses from existing NEO2 NEP6-wallet to NEO3 format", + Usage: "convert addresses from existing Neo Legacy NEP6-wallet to Neo N3 format", UsageText: "neo-go wallet convert -w legacywallet [--wallet-config path] -o n3wallet", Action: convertWallet, Flags: []cli.Flag{ @@ -169,7 +169,7 @@ func NewCommands() []cli.Command { }, { Name: "dump", - Usage: "check and dump an existing NEO wallet", + Usage: "check and dump an existing Neo wallet", UsageText: "neo-go wallet dump -w wallet [--wallet-config path] [-d]", Description: `Prints the given wallet (via -w option or via wallet configuration file) in JSON format to the standard output. If -d is given, private keys are unencrypted and diff --git a/docs/compiler.md b/docs/compiler.md index 7675ba4a6..a38a2dcf6 100644 --- a/docs/compiler.md +++ b/docs/compiler.md @@ -1,6 +1,6 @@ # NeoGo smart contract compiler -The neo-go compiler compiles Go programs to a bytecode that the NEO virtual machine can understand. +The neo-go compiler compiles Go programs to a bytecode that the Neo virtual machine can understand. ## Language compatibility @@ -33,8 +33,8 @@ a dialect of Go rather than a complete port of the language: it's up to the programmer whether assert can be performed successfully. ## VM API (interop layer) -Compiler translates interop function calls into NEO VM syscalls or (for custom -functions) into NEO VM instructions. [Refer to +Compiler translates interop function calls into Neo VM syscalls or (for custom +functions) into Neo VM instructions. [Refer to pkg.go.dev](https://pkg.go.dev/github.com/nspcc-dev/neo-go/pkg/interop) for full API documentation. In general it provides the same level of functionality as Neo .net Framework library. diff --git a/docs/node-configuration.md b/docs/node-configuration.md index 8651e10d4..2bfe30ec5 100644 --- a/docs/node-configuration.md +++ b/docs/node-configuration.md @@ -338,7 +338,7 @@ protocol-related settings described in the table below. | GarbageCollectionPeriod | `uint32` | 10000 | Controls MPT garbage collection interval (in blocks) for configurations with `RemoveUntraceableBlocks` enabled and `KeepOnlyLatestState` disabled. In this mode the node stores a number of MPT trees (corresponding to `MaxTraceableBlocks` and `StateSyncInterval`), but the DB needs to be clean from old entries from time to time. Doing it too often will cause too much processing overhead, doing it too rarely will leave more useless data in the DB. | | Hardforks | `map[string]uint32` | [] | The set of incompatible changes that affect node behaviour starting from the specified height. The default value is an empty set which should be interpreted as "each known hard-fork is applied from the zero blockchain height". The list of valid hard-fork names:
• `Aspidochelone` represents hard-fork introduced in [#2469](https://github.com/nspcc-dev/neo-go/pull/2469) (ported from the [reference](https://github.com/neo-project/neo/pull/2712)). It adjusts the prices of `System.Contract.CreateStandardAccount` and `System.Contract.CreateMultisigAccount` interops so that the resulting prices are in accordance with `sha256` method of native `CryptoLib` contract. `Aspidochelone` is also includes [#2519](https://github.com/nspcc-dev/neo-go/pull/2519) (ported from the [reference](https://github.com/neo-project/neo/pull/2749)). It adjusts the price of `System.Runtime.GetRandom` interop and fixes its vulnerability. | | KeepOnlyLatestState | `bool` | `false` | Specifies if MPT should only store the latest state (or a set of latest states, see `P2PStateExcangeExtensions` section for details). If true, DB size will be smaller, but older roots won't be accessible. This value should remain the same for the same database. | | -| Magic | `uint32` | `0` | Magic number which uniquely identifies NEO network. | +| Magic | `uint32` | `0` | Magic number which uniquely identifies Neo network. | | MaxBlockSize | `uint32` | `262144` | Maximum block size in bytes. | | MaxBlockSystemFee | `int64` | `900000000000` | Maximum overall transactions system fee per block. | | MaxTraceableBlocks | `uint32` | `2102400` | Length of the chain accessible to smart contracts. | `RemoveUntraceableBlocks` should be enabled to use this setting. | diff --git a/docs/rpc.md b/docs/rpc.md index ea19fedda..8a233c302 100644 --- a/docs/rpc.md +++ b/docs/rpc.md @@ -289,4 +289,4 @@ the client as JSON-RPC notifications. More details on that are written in the ## Reference * [JSON-RPC 2.0 Specification](http://www.jsonrpc.org/specification) -* [NEO JSON-RPC 2.0 docs](https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api.html) +* [Neo JSON-RPC 2.0 docs](https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api.html) diff --git a/examples/README.md b/examples/README.md index e548a7f20..0ac37772a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,9 +1,9 @@ -# NEO-GO smart contract examples +# NeoGo smart contract examples `examples` directory contains smart contract examples written in Go. These examples are aimed to demonstrate the basic usage of Go programming -language to write NEO smart contracts as far as to provide a brief introduction -to the NEO-specific interop package application. +language to write Neo smart contracts as far as to provide a brief introduction +to the Neo-specific interop package application. ## Examples structure @@ -22,9 +22,9 @@ See the table below for the detailed examples description. | Example | Description | |--------------------------| --- | -| [engine](engine) | This contract demonstrates how to use `runtime` interop package which implements an API for `System.Runtime.*` NEO system calls. Please, refer to the `runtime` [package documentation](../pkg/interop/doc.go) for details. | +| [engine](engine) | This contract demonstrates how to use `runtime` interop package which implements an API for `System.Runtime.*` Neo system calls. Please, refer to the `runtime` [package documentation](../pkg/interop/doc.go) for details. | | [events](events) | The contract shows how execution notifications with the different arguments types can be sent with the help of `runtime.Notify` function of the `runtime` interop package. Please, refer to the `runtime.Notify` [function documentation](../pkg/interop/runtime/runtime.go) for details. | -| [iterator](iterator) | This example describes a way to work with NEO iterators. Please, refer to the `iterator` [package documentation](../pkg/interop/iterator/iterator.go) for details. | +| [iterator](iterator) | This example describes a way to work with Neo iterators. Please, refer to the `iterator` [package documentation](../pkg/interop/iterator/iterator.go) for details. | | [nft-d](nft-d) | NEP-11 divisible NFT. See NEP-11 token standard [specification](https://github.com/neo-project/proposals/blob/master/nep-11.mediawiki) for details. | | [nft-nd](nft-nd) | NEP-11 non-divisible NFT. See NEP-11 token standard [specification](https://github.com/neo-project/proposals/blob/master/nep-11.mediawiki) for details. | | [nft-nd-nns](nft-nd-nns) | Neo Name Service contract which is NEP-11 non-divisible NFT. The contract implements methods for Neo domain name system managing such as domains registration/transferring, records addition and names resolving. The package also contains tests implemented with [neotest](https://pkg.go.dev/github.com/nspcc-dev/neo-go/pkg/neotest). | @@ -53,7 +53,7 @@ To deploy smart contracts, refer to the Feel free to explore neo-go smart contract development [workshop](https://github.com/nspcc-dev/neo-go-sc-wrkshp) to get the basic -concepts of how to develop, compile, debug and deploy NEO smart contracts written +concepts of how to develop, compile, debug and deploy Neo smart contracts written in go. diff --git a/examples/token/nep17/nep17.go b/examples/token/nep17/nep17.go index 6ee9a474e..7d4154766 100644 --- a/examples/token/nep17/nep17.go +++ b/examples/token/nep17/nep17.go @@ -94,7 +94,7 @@ func (t Token) CanTransfer(ctx storage.Context, from []byte, to []byte, amount i return amountFrom } -// IsUsableAddress checks if the sender is either the correct NEO address or SC address +// IsUsableAddress checks if the sender is either the correct Neo address or SC address func IsUsableAddress(addr []byte) bool { if len(addr) == 20 { diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index 0b75255a0..c8f67e2b3 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -197,7 +197,7 @@ func getBuildInfo(name string, src interface{}) (*buildInfo, error) { }, nil } -// Compile compiles a Go program into a bytecode that can run on the NEO virtual machine. +// Compile compiles a Go program into a bytecode that can run on the Neo virtual machine. // If `r != nil`, `name` is interpreted as a filename, and `r` as file contents. // Otherwise `name` is either a file name or a name of the directory containing source files. func Compile(name string, r io.Reader) ([]byte, error) { diff --git a/pkg/config/netmode/netmode.go b/pkg/config/netmode/netmode.go index 1257f3eab..b0943682c 100644 --- a/pkg/config/netmode/netmode.go +++ b/pkg/config/netmode/netmode.go @@ -3,11 +3,11 @@ package netmode import "strconv" const ( - // MainNet contains magic code used in the NEO main official network. + // MainNet contains magic code used in the Neo main official network. MainNet Magic = 0x334f454e // NEO3 - // TestNet contains magic code used in the NEO testing network. + // TestNet contains magic code used in the Neo testing network. TestNet Magic = 0x3554334e // N3T5 - // PrivNet contains magic code usually used for NEO private networks. + // PrivNet contains magic code usually used for Neo private networks. PrivNet Magic = 56753 // docker privnet // UnitTestNet is a stub magic code used for testing purposes. UnitTestNet Magic = 42 diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index f727fb7ae..7378f4c77 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -34,7 +34,7 @@ import ( // from C# implementation https://github.com/neo-project/neo/blob/master/neo/Ledger/Blockchain.cs#L64 const cacheMaxCapacity = 100 -// defaultTimePerBlock is a period between blocks which is used in NEO. +// defaultTimePerBlock is a period between blocks which is used in Neo. const defaultTimePerBlock = 15 * time.Second // Number of nanoseconds in millisecond. diff --git a/pkg/core/interop/runtime/engine.go b/pkg/core/interop/runtime/engine.go index a2daa48d9..be9e78764 100644 --- a/pkg/core/interop/runtime/engine.go +++ b/pkg/core/interop/runtime/engine.go @@ -152,7 +152,7 @@ func GetTime(ic *interop.Context) error { return nil } -// BurnGas burns GAS to benefit NEO ecosystem. +// BurnGas burns GAS to benefit Neo ecosystem. func BurnGas(ic *interop.Context) error { gas := ic.VM.Estack().Pop().BigInt() if !gas.IsInt64() { diff --git a/pkg/core/state/contract.go b/pkg/core/state/contract.go index 26bd9bf06..6b5048d2c 100644 --- a/pkg/core/state/contract.go +++ b/pkg/core/state/contract.go @@ -15,7 +15,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" ) -// Contract holds information about a smart contract in the NEO blockchain. +// Contract holds information about a smart contract in the Neo blockchain. type Contract struct { ContractBase UpdateCounter uint16 `json:"updatecounter"` diff --git a/pkg/core/transaction/transaction.go b/pkg/core/transaction/transaction.go index 557b20e59..3c201d042 100644 --- a/pkg/core/transaction/transaction.go +++ b/pkg/core/transaction/transaction.go @@ -32,7 +32,7 @@ const ( // ErrInvalidWitnessNum returns when the number of witnesses does not match signers. var ErrInvalidWitnessNum = errors.New("number of signers doesn't match witnesses") -// Transaction is a process recorded in the NEO blockchain. +// Transaction is a process recorded in the Neo blockchain. type Transaction struct { // The trading version which is currently 0. Version uint8 diff --git a/pkg/crypto/keys/private_key.go b/pkg/crypto/keys/private_key.go index bf32ff8af..541c3c42e 100644 --- a/pkg/crypto/keys/private_key.go +++ b/pkg/crypto/keys/private_key.go @@ -17,7 +17,7 @@ import ( "github.com/nspcc-dev/rfc6979" ) -// PrivateKey represents a NEO private key and provides a high level API around +// PrivateKey represents a Neo private key and provides a high level API around // ecdsa.PrivateKey. type PrivateKey struct { ecdsa.PrivateKey diff --git a/pkg/io/size.go b/pkg/io/size.go index 75d0da195..ba83a403e 100644 --- a/pkg/io/size.go +++ b/pkg/io/size.go @@ -35,7 +35,7 @@ func getVarIntSize(value int) int { } // GetVarSize returns the number of bytes in a serialized variable. It supports ints/uints (estimating -// them with variable-length encoding that is used in NEO), strings, pointers to Serializable structures, +// them with variable-length encoding that is used in Neo), strings, pointers to Serializable structures, // slices and arrays of ints/uints or Serializable structures. It's similar to GetVarSize(this T[] value) // used in C#, but differs in that it also supports things like Uint160 or Uint256. func GetVarSize(value interface{}) int { diff --git a/pkg/network/server_config.go b/pkg/network/server_config.go index e1df8b386..15aa47b4b 100644 --- a/pkg/network/server_config.go +++ b/pkg/network/server_config.go @@ -34,8 +34,8 @@ type ( // The network mode the server will operate on. // ModePrivNet docker private network. - // ModeTestNet NEO test network. - // ModeMainNet NEO main network. + // ModeTestNet Neo test network. + // ModeMainNet Neo main network. Net netmode.Magic // Relay determines whether the server is forwarding its inventory. diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index 9bc132cb1..ce1e7f847 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -2312,7 +2312,7 @@ func (s *Server) terminateSession(reqParams params.Params) (interface{}, *neorpc return ok, nil } -// submitBlock broadcasts a raw block over the NEO network. +// submitBlock broadcasts a raw block over the Neo network. func (s *Server) submitBlock(reqParams params.Params) (interface{}, *neorpc.Error) { blockBytes, err := reqParams.Value(0).GetBytesBase64() if err != nil { @@ -2338,7 +2338,7 @@ func (s *Server) submitBlock(reqParams params.Params) (interface{}, *neorpc.Erro }, nil } -// submitNotaryRequest broadcasts P2PNotaryRequest over the NEO network. +// submitNotaryRequest broadcasts P2PNotaryRequest over the Neo network. func (s *Server) submitNotaryRequest(ps params.Params) (interface{}, *neorpc.Error) { if !s.chain.P2PSigExtensionsEnabled() { return nil, neorpc.NewRPCError("P2PSignatureExtensions are disabled", "") @@ -2796,7 +2796,7 @@ func (s *Server) writeHTTPServerResponse(r *params.Request, w http.ResponseWrite } } -// validateAddress verifies that the address is a correct NEO address +// validateAddress verifies that the address is a correct Neo address // see https://docs.neo.org/en-us/node/cli/2.9.4/api/validateaddress.html func validateAddress(addr interface{}) bool { if addr, ok := addr.(string); ok { diff --git a/pkg/vm/opcode/opcode.go b/pkg/vm/opcode/opcode.go index 00eb6bf2a..847e5c400 100644 --- a/pkg/vm/opcode/opcode.go +++ b/pkg/vm/opcode/opcode.go @@ -2,7 +2,7 @@ package opcode //go:generate stringer -type=Opcode -linecomment -// Opcode represents a single operation code for the NEO virtual machine. +// Opcode represents a single operation code for the Neo virtual machine. type Opcode byte // Viable list of supported instruction constants. diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index dcfcd30cd..ecf2fdee7 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -1351,7 +1351,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro v.refs.Remove(toRemove) case *stackitem.Map: index := t.Index(key.Item()) - // NEO 2.0 doesn't error on missing key. + // Neo 2.0 doesn't error on missing key. if index >= 0 { elems := t.Value().([]stackitem.MapElement) key := elems[index].Key From 2d6db6f5c469cc50d0b908707adfd84ecbfc82ff Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 7 Dec 2022 17:30:02 +0300 Subject: [PATCH 2/2] vm: adjust stale comment --- pkg/vm/vm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index ecf2fdee7..950dfed7e 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -1351,7 +1351,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro v.refs.Remove(toRemove) case *stackitem.Map: index := t.Index(key.Item()) - // Neo 2.0 doesn't error on missing key. + // No error on missing key. if index >= 0 { elems := t.Value().([]stackitem.MapElement) key := elems[index].Key