Commit graph

8078 commits

Author SHA1 Message Date
Anna Shaleva
4b10f23aec
Merge pull request #3638 from nspcc-dev/uploader-retry-errors
cli: fix `upload-bin` error handling
2024-10-23 16:00:38 +03:00
Ekaterina Pavlova
a5e9ab6979 cli: verify index file construction in upload-bin command
Verify that there are no empty OIDs in the constructed index file, as
empty payloads can result in improperly set attributes, leading to empty
OIDs being added to the index file.

Close #3628

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-23 15:30:12 +03:00
Ekaterina Pavlova
42c8e40eaa cli: add retry to all requests to NeoFS in upload-bin
Add retry to `NetworkInfo` and `uploadObj`.

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-23 15:30:12 +03:00
Ekaterina Pavlova
8b43c33e44 cli: extend object attribute parsing error in upload-bin
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-23 15:30:12 +03:00
Ekaterina Pavlova
5b793bcf1b cli: fix process termination in upload-bin command
Add a return statement to properly handle errors, ensuring the process
terminates as expected.

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-23 15:30:12 +03:00
Ekaterina Pavlova
e83b3e4839 cli: fix error handling in upload-bin command
Fix shared global error reuse.

Close #3634

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-23 15:30:12 +03:00
Anna Shaleva
0b79901b7f
Merge pull request #3637 from nspcc-dev/attributes
BlockFetcher/BlockUploader: fix and add additional attributes
2024-10-23 15:07:09 +03:00
Ekaterina Pavlova
c47d4e6c5b BlockFetcher/BlockUploader: fix and add additional attributes
Capitalize block objects and index file objects attributes.
Add network magic attribute to container.

Close #3631

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-23 13:52:06 +03:00
Anna Shaleva
e82d9a179c
Merge pull request #3636 from nspcc-dev/blockfetcher-errors
blockfetcher: add more details to errors
2024-10-22 16:29:28 +03:00
Ekaterina Pavlova
8a154d9189 blockfetcher: add more details to errors
Close #3629

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-22 14:11:27 +03:00
Anna Shaleva
a0def2e5d2
Merge pull request #3633 from nspcc-dev/fix-empty-obj-uploading
cli: fix empty block uploading in `util upload-bin`
2024-10-22 10:12:17 +03:00
Ekaterina Pavlova
e00d7fec7f cli: fix empty block uploading in util upload-bin
In case of uploading retry already drained bin buffer is returned in
`bw.Bytes`, which leads to empty block uploading.

Close #3630

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-21 22:44:06 +03:00
Roman Khimov
29bb3ff1cf
Merge pull request #3627 from nspcc-dev/fix-ntf
core: prove contract notifications count is not restricted
2024-10-18 21:16:56 +03:00
Anna Shaleva
c962edcf47
Merge pull request #3625 from nspcc-dev/uploader-timeouts
cli: increase NeoFS pool deadlines for upload-bin command
2024-10-18 20:02:24 +03:00
Ekaterina Pavlova
41873e35c6 cli: increase NeoFS pool deadlines for upload-bin command
`defaultDialTimeout` and `defaultStreamTimeout` increased because of
`code = DeadlineExceeded desc = context deadline exceeded`

Close #3620

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-18 19:59:27 +03:00
Anna Shaleva
7b09812069 core: refactor TestEngineLimits
Replace repetative hand-written code with generated one.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-18 19:10:47 +03:00
Anna Shaleva
b5b89881b7 core: prove contract notifications count is not restricted
A part of #3490.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-18 19:10:34 +03:00
Anna Shaleva
8e1fdd5d70
Merge pull request #3626 from nspcc-dev/uploader-errors
cli: adjust error of `upload-bin` command
2024-10-18 14:28:02 +03:00
Ekaterina Pavlova
87bbff9831 cli: adjust error of upload-bin command
Miscalculation leads to negative values in errors:
```
2024-10-17 11:26:56.790	failed to fetch the latest missing block index
 from container: search of index files failed for batch with indexes
 from -260000 to -250000: error during object IDs iteration: context
 deadline exceeded
```

Close #3621

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-18 14:26:17 +03:00
Anna Shaleva
14ea5a8d32
Merge pull request #3582 from nspcc-dev/block-fetcher-commands
NeoFS block storage: add uploading commands
2024-10-17 12:10:06 +03:00
Ekaterina Pavlova
6199240598 cli: add upload-bin
This command is used for keeping container with blocks for
blockfetcher updated.

