Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
327 stars 207 forks source link

introduce a `lib/` directory under `a3p-integration` #10514

Open anilhelvaci opened 4 days ago

anilhelvaci commented 4 days ago

What is the Problem Being Solved?

In a3p-integration, currently every proposal has to have its own library to place helper functions, etc. This ends up a lot of copy and pasting since most of the helpers are generic and a lot of proposal can use them. @Chris-Hibbert expressed this idea to have a higher level directory to host shared methods.

Description of the Design

Curios to hear what you think about this design as well @turadg.

Security Considerations

As long as we don't break CI, I believe we should be good.

Scaling Considerations

None.

Test Plan

Convert existing proposals from locally copied libraries to the linked one.

Upgrade Considerations

None.

Chris-Hibbert commented 4 days ago

Sorry, I didn't communicate that well. I meant symbolic links in the file system (ln -s), not whatever yarn link --symbolic does. There would just be multiple copies of the directory full of library source, but they'd all show the same files, so any updates or enhancements are visible to all proposals. I don't think it needs to be a separate package.

anilhelvaci commented 1 day ago

Honestly, I'm leaning towards using yarn link because a file system symlink enables making changes to the linked lib instance. Having multiple proposals linked to ../../lib might end up unwanted changes to it that breaks other proposals unnecessarily. What do you guys think? @Chris-Hibbert @turadg

Chris-Hibbert commented 1 day ago

Honestly, I'm leaning towards using yarn link because a file system symlink enables making changes to the linked lib instance. Having multiple proposals linked to ../../lib might end up unwanted changes to it that breaks other proposals unnecessarily. What do you guys think?

Having multiple proposals linked to ../../lib is the goal. When changes are made to support one proposal, they should support the other proposals as well. I think of this as a faster route to getting shared code than going through agoric-3-proposals/synthetic-chain. In that case, you'd also have to write the library so that it supports all clients.