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

Fix: LIVE-12068 [cosmos]Adapt LL code to avoid using deprecated endpoints #6735

Merged
merged 10 commits into from May 15, 2024

Conversation

hzheng-ledger
Copy link
Contributor

@hzheng-ledger hzheng-ledger commented Apr 24, 2024

βœ… Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • **Impact of the changes: no impact
    • ...

πŸ“ Description

  1. Since sdk 0.50, the GetTxsEvent will use "query" param instead of "event", see https://docs.cosmos.network/api#tag/Service/operation/GetTxsEvent for more details.
    So, we should firstly check the cosmos sdk version and use query/event according to different cosmos sdk version.

  2. Since sdk 0.50, the GetTxsEvent endpoint returns empty "logs"(a field in the GetTxsEvent api response). so we can't use logs to retrieve transactions any more. We should use "tx.body.messages" from now on.

Fixed regression:
For example, dydx and dydx testnet upgrade the cosmos SDK to 0.50 recently. So, the current codebase doesn't work with them.
Here is an example:

https://testnet-dydx-api.lavenderfive.com/cosmos/tx/v1beta1/txs?query=message.sender=%27dydx1pax8j79vm78qqvsnd5maklujqxahqm6j6r2mkl%27&pagination.limit=100&pagination.offset=0&pagination.reverse=true

as we can see that the "logs" array is always empty in the response.

❓ Context


🧐 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)

@hzheng-ledger hzheng-ledger requested a review from a team as a code owner April 24, 2024 08:35
Copy link

vercel bot commented Apr 24, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
web-tools ❌ Failed (Inspect) May 15, 2024 1:29am
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 1:29am
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 1:29am
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 1:29am
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 1:29am

@live-github-bot live-github-bot bot added the common Has changes in live-common label Apr 24, 2024
hedi-edelbloute
hedi-edelbloute previously approved these changes May 2, 2024
Comment on lines +6 to +14
export const getMainMessage = (messages: CosmosEventMessage[]): CosmosEventMessage => {
const messagePriorities: string[] = [
"unbond",
"redelegate",
"delegate",
"withdraw_rewards",
"transfer",
"MsgUndelegate",
"MsgBeginRedelegate",
"MsgDelegate",
"MsgWithdrawDelegatorReward",
"MsgTransfer",
"MsgRecvPacket",
"MsgSend",
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ‘ πŸ‘

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I missed it, but I don't think we have a test checking that with a node on v0.50 we use a different URI ?

@lambertkevin lambertkevin merged commit bbb1e8d into develop May 15, 2024
56 of 58 checks passed
@lambertkevin lambertkevin deleted the bugfix/LIVE-12068-cosmos-sdk-update branch May 15, 2024 08:40
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants