f8c2d269fe
Still not fast enough for connections to be alive for the default case of 64+1 connections. Some of them are start to die after 5 seconds of test: ``` 2024-04-03T14:06:22.5504034Z === RUN TestWSClientsLimit 2024-04-03T14:06:22.5504142Z === RUN TestWSClientsLimit/default 2024-04-03T14:06:22.5504868Z logger.go:146: 2024-04-03T14:04:30.637Z INFO initial gas supply is not set or wrong, setting default value {"InitialGASSupply": "52000000"} 2024-04-03T14:06:22.5505730Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO P2PNotaryRequestPayloadPool size is not set or wrong, setting default value {"P2PNotaryRequestPayloadPoolSize": 1000} 2024-04-03T14:06:22.5506373Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxBlockSize is not set or wrong, setting default value {"MaxBlockSize": 262144} 2024-04-03T14:06:22.5507094Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxBlockSystemFee is not set or wrong, setting default value {"MaxBlockSystemFee": 900000000000} 2024-04-03T14:06:22.5507843Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxTransactionsPerBlock is not set or wrong, using default value {"MaxTransactionsPerBlock": 512} 2024-04-03T14:06:22.5508644Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxValidUntilBlockIncrement is not set or wrong, using default value {"MaxValidUntilBlockIncrement": 5760} 2024-04-03T14:06:22.5509114Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO no storage version found! creating genesis block 2024-04-03T14:06:22.5509788Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO ExtensiblePoolSize is not set or wrong, using default value {"ExtensiblePoolSize": 20} 2024-04-03T14:06:22.5510476Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO SessionPoolSize is not set or wrong, setting default value {"SessionPoolSize": 20} 2024-04-03T14:06:22.5511258Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxIteratorResultItems is not set or wrong, setting default value {"MaxIteratorResultItems": 100} 2024-04-03T14:06:22.5511951Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxFindResultItems is not set or wrong, setting default value {"MaxFindResultItems": 100} 2024-04-03T14:06:22.5512598Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxNEP11Tokens is not set or wrong, setting default value {"MaxNEP11Tokens": 100} 2024-04-03T14:06:22.5513316Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxRequestBodyBytes is not set or wong, setting default value {"MaxRequestBodyBytes": 5242880} 2024-04-03T14:06:22.5514060Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxRequestHeaderBytes is not set or wong, setting default value {"MaxRequestHeaderBytes": 1048576} 2024-04-03T14:06:22.5514755Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO MaxWebSocketClients is not set or wrong, setting default value {"MaxWebSocketClients": 64} 2024-04-03T14:06:22.5515215Z logger.go:146: 2024-04-03T14:04:30 .637Z INFO starting rpc-server {"endpoint": "127.0.0.1:0"} 2024-04-03T14:06:22.5515874Z logger.go:146: 2024-04-03T14:04:31 .200Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5516442Z logger.go:146: 2024-04-03T14:04:31 .200Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5516973Z logger.go:146: 2024-04-03T14:04:31 .226Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5517502Z logger.go:146: 2024-04-03T14:04:31 .388Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5518027Z logger.go:146: 2024-04-03T14:04:31 .398Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5518551Z logger.go:146: 2024-04-03T14:04:31 .420Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5519082Z logger.go:146: 2024-04-03T14:04:31 .577Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5519606Z logger.go:146: 2024-04-03T14:04:31 .587Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5520133Z logger.go:146: 2024-04-03T14:04:31 .624Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5520850Z logger.go:146: 2024-04-03T14:04:31 .780Z INFO persisted to disk {"blocks": 0, "keys": 127, "headerHeight": 0, "blockHeight": 0, "took": "121.8µs"} 2024-04-03T14:06:22.5521398Z logger.go:146: 2024-04-03T14:04:31 .780Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5521925Z logger.go:146: 2024-04-03T14:04:31 .812Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5522452Z logger.go:146: 2024-04-03T14:04:31 .969Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5522975Z logger.go:146: 2024-04-03T14:04:32 .016Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5523507Z logger.go:146: 2024-04-03T14:04:32 .172Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5524033Z logger.go:146: 2024-04-03T14:04:32 .219Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5524555Z logger.go:146: 2024-04-03T14:04:32 .273Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5525081Z logger.go:146: 2024-04-03T14:04:32 .376Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5525604Z logger.go:146: 2024-04-03T14:04:32 .423Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5526131Z logger.go:146: 2024-04-03T14:04:32 .563Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5526691Z logger.go:146: 2024-04-03T14:04:32 .627Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5527254Z logger.go:146: 2024-04-03T14:04:32 .767Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5527777Z logger.go:146: 2024-04-03T14:04:32 .830Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5528304Z logger.go:146: 2024-04-03T14:04:32 .955Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5528824Z logger.go:146: 2024-04-03T14:04:33 .033Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5529352Z logger.go:146: 2024-04-03T14:04:33 .158Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5529871Z logger.go:146: 2024-04-03T14:04:33 .237Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5530395Z logger.go:146: 2024-04-03T14:04:33 .322Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5530921Z logger.go:146: 2024-04-03T14:04:33 .348Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5531472Z logger.go:146: 2024-04-03T14:04:33 .444Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5532031Z logger.go:146: 2024-04-03T14:04:33 .535Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5532555Z logger.go:146: 2024-04-03T14:04:33 .645Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5533084Z logger.go:146: 2024-04-03T14:04:33 .724Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5533604Z logger.go:146: 2024-04-03T14:04:33 .848Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5534132Z logger.go:146: 2024-04-03T14:04:33 .926Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5534662Z logger.go:146: 2024-04-03T14:04:34 .036Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5535190Z logger.go:146: 2024-04-03T14:04:34 .130Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5535712Z logger.go:146: 2024-04-03T14:04:34 .224Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5536231Z logger.go:146: 2024-04-03T14:04:34 .318Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5536758Z logger.go:146: 2024-04-03T14:04:34 .413Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5537277Z logger.go:146: 2024-04-03T14:04:34 .423Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5537805Z logger.go:146: 2024-04-03T14:04:34 .423Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5538329Z logger.go:146: 2024-04-03T14:04:34 .523Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5538855Z logger.go:146: 2024-04-03T14:04:34 .602Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5539382Z logger.go:146: 2024-04-03T14:04:34 .612Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5539908Z logger.go:146: 2024-04-03T14:04:34 .712Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5540431Z logger.go:146: 2024-04-03T14:04:34 .805Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5540956Z logger.go:146: 2024-04-03T14:04:34 .915Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5541515Z logger.go:146: 2024-04-03T14:04:34 .993Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5542070Z logger.go:146: 2024-04-03T14:04:35 .118Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5542599Z logger.go:146: 2024-04-03T14:04:35 .181Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5543125Z logger.go:146: 2024-04-03T14:04:35 .307Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5543650Z logger.go:146: 2024-04-03T14:04:35 .385Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5544169Z logger.go:146: 2024-04-03T14:04:35 .426Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5544695Z logger.go:146: 2024-04-03T14:04:35 .510Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5545262Z logger.go:146: 2024-04-03T14:04:35 .589Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5545839Z logger.go:146: 2024-04-03T14:04:35 .698Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5546421Z logger.go:146: 2024-04-03T14:04:35 .777Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5547045Z logger.go:146: 2024-04-03T14:04:35 .902Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5547593Z logger.go:146: 2024-04-03T14:04:35 .980Z DEBUG processing rpc request {"method": "getversion", "params": "[]"} 2024-04-03T14:06:22.5551421Z subscription_test.go:620: 2024-04-03T14:06:22.5551977Z Error Trace: D:/a/neo-go/neo-go/pkg/services/rpcsrv/subscription_test.go:620 2024-04-03T14:06:22.5552611Z C:/hostedtoolcache/windows/go/1.22.1/x64/src/runtime/asm_amd64.s:1695 2024-04-03T14:06:22.5552821Z Error: Received unexpected error: 2024-04-03T14:06:22.5553328Z read tcp 127.0 .0.1:51969->127.0.0.1:51909: i/o timeout 2024-04-03T14:06:22.5553535Z Test: TestWSClientsLimit/default 2024-04-03T14:06:22.5553676Z subscription_test.go:620: 2024-04-03T14:06:22.5554223Z Error Trace: D:/a/neo-go/neo-go/pkg/services/rpcsrv/subscription_test.go:620 2024-04-03T14:06:22.5554831Z C:/hostedtoolcache/windows/go/1.22.1/x64/src/runtime/asm_amd64.s:1695 2024-04-03T14:06:22.5555036Z Error: Received unexpected error: 2024-04-03T14:06:22.5555521Z read tcp 127.0 .0.1:51970->127.0.0.1:51909: i/o timeout 2024-04-03T14:06:22.5555723Z Test: TestWSClientsLimit/default 2024-04-03T14:06:22.5555860Z subscription_test.go:620: 2024-04-03T14:06:22.5556336Z Error Trace: D:/a/neo-go/neo-go/pkg/services/rpcsrv/subscription_test.go:620 2024-04-03T14:06:22.5556953Z C:/hostedtoolcache/windows/go/1.22.1/x64/src/runtime/asm_amd64.s:1695 2024-04-03T14:06:22.5557160Z Error: Received unexpected error: 2024-04-03T14:06:22.5557636Z read tcp 127.0 .0.1:51973->127.0.0.1:51909: i/o timeout 2024-04-03T14:06:22.5557831Z Test: TestWSClientsLimit/default 2024-04-03T14:06:22.5557967Z subscription_test.go:620: 2024-04-03T14:06:22.5558437Z Error Trace: D:/a/neo-go/neo-go/pkg/services/rpcsrv/subscription_test.go:620 2024-04-03T14:06:22.5559028Z C:/hostedtoolcache/windows/go/1.22.1/x64/src/runtime/asm_amd64.s:1695 2024-04-03T14:06:22.5559229Z Error: Received unexpected error: 2024-04-03T14:06:22.5559696Z read tcp 127.0 .0.1:51971->127.0.0.1:51909: i/o timeout 2024-04-03T14:06:22.5559891Z Test: TestWSClientsLimit/default 2024-04-03T14:06:22.5560024Z subscription_test.go:620: 2024-04-03T14:06:22.5560490Z Error Trace: D:/a/neo-go/neo-go/pkg/services/rpcsrv/subscription_test.go:620 2024-04-03T14:06:22.5561142Z C:/hostedtoolcache/windows/go/1.22.1/x64/src/runtime/asm_amd64.s:1695 2024-04-03T14:06:22.5561371Z Error: Received unexpected error: 2024-04-03T14:06:22.5561849Z read tcp 127.0 .0.1:51972->127.0.0.1:51909: i/o timeout 2024-04-03T14:06:22.5562043Z Test: TestWSClientsLimit/default 2024-04-03T14:06:22.5562179Z subscription_test.go:630: 2024-04-03T14:06:22.5562638Z Error Trace: D:/a/neo-go/neo-go/pkg/services/rpcsrv/subscription_test.go:630 2024-04-03T14:06:22.5562879Z Error: An error is expected but got nil. 2024-04-03T14:06:22.5563073Z Test: TestWSClientsLimit/default 2024-04-03T14:06:22.5563361Z Messages: The connection beyond the limit should fail 2024-04-03T14:06:22.5563886Z logger.go:146: 2024-04-03T14:04:36 .481Z INFO shutting down RPC server {"endpoint": "127.0.0 .1:51908"} ``` Close #3379 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io> |
||
---|---|---|
.docker | ||
.github | ||
cli | ||
config | ||
docs | ||
examples | ||
internal | ||
pkg | ||
scripts | ||
.dockerignore | ||
.gitignore | ||
.gitmodules | ||
.golangci.yml | ||
CHANGELOG.md | ||
codecov.yml | ||
CONTRIBUTING.md | ||
Dockerfile | ||
Dockerfile.wsc | ||
go.mod | ||
go.sum | ||
LICENSE.md | ||
Makefile | ||
neo-go.service.template | ||
README.md | ||
ROADMAP.md |
Go Node and SDK for the Neo blockchain.
Overview
NeoGo is a complete platform for distributed application development built on top of and compatible with the Neo project. This includes, but not limited to (see documentation for more details):
- Consensus node
- RPC node & client
- CLI tool
- Smart contract compiler
- Neo virtual machine
- Smart contract examples
- Oracle service
- State validation service
The protocol implemented here is Neo N3-compatible, however you can also find an implementation of the Neo Legacy protocol in the master-2.x branch and releases before 0.80.0 (0.7X.Y track).
Getting started
Installation
NeoGo is distributed as a single binary that includes all the functionality
provided (but smart contract compiler requires Go compiler to operate). You
can grab it from releases
page, use a Docker image (see
Docker Hub for various releases of
NeoGo, :latest
points to the latest release) or build yourself.
Building
Building NeoGo requires Go 1.20+ and make
:
make
The resulting binary is bin/neo-go
. Notice that using some random revision
from the master
branch is not recommended (it can have any number of
incompatibilities and bugs depending on the development stage), please use
tagged released versions.
Building on Windows
To build NeoGo on Windows platform we recommend you to install make
from MinGW
package. Then, you can build NeoGo with:
make
The resulting binary is bin/neo-go.exe
.
Running a node
A node needs to connect to some network, either local one (usually referred to
as privnet
) or public (like mainnet
or testnet
). Network configuration
is stored in a file and NeoGo allows you to store multiple files in one
directory (./config
by default) and easily switch between them using network
flags.
To start Neo node on a private network, use:
./bin/neo-go node
Or specify a different network with an appropriate flag like this:
./bin/neo-go node --mainnet
Available network flags:
--mainnet, -m
--privnet, -p
--testnet, -t
To run a consensus/committee node, refer to consensus documentation.
If you're running a node on Windows, please turn off or configure Windows Firewall appropriately (allowing inbound connections to the P2P port).
Docker
By default, the CMD
is set to run a node on privnet
. So, to do this, simply run:
docker run -d --name neo-go -p 20332:20332 -p 20331:20331 nspccdev/neo-go
Which will start a node on privnet
and expose node's ports 20332
(P2P
protocol) and 20331
(JSON-RPC server).
Importing mainnet/testnet dump files
If you want to jump-start your mainnet or testnet node with chain archives provided by NGD, follow these instructions:
$ wget .../chain.acc.zip # chain dump file
$ unzip chain.acc.zip
$ ./bin/neo-go db restore -m -i chain.acc # for testnet use '-t' flag instead of '-m'
The process differs from the C# node in that block importing is a separate mode. After it ends, the node can be started normally.
Running a private network
Refer to consensus node documentation.
Smart contract development
Please refer to NeoGo smart contract development workshop that shows some simple contracts that can be compiled/deployed/run using NeoGo compiler, SDK and a private network. For details on how Go code is translated to Neo VM bytecode and what you can and can not do in a smart contract, please refer to the compiler documentation.
Refer to examples for more Neo smart contract examples written in Go.
Wallets
NeoGo wallet is just a NEP-6 file that is used by CLI commands to sign various things. CLI commands are not a direct part of the node, but rather a part of the NeoGo binary, their implementations use RPC to query data from the blockchain and perform any required actions. It's not required to open a wallet on an RPC node (unless your node provides some service for the network like consensus or oracle nodes do).
Monitoring
NeoGo provides Prometheus and Pprof services that can be enabled in the node in order to provide additional monitoring and debugging data.
Configuring any of the two services is easy, add the following section (Pprof
instead of Prometheus
if you need that) to the respective config/protocol.*.yml
:
Prometheus:
Enabled: true
Addresses:
- ":2112"
where you can switch on/off and define port. Prometheus is enabled and Pprof is disabled by default.
Contributing
Feel free to contribute to this project after reading the contributing guidelines.
Before starting to work on a certain topic, create a new issue first describing the feature/topic you are going to implement.
Contact
- @AnnaShaleva on GitHub
- @roman-khimov on GitHub
- Reach out to us on the Neo Discord channel
License
- Open-source MIT