Close #3578

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-17 11:56:07 +03:00
Ekaterina Pavlova
59fab5d654 blockfetcher: adjust index file numeration from 0
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-16 19:23:56 +03:00
Ekaterina Pavlova
852dcb0f64 config, docs: adjust NeoFSBlockFetcher index file and time attributes
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-16 19:23:56 +03:00
Ekaterina Pavlova
2435484dc4 neofs: add ObjectSearchInitter
With ObjectSearchInitter ObjectSearch can can be done by both NeoFS SDK
client and pool.

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-16 19:23:56 +03:00
Roman Khimov
86ed214e8a
Merge pull request #3616 from nspcc-dev/coverage-enh
neotest: coverage collection polishing
2024-10-16 16:14:04 +03:00
Anna Shaleva
c1444d45a4 nns: update neo-go dependency
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-16 16:04:54 +03:00
Anna Shaleva
d8e945978a neotest: sort coverage blocks within a test scope
Make the behaviour similar to the `go test` output. It's not a problem
for the `go cover` tool, but the sorted file is easier to debug and analize.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-16 16:03:46 +03:00
Anna Shaleva
c747bb8ff7 neotest: preallocate coverage blocks list
And always use pointers for coverage block processing, dereference is
excessive in this context.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-15 15:44:54 +03:00
Anna Shaleva
49f2e1dc64 neotest: gracefully report about coverage setup error
Don't use panic when we can use t.Fatal.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-15 15:44:54 +03:00
Anna Shaleva
2dc588ea95 neotest: distinguish coverage modes
Use calls frequency calculated by executor in the final coverage
profile for `atomic` cover mode. Support only `set` cover mode for now
due to #3587.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-15 15:44:53 +03:00
Anna Shaleva
a9242535db
Merge pull request #3605 from nspcc-dev/fix-linter
Enable linter for every module
2024-10-11 14:16:44 +03:00
Anna Shaleva
8bdb8afaf5 Makefile: adjust lint target
Enable linter for examples, scripts and interop packages.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-11 12:41:06 +03:00
Anna Shaleva
c5c64f5f07 interop: fix linter issues
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-11 12:41:06 +03:00
Anna Shaleva
25b353c9f8 workflows: enable lint for interop package
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-11 12:41:06 +03:00
Anna Shaleva
9fb291d5df workflows: add linter for scripts
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-11 12:40:55 +03:00
Anna Shaleva
524ba5fd1b examples: fix linter issues
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-11 12:24:02 +03:00
Anna Shaleva
949ed4f2ea workflows: enable linter for example contracts
Avoid situations like 9f93123301.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-10 11:36:45 +03:00
Anna Shaleva
8ee13cc35e scripts: keep go.mod tidy
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-10 11:36:45 +03:00
Anna Shaleva
8ed3ab8c82
Merge pull request #3604 from nspcc-dev/fix-nns-test-with-coverage
Fix nns test with coverage
2024-10-09 18:49:00 +03:00
Roman Khimov
ad41d0f9c7 neotest: add a warning to CompileSource, it's bad for coverage
$ go tool cover -html=coverage.txt -o coverage.html
cover: can't read "/home/rik/dev/neo-go/examples/nft-nd-nns/contract.go": open /home/rik/dev/neo-go/examples/nft-nd-nns/contract.go: no such file or directory

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-10-09 15:53:01 +03:00
Roman Khimov
594612bbdf nft-nd-nns: update to coverage-enabled NeoGo
It's to be updated to the final release eventually, but it's a good contract
to showcase the coverage feature, quite a lot of code with good overall
percentage.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-10-09 15:52:06 +03:00
Roman Khimov
9f93123301 nft-nd-nns: fix test runs
./nns_test.go:161:6: declared and not used: i

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-10-09 15:50:18 +03:00
Roman Khimov
0968c3a81f
Merge pull request #3600 from nspcc-dev/fix-cover-panic
neotest: don't collect coverage for contracts with empty DI
2024-10-07 19:15:39 +03:00
Anna Shaleva
7fac3bcd6f neotest: don't collect coverage for contracts with empty DI
Users are allowed to provide any contract to neotest, including those
contracts that don't have DebugInfo filled in. Neotest should filter
them out, otherwise panic may occur on attempt to write coverage profile:
```
--- FAIL: TestDeploys (0.01s)
panic: runtime error: invalid memory address or nil pointer dereference
	panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xc6f5b5]

goroutine 1735 [running]:
testing.tRunner.func1.2({0xd7aa80, 0x1723f60})
	/usr/local/go/src/testing/testing.go:1631 +0x24a
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1634 +0x377
panic({0xd7aa80?, 0x1723f60?})
	/usr/local/go/src/runtime/panic.go:770 +0x132
github.com/nspcc-dev/neo-go/pkg/neotest.processCover()
	/home/anna/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.106.4-0.20241007094345-11151938b9bd/pkg/neotest/coverage.go:143 +0xd5
github.com/nspcc-dev/neo-go/pkg/neotest.writeCoverageReport({0x10c6260, 0xc00033a378})
	/home/anna/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.106.4-0.20241007094345-11151938b9bd/pkg/neotest/coverage.go:123 +0x4b
github.com/nspcc-dev/neo-go/pkg/neotest.reportCoverage({0x10db278, 0xc00021a000})
	/home/anna/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.106.4-0.20241007094345-11151938b9bd/pkg/neotest/coverage.go:118 +0x165
github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).trackCoverage.func1()
	/home/anna/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.106.4-0.20241007094345-11151938b9bd/pkg/neotest/basic.go:182 +0x1b
testing.(*common).Cleanup.func1()
	/usr/local/go/src/testing/testing.go:1175 +0x10f
testing.(*common).runCleanup(0xc00021a000, 0x58d7c0?)
	/usr/local/go/src/testing/testing.go:1353 +0xdb
testing.(*common).runCleanup.func2()
	/usr/local/go/src/testing/testing.go:1337 +0x47
panic({0xd7aa80?, 0x1723f60?})
```

