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

neotest: Add contract signer support #3233

Conversation

stepanovdmitrii
Copy link
Contributor

Problem

When using another contract for verification in unit tests, the transaction cost is calculated incorrectly.
...

Solution

To calculate the transaction cost, a test neo-vm is started on which the verification is performed.
...

pkg/neotest/signer.go Show resolved Hide resolved
pkg/neotest/basic.go Outdated Show resolved Hide resolved
pkg/neotest/signer.go Outdated Show resolved Hide resolved
pkg/neotest/signer.go Outdated Show resolved Hide resolved
pkg/neotest/basic.go Outdated Show resolved Hide resolved
@AnnaShaleva AnnaShaleva added this to the v0.105.0 milestone Nov 28, 2023
@roman-khimov
Copy link
Member

roman-khimov commented Nov 28, 2023

Just as an idea --- can we reuse a local client in neotest and provide the regular RPC client API to tests? I think this would solve the problem immediately, calculatenetworkfee handles this and many other cases easily. Other APIs can also be useful.

@AnnaShaleva
Copy link
Member

Just as an idea

I like this idea, but even with RPC-based network fee calculation in neotest I still think that it might be a good point to implement contract signer so that it would be easier to construct contract-based witnesses.

AnnaShaleva added a commit that referenced this pull request Nov 28, 2023
No functional changes, just moved a part of emit.Array to a separate
exported method. It may be useful for contract-based witness invocation
scripts construction and not only. Ref.
#3233 (comment).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
AnnaShaleva added a commit that referenced this pull request Nov 28, 2023
No functional changes, just moved a part of emit.Array to a separate
exported method. It may be useful for contract-based witness invocation
scripts construction and not only. Ref.
#3233 (comment).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
AnnaShaleva added a commit that referenced this pull request Nov 28, 2023
No functional changes, just moved a part of emit.Array to a separate
exported method. It may be useful for contract-based witness invocation
scripts construction and not only. Ref.
#3233 (comment).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
AnnaShaleva added a commit that referenced this pull request Nov 28, 2023
No functional changes, just moved a part of emit.Array to a separate
exported method. It may be useful for contract-based witness invocation
scripts construction and not only. Ref.
#3233 (comment).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@stepanovdmitrii stepanovdmitrii force-pushed the feat/neotest_contract_signer_support branch from d0dd4dc to 2f960fc Compare November 29, 2023 06:51
Copy link

codecov bot commented Nov 29, 2023

Codecov Report

Attention: 60 lines in your changes are missing coverage. Please review.

Comparison is base (6c0c2a6) 85.34% compared to head (7b53a0c) 85.25%.

Files Patch % Lines
pkg/neotest/signer.go 0.00% 43 Missing ⚠️
pkg/neotest/basic.go 29.16% 15 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3233      +/-   ##
==========================================
- Coverage   85.34%   85.25%   -0.09%     
==========================================
  Files         327      327              
  Lines       44084    44144      +60     
==========================================
+ Hits        37622    37635      +13     
- Misses       4983     5020      +37     
- Partials     1479     1489      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/neotest/signer.go Outdated Show resolved Hide resolved
pkg/neotest/signer.go Outdated Show resolved Hide resolved
pkg/neotest/signer.go Outdated Show resolved Hide resolved
pkg/neotest/signer.go Show resolved Hide resolved
pkg/neotest/basic.go Outdated Show resolved Hide resolved
pkg/neotest/basic.go Show resolved Hide resolved
pkg/neotest/basic.go Outdated Show resolved Hide resolved
pkg/neotest/basic.go Outdated Show resolved Hide resolved
pkg/neotest/basic.go Outdated Show resolved Hide resolved
pkg/neotest/basic.go Outdated Show resolved Hide resolved
pkg/neotest/basic.go Outdated Show resolved Hide resolved
pkg/neotest/signer.go Show resolved Hide resolved
pkg/neotest/signer.go Show resolved Hide resolved
Signed-off-by: Dmitrii Stepanov <dima-stepan@yandex.ru>
@stepanovdmitrii stepanovdmitrii force-pushed the feat/neotest_contract_signer_support branch from 2f960fc to 7b53a0c Compare December 1, 2023 07:50
@roman-khimov roman-khimov merged commit 9a270ae into nspcc-dev:master Dec 4, 2023
15 of 18 checks passed
fyfyrchik added a commit to fyfyrchik/neo-go that referenced this pull request Dec 8, 2023
Refs nspcc-dev#3245
Refs nspcc-dev#3233

Signed-off-by: Evgenii Stratonikov <fyfyrchik@runbox.com>
fyfyrchik added a commit to fyfyrchik/neo-go that referenced this pull request Dec 8, 2023
Refs nspcc-dev#3245
Refs nspcc-dev#3233

Signed-off-by: Evgenii Stratonikov <fyfyrchik@runbox.com>
fyfyrchik added a commit to fyfyrchik/neo-go that referenced this pull request Dec 21, 2023
Refs nspcc-dev#3245
Refs nspcc-dev#3233

Signed-off-by: Evgenii Stratonikov <fyfyrchik@runbox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants