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

[Bug] Explorer does not render private view functions #571

Open
alnoki opened this issue Jul 17, 2023 · 3 comments
Open

[Bug] Explorer does not render private view functions #571

alnoki opened this issue Jul 17, 2023 · 3 comments

Comments

@alnoki
Copy link

alnoki commented Jul 17, 2023

@banool @CapCap

Per @davidiw migrated from aptos-labs/aptos-core#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 aptos-labs/aptos-core#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
@0xbe1
Copy link
Contributor

0xbe1 commented Oct 24, 2024

@alnoki it is because private view function are not included in the generated abi file, and the explorer replies on generated abi to list all entry/view functions.

@gregnazario does it make sense to add private view function to generated abi?

@gregnazario
Copy link
Contributor

Actually the generated ABI file and the ABI from the module API differ. The module API includes private entry functions as well.

@0xbe1
Copy link
Contributor

0xbe1 commented Oct 24, 2024

Actually the generated ABI file and the ABI from the module API differ. The module API includes private entry functions as well.

@gregnazario Not sure i follow, but i check alex's example module https://api.testnet.staging.aptoslabs.com/v1/accounts/0x40b119411c6a975fca28f1ba5800a8a418bba1e16a3f13b1de92f731e023d135/modules?limit=1000 but i cannot find function index_orders in the response abi field - do i miss anything?

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

No branches or pull requests

3 participants