aptos-labs / aptos-labs/explorer

[Bug] Explorer does not render private view functions

Open
#571 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
124
Forks
150
Avg merge
15h 15m
Merged PRs (30d)
26

Description

@banool @CapCap

Per @davidiw migrated from https://github.com/aptos-labs/aptos-core/issues/8991

View functions can be declared as private when the output of the view function is generated by consuming a resource such that the write set is simply thrown away per https://github.com/aptos-labs/aptos-core/pull/8539

Presently, the explorer does not render view functions that are declared private, even though these should be publicly accessible outside of the VM.

# Example

Private view function source code: https://github.com/econia-labs/econia/blob/c79e58eeb7129029d9336edd6205c8aaf73e3866/src/move/econia/sources/market.move#L935-L980

CLI view output:

```
econia_testnet_addr=0x40b119411c6a975fca28f1ba5800a8a418bba1e16a3f13b1de92f731e023d135
aptos move view \
--function-id $econia_testnet_addr::market::index_orders \
--args String:1
{
"Result": [
{
"asks": [],
"bids": [
{
"custodian_id": "0",
"order_access_key": "1",
"price": "900",
"size": "1",
"user": "0x40b119411c6a975fca28f1ba5800a8a418bba1e16a3f13b1de92f731e023d135"
},
{
"custodian_id": "0",
"order_access_key": "2",
"price": "899",
"size": "1",
"user": "0x40b119411c6a975fca28f1ba5800a8a418bba1e16a3f13b1de92f731e023d135"
},
{
"custodian_id": "0",
"order_access_key": "3",
"price": "898",
"size": "1",
"user": "0x40b119411c6a975fca28f1ba5800a8a418bba1e16a3f13b1de92f731e023d135"
}
]
}
]
}
```

Explorer link with missing view function:

https://explorer.aptoslabs.com/account/0x40b119411c6a975fca28f1ba5800a8a418bba1e16a3f13b1de92f731e023d135/modules/view/assets?network=testnet

Explorer render with `market::index_orders()` missing:

Screenshot 2023-07-16 at 06 57 11

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the missing function at the linked Explorer account URL and compare it with the supplied CLI output. Trace the Explorer's module view-function discovery and rendering path; done means private view functions such as market::index_orders appear and can be rendered like other view functions.

Written by the indexing model from the issue text.

Assessment

Tech stack
blockchain, typescript
Domain
blockchain, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.