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

LIVE-8169: multiversx coin modularization #7750

Merged
merged 6 commits into from
Sep 16, 2024

Conversation

Wozacosta
Copy link
Contributor

@Wozacosta Wozacosta commented Sep 4, 2024

coin modularization of elrond/multiversx, some bug fixes and new unit tests

This was done by the multiversx team, I've already reviewed their original PR #7637, you can look at the comments to check what was spotted / fixed.

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests. From author: added a few new unit tests (more to be added on the re-branding PR)
  • Impact of the changes: at list of QA tests to do can be found in the comments of https://ledgerhq.atlassian.net/browse/LIVE-8169?focusedCommentId=466674. (From the author: Features related to MultiversX: transfers of native & custom currencies, staking actions (staking, claiming rewards, etc.)

Nitrogen bot testing: ✅ #7750 (comment)

📝 Description

Main

  • Refactored MultiversX components to match the coin modularization guidelines.
  • Note that renaming of "Elrond" to "MultiversX" will be applied in a separate PR.
  • Fixed display issue (present in current version of Ledger Live) - regarding the displayed "delegated amount".

Secondary

Flaky test fix

https://github.com/cosmos/cosmos-sdk/blob/6b20ef7388dffe3f3938b81bc1946b7a5b072db1/x/staking/types/validator.go#L321 uses rounding up.

As for the documentation, they raise that rounding behaviour has quirks https://docs.cosmos.network/main/build/modules/auth/vesting#undelegating.

bignumber.js equivalent to rounding up is BigNumber.ROUND_CEIL

❓ Context

  • JIRA or GitHub link: LIVE-8169

🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

Copy link

vercel bot commented Sep 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2024 4:26pm
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2024 4:26pm
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2024 4:26pm
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2024 4:26pm
web-tools ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2024 4:26pm

@live-github-bot live-github-bot bot added desktop Has changes in LLD mobile Has changes in LLM common Has changes in live-common ledgerjs Has changes in the ledgerjs open source libs tools Has changes in tools labels Sep 4, 2024
Copy link

socket-security bot commented Sep 4, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@multiversx/sdk-core@13.3.0 Transitive: environment, filesystem +11 3.22 MB lucian.mincu
npm/@types/lodash@4.17.7 None 0 867 kB types
npm/protobufjs@7.3.2 filesystem, network +10 2.98 MB dcode

View full report↗︎

@live-github-bot
Copy link
Contributor

live-github-bot bot commented Sep 4, 2024

Desktop Bundle Checks

Comparing 88a211d against 77f9a5e.

⚠️ renderer bundle size significantly increased: 42.1mb -> 42.3mb. Please check if this is expected.

Mobile Bundle Checks

Comparing 88a211d against 77f9a5e.

⚠️ main.ios.jsbundle bundle size significantly increased: 64.5mb -> 64.8mb. Please check if this is expected.
⚠️ main.android.jsbundle bundle size significantly increased: 64.5mb -> 64.8mb. Please check if this is expected.

@Wozacosta Wozacosta marked this pull request as ready for review September 5, 2024 06:50
@Wozacosta Wozacosta requested review from a team as code owners September 5, 2024 06:50
Copy link

github-actions bot commented Sep 5, 2024

[Bot] Testing with 'Nitrogen' ✅ 3 txs ($24.07) ⏲ 6min 32s

✅ 1 specs are successful: Elrond

What is the bot and how does it work? Everything is documented here!

⚠️ 1 spec hints
  • Spec Elrond:
    • mutations should define a testDestination(): move some ESDT
Details of the 3 mutations

Spec Elrond (8)

