-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(a3p): create a3p test for replace electorate core eval (#10241)
closes: #10138 closes: #10185 closes: #10258 ## Description A3P tests for the replace electorate core eval. also adds the replace-electorate-core.js script to upgrade.go since it will now be a part of the chain halting upgrade new tests are as follows: - adds new `n:replace-electorate` which tests for acceptance of new invitations - adds params governance proposal and voting tests to `z:acceptance` ### Security Considerations ### Scaling Considerations ### Documentation Considerations ### Testing Considerations ### Upgrade Considerations
- Loading branch information
Showing
22 changed files
with
697 additions
and
98 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ add-OLIVES/ | |
upgrade-bank/ | ||
upgrade-provisionPool/ | ||
upgrade-orch-core/ | ||
replace-electorate/ |
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,19 @@ | ||
#!/usr/bin/env node | ||
import '@endo/init'; | ||
import { agops, GOV1ADDR, GOV2ADDR } from '@agoric/synthetic-chain'; | ||
import { GOV4ADDR } from './agoric-tools.js'; | ||
|
||
// New GOV4 account to be added | ||
const addresses = [GOV1ADDR, GOV2ADDR, GOV4ADDR]; | ||
|
||
await Promise.all( | ||
addresses.map((addr, idx) => | ||
agops.ec('committee', '--send-from', addr, '--voter', `${idx}`), | ||
), | ||
); | ||
|
||
await Promise.all( | ||
addresses.map(addr => | ||
agops.ec('charter', '--send-from', addr, '--name', 'econCommitteeCharter'), | ||
), | ||
); |
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 @@ | ||
import '@endo/init'; | ||
import { execFileSync } from 'node:child_process'; | ||
import { makeAgd } from './synthetic-chain-excerpt.js'; | ||
import { GOV4ADDR } from './agoric-tools.js'; | ||
|
||
const agd = makeAgd({ execFileSync }).withOpts({ keyringBackend: 'test' }); | ||
|
||
agd.keys.add( | ||
'gov4', | ||
'smile unveil sketch gaze length bulb goddess street case exact table fetch robust chronic power choice endorse toward pledge dish access sad illegal dance', | ||
); | ||
|
||
agd.tx( | ||
['swingset', 'provision-one', 'faucet_provision', GOV4ADDR, 'SMART_WALLET'], | ||
{ | ||
chainId: 'agoriclocal', | ||
from: 'validator', | ||
yes: true, | ||
}, | ||
); |
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,33 @@ | ||
import { queryVstorage } from '@agoric/synthetic-chain'; | ||
import { makeMarshal, Remotable } from '@endo/marshal'; | ||
|
||
export const GOV4ADDR = 'agoric1c9gyu460lu70rtcdp95vummd6032psmpdx7wdy'; | ||
|
||
const slotToRemotable = (_slotId, iface = 'Remotable') => | ||
Remotable(iface, undefined, { | ||
getBoardId: () => _slotId, | ||
}); | ||
|
||
// /** @param {BoardRemote | object} val */ | ||
const boardValToSlot = val => { | ||
if ('getBoardId' in val) { | ||
return val.getBoardId(); | ||
} | ||
throw Error(`unknown obj in boardSlottingMarshaller.valToSlot ${val}`); | ||
}; | ||
|
||
const boardSlottingMarshaller = slotToVal => { | ||
return makeMarshal(boardValToSlot, slotToVal, { | ||
serializeBodyFormat: 'smallcaps', | ||
}); | ||
}; | ||
|
||
export const marshaller = boardSlottingMarshaller(slotToRemotable); | ||
|
||
export const queryVstorageFormatted = async (path, index = -1) => { | ||
const data = await queryVstorage(path); | ||
|
||
const formattedData = JSON.parse(data.value); | ||
const formattedDataAtIndex = JSON.parse(formattedData.values.at(index)); | ||
return marshaller.fromCapData(formattedDataAtIndex); | ||
}; |
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
35 changes: 35 additions & 0 deletions
35
a3p-integration/proposals/n:upgrade-next/replaceElectorate.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,35 @@ | ||
import test from 'ava'; | ||
import '@endo/init'; | ||
import { GOV1ADDR, GOV2ADDR } from '@agoric/synthetic-chain'; | ||
import { passStyleOf } from '@endo/marshal'; | ||
import { GOV4ADDR, queryVstorageFormatted } from './agoric-tools.js'; | ||
|
||
const governanceAddresses = [GOV4ADDR, GOV2ADDR, GOV1ADDR]; | ||
|
||
test.serial('should be able to view the new accepted invitations', async t => { | ||
const instance = await queryVstorageFormatted( | ||
`published.agoricNames.instance`, | ||
); | ||
const instances = Object.fromEntries(instance); | ||
|
||
for (const address of governanceAddresses) { | ||
const wallet = await queryVstorageFormatted( | ||
`published.wallet.${address}.current`, | ||
); | ||
const usedInvitations = wallet.offerToUsedInvitation.map(v => v[1]); | ||
|
||
const charterInvitation = usedInvitations.find( | ||
v => | ||
v.value[0].instance.getBoardId() === | ||
instances.econCommitteeCharter.getBoardId(), | ||
); | ||
t.is(passStyleOf(charterInvitation), 'copyRecord'); | ||
|
||
const committeeInvitation = usedInvitations.find( | ||
v => | ||
v.value[0].instance.getBoardId() === | ||
instances.economicCommittee.getBoardId(), | ||
); | ||
t.is(passStyleOf(committeeInvitation), 'copyRecord'); | ||
} | ||
}); |
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,7 @@ | ||
#!/bin/bash | ||
|
||
# Exit when any command fails | ||
set -uxeo pipefail | ||
|
||
node ./addGov4 | ||
./acceptInvites.js |
Oops, something went wrong.