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

test: verify purse balances are updated after smartWallet upgrade #8787

Merged
merged 40 commits into from
Feb 19, 2024

Conversation

Chris-Hibbert
Copy link
Contributor

closes: #8293

Description

Verify that purse balances are updated after smartWallet upgrade in an a3p-integration test.

Security Considerations

None.

Scaling Considerations

None

Documentation Considerations

None

Testing/Upgrade Considerations

This is a test that upgrading SmartWallet maintains the ability to update vstorage for purses.

Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

Some

"type": "module",
"license": "Apache-2.0",
"dependencies": {
"@agoric/synthetic-chain": "^0.0.3",
Copy link
Member

Choose a reason for hiding this comment

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

if you use 0.0.4-2 then you don't need core-eval-support.js and most of performActions.js.

you'll still need eval.sh because you're making an extra submission distinct from the agoricProposal one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

core-eval-support.js is gone, but I couldn't find definitions of anything in performActions in @synthetic-chain. How/where should I have searched?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

3836e70a takes us back to 0.0.3, so I'm going to assume for now that the suggestions about reducing performActions.js won't apply until a later branch.

a3p-integration/proposals/b:wallet-factory2/package.json Outdated Show resolved Hide resolved
a3p-integration/proposals/b:wallet-factory2/package.json Outdated Show resolved Hide resolved
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

No blockers, but the code can be simpler to reduce maintenance cost and be a better example

/** Provide access to the outside world via context. */
const makeTestContext = async () => {
// assume filenames don't overlap
const bundleAssets = makeFakeWebCache('submission');
Copy link
Member

Choose a reason for hiding this comment

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

if you're going to keep this part of performActions.ts then consider renaming the submission directory and this string that's looking for it.

But I think you could simplify this file to,

import { evalBundles } from '@agoric/synthetic-chain/src/lib/core-eval.js`;
evalBundles('zcfProber-submission');

Oh, I guess there's already support for specifying a directory path. 🤦

Copy link
Contributor Author

@Chris-Hibbert Chris-Hibbert Jan 26, 2024

Choose a reason for hiding this comment

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

I reran yarn; yarn build, but I still don't see '@agoric/synthetic-chain/src/lib/core-eval.js';. I looked in a3p as well, and it doesn't appear to be in packages/synthetic-chain/src/lib, and I've just pulled again.

@Chris-Hibbert
Copy link
Contributor Author

Sorry, I asked for a re-review, but I hadn't submitted my comments. Apologies.

Copy link
Contributor Author

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

I moved the proposal from ./submission to ./invite-submission.

"type": "module",
"license": "Apache-2.0",
"dependencies": {
"@agoric/synthetic-chain": "^0.0.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

3836e70a takes us back to 0.0.3, so I'm going to assume for now that the suggestions about reducing performActions.js won't apply until a later branch.

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.

Why is this a new layer? Why are the tests not added to the chain software upgrade layer which already performs the wallet factory upgrade as a core proposal?

@mhofman mhofman added the force:integration Force integration tests to run on PR label Jan 26, 2024
Comment on lines 1 to 2
The main core-eval submission here is the wallet upgrade, which is specified in
package.json and built in ./submission.
Copy link
Member

Choose a reason for hiding this comment

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

not true anymore but not a blocker.

The wallet upgrade is part of the upgrade-14 "upgradeInfo"

The core-eval is invoked from the test, which then verifies that the details are
written to vstore.

https://github.com/Agoric/agoric-3-proposals/issues/82 will provide a better way
Copy link
Member

Choose a reason for hiding this comment

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

lots of room for improvement :)

@Chris-Hibbert Chris-Hibbert force-pushed the 8445-a3p-tests branch 7 times, most recently from 77dc118 to 5e98f9f Compare January 31, 2024 22:36
@Chris-Hibbert Chris-Hibbert force-pushed the 8445-a3p-tests branch 2 times, most recently from 929c333 to 0be12d4 Compare February 9, 2024 01:32
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.

LGTM besides the unexplained logging change to the smart wallet

@@ -0,0 +1,12 @@
This core-eval installs upgrades for the wallet and Zoe. This test verifies that
Copy link
Member

Choose a reason for hiding this comment

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

Probably should remove the first sentence since the wallet factory and zoe upgrades are part of the chain software upgrade now.

Copy link
Member

Choose a reason for hiding this comment

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

Please revise the whole readme. I think it was moved from a README for the earlier governance proposal but now it's scoped to just this core-eval used for testRepairs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's another attempt.

These files enable a test of the walletFactory changes in upgrade-14, by
verifying that upgraded wallets that aren't backed by vbanks can still add
assets, in this case an invitation.

(sendInvite.tpl) to produce the .js file that will be submitted.

The core-eval is invoked from the test, which then verifies that the details
were written to vstore.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
were written to vstore.
were written to vstorage.

Comment on lines 43 to 44
const replaceAddressInFile = async (string, fileName, replacement) => {
const scriptBuffer = await readFile(`${SUBMISSION_DIR}/${fileName}.tpl`);
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the order of arguments is surprising. Also why hard code SUBMISSION_DIR instead of expecting it in the input fileName?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestions.

trace(`Found ${brandToPurses.values()} purse(s) for ${address}`);
trace(`Found purse(s) for ${address}`);
Copy link
Member

Choose a reason for hiding this comment

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

Is this change to debug logging in the smart wallet meant to go into a "testing" PR?

It's also a change I don't see on master.

Copy link
Member

Choose a reason for hiding this comment

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

please revert

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Chris-Hibbert
Copy link
Contributor Author

I simplified testRepairs.ts substantially (and dropped all the added dependencies) after getting it to work cross-platform. It's worth another look.

@mhofman mhofman changed the base branch from dev-upgrade-14 to mhofman/cherry-pick-ibc-updates February 18, 2024 03:32
@mhofman mhofman changed the base branch from mhofman/cherry-pick-ibc-updates to mhofman/cherry-pick-a3p-changes February 18, 2024 03:36
Chris-Hibbert and others added 2 commits February 18, 2024 03:41
)

* test: verify purse balances are updated after smartWallet upgrade

* chore: helpful suggestions from review

* refactor: testRepairs to Ava test

* chore: make test work on master

* chore: rearrange files, repair merge conflict

* chore: rename

* chore: adapt wallet a3p test to new core-eval style

* fixup

---------

Co-authored-by: Turadg Aleahmad <turadg@agoric.com>
Co-authored-by: Mathieu Hofman <mathieu@agoric.com>
@mhofman
Copy link
Member

mhofman commented Feb 18, 2024

I re-synced this PR with #8909 and stacked it on #8942

@mhofman mhofman force-pushed the mhofman/cherry-pick-a3p-changes branch 2 times, most recently from 44ae7cc to 6d9459d Compare February 19, 2024 21:17
Base automatically changed from mhofman/cherry-pick-a3p-changes to dev-upgrade-14 February 19, 2024 22:40
@mhofman mhofman merged commit 46f957f into dev-upgrade-14 Feb 19, 2024
64 checks passed
@mhofman mhofman deleted the 8445-a3p-tests branch February 19, 2024 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contract-upgrade force:integration Force integration tests to run on PR wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants