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

add a CoreEval proposal to a3p-integration #8801

Merged
merged 3 commits into from
Feb 13, 2024
Merged

add a CoreEval proposal to a3p-integration #8801

merged 3 commits into from
Feb 13, 2024

Conversation

turadg
Copy link
Member

@turadg turadg commented Jan 23, 2024

refs: Agoric/agoric-3-proposals#59

Description

Trunk should have a CoreEvalProposal to demonstrate how to use them in release branches.

This also serves as a validation of the changes in Agoric/agoric-3-proposals#59 that make it much simpler to write a CoreEvalProposal package

This uses an alpha release of @agoric/synthetic-chain, 0.0.4-3

I tried to get source: buildScript working but ran into Agoric/agoric-3-proposals#87 and decided it's better to defer.

Security Considerations

n/a

Scaling Considerations

n/a

Documentation Considerations

Concern of the https:/Agoric/agoric-3-proposals/ package

Testing Considerations

Punts on an actual test of restart-vats. Basically just testing that it executes.

Upgrade Considerations

n/a

Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

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

For core evals generated in non agoric-3-proposals repos, I would really expect the core eval material to be generated dynamically from the repo and not checked in. As such I don't understand the approach. Let's discuss.

@@ -12,5 +12,6 @@
"@agoric/synthetic-chain": "^0.0.4-2",
"tsx": "^4.7.0"
},
"packageManager": "[email protected]",
Copy link
Member

Choose a reason for hiding this comment

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

I'm concerned this will force anyone / anything running this to use corepack. Is it even enabled in CI?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm concerned this will force anyone / anything running this to use corepack.

Valid concern. I adopted it to make it possible to yarn link to a local checkout of agoric-3-proposals. I'm open to cutting it. But I would argue that we should adopt corepack throughout our development.

Is it even enabled in CI?

prolly not. easy to solve for this job

Copy link
Member

Choose a reason for hiding this comment

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

I adopted it to make it possible to yarn link to a local checkout of agoric-3-proposals.

I see. Technically a link is irrespective of the package manager, as it's just a symlink in node_modules.

Would temporarily overriding the "version" to a local path not work? Arguably this package is not part of the workspace, so my concerns are not high as long as we enable corepack in CI for this test.

I would argue that we should adopt corepack throughout our development.

Yes we should get off the yarn1 train, but that's another topic.

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically a link is irrespective of the package manager, as it's just a symlink in node_modules.

That's not how Yarn 2+ works. It uses resolutions in package.json. agoric-3-proposals is using 2+ so it can't produce what a3p-integration with Yarn 1 is expecting. Of course I could manually create the symlink but I thought it would be good progress to bump Yarn here.

so my concerns are not high as long as we enable corepack in CI for this test

I'm hearing that as the request and agreement to maintain the Yarn version bump.

Copy link
Member

Choose a reason for hiding this comment

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

@mhofman
Copy link
Member

mhofman commented Jan 23, 2024

For core evals generated in non agoric-3-proposals repos, I would really expect the core eval material to be generated dynamically from the repo and not checked in.

FWIW, I still believe that for agoric-3-proposals, the material should not be checked in either, but pulled as an artifact published from the source which proposed the core eval (or maybe even the chain itself)

@turadg
Copy link
Member Author

turadg commented Jan 23, 2024

FWIW, I still believe that for agoric-3-proposals, the material should not be checked in either, but pulled as an artifact published from the source which proposed the core eval (or maybe even the chain itself)

I've seen so much CI flakiness from network dependency. I agree it should be easy to source from chain history and to validate what's checked in matches that, which is Agoric/agoric-3-proposals#67 .

@turadg
Copy link
Member Author

turadg commented Jan 25, 2024

Once approved I'll clean up the commit history with a force push. E.g. the two commits that claim o update dependencies don't
7665d9e
f19f24a

@turadg turadg requested a review from mhofman January 25, 2024 17:16
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.

looks like it's getting there...

Comment on lines 7 to 9
"build": "./node_modules/.bin/synthetic-chain build",
"test": "./node_modules/.bin/synthetic-chain test",
"doctor": "./node_modules/.bin/synthetic-chain doctor"
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't plain "synthetic-chain build" work? doesn't yarn arrange for ./node_modules.bin to be in $PATH?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should but it doesn't due to the .ts extensions. Another option is to use tsx as in Agoric/agoric-3-proposals@e4c4791

Copy link
Member

Choose a reason for hiding this comment

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

OK. Good to know.

@@ -12,5 +12,6 @@
"@agoric/synthetic-chain": "^0.0.4-2",
"tsx": "^4.7.0"
},
"packageManager": "[email protected]",
Copy link
Member

Choose a reason for hiding this comment

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

"agoricProposal": {
"type": "/agoric.swingset.CoreEvalProposal",
"source": "build",
"buildScript": "../packages/builders/scripts/vats/restart-vats.js"
Copy link
Member

Choose a reason for hiding this comment

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

hm. cross-package reference. Did you consider supporting this sort of thing?

Suggested change
"buildScript": "../packages/builders/scripts/vats/restart-vats.js"
"buildScript": "@agoric/builders/scripts/vats/restart-vats.js"

Copy link
Member

Choose a reason for hiding this comment

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

I'm actually confused as to which context this import is resolved in, given the ../packages. I know the upgrade core proposal mechanism implemented by cosmic-swingset supports the @agoric/builders form, and it would be confusing if this type of proposal didn't.

More generally however, I'm wondering if a "resolve in the context of agoric-sdk" approach is correct for core evals. And where does the agoric-sdk even come from, the one inside the image? Consider 3rd party contracts that only depend on agoric-sdk packages through NPM installed packages, no checkout of agoric-sdk. How should their version of a3p-integration in their own repo resolve the build script?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now this is just relative to where the synthetic-chain is run, so a3p-integration. I could do some work to make it resolves against NPM packages, but can we call that future work?

How should their version of a3p-integration in their own repo resolve the build script?

Right now it's the relative path. If we went the package resolution route, it would be the package export. But I don't think we should require them to make their build script an export from a package. It's just a file.

Copy link
Member Author

Choose a reason for hiding this comment

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

normally you want to generate a core eval from your local repo, which may not be agoric-sdk.

Exactly. That's why I think it best to leave this to filesystem path resolution. Another repo might have a3p-integration as its home for this tooling, or not. It'll just be somewhere in the repo. And the build script will be referenced relative to that.

Oh, maybe here's the confusion: this buildScript is executed before any Docker comes into play. It's a convention of the synthetic-chain tooling that it builds the script and puts the output into the proposal directory, so that it's there during the image building.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, maybe here's the confusion: this buildScript is executed before any Docker comes into play. It's a convention of the synthetic-chain tooling that it builds the script and puts the output into the proposal directory, so that it's there during the image building.

Ah that's where I was confused, and yes this is the behavior I expect. In this case I am fine with relative path, they actually make more sense.

Copy link
Member

Choose a reason for hiding this comment

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

I could do some work to make it resolves against NPM packages, but can we call that future work?

Yes.

And I'm content without an issue until motivation is more pressing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now running into,

agoric: run: running /home/runner/work/agoric-sdk/agoric-sdk/packages/builders/scripts/vats/restart-vats.js
agoric: (Error#1)
Error#1: Cannot find package '@agoric/deploy-script-support' imported from /home/runner/work/agoric-sdk/agoric-sdk/packages/builders/scripts/vats/restart-vats.js

So it's not "just a file". I could add @agoric/deploy-script-support to the a3p-integration package.json, but it'll surprise someone again when they depend on something else.

I think a3p-integration needs to be part of the repo workspace, so when it runs these scripts from the repo they can use anything in the repo.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've got a commit to do that, but it runs into a new problem with https:/Agoric/agoric-3-proposals/blob/main/packages/synthetic-chain/cli.ts#L53-L56

I'll mark this as Draft until I get that working in a 0.0.4-3 or later

"runModuleBehaviors": "makeCoreProposalBehavior"
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

github flags lack of a newline at end of file here.
Do we have a shop norm?
Locally, I get a lot of spurious diffs on save for this sort of thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have .editorconfig set up to specify line endings but I think the norm is to include them.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just a file move of the output from agoric run. If we want the file here to have a newline, I think the proper fix is to update upstream. (I don't think it's worth it)

Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

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

I'm confused about the design goal of the core eval support in synthethic-chain. It seems to be geared towards generating core eval material from the agoric-sdk repo inside the container, but I think that is the outlier use case, and normally you want to generate a core eval from your local repo, which may not be agoric-sdk.

I likely misunderstood something, so let's discuss.

"agoricProposal": {
"type": "/agoric.swingset.CoreEvalProposal",
"source": "build",
"buildScript": "../packages/builders/scripts/vats/restart-vats.js"
Copy link
Member

Choose a reason for hiding this comment

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

I'm actually confused as to which context this import is resolved in, given the ../packages. I know the upgrade core proposal mechanism implemented by cosmic-swingset supports the @agoric/builders form, and it would be confusing if this type of proposal didn't.

More generally however, I'm wondering if a "resolve in the context of agoric-sdk" approach is correct for core evals. And where does the agoric-sdk even come from, the one inside the image? Consider 3rd party contracts that only depend on agoric-sdk packages through NPM installed packages, no checkout of agoric-sdk. How should their version of a3p-integration in their own repo resolve the build script?

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.

This looks quite helpful.

@turadg
Copy link
Member Author

turadg commented Jan 26, 2024

Integration test failing with,

Refreshing submission for b restart-vats
/bin/sh: 1: agoric: not found
node:internal/errors:86[5](https:/Agoric/agoric-sdk/actions/runs/7670307322/job/20906183146?pr=8801#step:6:6)
  const err = new Error(message);
              ^

Error: Command failed: agoric run ../../../../packages/builders/scripts/vats/restart-vats.js

That seems due to the Yarn 4.0.2 update, which can be punted so I'm removing those commits.

(#8801 (comment) was by Mergify. #8801 (comment) has the fix to test)

@turadg turadg force-pushed the ta/a3p-coreeval branch 2 times, most recently from 9c18377 to eaaca65 Compare January 26, 2024 16:27
@mhofman
Copy link
Member

mhofman commented Jan 26, 2024

That seems due to the Yarn 4.0.2 update, which can be punted so I'm removing those commits.

Looks like we still have the same failure with older yarn

@turadg
Copy link
Member Author

turadg commented Jan 26, 2024

Looks like we still have the same failure with older yarn

Yep, that's what the next build shows. It's not happening for me locally because I have agoric in my path. I have really wanted to not have JS code shell out to a CLI that's implemented in JS code. I'll see if I can solve short-circuit that quickly. Probably not today.

@dckc
Copy link
Member

dckc commented Jan 26, 2024

FWIW, I saw no trouble with b:restart-vats in combination with yarn 4 in the release branch context (#8819).

@mhofman
Copy link
Member

mhofman commented Jan 26, 2024

I have really wanted to not have JS code shell out to a CLI that's implemented in JS code.

In the case of 3rd party dapps, the agoric CLI would be NPM installed. I think in all cases it should be fine to assume that there is an agoric-cli in the "NPM PATH environment"

$ ls -la node_modules/.bin/agoric 
lrwxrwxrwx 1 node node 43 Jan 25 19:13 node_modules/.bin/agoric -> ../../packages/agoric-cli/src/entrypoint.js

I'm wondering if the problem is that a3p-integration is outside the workspace, so the environment created by yarn is scoped to a3p-integration and not to the containing workspace. I'm not sure how we should solve that however (I'm not sure the yarn.lock of the workspace should be affected by a3p-integration)

@turadg turadg removed the automerge:rebase Automatically rebase updates, then merge label Jan 26, 2024
@turadg turadg marked this pull request as draft January 26, 2024 17:32
@turadg turadg self-assigned this Jan 29, 2024
yarn.lock Outdated
Copy link
Member

Choose a reason for hiding this comment

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

It looks like we started taking on dependencies onto the published versions of agoric-sdk packages, and different endo versions. I am very worried this will cause issues. I haven't traced the cause, but I'm wondering if we can avoid this somehow.

yarn.lock Outdated
@@ -2686,6 +3468,50 @@ aggregate-error@^4.0.0:
clean-stack "^4.0.0"
indent-string "^5.0.0"

agoric@^0.22.0-u13.0:
Copy link
Member

Choose a reason for hiding this comment

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

I think this is what is entraining all the new deps

@@ -11,6 +11,7 @@
},
"dependencies": {
"@agoric/synthetic-chain": "^0.0.4-3",
"agoric": "^0.22.0-u13.0",
Copy link
Member

Choose a reason for hiding this comment

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

Oh yeah, why are we depending on the published version here?

Copy link
Member Author

@turadg turadg Jan 29, 2024

Choose a reason for hiding this comment

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

aye, this was to get the version when it was in a separate workspace. I put into the SDK workspace, which makes this change unnecessary (and harmful)

Copy link
Member Author

Choose a reason for hiding this comment

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

I had to revert because mixing a3p-integration into the root project ran into too many assumptions made about workspace packages

@turadg turadg marked this pull request as ready for review January 30, 2024 14:40
@turadg turadg requested a review from mhofman January 30, 2024 14:40
@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label Jan 30, 2024
Comment on lines 5 to 8
The `submission` dir was built using:
`packages/builders/scripts/vats/restart-vats.js`

UNTIL https:/Agoric/agoric-3-proposals/issues/87
Copy link
Member

Choose a reason for hiding this comment

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

I am extremely uncomfortable with this approach in the context of an a3p-integration test. People will not know and forget to regenerate these bundles, which will get out of sync with the code in the repo.

At the very least, I would want CI to verify that the bundles are up to date, but then that begs the question of why CI can't generate the bundles automatically in the first place.

Is there really not a way to support a "spawn this command to generate bundles" mode? What in the local generation requires manual intervention that it can't be scripted?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure it's possible. I understood that someone was blocked on the changes already here so I figured that can land after these other changes. But they don't actually depend on these changes so I'll drop this back into draft and make Agoric/agoric-3-proposals#87 be part of its requirements.

There's other work here that's safe to land which I've pulled out into #8839

@turadg turadg mentioned this pull request Jan 30, 2024
@turadg turadg marked this pull request as draft January 30, 2024 15:22
@turadg turadg removed the automerge:rebase Automatically rebase updates, then merge label Jan 30, 2024
@turadg
Copy link
Member Author

turadg commented Feb 9, 2024

Current hurdle: JSON parsing failure due to extra output from Cosmos.

The fix merged a couple days ago but hasn't reached our master yet.

@mhofman
Copy link
Member

mhofman commented Feb 9, 2024

Current hurdle: JSON parsing failure due to extra output from Cosmos.

The fix merged a couple days ago but hasn't reached our master yet.

There's an incoming fix for that. I have a branch with the fix, but it fails on another problem (the proposal doesn't seem available when queried for deposit and voting): https:/Agoric/agoric-sdk/compare/mhofman/provisioning-upgrade

@turadg turadg marked this pull request as ready for review February 13, 2024 16:35
@turadg turadg requested review from dckc and mhofman February 13, 2024 16:36
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.

I'm a little surprised to see the bundle checked in, but I guess that's the current state of the art?

{
"agoricProposal": {
"type": "/agoric.swingset.CoreEvalProposal",
"source": "subdir"
Copy link
Member

Choose a reason for hiding this comment

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

subdir? not submission?

I'm a little surprised to see the bundle checked in, but I guess that's the current state of the art?

Copy link
Member Author

Choose a reason for hiding this comment

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

unfortunately yes

@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label Feb 13, 2024
@mergify mergify bot merged commit b4094ba into master Feb 13, 2024
83 checks passed
@mergify mergify bot deleted the ta/a3p-coreeval branch February 13, 2024 16:46
mhofman pushed a commit that referenced this pull request Feb 18, 2024
add a CoreEval proposal to a3p-integration
mhofman pushed a commit that referenced this pull request Feb 18, 2024
add a CoreEval proposal to a3p-integration
mhofman pushed a commit that referenced this pull request Feb 19, 2024
add a CoreEval proposal to a3p-integration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge force:integration Force integration tests to run on PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants