Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: use non-default scrypt parameters for encrypting/decrypting #2001

Merged
merged 3 commits into from
Jun 11, 2021

Conversation

AnnaShaleva
Copy link
Member

This PR should fix Tests Github Workflow failing due to timeout while decrypting account:

2021-05-31T08:30:46.4452214Z goroutine 4306 [runnable]:
2021-05-31T08:30:46.4452963Z golang.org/x/crypto/scrypt.salsaXOR(0xc00034d7e8, 0xc00017d980, 0x1a0, 0x1a0, 0xc00017dcc0, 0xd0, 0xd0)
2021-05-31T08:30:46.4454249Z 	/home/runner/go/pkg/mod/golang.org/x/crypto@v0.0.0-20190701094942-4def268fd1a4/scrypt/scrypt.go:34 +0x118b
2021-05-31T08:30:46.4455237Z golang.org/x/crypto/scrypt.blockMix(0xc00034d7e8, 0xc00017d800, 0x200, 0x200, 0xc00017dc00, 0x100, 0x100, 0x8)
2021-05-31T08:30:46.4456510Z 	/home/runner/go/pkg/mod/golang.org/x/crypto@v0.0.0-20190701094942-4def268fd1a4/scrypt/scrypt.go:134 +0x258
2021-05-31T08:30:46.4457470Z golang.org/x/crypto/scrypt.smix(0xc00045fc00, 0x400, 0x400, 0x8, 0x4000, 0xc002354000, 0x400000, 0x400000, 0xc00017d800, 0x200, ...)
2021-05-31T08:30:46.4458729Z 	/home/runner/go/pkg/mod/golang.org/x/crypto@v0.0.0-20190701094942-4def268fd1a4/scrypt/scrypt.go:156 +0x4e5
2021-05-31T08:30:46.4459795Z golang.org/x/crypto/scrypt.Key(0xc00040cbe8, 0x3, 0x8, 0xc00045c012, 0x4, 0xa5, 0x4000, 0x8, 0x8, 0x40, ...)
2021-05-31T08:30:46.4461073Z 	/home/runner/go/pkg/mod/golang.org/x/crypto@v0.0.0-20190701094942-4def268fd1a4/scrypt/scrypt.go:209 +0x2bf
2021-05-31T08:30:46.4462573Z github.com/nspcc-dev/neo-go/pkg/crypto/keys.NEP2Decrypt(0xc000417000, 0x3a, 0xc000550ac8, 0x3, 0xfc478f, 0xc000426420, 0x1991820)
2021-05-31T08:30:46.4463796Z 	/home/runner/work/neo-go/neo-go/pkg/crypto/keys/nep2.go:92 +0x1b1
2021-05-31T08:30:46.4464899Z github.com/nspcc-dev/neo-go/pkg/wallet.(*Account).Decrypt(0xc0001cee70, 0xc000550ac8, 0x3, 0x0, 0x0)
2021-05-31T08:30:46.4465987Z 	/home/runner/work/neo-go/neo-go/pkg/wallet/account.go:128 +0x150
2021-05-31T08:30:46.4467405Z github.com/nspcc-dev/neo-go/pkg/consensus.NewService(0xc0009caea0, 0xc0003ae1b0, 0x1d632a0, 0xc0002af440, 0x2a, 0x64, 0x3e8, 0x4000000000000, 0xd18c2e2800, 0x20000030d40, ...)
2021-05-31T08:30:46.4468795Z 	/home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:145 +0x789
2021-05-31T08:30:46.4470240Z github.com/nspcc-dev/neo-go/pkg/network.newServerFromConstructors(0x0, 0x5, 0xa, 0xc0002922e0, 0x14, 0x0, 0x0, 0x2a00000000, 0x1, 0x0, ...)
2021-05-31T08:30:46.4471623Z 	/home/runner/work/neo-go/neo-go/pkg/network/server.go:211 +0x1002
2021-05-31T08:30:46.4472803Z github.com/nspcc-dev/neo-go/pkg/network.NewServer(0x0, 0x5, 0xa, 0xc0002922e0, 0x14, 0x0, 0x0, 0x2a00000000, 0x1, 0x0, ...)
2021-05-31T08:30:46.4473942Z 	/home/runner/work/neo-go/neo-go/pkg/network/server.go:109 +0xd5
2021-05-31T08:30:46.4475023Z github.com/nspcc-dev/neo-go/cli.newTestChain(0xc001236780, 0x0, 0x24b3788, 0x24b3788, 0x878)
2021-05-31T08:30:46.4476093Z 	/home/runner/work/neo-go/neo-go/cli/executor_test.go:80 +0x75f
2021-05-31T08:30:46.4477216Z github.com/nspcc-dev/neo-go/cli.newExecutorWithConfig(0xc001236780, 0x1, 0x0, 0x109983b)
2021-05-31T08:30:46.4478380Z 	/home/runner/work/neo-go/neo-go/cli/executor_test.go:104 +0x525
2021-05-31T08:30:46.4479293Z github.com/nspcc-dev/neo-go/cli.newExecutor(...)
2021-05-31T08:30:46.4480225Z 	/home/runner/work/neo-go/neo-go/cli/executor_test.go:91
2021-05-31T08:30:46.4481266Z github.com/nspcc-dev/neo-go/cli.TestImportDeployed(0xc001236780)
2021-05-31T08:30:46.4482320Z 	/home/runner/work/neo-go/neo-go/cli/wallet_test.go:243 +0x65
2021-05-31T08:30:46.4482959Z testing.tRunner(0xc001236780, 0x1b90390)
2021-05-31T08:30:46.4483701Z 	/opt/hostedtoolcache/go/1.15.12/x64/src/testing/testing.go:1123 +0x203
2021-05-31T08:30:46.4484348Z created by testing.(*T).Run
2021-05-31T08:30:46.4485030Z 	/opt/hostedtoolcache/go/1.15.12/x64/src/testing/testing.go:1168 +0x5bc