Spec Elrond found 8 MultiversX accounts (preload: 285ms). Will use MultiversX 1.0.20 on nanoS 2.1.0
undefined: 0 EGLD (422ops) (erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp on 44'/508'/0'/0/0) #0 js:2:elrond:erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp:
undefined: 0 EGLD (450ops) (erd172muqtk2ka5ath64284fm0av4tarkg6l040c595uswwz3tgngh9s9dtgp6 on 44'/508'/1'/0/0) #1 js:2:elrond:erd172muqtk2ka5ath64284fm0av4tarkg6l040c595uswwz3tgngh9s9dtgp6:
undefined: 0.0342846 EGLD (419ops) (erd1ql9pxrhe29cjr8qgxx3rtmh9lyax5x9dkvu3mfzrgt4e8hwk536ssl4sea on 44'/508'/2'/0/0) #2 js:2:elrond:erd1ql9pxrhe29cjr8qgxx3rtmh9lyax5x9dkvu3mfzrgt4e8hwk536ssl4sea:
undefined: 0 EGLD (406ops) (erd1sjvd5mh946cty4wq0ya0d82509tc8eulxjujrad5ztfwjlhkqz0qy5yzmn on 44'/508'/3'/0/0) #3 js:2:elrond:erd1sjvd5mh946cty4wq0ya0d82509tc8eulxjujrad5ztfwjlhkqz0qy5yzmn:
undefined: 0.382901 EGLD (385ops) (erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el on 44'/508'/4'/0/0) #4 js:2:elrond:erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el:
undefined: 0.033701 EGLD (346ops) (erd143yn6uvrfzjptq5g7wvzntl3fcthsxtxrp9f3dgasluj6q5n0pxq2td67n on 44'/508'/5'/0/0) #5 js:2:elrond:erd143yn6uvrfzjptq5g7wvzntl3fcthsxtxrp9f3dgasluj6q5n0pxq2td67n:
undefined: 0.481758 EGLD (264ops) (erd1nhe920dlsx8u0lg46grd82dc8vqj8wejh8u7xcdjzfr8yy8ncdtsgtgjz7 on 44'/508'/6'/0/0) #6 js:2:elrond:erd1nhe920dlsx8u0lg46grd82dc8vqj8wejh8u7xcdjzfr8yy8ncdtsgtgjz7:
undefined: 0 EGLD (0ops) (erd1w4jjugkk5rp8hn8erefltjn0xek4x60t4hzsmnkfty7930sxujtqgryqgw on 44'/508'/7'/0/0) #7 js:2:elrond:erd1w4jjugkk5rp8hn8erefltjn0xek4x60t4hzsmnkfty7930sxujtqgryqgw:
necessary accounts resynced in 0.11ms
▬ MultiversX 1.0.20 on nanoS 2.1.0
→ FROM undefined: 0.0342846 EGLD (419ops) (erd1ql9pxrhe29cjr8qgxx3rtmh9lyax5x9dkvu3mfzrgt4e8hwk536ssl4sea on 44'/508'/2'/0/0) #2 js:2:elrond:erd1ql9pxrhe29cjr8qgxx3rtmh9lyax5x9dkvu3mfzrgt4e8hwk536ssl4sea: 0.034284668146490572 EGLD spendable. 
  nonce : 218
  TokenAccount MEX: 4.753993606015131105 MEX (123 ops)
  TokenAccount RARE: 1.241083001290913839 RARE (23 ops) (! sum of ops -0.758916998709086161 RARE)
max spendable ~0.0342346
★ using mutation 'send 50%~'
→ TO undefined: 0 EGLD (422ops) (erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp on 44'/508'/0'/0/0) #0 js:2:elrond:erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp:
✔️ transaction 
SEND  0.017350376248099602 EGLD
TO erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp
STATUS (2.92ms)
  amount: 0.017350376248099602 EGLD
  estimated fees: 0.00005 EGLD
  total spent: 0.017400376248099602 EGLD
errors: 
warnings: 
✔️ has been signed! (3.2s) 
✔️ broadcasted! (311ms) optimistic operation: 
  -0.017400376248099602 EGLD OUT        5764149d13c92cf8ccdbf9e347294595abbf4834e1b6bf450e6692d76d2b9048 2024-09-05T10:31
✔️ operation confirmed (12.5s): 
  -0.017400376248099602 EGLD OUT        5764149d13c92cf8ccdbf9e347294595abbf4834e1b6bf450e6692d76d2b9048 2024-09-05T10:31
✔️ undefined: 0.0168842 EGLD (420ops) (erd1ql9pxrhe29cjr8qgxx3rtmh9lyax5x9dkvu3mfzrgt4e8hwk536ssl4sea on 44'/508'/2'/0/0) #2 js:2:elrond:erd1ql9pxrhe29cjr8qgxx3rtmh9lyax5x9dkvu3mfzrgt4e8hwk536ssl4sea: 0.01688429189839097 EGLD spendable. 
  nonce : 219
  TokenAccount MEX: 4.753993606015131105 MEX (123 ops)
  TokenAccount RARE: 1.241083001290913839 RARE (23 ops) (! sum of ops -0.758916998709086161 RARE)(in 12.5s)
✔️ destination operation 
  +0.017350376248099602 EGLD IN         5764149d13c92cf8ccdbf9e347294595abbf4834e1b6bf450e6692d76d2b9048 2024-09-05T10:32
(in 22.4s)

necessary accounts resynced in 0.16ms
▬ MultiversX 1.0.20 on nanoS 2.1.0
→ FROM undefined: 0.382901 EGLD (385ops) (erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el on 44'/508'/4'/0/0) #4 js:2:elrond:erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el: 0.382901368845825618 EGLD spendable. 
  nonce : 203
  TokenAccount MEX: 0.308860072115781549 MEX (119 ops)
  TokenAccount RARE: 0.54444033692695976 RARE (12 ops)
max spendable ~0.382851
★ using mutation 'send max'
→ TO undefined: 0.0173503 EGLD (423ops) (erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp on 44'/508'/0'/0/0) #0 js:2:elrond:erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp:
✔️ transaction 
SEND MAX
TO erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp
STATUS (1.80ms)
  amount: 0.382851368845825618 EGLD
  estimated fees: 0.00005 EGLD
  total spent: 0.382901368845825618 EGLD
errors: 
warnings: 
✔️ has been signed! (3s) 
✔️ broadcasted! (234ms) optimistic operation: 
  -0.382901368845825618 EGLD OUT        4d2113cd606199171dcb144b0a2551301c47414197076551db0484e8553be873 2024-09-05T10:32
✔️ operation confirmed (12.3s): 
  -0.382901368845825618 EGLD OUT        4d2113cd606199171dcb144b0a2551301c47414197076551db0484e8553be873 2024-09-05T10:32
✔️ undefined: 0 EGLD (386ops) (erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el on 44'/508'/4'/0/0) #4 js:2:elrond:erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el: 0 EGLD spendable. 
  nonce : 204
  TokenAccount MEX: 0.308860072115781549 MEX (119 ops)
  TokenAccount RARE: 0.54444033692695976 RARE (12 ops)(in 12.3s)
✔️ destination operation 
  +0.382851368845825618 EGLD IN         4d2113cd606199171dcb144b0a2551301c47414197076551db0484e8553be873 2024-09-05T10:32
(in 22.4s)

necessary accounts resynced in 0.20ms
▬ MultiversX 1.0.20 on nanoS 2.1.0
→ FROM undefined: 0.033701 EGLD (346ops) (erd143yn6uvrfzjptq5g7wvzntl3fcthsxtxrp9f3dgasluj6q5n0pxq2td67n on 44'/508'/5'/0/0) #5 js:2:elrond:erd143yn6uvrfzjptq5g7wvzntl3fcthsxtxrp9f3dgasluj6q5n0pxq2td67n: 0.033701081918500419 EGLD spendable. 
  nonce : 144
  TokenAccount MEX: 6.268799644559485771 MEX (91 ops)
  TokenAccount RARE: 0.000162556367485977 RARE (11 ops)
max spendable ~0.033651
★ using mutation 'move some ESDT'
→ TO undefined: 0 EGLD (386ops) (erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el on 44'/508'/4'/0/0) #4 js:2:elrond:erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el:
✔️ transaction 
SEND  0.00006811901122639 RARE
TO erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el
STATUS (1.98ms)
  amount: 0.00006811901122639 RARE
  estimated fees: 0.00012578 EGLD
  total spent: 0.00006811901122639 RARE
errors: 
warnings: 
✔️ has been signed! (3.3s) 
✔️ broadcasted! (238ms) optimistic operation: 
  -0.00012578 EGLD   OUT        84f74000583a094eb292429759344a8a5615ecf055847ee14d2f215a8a8fff6f 2024-09-05T10:32
    -0.00006811901122639 RARE OUT        
✔️ operation confirmed (12.4s): 
  -0.000124 EGLD     OUT        84f74000583a094eb292429759344a8a5615ecf055847ee14d2f215a8a8fff6f 2024-09-05T10:33
    -0.00006811901122639 RARE OUT        
✔️ undefined: 0.033577 EGLD (347ops) (erd143yn6uvrfzjptq5g7wvzntl3fcthsxtxrp9f3dgasluj6q5n0pxq2td67n on 44'/508'/5'/0/0) #5 js:2:elrond:erd143yn6uvrfzjptq5g7wvzntl3fcthsxtxrp9f3dgasluj6q5n0pxq2td67n: 0.033577081918500419 EGLD spendable. 
  nonce : 145
  TokenAccount MEX: 6.268799644559485771 MEX (91 ops)
  TokenAccount RARE: 0.000094437356259587 RARE (12 ops)(in 12.4s)


Details of the 3 uncovered mutations

Spec Elrond (3)

  • delegate 1 EGLD: balance is too low (4), spendable balance is less than minimum delegation amount (1)
  • unDelegate 1 EGLD: balance is too low (4), account doesn't have any delegations (1)
  • withdraw all EGLD: balance is too low (4), account doesn't have any delegations (1)
Portfolio ($24.07) – Details of the 1 currencies
Spec (accounts) State Remaining Runs (est) funds?
Elrond (8) 2698 ops (+6), 0.932645 EGLD ($24.07) 💪 999+ erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp
undefined: 0.400201 EGLD (424ops) (erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp on 44'/508'/0'/0/0) #0 js:2:elrond:erd18n5sk95fq9dtgdsa9m9q5ddp66ch9cq5lpjflwn5j9z8x2e9h0qqrvk5qp:
undefined: 0 EGLD (450ops) (erd172muqtk2ka5ath64284fm0av4tarkg6l040c595uswwz3tgngh9s9dtgp6 on 44'/508'/1'/0/0) #1 js:2:elrond:erd172muqtk2ka5ath64284fm0av4tarkg6l040c595uswwz3tgngh9s9dtgp6:
undefined: 0.0168842 EGLD (420ops) (erd1ql9pxrhe29cjr8qgxx3rtmh9lyax5x9dkvu3mfzrgt4e8hwk536ssl4sea on 44'/508'/2'/0/0) #2 js:2:elrond:erd1ql9pxrhe29cjr8qgxx3rtmh9lyax5x9dkvu3mfzrgt4e8hwk536ssl4sea:
undefined: 0 EGLD (406ops) (erd1sjvd5mh946cty4wq0ya0d82509tc8eulxjujrad5ztfwjlhkqz0qy5yzmn on 44'/508'/3'/0/0) #3 js:2:elrond:erd1sjvd5mh946cty4wq0ya0d82509tc8eulxjujrad5ztfwjlhkqz0qy5yzmn:
undefined: 0 EGLD (387ops) (erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el on 44'/508'/4'/0/0) #4 js:2:elrond:erd149kzxgtymzzaddanlj02zhyhwves9wspvk8p69u325tjln5en9aqf8x8el:
undefined: 0.033577 EGLD (347ops) (erd143yn6uvrfzjptq5g7wvzntl3fcthsxtxrp9f3dgasluj6q5n0pxq2td67n on 44'/508'/5'/0/0) #5 js:2:elrond:erd143yn6uvrfzjptq5g7wvzntl3fcthsxtxrp9f3dgasluj6q5n0pxq2td67n:
undefined: 0.481758 EGLD (264ops) (erd1nhe920dlsx8u0lg46grd82dc8vqj8wejh8u7xcdjzfr8yy8ncdtsgtgjz7 on 44'/508'/6'/0/0) #6 js:2:elrond:erd1nhe920dlsx8u0lg46grd82dc8vqj8wejh8u7xcdjzfr8yy8ncdtsgtgjz7:
undefined: 0 EGLD (0ops) (erd1w4jjugkk5rp8hn8erefltjn0xek4x60t4hzsmnkfty7930sxujtqgryqgw on 44'/508'/7'/0/0) #7 js:2:elrond:erd1w4jjugkk5rp8hn8erefltjn0xek4x60t4hzsmnkfty7930sxujtqgryqgw:
Performance ⏲ 6min 32s

Time spent for each spec: (total across mutations)

Spec (accounts) preload scan re-sync tx status sign op broadcast test destination test
TOTAL 285ms 4min 55s 2386ms 7ms 9.5s 782ms 37.1s 44.8s
Elrond (7) 285ms 4min 55s 2386ms 7ms 9.5s 782ms 37.1s 44.8s

What is the bot and how does it work? Everything is documented here!

popenta and others added 5 commits September 12, 2024 18:25
move files from ledger-live-common to new package

wip: updating files

fix files

adapt files and move hw-app to separate package

fixes after review

fixes after review

fixes

update generated files

change string representation to ascii for address

rename to elrond for easier integration

move dependency from devDependencies

add missing dependency

regenerate files and small comment fix

update snapshot

fixes after testing

fix ledger live imports

Update auto-generated files.

Update libs/coin-modules/coin-elrond/src/bridge/js.ts

Co-authored-by: Samy Rabah <rabah.m.samy@gmail.com>

Fix regression - passing the data field (MultiversX transactions).

Bit of refactoring. Add unit tests.

mobile import fixes

Fix displayed amount upon performing a "delegate" operation.

Add unit tests.

Fix types within tests.

fixes after review

regenerate pnpm-lock

fix pnpmlock

update unimported

log out flaky test
remove logs

changeset
@Wozacosta Wozacosta merged commit 8679584 into develop Sep 16, 2024
51 of 52 checks passed
@Wozacosta Wozacosta deleted the feat/coin-multiversx-final branch September 16, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Has changes in live-common desktop Has changes in LLD ledgerjs Has changes in the ledgerjs open source libs mobile Has changes in LLM tools Has changes in tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants