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

rpcsrv: fix RPC error codes proposal compatibility #3360

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

AnnaShaleva
Copy link
Member

@AnnaShaleva AnnaShaleva commented Mar 18, 2024

Problem

Implementation doesn't match neo-project/proposals#156 wrt mempool-related transaction fee check on submitting new transaction to the node. Thanks to @carpawell for pointing that out.

Solution

Fix the implementation.

@roman-khimov, I'd like to highlight: whereas it's quite easy to fix this compatibility problem on our side, C# node has the same divergence from the standard and requires more changes to fix it: TransactionVerificationContext.CheckTransaction should be adjusted to return some new special error, this error should be detached from VerifyResult.InsufficientFunds and ported to other components (ref. https://github.com/neo-project/neo/blob/b05501af882a0d1f2a1a7841c6ddc4d0504e5fc1/src/Neo/Network/P2P/Payloads/Transaction.cs#L368).

I may port it to C# or create an issue about it, what would we prefer?

Avoid mempool conflicts in tests.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
mempool.ErrInsufficientFunds is used when sender doesn't have enough
balance to pay the submitted transaction fees (-511 code according to
neo-project/proposals#156). mempool.ErrConflict is
used when sender is not able to pay the overall transactions fee sum in
the pool (generic -500 error according to the proposal).

This bugfix is kind of breaking change for those users who relied on the
old -511 code previously returning "insufficient funds" error.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva AnnaShaleva added bug Something isn't working rpc RPC server and client labels Mar 18, 2024
Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.66%. Comparing base (bfc3aa6) to head (82e52c4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3360      +/-   ##
==========================================
- Coverage   84.68%   84.66%   -0.02%     
==========================================
  Files         331      331              
  Lines       44935    44935              
==========================================
- Hits        38053    38045       -8     
- Misses       5370     5376       +6     
- Partials     1512     1514       +2     

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

@AnnaShaleva AnnaShaleva added this to the v0.106.0 milestone Mar 18, 2024
@roman-khimov
Copy link
Member

I may port it to C# or create an issue about it, what would we prefer?

Can be both, start with issue and then we'll see. It's a relatively minor problem to me, not a 3.7 must have.

@roman-khimov roman-khimov merged commit 445ab97 into master Mar 18, 2024
18 of 20 checks passed
@roman-khimov roman-khimov deleted the adj-mempool-err-codes branch March 18, 2024 15:55
@AnnaShaleva
Copy link
Member Author

Ref. neo-project/neo-modules#889.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rpc RPC server and client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants