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

Adding a Box Describing VStorage as readonly Contract State Query #1256

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

amessbee
Copy link
Contributor

@amessbee amessbee commented Dec 4, 2024

Copy link

cloudflare-workers-and-pages bot commented Dec 4, 2024

Deploying documentation with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7f50eb6
Status: ✅  Deploy successful!
Preview URL: https://05251ca3.documentation-7tp.pages.dev
Branch Preview URL: https://ms-vstorage-as-readonly-api.documentation-7tp.pages.dev

View logs

Copy link

github-actions bot commented Dec 4, 2024

Cloudflare deployment logs are available here

@amessbee amessbee marked this pull request as ready for review December 4, 2024 09:37
@amessbee amessbee requested a review from dckc December 4, 2024 09:37
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

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

"economical" is good, but again, "cost-free" is too far.

and I think a link is incomplete

Comment on lines 52 to 53
the Agoric chain does not offer such direct readonly APIs for querying contract state. Instead, the Agoric
platform achieves this functionality through a powerful feature called VStorage.
Copy link
Member

Choose a reason for hiding this comment

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

editorial: starting with "Agoric does not offer X" feels weird.
and "a powerful feature" seems like bravado that I wouldn't expect in docs.

Maybe move the ethereum stuff to the end of this box? "This contract state query mechanism provides much of the funcionality of ethereum readonly or view query APIs." I dunno.

Copy link
Contributor Author

@amessbee amessbee Dec 11, 2024

Choose a reason for hiding this comment

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

@dckc I agree but I am a bit at loss regarding how to start this box - would appreciate any idea s.

Copy link
Member

Choose a reason for hiding this comment

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

maybe:

To expose contract state for query, where smart contracts on Ethereum and other chains use readonly or view query methods, Agoric smart contracts write to storage nodes so that clients can query them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, updated!

Comment on lines 57 to 58
API on other blockchains. It is completely cost-free, meaning developers and users can fetch data
from VStorage without incurring any fees.
Copy link
Member

Choose a reason for hiding this comment

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

While we don't have a vstorage-specific cost-recovery mechanism in place, there is a cost to the validators and such to store the data. For mainnet 2, we manually verify that the cost of storage used by contracts is paid for somehow. For example, in Inter Protocol, there's a charge to open a vault and to keep it open.

As to fetching the data, operating an RPC server also has a cost. It's typically not born directly by developers or users, but there's no particular guarantee of availability. Rate limiting is typically used to keep the cost manageable, for example.

It's worth saying that fetching data does not incur the cost of a blockchain transaction. But "completely cost-free" over-states the case.


For instace, if a smart contract manages educational records, it can publish any relevant information
to VStorage through a `chainStorage` API, and anyone can query this data to verify the authenticity of
the records. This approach is illustrated in the [dapp-ed-cert.
Copy link
Member

Choose a reason for hiding this comment

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

dapp-ed-cert link seems incomplete.

Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to have a small snippet of code inline here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding the snippet, I am not sure at this point. ATM dapp-ed-cert using E(), as in:

const edCertNode = E(certificateDataRoot).makeChildNode(edCert.certificateId);
await E(edCertNode).setValue(JSON.stringify(edCert));

I would rather add the snippet later after I have fixed it.

Comment on lines 63 to 65
Agoric’s approach replaces direct readonly APIs with a public and cost-free vstorage mechanism,
enabling developers to create dynamic and responsive dApps while keeping the blockchain interactions
efficient and economical.
Copy link
Member

Choose a reason for hiding this comment

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

"economical" is good, but again, "cost-free" is too far.

@amessbee amessbee requested a review from dckc December 11, 2024 15:07
@amessbee amessbee force-pushed the ms/vstorage-as-readonly-API branch from 44d68ae to 1479a31 Compare December 13, 2024 06:00
@amessbee amessbee force-pushed the ms/vstorage-as-readonly-API branch from 1479a31 to 7f50eb6 Compare December 13, 2024 06:02
@amessbee amessbee merged commit c2d1108 into main Dec 13, 2024
6 checks passed
@amessbee amessbee deleted the ms/vstorage-as-readonly-API branch December 13, 2024 06:28
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