mx-chain-go icon indicating copy to clipboard operation
mx-chain-go copied to clipboard

Feat/RelayedV3

Open sstanculeanu opened this issue 2 years ago • 1 comments

Reasoning behind the pull request

  • Relayed tx v3
  • Fix base cost of user tx for all relayed transactions
  • Only consume move balance cost of user tx in case of relayed move balance

Proposed changes

  • Implemented relayed tx v3. Added a new field on the tx, InnerTransactions that can hold a configurable max number of relayed user transactions (currently set to 50 max).
  • Fixed base cost of relayed tx for all types. Ex: let's consider a relayed v1 tx, with a move balance as user tx, having len of data 200. Considering we would have passed the fixed gas limit, it should be: 50.000 for user move balance + 50.000 for relayed tx + 300.000 for len of data. So total of 400.000. But, due to the way it was computed, it would have cost less than that (350.000 for relayed tx + 500 considered the processing cost). After this fix, this tx should consume exactly 400.000. Also applies for sc calls, where the base cost was omitted.
  • Now when a move balance is detected as a user tx, only the cost of move balance is removed from relayer, no matter how much extra gas is provided.

Testing procedure

  • standard system test
  • test relayed v1 and relayed v2 fees for all kind of transactions(failure/refund scenarios to be verified as well). Make sure the fees consumed by the same transaction are different before and after the fix. After fix, all of them should consume more gas as described above.
  • test relayed v3 transaction execution + fees consumed + events generated for all user txs, in respect with the confluence specs

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

sstanculeanu avatar Nov 27 '23 12:11 sstanculeanu

Codecov Report

Attention: Patch coverage is 74.23581% with 59 lines in your changes are missing coverage. Please review.

Project coverage is 78.77%. Comparing base (6d93fee) to head (d31d68b). Report is 1 commits behind head on rc/v1.7.next1.

Files Patch % Lines
api/groups/transactionGroup.go 59.82% 44 Missing and 1 partial :warning:
node/external/transactionAPI/unmarshaller.go 0.00% 2 Missing and 2 partials :warning:
node/node.go 33.33% 3 Missing and 1 partial :warning:
process/transaction/shardProcess.go 91.42% 2 Missing and 1 partial :warning:
process/constants.go 0.00% 2 Missing :warning:
process/transaction/interceptedTransaction.go 98.00% 1 Missing :warning:
Additional details and impacted files
@@                Coverage Diff                @@
##           rc/v1.7.next1    #5741      +/-   ##
=================================================
- Coverage          78.80%   78.77%   -0.03%     
=================================================
  Files                752      752              
  Lines              98013    98137     +124     
=================================================
+ Hits               77238    77308      +70     
- Misses             15553    15604      +51     
- Partials            5222     5225       +3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Nov 27 '23 15:11 codecov[bot]