-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8635 from Agoric/8605-local-a3p
8605 a3p integration
- Loading branch information
Showing
26 changed files
with
3,380 additions
and
1,247 deletions.
There are no files selected for viewing
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
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
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,12 @@ | ||
# build in CI | ||
Dockerfile | ||
upgrade-test-scripts | ||
|
||
# Yarn (https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored) | ||
proposals/*/.pnp.* | ||
proposals/*/.yarn/* | ||
proposals/*/!.yarn/patches | ||
proposals/*/!.yarn/plugins | ||
proposals/*/!.yarn/releases | ||
proposals/*/!.yarn/sdks | ||
proposals/*/!.yarn/versions |
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,50 @@ | ||
# Integration with agoric-3 synthetic test chain | ||
|
||
The test runner is `@agoric/synthetic-chain`. This package depends on that so that you can run, | ||
``` | ||
yarn synthetic-chain append | ||
yarn synthetic-chain test | ||
yarn synthetic-chain test --debug | ||
``` | ||
|
||
# Package management | ||
|
||
This directory hierarchy, while it contains packages, is not part of the agoric-sdk workspace. This is to isolate it from tooling that expects a public package published to NPM. | ||
|
||
For each proposal, their package.json is also separate but it can't access the SDK code. Instead you must either source a published version of `@agoric/synthetic-chain` (e.g. a `dev` version published on each master commit) or pack a tarball and source that. | ||
|
||
``` | ||
cd packages/synthetic-chain | ||
yarn pack | ||
TARBALL=`ls *.tgz` | ||
cd - | ||
mv packages/synthetic-chain/$TARBALL a3p-integration/proposals/c:myproposal/ | ||
# .tgz are gitignored at the root but a closer .gitignore makes an exception for this package's tarball | ||
git add a3p-integration/proposals/c:myproposal/$TARBALL | ||
yarn add @agoric/synthetic-chain@file:$TARBALL | ||
``` | ||
|
||
# Troubleshooting | ||
|
||
## no match for platform | ||
|
||
If you get an error like this, | ||
``` | ||
ERROR: failed to solve: ghcr.io/agoric/agoric-3-proposals:main: no match for platform in manifest sha256:83321abda66fa94915f1ae20d651b66870f2d1aac17b71449c04ecd46b6b1b96: not found | ||
``` | ||
it's because our CI only builds x64 yet and you're on some other machine, probably a Mac. | ||
|
||
There is some effort to make CI build multiplatform: https://github.com/Agoric/agoric-3-proposals/pull/32 | ||
|
||
Meanwhile you can build the `main` image locally: | ||
|
||
```sh | ||
cd agoric-3-proposals | ||
./node_modules/.bin/synthetic-chain build | ||
|
||
# build the default entrypoint and tag it so the `append` command finds it | ||
docker buildx build --tag ghcr.io/agoric/agoric-3-proposals:main . | ||
``` |
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,15 @@ | ||
{ | ||
"private": true, | ||
"agoricSyntheticChain": { | ||
"fromTag": "upgrade-12" | ||
}, | ||
"scripts": { | ||
"build": "echo Use synthetic-chain to build proposal images", | ||
"test": "echo Use synthetic-chain to test proposal images" | ||
}, | ||
"dependencies": { | ||
"@agoric/synthetic-chain": "^0.0.2", | ||
"tsx": "^4.7.0" | ||
}, | ||
"license": "Apache-2.0" | ||
} |
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 @@ | ||
nodeLinker: node-modules |
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,20 @@ | ||
{ | ||
"agoricProposal": { | ||
"releaseNotes": "https://github.com/Agoric/agoric-sdk/releases/tag/agoric-upgrade-13", | ||
"sdkImageTag": "latest", | ||
"planName": "agoric-upgrade-13", | ||
"type": "Software Upgrade Proposal" | ||
}, | ||
"type": "module", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@agoric/synthetic-chain": "^0.0.2-0", | ||
"ava": "^5.3.1", | ||
"better-sqlite3": "^9.2.2", | ||
"execa": "^7.2.0" | ||
}, | ||
"scripts": { | ||
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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,55 @@ | ||
import test from 'ava'; | ||
|
||
import { agd } from '@agoric/synthetic-chain/src/lib/cliHelper.js'; | ||
import { | ||
ATOM_DENOM, | ||
CHAINID, | ||
GOV1ADDR, | ||
} from '@agoric/synthetic-chain/src/lib/constants.js'; | ||
import { | ||
mintIST, | ||
getISTBalance, | ||
openVault, | ||
} from '@agoric/synthetic-chain/src/lib/econHelpers.js'; | ||
import { | ||
waitForBlock, | ||
addUser, | ||
} from '@agoric/synthetic-chain/src/lib/commonUpgradeHelpers.js'; | ||
|
||
test.before(async t => { | ||
await mintIST(GOV1ADDR, 12340000000, 10000, 2000); | ||
|
||
await waitForBlock(2); | ||
const userAddress = await addUser('user-auto'); | ||
await agd.tx( | ||
'bank', | ||
'send', | ||
'gov1', | ||
userAddress, | ||
`1000000uist,2100000000${ATOM_DENOM}`, | ||
'--from', | ||
GOV1ADDR, | ||
'--chain-id', | ||
CHAINID, | ||
'--keyring-backend', | ||
'test', | ||
'--yes', | ||
); | ||
t.context = { userAddress }; | ||
await waitForBlock(2); | ||
}); | ||
|
||
test('Open Vaults with auto-provisioned wallet', async t => { | ||
const { userAddress } = /** @type {{userAddress: string}} */ (t.context); | ||
t.is(await getISTBalance(userAddress), 1); | ||
|
||
const ATOMGiven = 2000; | ||
const ISTWanted = 400; | ||
await openVault(userAddress, ISTWanted, ATOMGiven); | ||
|
||
await waitForBlock(2); | ||
|
||
const newISTBalance = await getISTBalance(userAddress); | ||
t.log('New IST Balance in user-auto account:', newISTBalance); | ||
t.true(newISTBalance >= ISTWanted, 'Got the wanted IST'); | ||
}); |
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,4 @@ | ||
#!/bin/bash | ||
source /usr/src/upgrade-test-scripts/env_setup.sh | ||
|
||
yarn ava post.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,5 @@ | ||
#!/bin/bash | ||
|
||
# UNTIl this is upstream https://github.com/Agoric/agoric-3-proposals/issues/40 | ||
# Set to zero so tests don't have to pay gas (we're not testing that) | ||
sed --in-place=.bak s/'minimum-gas-prices = ""'/'minimum-gas-prices = "0ubld,0uist"'/ ~/.agoric/config/app.toml |
Oops, something went wrong.