Open turadg opened 7 months ago
Can you clarify "broke using the library in vats"? I believe there's at least an option 4:
@agoric/cosmic-proto
modules can be imported within a contract/vat. This is also useful to minimize the amount of dead code bundled with your contract since @endo/bundle-source
doesn't yet do tree shaking.Can you clarify "broke using the library in vats"?
Getting the registry requires enabling amino types in codegen, which entails tendermint-rpc which entails axios and http
which is not available in a vat.
E.g. if you revert the last three commits of https://github.com/Agoric/agoric-sdk/pull/9112 and run build:submissions
in a3p-integration you'll get,
TypeError#1: Failed to load module "./src/proposals/localchain-test.js" in package "file:///opt/agoric/agoric-sdk/packages/vats/" (11 underlying failures: Cannot find external module "http" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "https" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "util" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "zlib" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "stream" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "events" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "stream" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "util" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "stream" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "stream" in package file:///opt/agoric/agoric-sdk/node_modules/axios/, Cannot find external module "url" in package file:///opt/agoric/agoric-sdk/node_modules/axios/
I've pushed that as https://github.com/Agoric/agoric-sdk/pull/9202 so you can see it in CI.
Even a targeted import of a module has the same problem,
import { MsgDelegate } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx';
This is why I enumerated option 3 to unencumber the codec modules with the client dependencies. I don't see how we could get much use out of detailed instructions while the modules mix dependencies in this way.
Thanks for the clear answer. I agree: my option 4 won't get us anywhere.
The scope of this is codegen for read-only queries. Transaction signing support can build on this and I'll track that in https://github.com/Agoric/agoric-sdk/issues/5912
What is the Problem Being Solved?
For a few weeks we had RPC query clients using Telescope:
But the implementation broke using the library in vats, which is more urgent. So this ticket is for restoring that functionality.
Description of the Design
Some options:
Security Considerations
Scaling Considerations
Test Plan
Upgrade Considerations