-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add agoric-upgrade-18 (proposal 83)
- Loading branch information
1 parent
183440d
commit 8a4a980
Showing
30 changed files
with
7,306 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
45 changes: 45 additions & 0 deletions
45
proposals/83:upgrade-18/.yarn/patches/axios-npm-1.7.7-cfbedc233d.patch
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,45 @@ | ||
diff --git a/dist/node/axios.cjs b/dist/node/axios.cjs | ||
index db4997bee1aa48aca215c6b2e7443292c94c086f..fb39f7e0046c66b1c0275c1a82ed49d3cc7cff83 100644 | ||
--- a/dist/node/axios.cjs | ||
+++ b/dist/node/axios.cjs | ||
@@ -371,9 +371,18 @@ function merge(/* obj1, obj2, obj3, ... */) { | ||
const extend = (a, b, thisArg, {allOwnKeys}= {}) => { | ||
forEach(b, (val, key) => { | ||
if (thisArg && isFunction(val)) { | ||
- a[key] = bind(val, thisArg); | ||
- } else { | ||
+ val = bind(val, thisArg); | ||
+ } | ||
+ const oldDesc = Object.getOwnPropertyDescriptor(a, key); | ||
+ if (oldDesc) { | ||
a[key] = val; | ||
+ } else { | ||
+ Object.defineProperty(a, key, { | ||
+ value: val, | ||
+ writable: true, | ||
+ enumerable: true, | ||
+ configurable: true | ||
+ }); | ||
} | ||
}, {allOwnKeys}); | ||
return a; | ||
@@ -404,7 +413,9 @@ const stripBOM = (content) => { | ||
*/ | ||
const inherits = (constructor, superConstructor, props, descriptors) => { | ||
constructor.prototype = Object.create(superConstructor.prototype, descriptors); | ||
- constructor.prototype.constructor = constructor; | ||
+ Object.defineProperty(constructor.prototype, 'constructor', { | ||
+ value: constructor | ||
+ }); | ||
Object.defineProperty(constructor, 'super', { | ||
value: superConstructor.prototype | ||
}); | ||
@@ -566,7 +577,7 @@ const isRegExp = kindOfTest('RegExp'); | ||
|
||
const reduceDescriptors = (obj, reducer) => { | ||
const descriptors = Object.getOwnPropertyDescriptors(obj); | ||
- const reducedDescriptors = {}; | ||
+ const reducedDescriptors = Object.create(null); | ||
|
||
forEach(descriptors, (descriptor, name) => { | ||
let ret; |
36 changes: 36 additions & 0 deletions
36
proposals/83:upgrade-18/.yarn/patches/protobufjs-npm-6.11.4-af11968b80.patch
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,36 @@ | ||
diff --git a/src/util/minimal.js b/src/util/minimal.js | ||
index 3c406dee753b5c6fb29dda2e64d4482e754e7873..564e5dadaa50e4ad05fc18b767ee276c99e9f0f9 100644 | ||
--- a/src/util/minimal.js | ||
+++ b/src/util/minimal.js | ||
@@ -280,7 +280,30 @@ function newError(name) { | ||
merge(this, properties); | ||
} | ||
|
||
- (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError; | ||
+ CustomError.prototype = Object.create(Error.prototype, { | ||
+ constructor: { | ||
+ value: CustomError, | ||
+ writable: true, | ||
+ enumerable: false, | ||
+ configurable: true, | ||
+ }, | ||
+ name: { | ||
+ get() { return name; }, | ||
+ set: undefined, | ||
+ enumerable: false, | ||
+ // configurable: false would accurately preserve the behavior of | ||
+ // the original, but I'm guessing that was not intentional. | ||
+ // For an actual error subclass, this property would | ||
+ // be configurable. | ||
+ configurable: true, | ||
+ }, | ||
+ toString: { | ||
+ value() { return this.name + ": " + this.message; }, | ||
+ writable: true, | ||
+ enumerable: false, | ||
+ configurable: true, | ||
+ }, | ||
+ }); | ||
|
||
Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } }); | ||
|
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,5 @@ | ||
# Proposal to upgrade the chain software | ||
|
||
This reflects agoric-upgrade-18, which was adopted on mainnet by [governance | ||
proposal 83](https://ping.pub/agoric/gov/83) at block height 17842500 and | ||
block time 2025-01-10T11:11:56.366090454Z. |
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/debug.js'; | ||
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/debug.js'; | ||
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,207 @@ | ||
import { | ||
agd, | ||
agops, | ||
agopsLocation, | ||
CHAINID, | ||
executeCommand, | ||
executeOffer, | ||
GOV1ADDR, | ||
GOV2ADDR, | ||
GOV3ADDR, | ||
VALIDATORADDR, | ||
} from '@agoric/synthetic-chain'; | ||
|
||
const ORACLE_ADDRESSES = [GOV1ADDR, GOV2ADDR, GOV3ADDR]; | ||
|
||
export const BID_OFFER_ID = 'bid-vaultUpgrade-test3'; | ||
|
||
const queryVstorage = path => | ||
agd.query('vstorage', 'data', '--output', 'json', path); | ||
|
||
// XXX use endo/marshal? | ||
const getQuoteBody = async path => { | ||
const queryOut = await queryVstorage(path); | ||
|
||
const body = JSON.parse(JSON.parse(queryOut.value).values[0]); | ||
return JSON.parse(body.body.substring(1)); | ||
}; | ||
|
||
export const getOracleInstance = async price => { | ||
const instanceRec = await queryVstorage(`published.agoricNames.instance`); | ||
|
||
const value = JSON.parse(instanceRec.value); | ||
const body = JSON.parse(value.values.at(-1)); | ||
|
||
const feeds = JSON.parse(body.body.substring(1)); | ||
const feedName = `${price}-USD price feed`; | ||
|
||
const key = Object.keys(feeds).find(k => feeds[k][0] === feedName); | ||
if (key) { | ||
return body.slots[key]; | ||
} | ||
return null; | ||
}; | ||
|
||
export const checkForOracle = async (t, name) => { | ||
const instance = await getOracleInstance(name); | ||
t.truthy(instance); | ||
}; | ||
|
||
export const registerOraclesForBrand = async (brandIn, oraclesByBrand) => { | ||
await null; | ||
const promiseArray = []; | ||
|
||
const oraclesWithID = oraclesByBrand.get(brandIn); | ||
for (const oracle of oraclesWithID) { | ||
const { address, offerId } = oracle; | ||
promiseArray.push( | ||
executeOffer( | ||
address, | ||
agops.oracle('accept', '--offerId', offerId, `--pair ${brandIn}.USD`), | ||
), | ||
); | ||
} | ||
|
||
return Promise.all(promiseArray); | ||
}; | ||
|
||
/** | ||
* Generate a consistent map of oracleIDs for a brand that can be used to | ||
* register oracles or to push prices. The baseID changes each time new | ||
* invitations are sent/accepted, and need to be maintained as constants in | ||
* scripts that use the oracles. Each oracleAddress and brand needs a unique | ||
* offerId, so we create recoverable IDs using the brandName and oracle id, | ||
* mixed with the upgrade at which the invitations were accepted. | ||
* | ||
* @param {string} baseId | ||
* @param {string} brandName | ||
*/ | ||
const addOraclesForBrand = (baseId, brandName) => { | ||
const oraclesWithID = []; | ||
for (let i = 0; i < ORACLE_ADDRESSES.length; i += 1) { | ||
const oracleAddress = ORACLE_ADDRESSES[i]; | ||
const offerId = `${brandName}.${baseId}.${i}`; | ||
oraclesWithID.push({ address: oracleAddress, offerId }); | ||
} | ||
return oraclesWithID; | ||
}; | ||
|
||
export const addPreexistingOracles = async (brandIn, oraclesByBrand) => { | ||
await null; | ||
|
||
const oraclesWithID = []; | ||
for (let i = 0; i < ORACLE_ADDRESSES.length; i += 1) { | ||
const oracleAddress = ORACLE_ADDRESSES[i]; | ||
|
||
const path = `published.wallet.${oracleAddress}.current`; | ||
const wallet = await getQuoteBody(path); | ||
const idToInvitation = wallet.offerToUsedInvitation.find(([k]) => { | ||
return !Number.isNaN(k[0]); | ||
}); | ||
if (idToInvitation) { | ||
oraclesWithID.push({ | ||
address: oracleAddress, | ||
offerId: idToInvitation[0], | ||
}); | ||
} else { | ||
console.log('AGD addO skip', oraclesWithID); | ||
} | ||
} | ||
|
||
oraclesByBrand.set(brandIn, oraclesWithID); | ||
}; | ||
|
||
/** | ||
* Generate a consistent map of oracleIDs and brands that can be used to | ||
* register oracles or to push prices. The baseID changes each time new | ||
* invitations are sent/accepted, and need to be maintained as constants in | ||
* scripts that use these records to push prices. | ||
* | ||
* @param {string} baseId | ||
* @param {string[]} brandNames | ||
*/ | ||
export const generateOracleMap = (baseId, brandNames) => { | ||
const oraclesByBrand = new Map(); | ||
for (const brandName of brandNames) { | ||
const oraclesWithID = addOraclesForBrand(baseId, brandName); | ||
oraclesByBrand.set(brandName, oraclesWithID); | ||
} | ||
return oraclesByBrand; | ||
}; | ||
|
||
export const pushPrices = (price, brandIn, oraclesByBrand) => { | ||
const promiseArray = []; | ||
|
||
for (const oracle of oraclesByBrand.get(brandIn)) { | ||
promiseArray.push( | ||
executeOffer( | ||
oracle.address, | ||
agops.oracle( | ||
'pushPriceRound', | ||
'--price', | ||
price, | ||
'--oracleAdminAcceptOfferId', | ||
oracle.offerId, | ||
), | ||
), | ||
); | ||
} | ||
|
||
return Promise.all(promiseArray); | ||
}; | ||
|
||
export const getPriceQuote = async price => { | ||
const path = `published.priceFeed.${price}-USD_price_feed`; | ||
const body = await getQuoteBody(path); | ||
return body.amountOut.value; | ||
}; | ||
|
||
export const agopsInter = (...params) => { | ||
const newParams = ['inter', ...params]; | ||
return executeCommand(agopsLocation, newParams); | ||
}; | ||
|
||
export const createBid = (price, addr, offerId) => { | ||
return agopsInter( | ||
'bid', | ||
'by-price', | ||
`--price ${price}`, | ||
`--give 1.0IST`, | ||
'--from', | ||
addr, | ||
'--keyring-backend test', | ||
`--offer-id ${offerId}`, | ||
); | ||
}; | ||
|
||
export const getLiveOffers = async addr => { | ||
const path = `published.wallet.${addr}.current`; | ||
const body = await getQuoteBody(path); | ||
return body.liveOffers; | ||
}; | ||
|
||
export const getAuctionCollateral = async index => { | ||
const path = `published.auction.book${index}`; | ||
const body = await getQuoteBody(path); | ||
return body.collateralAvailable.value; | ||
}; | ||
|
||
export const getVaultPrices = async index => { | ||
const path = `published.vaultFactory.managers.manager${index}.quotes`; | ||
const body = await getQuoteBody(path); | ||
return body.quoteAmount; | ||
}; | ||
|
||
export const bankSend = (addr, wanted) => { | ||
const chain = ['--chain-id', CHAINID]; | ||
const from = ['--from', VALIDATORADDR]; | ||
const testKeyring = ['--keyring-backend', 'test']; | ||
const noise = [...from, ...chain, ...testKeyring, '--yes']; | ||
|
||
return agd.tx('bank', 'send', VALIDATORADDR, addr, wanted, ...noise); | ||
}; | ||
|
||
export const getProvisionPoolMetrics = async () => { | ||
const path = `published.provisionPool.metrics`; | ||
return getQuoteBody(path); | ||
}; |
Oops, something went wrong.