-
Notifications
You must be signed in to change notification settings - Fork 208
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
feat(cosmos): upgrade provisioning vat #8901
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...integration/proposals/a:upgrade-next/provisioning-test-submission/send-script-permit.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
true |
28 changes: 28 additions & 0 deletions
28
a3p-integration/proposals/a:upgrade-next/provisioning-test-submission/send-script.tjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#! false node --ignore-this-line | ||
/* global E */ | ||
|
||
/// <reference types="@agoric/vats/src/core/core-eval-env"/> | ||
/// <reference types="@agoric/vats/src/core/types-ambient"/> | ||
|
||
/** | ||
* Send a payment by looking up deposit facet via namesByAddress. | ||
* | ||
* see ./post.test.js | ||
* | ||
* @param {BootstrapPowers} powers | ||
*/ | ||
const sendIt = async powers => { | ||
const addr = '{{ADDRESS}}'; | ||
const { | ||
consume: { namesByAddress, zoe }, | ||
instance: { | ||
consume: { reserve }, | ||
}, | ||
} = powers; | ||
const pf = E(zoe).getPublicFacet(reserve); | ||
const anInvitation = await E(pf).makeAddCollateralInvitation(); | ||
const addressDepositFacet = E(namesByAddress).lookup(addr, 'depositFacet'); | ||
await E(addressDepositFacet).receive(anInvitation); | ||
}; | ||
|
||
sendIt; |
51 changes: 51 additions & 0 deletions
51
a3p-integration/proposals/a:upgrade-next/provisioning.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// @ts-check | ||
|
||
import test from 'ava'; | ||
import { readFile, writeFile } from 'node:fs/promises'; | ||
|
||
import { | ||
getIncarnation, | ||
getUser, | ||
evalBundles, | ||
waitForBlock, | ||
agoric, | ||
} from '@agoric/synthetic-chain'; | ||
|
||
const SUBMISSION_DIR = 'provisioning-test-submission'; | ||
|
||
/** | ||
* @param {string} fileName base file name without .tjs extension | ||
* @param {Record<string, string>} replacements | ||
*/ | ||
const replaceTemplateValuesInFile = async (fileName, replacements) => { | ||
let script = await readFile(`${fileName}.tjs`, 'utf-8'); | ||
for (const [template, value] of Object.entries(replacements)) { | ||
script = script.replaceAll(`{{${template}}}`, value); | ||
} | ||
await writeFile(`${fileName}.js`, script); | ||
}; | ||
|
||
test(`provisioning vat was upgraded`, async t => { | ||
const incarnation = await getIncarnation('provisioning'); | ||
|
||
t.is(incarnation, 1); | ||
}); | ||
|
||
test(`send invitation via namesByAddress`, async t => { | ||
const addr = await getUser('gov1'); | ||
|
||
await replaceTemplateValuesInFile(`${SUBMISSION_DIR}/send-script`, { | ||
ADDRESS: addr, | ||
}); | ||
|
||
await evalBundles(SUBMISSION_DIR); | ||
|
||
await waitForBlock(2); // enough time for invitation to arrive? | ||
const update = await agoric.follow('-lF', `:published.wallet.${addr}`); | ||
t.is(update.updated, 'balance'); | ||
t.notDeepEqual(update.currentAmount.value, []); | ||
t.log('balance value', update.currentAmount.value); | ||
t.log('balance brand', update.currentAmount.brand); | ||
// XXX agoric follow returns brands as strings | ||
t.regex(update.currentAmount.brand, /Invitation/); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is more than a test... ah... the commit message says
feat
. The PR title threw me off a bit.