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

[cherry-pick][rpc][bugfix] Remove the usage of get_past_object_read from get_coin_… #11999

Merged
merged 1 commit into from
May 15, 2023

Conversation

666lcz
Copy link
Contributor

@666lcz 666lcz commented May 15, 2023

…metadata (#11971)

Description

The current implementation of get_coin_metadata relies on get_past_object_read, which stops working if the fullnode has pruning enabled. This is unnecessary because we only need the latest version of the coinmetada object(if it is wrapped, then it's okay to return null).

Test Plan

tested locally

curl --location 'https://mainnet.sui.rpcpool.com' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc":"2.0",
    "id":1,
    "method":"suix_getCoinMetadata",
    "params":["0x2::sui::SUI"]
}'
{
    "jsonrpc": "2.0",
    "result": {
        "decimals": 9,
        "name": "Sui",
        "symbol": "SUI",
        "description": "",
        "iconUrl": null,
        "id": "0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3"
    },
    "id": 1
}

If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.

Type of Change (Check all that apply)

  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

Fixed a bug for get_coin_metadata which can return null when the fullnode is pruned

Description

Describe the changes or additions included in this PR.

Test Plan

How did you test the new or updated feature?


If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.

Type of Change (Check all that apply)

  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

…metadata (#11971)

## Description 

The current implementation of `get_coin_metadata` relies on
`get_past_object_read`, which stops working if the fullnode has pruning
enabled. This is unnecessary because we only need the latest version of
the coinmetada object(if it is wrapped, then it's okay to return null).

## Test Plan 

tested locally

```
curl --location 'https://mainnet.sui.rpcpool.com' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc":"2.0",
    "id":1,
    "method":"suix_getCoinMetadata",
    "params":["0x2::sui::SUI"]
}'
```

```
{
    "jsonrpc": "2.0",
    "result": {
        "decimals": 9,
        "name": "Sui",
        "symbol": "SUI",
        "description": "",
        "iconUrl": null,
        "id": "0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3"
    },
    "id": 1
}
```

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [x] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes

Fixed a bug for `get_coin_metadata` which can return null when the
fullnode is pruned
@vercel
Copy link

vercel bot commented May 15, 2023

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

4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) May 15, 2023 5:21pm
explorer-storybook ⬜️ Ignored (Inspect) May 15, 2023 5:21pm
sui-wallet-kit ⬜️ Ignored (Inspect) May 15, 2023 5:21pm
wallet-adapter ⬜️ Ignored (Inspect) May 15, 2023 5:21pm

@666lcz 666lcz marked this pull request as ready for review May 15, 2023 17:20
@666lcz 666lcz changed the title [rpc][bugfix] Remove the usage of get_past_object_read from get_coin_… [cherry-pick][rpc][bugfix] Remove the usage of get_past_object_read from get_coin_… May 15, 2023
@666lcz 666lcz enabled auto-merge (squash) May 15, 2023 17:22
@666lcz 666lcz merged commit 4c9993f into releases/sui-v1.1.0-release May 15, 2023
@666lcz 666lcz deleted the chris-cp-coinmeta branch May 15, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants