Skip to content

save proposal from archive node #84

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

Merged
merged 10 commits into from
May 27, 2025
Merged

save proposal from archive node #84

merged 10 commits into from
May 27, 2025

Conversation

turadg
Copy link
Member

@turadg turadg commented Jan 26, 2024

closes: #67

The issue was to "validate" but I figured the more valuable cases are "do it for me" and "fix it for me". This adds scripts/add-proposal.ts which does those.

To validate, just save and git diff. If there's a problem, check in the correct version and figure out why SCM didn't have that.

Running the tool revealed that #246 didn't have the bundles from Mainnet, which I missed in review. Not something I could have done without pulling them down, so I think that speaks to the value of the automation in this tool.

Copy link

changeset-bot bot commented May 19, 2025

🦋 Changeset detected

Latest commit: f6e9817

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@agoric/synthetic-chain Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@turadg turadg requested a review from dckc May 19, 2025 23:45
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 pretty good so far

one suggestion on fetching bundles...

Comment on lines -32 to +33
"@agoric/cosmic-proto": "0.5.0-u18.5",
"@agoric/cosmic-proto": "0.4.1-dev-c0e75ad.0",
Copy link
Member

Choose a reason for hiding this comment

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

why bump it backward?

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's actually newer. the SDK release process bumped it, but u18 is older than dev which is every push to master.

fixing that is something Yarn 4 and Changesets will help with

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 surprised the lerna dev publish doesn't bump versions the same way.


export const CHAINID = NonNullish(process.env.CHAINID);
export const HOME = NonNullish(process.env.HOME);
Copy link
Member

Choose a reason for hiding this comment

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

so this reduces the scope of HOME? good.

(it still bugs me that we have a file called constants.js that's full of variables.)

console.log(
'Proposal saved to',
submissionDir,
'. Now find these bundles and save them there too:',
Copy link
Member

Choose a reason for hiding this comment

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

bundle-tool2 might have some clues to automate this.

  • provided you have the transaction hash of the bundle upload, the txMessages and getBundle calls in exploreTx should work; that's pretty well tested
  • to get find the transaction, queryBundleInstalls might work; it's not really used "in anger" though

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks these were critical clues

Copy link
Member

Choose a reason for hiding this comment

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

so the idea is that the user fetches the bundles in a separate step?

perhaps this message should refer to scripts/fetch-all-bundles.ts?

Copy link
Member Author

@turadg turadg May 27, 2025

Choose a reason for hiding this comment

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

eek, a bunch of code was lost in rebase. I'll scrounge it up

@turadg turadg force-pushed the 67-save-proposal branch 2 times, most recently from 9045994 to ef04181 Compare May 20, 2025 20:16
@turadg turadg force-pushed the 67-save-proposal branch from deb02a6 to ddddbaf Compare May 22, 2025 22:53
@turadg turadg requested a review from dckc May 22, 2025 22:55
@turadg turadg force-pushed the 67-save-proposal branch from ddddbaf to 305e35d Compare May 27, 2025 20:36

This comment was marked as resolved.

@turadg turadg force-pushed the 67-save-proposal branch from 305e35d to 2627e7b Compare May 27, 2025 20:41
@turadg turadg force-pushed the 67-save-proposal branch from 2627e7b to 171a2c6 Compare May 27, 2025 20:53
@turadg turadg requested a review from mujahidkay May 27, 2025 20:56
@turadg turadg marked this pull request as ready for review May 27, 2025 20:57
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 forward progress

'@agoric/synthetic-chain': patch
---

remove bankSend agd wrapper
Copy link
Member

Choose a reason for hiding this comment

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

should there be a changeset for the save feature?

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's part of the repo but not what gets a versioned release

@@ -14,12 +19,10 @@ corepack enable
cd "$(dirname "$(realpath -- "$0")")"

# TODO consider yarn workspaces to install all in one command
if [ -n "$PROPOSAL_PATH" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

my breaking change spidey-sense is tingling.

I presume this is internal, for now.

import { ProposalInfo } from './proposals.js';
import { type ProposalInfo } from './proposals.js';
Copy link
Member

Choose a reason for hiding this comment

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

note: I wonder why yarn lint didn't catch this earlier.

export async function saveProposalContents(proposal: ProposalInfo) {
assert(isPassed(proposal), 'unpassed propoosals are not on the chain');

const tm = await makeTendermint34Client(DEFAULT_ARCHIVE_NODE, { fetch });
Copy link
Member

Choose a reason for hiding this comment

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

note: in a follow-on, I'm inclined to try factoring out this ambient authority using some tooling...

`${proposal.proposalIdentifier}:${proposal.proposalName}`,
'submission',
);
await fsp.mkdir(submissionDir, { recursive: true });
Copy link
Member

Choose a reason for hiding this comment

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

likewise passing submissionDir as a string rather than an object representing filesystem access

console.log(
'Proposal saved to',
submissionDir,
'. Now find these bundles and save them there too:',
Copy link
Member

Choose a reason for hiding this comment

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

so the idea is that the user fetches the bundles in a separate step?

perhaps this message should refer to scripts/fetch-all-bundles.ts?

Comment on lines +9 to +13
const CACHE_DIR = path.join(
process.env.HOME || process.env.USERPROFILE || '',
'.agoric',
'cache',
);
Copy link
Member

Choose a reason for hiding this comment

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

Moving this CACHE_DIR calculation up to scripts/fetch-all-bundles.ts would make the data flow more clear (and avoid ambient authority).

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 tried it but then it made the cache dir configurable in a way that I didn't want. I also realized it was conflating authority with configuration. What would actually be ocap would be removing fs and path from the bundles module, and creating an ad-hoc powers API for it to use, but I don't think overall that's warranted

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.

a couple questions

Comment on lines 4 to 5
import { fetchMsgInstallBundleTxs } from '../src/cli/chain.js';
import { refreshBundlesCache } from '../src/lib/bundles.js';
Copy link
Member

Choose a reason for hiding this comment

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

How do these imports work?

I don't see a ../src directory.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, refactored without testing. will fix

import fs from 'node:fs';
import { execSync } from 'node:child_process';

import { saveProposalContents } from '../packages/synthetic-chain/src/cli/chain.ts';
Copy link
Member

Choose a reason for hiding this comment

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

this looks like a cross-package import or something; I'm under the impression that we avoid these, though I don't completely understand why.

This doesn't rely on any undocumented magic, does it?

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's bad if the importing package is published, because the file paths won't necessarily be there in other environments. but these imports are from a repo script which is never published

@turadg turadg force-pushed the 67-save-proposal branch from 171a2c6 to 7f8421c Compare May 27, 2025 22:22
@turadg turadg enabled auto-merge May 27, 2025 22:22
@turadg turadg force-pushed the 67-save-proposal branch from 7f8421c to f6e9817 Compare May 27, 2025 22:41
@turadg turadg merged commit 9e15465 into main May 27, 2025
4 checks passed
@turadg turadg deleted the 67-save-proposal branch May 27, 2025 23:30
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.

validate CoreEval submission in passed proposals against actual passed proposal
3 participants