Skip to content

Commit

Permalink
Merge branch 'master' into fraz/replace-committee-a3p
Browse files Browse the repository at this point in the history
  • Loading branch information
frazarshad authored Oct 18, 2024
2 parents 49a6407 + 36d0670 commit 1ced77c
Show file tree
Hide file tree
Showing 139 changed files with 1,552 additions and 1,090 deletions.
12 changes: 11 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ module.exports = {
'./packages/*/tsconfig.json',
'./packages/*/tsconfig.json',
'./packages/wallet/*/tsconfig.json',
'./a3p-integration/proposals/*/tsconfig.json',
'./tsconfig.json',
],
tsconfigRootDir: __dirname,
Expand Down Expand Up @@ -240,6 +239,17 @@ module.exports = {
project: false,
},
},
{
files: ['a3p-integration/**'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
parserOptions: {
EXPERIMENTAL_useProjectService: false,
project: false,
},
rules: {
'@jessie.js/safe-await-separator': 'off',
},
},
{
// Types files have no promises to lint and that linter chokes on the .d.ts twin.
// Maybe due to https://github.com/typescript-eslint/typescript-eslint/issues/7435
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/test-all-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,17 @@ jobs:
with:
node-version: '18.x'

- name: yarn lint rest
# Check some of a3p-integration in this job that runs on PRs instead of
# waiting for the slow integration test that by default only runs in the
# master merge check
- name: yarn lint rest of packages/*
run: ./scripts/lint-with-types.sh rest
- name: Lint a3p-integration
run: yarn install && yarn lint && yarn doctor
working-directory: a3p-integration
- name: build A3P submissions
run: yarn run build:submissions
working-directory: a3p-integration

##################
# Fast-running tests run as a group:
Expand Down
59 changes: 6 additions & 53 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ shared:
- and: # breakage fails like we thought
- check-failure=breakage
- label=proto:expect-breakage
high_priority_queue_conditions: &high-priority-queue-conditions
- and: *queue-conditions
- label=priority:high
merge_conditions: &merge-conditions
- base=master
# Rebase PRs with fixup commits are allowed to enter the merge queue but
Expand Down Expand Up @@ -48,31 +45,13 @@ shared:
- base=master
- label=automerge:squash

queue_rules:
- name: high_priority_rebase
commit_message_template: *commit-message-template
queue_conditions: *high-priority-queue-conditions
merge_conditions: *merge-conditions
merge_method: merge
update_method: rebase

- name: high_priority_merge
commit_message_template: *commit-message-template
queue_conditions: *high-priority-queue-conditions
merge_conditions: *merge-conditions
disallow_checks_interruption_from_queues:
- high_priority_rebase
merge_method: merge

- name: high_priority_squash
commit_message_template: *commit-message-template
queue_conditions: *high-priority-queue-conditions
merge_conditions: *merge-conditions
disallow_checks_interruption_from_queues:
- high_priority_rebase
- high_priority_merge
merge_method: squash
priority_rules:
- name: high_priority
conditions:
- label=priority:high
priority: high

queue_rules:
- name: rebase
commit_message_template: *commit-message-template
queue_conditions: *queue-conditions
Expand All @@ -84,41 +63,15 @@ queue_rules:
commit_message_template: *commit-message-template
queue_conditions: *queue-conditions
merge_conditions: *merge-conditions
disallow_checks_interruption_from_queues:
- rebase
merge_method: merge

- name: squash
commit_message_template: *commit-message-template
queue_conditions: *queue-conditions
merge_conditions: *merge-conditions
disallow_checks_interruption_from_queues:
- rebase
- merge
merge_method: squash

pull_request_rules:
- name: high priority - merge to master
conditions:
- and: *pr-queue-merge-conditions
- label=priority:high
actions:
queue:
name: high_priority_merge
- name: high priority - rebase updates then merge to master
conditions:
- and: *pr-queue-rebase-conditions
- label=priority:high
actions:
queue:
name: high_priority_rebase
- name: high priority - squash to master
conditions:
- and: *pr-queue-squash-conditions
- label=priority:high
actions:
queue:
name: high_priority_squash
- name: merge to master
conditions: *pr-queue-merge-conditions
actions:
Expand Down
4 changes: 4 additions & 0 deletions a3p-integration/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ proposals/*/.yarn/*
!proposals/*/.yarn/releases
!proposals/*/.yarn/sdks
!proposals/*/.yarn/versions

# build artifacts
proposals/*/mainNet/*
proposals/*/devNet/*
5 changes: 4 additions & 1 deletion a3p-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
"scripts": {
"build": "yarn run build:sdk && yarn run build:submissions && yarn run build:synthetic-chain",
"build:sdk": "make -C ../packages/deployment docker-build-sdk",
"build:submissions": "scripts/build-all-submissions.sh",
"build:submissions": "scripts/build-all-submissions.sh && yarn run build:priceFeeds-for-mainnet && yarn run build:priceFeeds-for-devnet",
"build:priceFeeds-for-mainnet": "scripts/build-submission.sh proposals/f:replace-price-feeds inter-protocol/updatePriceFeeds.js submission/main main; scripts/build-submission.sh proposals/f:replace-price-feeds vats/add-auction.js submission/main; scripts/build-submission.sh proposals/f:replace-price-feeds vats/upgradeVaults.js submission/main",
"build:priceFeeds-for-devnet": "scripts/build-submission.sh proposals/f:replace-price-feeds inter-protocol/updatePriceFeeds.js submission/devnet devnet; scripts/build-submission.sh proposals/f:replace-price-feeds vats/add-auction.js submission/devnet; scripts/build-submission.sh proposals/f:replace-price-feeds vats/upgradeVaults.js submission/devnet",
"build:synthetic-chain": "yarn synthetic-chain build",
"lint": "../node_modules/.bin/eslint proposals",
"test": "yarn synthetic-chain test",
"doctor": "yarn synthetic-chain doctor"
},
Expand Down
3 changes: 1 addition & 2 deletions a3p-integration/proposals/n:upgrade-next/agd-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
GOV1ADDR,
GOV2ADDR,
GOV3ADDR,
newOfferId,
VALIDATORADDR,
} from '@agoric/synthetic-chain';

Expand Down Expand Up @@ -97,7 +96,7 @@ export const addPreexistingOracles = async (brandIn, oraclesByBrand) => {
const path = `published.wallet.${oracleAddress}.current`;
const wallet = await getQuoteBody(path);
const idToInvitation = wallet.offerToUsedInvitation.find(([k]) => {
return !isNaN(k[0]);
return !Number.isNaN(k[0]);
});
if (idToInvitation) {
oraclesWithID.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @file work-around: importing @agoric/synthetic-chain hangs XXX
*/
// @ts-check
/* eslint-env node */
import { $ } from 'execa';

const waitForBootstrap = async () => {
Expand Down Expand Up @@ -103,6 +104,7 @@ export const makeAgd = ({ execFileSync }) => {
const nameHub = freeze({
/**
* NOTE: synchronous I/O
* @param {...any} path
*/
lookup: (...path) => {
if (!Array.isArray(path)) {
Expand Down
3 changes: 3 additions & 0 deletions a3p-integration/proposals/n:upgrade-next/vatDetails.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-env node */

import dbOpenAmbient from 'better-sqlite3';

const HOME = process.env.HOME;
Expand Down Expand Up @@ -43,6 +45,7 @@ const makeSwingstore = db => {
const sql = dbTool(db);

/** @param {string} key */
// @ts-expect-error cast
const kvGet = key => sql.get`select * from kvStore where key = ${key}`.value;
/** @param {string} key */
const kvGetJSON = key => JSON.parse(kvGet(key));
Expand Down
2 changes: 2 additions & 0 deletions a3p-integration/proposals/n:upgrade-next/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,8 @@ __metadata:
"@endo/init": "npm:^1.1.5"
"@endo/marshal": "npm:^1.5.4"
ava: "npm:^5.3.1"
better-sqlite3: "npm:^9.6.0"
execa: "npm:^9.3.1"
languageName: unknown
linkType: soft

Expand Down
1 change: 0 additions & 1 deletion a3p-integration/proposals/s:stake-bld/stakeBld.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @jessie.js/safe-await-separator -- buggy version */
import test from 'ava';

import { QueryClient, setupStakingExtension } from '@cosmjs/stargate'; // fails to import after Endo/init
Expand Down
1 change: 0 additions & 1 deletion a3p-integration/proposals/s:stake-bld/test-lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const networkConfig = {
*/
const delay = ms => new Promise(resolve => setTimeout(() => resolve(), ms));

// eslint-disable-next-line @jessie.js/safe-await-separator -- buggy version
export const walletUtils = await makeWalletUtils(
{ delay, execFileSync, fetch },
networkConfig,
Expand Down
1 change: 0 additions & 1 deletion a3p-integration/proposals/z:acceptance/core-eval.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @jessie.js/safe-await-separator */
import test from 'ava';
import { readFile, writeFile } from 'node:fs/promises';

Expand Down
1 change: 1 addition & 0 deletions a3p-integration/proposals/z:acceptance/exitOffer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Note: limit imports to node modules for portability
/* eslint-env node */
import { parseArgs, promisify } from 'node:util';
import { execFile } from 'node:child_process';
import { writeFile, mkdtemp, rm } from 'node:fs/promises';
Expand Down
4 changes: 1 addition & 3 deletions a3p-integration/proposals/z:acceptance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
"@endo/init": "^1.1.4",
"@endo/marshal": "^1.5.3",
"ava": "^6.1.2",
"execa": "^9.3.1",
"tsx": "^4.17.0"
},
"resolutions": {
"execa": "^9.3.1"
},
"ava": {
"concurrency": 1,
"serial": true,
Expand Down
6 changes: 4 additions & 2 deletions a3p-integration/proposals/z:acceptance/test-lib/sync-tools.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-env node */

/**
* @file These tools mostly duplicate code that will be added in other PRs
* and eventually migrated to synthetic-chain. Sorry for the duplication.
Expand All @@ -7,12 +9,12 @@
* @typedef {object} RetryOptions
* @property {number} [maxRetries]
* @property {number} [retryIntervalMs]
* @property {(...arg0: string[]) => void} [log]
* @property {(...arg0: string[]) => void} log
* @property {(object) => void} [setTimeout]
* @property {string} [errorMessage=Error]
*/

const ambientSetTimeout = globalThis.setTimeout;
const ambientSetTimeout = global.setTimeout;

/**
* From https://github.com/Agoric/agoric-sdk/blob/442f07c8f0af03281b52b90e90c27131eef6f331/multichain-testing/tools/sleep.ts#L10
Expand Down
3 changes: 1 addition & 2 deletions a3p-integration/proposals/z:acceptance/test-lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ export const getBalances = async (addresses, targetDenom = undefined) => {
return addresses.length === 1 ? balancesList[0] : balancesList;
};

export const agopsVaults = async addr =>
await agops.vaults('list', '--from', addr);
export const agopsVaults = addr => agops.vaults('list', '--from', addr);
3 changes: 2 additions & 1 deletion a3p-integration/proposals/z:acceptance/vaults.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env node */
import test from 'ava';
import {
agoric,
Expand Down Expand Up @@ -47,7 +48,7 @@ test.before(async t => {
'price not pushed yet',
{
log: t.log,
setTimeout: globalThis.setTimeout,
setTimeout: global.setTimeout,
// @ts-expect-error t.context is fine
...t.context.pushPriceRetryOpts,
},
Expand Down
8 changes: 5 additions & 3 deletions a3p-integration/proposals/z:acceptance/wallet.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
CHAINID,
waitForBlock,
} from '@agoric/synthetic-chain';
import { $ } from 'execa';
import {
agd,
getBalances,
replaceTemplateValuesInFile,
} from './test-lib/utils.js';
import { $ } from 'execa';

test.serial(`send invitation via namesByAddress`, async t => {
const SUBMISSION_DIR = 'invitation-test-submission';
Expand Down Expand Up @@ -54,8 +54,10 @@ test.serial('exitOffer tool reclaims stuck payment', async t => {
const after = await getBalances([GOV1ADDR], 'uist');
t.log('uist balance after:', after);

t.true(after > before),
'The IST balance should increase after reclaiming the stuck payment';
t.true(
after > before,
'The IST balance should increase after reclaiming the stuck payment',
);
});

test.serial(`ante handler sends fee only to vbank/reserve`, async t => {
Expand Down
1 change: 1 addition & 0 deletions a3p-integration/proposals/z:acceptance/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,7 @@ __metadata:
"@endo/init": "npm:^1.1.4"
"@endo/marshal": "npm:^1.5.3"
ava: "npm:^6.1.2"
execa: "npm:^9.3.1"
tsx: "npm:^4.17.0"
typescript: "npm:^5.5.4"
languageName: unknown
Expand Down
4 changes: 2 additions & 2 deletions docs/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export {};
**types-index.d.ts**
```ts
// Export all the types this package provides
export * from './types.js';
export * from './other-types.js';
export type * from './types.js';
export type * from './other-types.js';
```

The actual type implementation is then written in `types.ts` and `other-types.ts` files (per the example above).
Expand Down
9 changes: 2 additions & 7 deletions golang/cosmos/x/vbank/vbank.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,9 @@ func (ch portHandler) Receive(cctx context.Context, str string) (ret string, err
}
coin := keeper.GetBalance(ctx, addr, msg.Denom)
packet := coin.Amount.String()
bytes, err := json.Marshal(&packet)
if err == nil {
bytes, err := json.Marshal(&packet)
if err == nil {
ret = string(bytes)
}
ret = string(bytes)
}

case "VBANK_GRAB":
Expand Down Expand Up @@ -216,9 +214,6 @@ func (ch portHandler) Receive(cctx context.Context, str string) (ret string, err
if err := keeper.StoreRewardCoins(ctx, coins); err != nil {
return "", fmt.Errorf("cannot store reward %s coins: %s", coins.Sort().String(), err)
}
if err != nil {
return "", err
}
state := keeper.GetState(ctx)
state.RewardPool = state.RewardPool.Add(coins...)
keeper.SetState(ctx, state)
Expand Down
6 changes: 3 additions & 3 deletions multichain-testing/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1803,8 +1803,8 @@ __metadata:
linkType: hard

"elliptic@npm:^6.5.4":
version: 6.5.5
resolution: "elliptic@npm:6.5.5"
version: 6.5.7
resolution: "elliptic@npm:6.5.7"
dependencies:
bn.js: "npm:^4.11.9"
brorand: "npm:^1.1.0"
Expand All @@ -1813,7 +1813,7 @@ __metadata:
inherits: "npm:^2.0.4"
minimalistic-assert: "npm:^1.0.1"
minimalistic-crypto-utils: "npm:^1.0.1"
checksum: 10c0/3e591e93783a1b66f234ebf5bd3a8a9a8e063a75073a35a671e03e3b25253b6e33ac121f7efe9b8808890fffb17b40596cc19d01e6e8d1fa13b9a56ff65597c8
checksum: 10c0/799959b6c54ea3564e8961f35abdf8c77e37617f3051614b05ab1fb6a04ddb65bd1caa75ed1bae375b15dda312a0f79fed26ebe76ecf05c5a7af244152a601b8
languageName: node
linkType: hard

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "module",
"packageManager": "[email protected]",
"devDependencies": {
"@endo/eslint-plugin": "^2.2.1",
"@endo/eslint-plugin": "^2.2.2",
"@jessie.js/eslint-plugin": "^0.4.1",
"@types/express": "^4.17.17",
"@types/node": "^22.0.0",
Expand Down
Loading

0 comments on commit 1ced77c

Please sign in to comment.