An example of such partially-filled contract is:
a8d5e001a2/tests/deploys_test.go (L13)
a8d5e001a2/contracts/contracts.go (L96)

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-07 17:51:19 +03:00
Anna Shaleva
11151938b9
Merge pull request #3599 from Slava0135/fix-modmul
vm: fix modmul operation
2024-10-07 12:43:45 +03:00
slava0135
9aca090644 vm: fix modmul operation
Signed-off-by: Slava0135 <super.novalskiy_0135@inbox.ru>
2024-10-07 11:02:01 +03:00
Anna Shaleva
c960a7eb47
Merge pull request #3594 from nspcc-dev/unclaimed-gas
vm: fix unclaimedGas calculation
2024-10-04 17:03:21 +03:00
Ekaterina Pavlova
02727b14b7 vm: fix unclaimedGas calculation
Fix difference with C#:
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST
http://seed1t5.neo.org:20332 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   429    0   269  100   160    582    346 --:--:-- --:--:-- --:--:--
   930
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : null,
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "0"
               }
            ],
            "trigger" : "Application",
            "vmstate" : "HALT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST  https://rpc
.t5.n3.nspcc.ru:20331 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   583  100   423  100   160   1424    538 --:--:-- --:--:-- --:--:--
  1969
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : "at instruction 120 (SYSCALL): can't calculate
             bonus of height unequal (BlockHeight + 1)",
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "4704605"
               },
               {
                  "type" : "ByteString",
                  "value" : "KfYYlDe/fxqqqm1yr7o5XLnQ7uk="
               }
            ],
            "trigger" : "Application",
            "vmstate" : "FAULT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}

```
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % ./bin/neo-go contract
invokefunction -r https://rpc.t5.n3.nspcc.ru:20331 -w ./testnet_wallet
.json 1e6f88377a6c6bc4f683a5fc61eed5645ec5f123 unclaimedGas
e9eed0b95c39baaf726daaaa1a7fbf379418f629 4704605
Enter account NWtk9HYWsf1njtSzA3XNgwZXRtriACcJ9G password >
Warning: FAULT VM state returned from the RPC node: at instruction 120
(SYSCALL): can't calculate bonus of height unequal (BlockHeight + 1).
Use --force flag to send the transaction anyway.
```

Close #3589

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-10-04 16:55:12 +03:00
Roman Khimov
b1068b1ab9
Merge pull request #3596 from nspcc-dev/fix-test 2024-10-04 13:06:57 +03:00
Anna Shaleva
fadfac7041 native: fix formulae of unclaimed GAS calculation in test
The behaviour is the same, the result is also the same, but the meaning
is fixed.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-04 11:59:48 +03:00