pkg/wallet/account.go Outdated Show resolved Hide resolved
pkg/wallet/account.go Outdated Show resolved Hide resolved
pkg/wallet/account.go Outdated Show resolved Hide resolved
pkg/crypto/keys/nep2.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 11, 2021

Codecov Report

Merging #2001 (70de79a) into master (61dfca3) will increase coverage by 0.06%.
The diff coverage is 67.64%.

❗ Current head 70de79a differs from pull request most recent head 91f4513. Consider uploading reports for the commit 91f4513 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2001      +/-   ##
==========================================
+ Coverage   83.17%   83.23%   +0.06%     
==========================================
  Files         287      287              
  Lines       23256    23263       +7     
==========================================
+ Hits        19343    19364      +21     
+ Misses       2714     2696      -18     
- Partials     1199     1203       +4     
Impacted Files Coverage Δ
cli/wallet/validator.go 75.00% <0.00%> (ø)
pkg/services/oracle/nodes.go 58.82% <0.00%> (ø)
pkg/wallet/wallet.go 79.16% <0.00%> (ø)
pkg/crypto/keys/nep2.go 73.52% <33.33%> (-4.60%) ⬇️
pkg/consensus/consensus.go 70.94% <50.00%> (+0.61%) ⬆️
cli/wallet/legacy.go 88.88% <60.00%> (-2.54%) ⬇️
cli/wallet/wallet.go 72.26% <88.88%> (+0.06%) ⬆️
cli/smartcontract/smart_contract.go 87.38% <100.00%> (ø)
pkg/services/notary/node.go 100.00% <100.00%> (ø)
pkg/services/notary/notary.go 92.46% <100.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61dfca3...91f4513. Read the comment docs.

Problem:
```
executor_test.go:151:
    	Error Trace:	executor_test.go:151
    	            				executor_test.go:147
    	            				nep11_test.go:232
      	Error:      	Expect "{"name":"HASHY 3HNCEX8D9J0p\u002BLxmr3uPhOhSW90="}" to match "{"name":"HASHY 3HNCEX8D9J0p+Lxmr3uPhOhSW90="}"
       	Test:       	TestNEP11_OwnerOf_BalanceOf_Transfer
```

Solution:
Same as preesnted in #2006.
@AnnaShaleva AnnaShaleva marked this pull request as ready for review June 11, 2021 12:37
@AnnaShaleva
Copy link
Member Author

Well, some of these tests are still failing, but at least because of other reasons.

@roman-khimov roman-khimov merged commit d5e11e0 into master Jun 11, 2021
@roman-khimov roman-khimov deleted the tests/fix-failing-workflows branch June 11, 2021 14:27
@roman-khimov roman-khimov modified the milestones: v0.96.0, v0.95.3 Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants