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

0.38.x: Move (some) signatures and decoders of versioned ABIs to a dedicated location #6569

Conversation

david-bakin-sl
Copy link
Member

(Essentially a cherry-pick from develop, but done on my machine before the merge to develop happened. See #6564 for the original PR.)

Start of a new method for having one-stop-shopping for everything we
need related to system contract ABIs. (Subsequent additions will
include all system contract ABIs, and then moving to use this enum
as the source of ground truth for ABI (names, selectors, etc.)
everywhere.

N.B.: The initial goal of this is to simplify correct maintenance by putting everything related to our ABI in one place, instead of being scattered all over the place the way it is now. The ultimate goal is to generate this enum from the ground truth Solidity system contracts in our smart contracts repo.

Of the versioned ABIs, in this PR are: burn, mint, update token expiry info.

Subsequent PR will add all the creates, crypto transfer, and update token info.

Signed-off-by: David Bakin 117694041+david-bakin-sl@users.noreply.github.comDescription:

Related issue(s):

Fixes #6559

Notes for reviewer:

The meat is in the new enum SystemContractAbis which provides an enum element for each versioned ABI that supplies things like its selector and its decoder and also other interesting stuff. All the versioned ABIs are in there, and the unit test checks that the selectors computed from the signatures given match the ones we depend on in AbiConstants.

The enum contains all versioned ABIs though this PR only has fixed up the code for burn, mint, and update token expiry.

Future work will finish the work on incorporating the versioned ABIs from this enum into the precompiles, add all the non-versioned ABIs, and eventually refactor with an aim of eliminating other files where this stuff is scattered about, including ParsingConstants and DecodingFacade. We should also generate AbiConstants.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

…location

(Essentially a cherry-pick from develop, but before that PR got merged to
develop. But see PR #6564.)

Start of a new method for having one-stop-shopping for everything we need
related to system contract ABIs.

Signed-off-by: David Bakin <117694041+david-bakin-sl@users.noreply.github.com>
@david-bakin-sl david-bakin-sl added this to the v0.38 milestone May 12, 2023
@david-bakin-sl david-bakin-sl requested a review from a team as a code owner May 12, 2023 17:34
@david-bakin-sl david-bakin-sl self-assigned this May 12, 2023
Signed-off-by: David Bakin <117694041+david-bakin-sl@users.noreply.github.com>
…removed

Signed-off-by: David Bakin <117694041+david-bakin-sl@users.noreply.github.com>
@github-actions
Copy link

Node: Integration Test Results

    3 files      3 suites   15m 12s ⏱️
151 tests 151 ✔️ 0 💤 0
152 runs  152 ✔️ 0 💤 0

Results for commit 05d5142.

@github-actions
Copy link

Node: E2E Test Results

    1 files      1 suites   17m 8s ⏱️
309 tests 309 ✔️ 0 💤 0
327 runs  327 ✔️ 0 💤 0

Results for commit 05d5142.

@github-actions
Copy link

Node: Unit Test Results

  1 352 files    1 352 suites   1h 17m 5s ⏱️
97 518 tests 97 510 ✔️ 8 💤 0
99 150 runs  99 142 ✔️ 8 💤 0

Results for commit 05d5142.

@codecov
Copy link

codecov bot commented May 12, 2023

Codecov Report

Patch coverage: 91.01% and project coverage change: +23.03 🎉

Comparison is base (689d680) 67.97% compared to head (05d5142) 91.00%.

Additional details and impacted files
@@                 Coverage Diff                 @@
##             release/0.38    #6569       +/-   ##
===================================================
+ Coverage           67.97%   91.00%   +23.03%     
+ Complexity          22317    17294     -5023     
===================================================
  Files                2018     1327      -691     
  Lines              135994    49700    -86294     
  Branches             7686     4998     -2688     
===================================================
- Hits                92437    45230    -47207     
+ Misses              42060     3515    -38545     
+ Partials             1497      955      -542     
Impacted Files Coverage Δ
.../store/contracts/precompile/codec/BurnWrapper.java 100.00% <ø> (ø)
.../store/contracts/precompile/codec/MintWrapper.java 100.00% <ø> (ø)
...ecompile/impl/UpdateTokenExpiryInfoPrecompile.java 95.23% <83.33%> (-1.54%) ⬇️
...tracts/precompile/impl/WipeFungiblePrecompile.java 94.11% <83.33%> (-1.72%) ⬇️
...tore/contracts/precompile/impl/BurnPrecompile.java 95.74% <85.71%> (-0.49%) ⬇️
...tore/contracts/precompile/impl/MintPrecompile.java 94.33% <85.71%> (-0.58%) ⬇️
.../contracts/precompile/impl/SystemContractAbis.java 93.10% <93.10%> (ø)
...contracts/precompile/impl/SystemContractTypes.java 100.00% <100.00%> (ø)

... and 928 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sonarcloud
Copy link

sonarcloud bot commented May 12, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

91.7% 91.7% Coverage
0.0% 0.0% Duplication

Copy link
Member

@Neeharika-Sompalli Neeharika-Sompalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a comment on the PR. Other changes LGTM

@Neeharika-Sompalli Neeharika-Sompalli merged commit cd876bb into release/0.38 May 12, 2023
11 of 13 checks passed
@Neeharika-Sompalli Neeharika-Sompalli deleted the 06559-vs-0.38-refactor-system-contract-signatures branch May 12, 2023 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants