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

[rpc][bugfix] Remove the usage of get_past_object_read from get_coin_metadata #11971

Merged
merged 1 commit into from
May 15, 2023

Conversation

666lcz
Copy link
Contributor

@666lcz 666lcz commented May 12, 2023

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

@vercel
Copy link

vercel bot commented May 12, 2023

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

4 Ignored Deployments
Name Status Preview Updated (UTC)
explorer ⬜️ Ignored (Inspect) May 12, 2023 10:17pm
explorer-storybook ⬜️ Ignored (Inspect) May 12, 2023 10:17pm
sui-wallet-kit ⬜️ Ignored (Inspect) May 12, 2023 10:17pm
wallet-adapter ⬜️ Ignored (Inspect) May 12, 2023 10:17pm

@666lcz 666lcz changed the title Remove the usage of get_past_object_read from get_coin_metadata [rpc][bugfix] Remove the usage of get_past_object_read from get_coin_metadata May 12, 2023
@666lcz 666lcz requested a review from patrickkuo May 12, 2023 22:18
@666lcz 666lcz marked this pull request as ready for review May 12, 2023 22:26
@666lcz 666lcz requested review from gegaowp, healthydeve and wlmyng May 12, 2023 22:27
@666lcz 666lcz enabled auto-merge (squash) May 15, 2023 14:28
@666lcz 666lcz merged commit 3df29ff into main May 15, 2023
@666lcz 666lcz deleted the chris-fix-metadata branch May 15, 2023 14:38
666lcz added a commit that referenced this pull request 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)

- [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
666lcz added a commit that referenced this pull request May 15, 2023
…rom get_coin_… (#11999)

…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

## 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
ronny-mysten pushed a commit that referenced this pull request May 17, 2023
…metadata (#11971)

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

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.

- [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

Fixed a bug for `get_coin_metadata` which can return null when the
fullnode is pruned
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