iotexproject / iotex-core

Official implementation of IoTeX blockchain protocol in Go.
https://iotex.io
Apache License 2.0
1.55k stars 322 forks source link

[action] check action size instead of total size #4297

Open dustinxie opened 2 weeks ago

dustinxie commented 2 weeks ago

Description

  1. All our actions include a data field AbstractAction, while the envelope struct also contains AbstractAction.
  2. the only reason is b/c transfer and execution has a TotalSize() method that needs to access fields in AbstractAction
  3. we change to use Size() (which does not need AbstractAction), and add a hard-fork flag
  4. after the hard-fork, we no longer need TotalSize(), and can remove AbstractAction from all actions

benefits:

  1. simplify code and data structure
  2. better readability, less clumsy code
  3. for example, SignedTransfer now has 7 inputs, after this is done, it will reduce to 3 inputs

Fixes #(issue)

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Test Configuration:

Checklist:

sonarcloud[bot] commented 6 days ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

Liuhaai commented 1 day ago

How can TotalSize() be removed if doing a full sync after the fork?