Skip to content
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

PR for CI test #2

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open

PR for CI test #2

wants to merge 68 commits into from

Conversation

anilhelvaci
Copy link
Collaborator

@anilhelvaci anilhelvaci commented Oct 4, 2024

closes: https://github.com/Agoric/BytePitchPartnerEng/issues/8
closes: Agoric#10111

Description

Currently acceptance tests do not cover auction functionality. When we look at the proposals in https://github.com/Agoric/agoric-3-proposals, there are no tests that check for depositors or bidders payouts from a given auction. There is code for changing auction params here and there, including z:acceptance.

In this PR, we test an auction from start to end. Here's the test case implemented;

  • In USE phase of n:upgrade-next, we place a bid
  • Start executing TEST phase of z:acceptance
  • We push a price for ATOM
  • gov1 deposits 100 IST to ATOM auction book
  • user1 places a bid
  • gov2 places a bid
  • Auction round ends
  • Depositor gets correct payouts
  • All bidders including the one placed in an earlier proposal get correct payouts

Why is this PR a draft?

This pr depends on tools in Agoric#10171, as soon that's approved I'll rebase this one on top of that one.

Security Considerations

None.

Scaling Considerations

Currently this test takes from 4-5 minutes to 12-13 minutes. I can take up to 20 minutes. This is because how the auction params are set. Why not just change the auction params? See Testing Considerations.

Documentation Considerations

None.

Testing Considerations

Testing auctions in a3p have a huge disadvantage since we don't have any tools for controlling how the time advances when running an actual node. I believe Agoric/agoric-3-proposals#179 should be priority as it will unlock very comprehensive test coverage in a3p testing.

Since time is a variable that we cannot control but it also plays a huge role when running our auction tests, we need to wait for it. Another complication is coming from how a3p images are built. Imagine this scenario;

  • chain stopped at t - 3
  • when the chain stopped, nextStartTime of the auction schedule was t - 1
  • auction tests started the chain at t
  • when chain started at t the waker set for the round t - 1 is triggered before our run-test.sh is run
  • the callback of the waker captured the prices then tried to start the round at t - 1 when it is actually at t
  • scheduler realized this and rescheduled the round at t - 1 to start at t + 1
  • round at t + 1 is now the activeStartTime but there's a +1 delay that we have to wait for
  • our test starts depositing and bidding after the price we set is captured by the auctioneer
  • price for activeStartTime is already captured when the t - 1 waker run during the fast forward when chain restarted
  • we need the auction to run with the price we set so we can make sure the long living bid is ended with correct payouts
  • auctioneer will capture new prices at newStartTime
  • so the soonest we can start running out test is at newStartTime
  • we have to wait for +1 (assuming we are still at t) PLUS a whole auction round

This scenario is common when yarn test -m acceptance uses caching as the latest cached layer will have it's state at when it was built. So if you built your cached layer an hour ago and auction start frequency is 10 minutes, you will face this issue.

If the latest cached layer is built less than 15 mins ago (10 mins round time and 5 mins maxLate, auctioneer is okay if round starts less than 5 mins), it very unlikely that you will face this issue("unlikely" because my math there might be wrong.) So I assume we will not face this issue when running in CI as I think all build layers are built from scratch in CI.

Why not update auction params?

Changed params take effect AFTER the next scheduled round. We are only interested in the next scheduled round since it is the soonest we can start depositing and bidding. One way to make the changed params effective for the next scheduled round in our test-acceptance build might be to change them in an earlier proposal USE state which means we have to depend on the global state to carry out our tests which is something I'm not a fan of.

Who places the long living bid?

Again, in order not to depend on global state we create a new user called long-living-bidder. Because other tests might mess with the bidder's wallet history and make querying payouts more complex.

Upgrade Considerations

None.

@anilhelvaci anilhelvaci force-pushed the anil/auction-tests branch 2 times, most recently from 65bfdc0 to b29d36e Compare October 5, 2024 02:53
@anilhelvaci anilhelvaci closed this Oct 5, 2024
@anilhelvaci anilhelvaci reopened this Oct 5, 2024
@anilhelvaci anilhelvaci force-pushed the anil/auction-tests branch 2 times, most recently from f1dad49 to a89e8e2 Compare October 8, 2024 20:59
frazarshad and others added 24 commits October 24, 2024 19:52
…0241)

closes: Agoric#10138 
closes: Agoric#10185 
closes: Agoric#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
refs: Agoric#10267

## Description

We'll be upgrading Zoe in the next SW upgrade. We need to reset the KREAd subscribers when we do that.

### Security Considerations

No broader security implications

### Scaling Considerations

Not a scaling concern

### Documentation Considerations

I should have remembered this when adding the Zoe upgrade.

### Testing Considerations

None

### Upgrade Considerations

There's a constraint that we need to enforce when we upgrade Zoe. So far, we've been remembering it, but it would be better to automate.
…ic#10306)

closes: Agoric#10274

## Description

Half the EC were able to pass a motion, when a majority should have been required.

### Security Considerations

Ordinary vote counting issue.

### Scaling Considerations

N/A

### Documentation Considerations

None

### Testing Considerations

Added tests for committee.

### Upgrade Considerations

The change is in the committee code. This needs to be merged before the proposal in Agoric#10164 runs. It [already installs new committee code](https://github.com/Agoric/agoric-sdk/blob/4a33accaeeba27044ab07dd04f64226de1b77759/packages/builders/scripts/inter-protocol/replace-electorate-core.js#L28).
…0318)

## Description
Updates inline comments in GitHub actions files to explain CI override directives (`#endo-branch`, `#getting-started-branch`, etc.) and adds references to them in the PR template to reduce our dependence upon oral tradition.

Also, although out of scope for this PR and probably not needed, we might consider a future change to pull out a helper for consumption of such directives:

<details><summary>.github/**/*.yml</summary>

```patch
       - name: Get the appropriate dapp branch
         id: get-branch
-        uses: actions/github-script@v7
+        uses: ./.github/actions/read-pr-directive
         with:
-          result-encoding: string
-          script: |
-            let branch = 'main';
-            if (context.payload.pull_request) {
-              const { body } = context.payload.pull_request;
-              const regex = /^\#getting-started-branch:\s+(\S+)/m;
-              const result = regex.exec(body);
-              if (result) {
-                branch = result[1];
-              }
-            }
-            console.log('getting-started dapp branch: ' + branch);
-            return branch;
+          tag: '#getting-started-branch'
+          default-value: main
```

</details>
<details><summary>.github/actions/read-pr-directive</summary>

```yaml
name: Read PR Directive
description: 'Read the value of a `#`-prefixed directive from a PR description'

inputs:
  tag:
    description: 'The directive tag to read (must start with `#`)'
    required: true
  default-value:
    description: 'The value to return in the absence of any overriding directive'
    required: true

outputs:
  result:
    description: >-
      The value of the last overriding directive, or the default value if the
      context is not a pull request or there is no such directive
    value: ${{ steps.script.outputs.result }}

runs:
  using: composite
  steps:
    - id: script
      uses: actions/github-script@v7
      env:
        TAG: ${{ inputs.tag }}
        DEFAULT_VALUE: ${{ inputs.default-value }}
      with:
        result-encoding: string
        script: |-
          const q = JSON.stringify;
          const { TAG, DEFAULT_VALUE } = process.env;
          if (!TAG.startsWith('#')) {
            throw Error(`malformed directive tag ${q(TAG)}`);
          }
          if (!context.payload.pull_request) return DEFAULT_VALUE;

          const { body } = context.payload.pull_request;
          const directives = body.matchAll(/^(\#[\w-]+):\s+(\S+)/gm);
          const selections = directives.filter(m => m[1] === TAG).map(m => m[2]);
          const selection = selections.pop();
          for (const ignored of selections) {
            console.warn(`ignoring ${q(`${TAG}: ${ignored}`)}`);
          }
          console.log(`${TAG}: ${selection}`);
          return selection || DEFAULT_VALUE;
```

</details>

### Security Considerations
n/a

### Scaling Considerations
n/a

### Documentation Considerations
:ballot_box_with_check:

### Testing Considerations
n/a

### Upgrade Considerations
n/a
extracted getVariantFromUpgradeName
The vaults upgrade consumed instance.auctioneer and compared it to the
new instance, passed from the new auctioneer proposal in a single-use
promise, and failed if they weren't different. In this software
upgrade, the instance.auctioneer value might be the new value, so this
test can fail. Since the single-use promise comes directly from the
new auction proposal, if it has a value, it's the new one.
mergify bot and others added 24 commits October 26, 2024 01:37
The kernel is responsible for "disconnecting" (rejecting) promises
decided by a vat being upgraded, because Promise settlement functions
(resolve/reject) are ephemeral, so they are lost during the upgrade, so
the new incarnation will have no way to ever settle them.

When the vat resolves a promise with syscall.resolve(), that vat's
c-list entry is removed by the syscall handler. But when the kernel did
the rejection, the c-list entry was left in place, causing the promise
to be pinned forever.

This changes the kernel to remove the c-list entry as well, except in
the case that the vat is also subscribed to its own promise (which
happens when a PromiseWatcher is used on a locally-decided promise:
unusual but we needed to tolerate that case). Self-subscribed promises
are left in the c-list, because the subsequent dispatch.notify() will
finish the job and remove the entry.

We also add remediation code, run during `upgradeSwingset`, and bump the
state version from 2 to 3. Remediation looks for all settled promises
that are still present in vat c-lists, and schedules dispatch.notify
deliveries to allow the usual cleanup code to remove the entries,
decrement the refcounts, and GC anything thus freed. This results in
harmless deliveries that will be ignored by the vat's new incarnation.

fixes Agoric#9039
Two tests are updated to exercise the cleanup of promise c-list
entries during vat termination. `terminate.test.js` adds some promises
to the c-list and then checks their refcounts after termination, to
demonstrate that bug Agoric#10261 is leaking a refcount when it deletes the
dead vat's c-list entry without also decrementing the
refcount. `slow-termination.test.js` adds a number of promises to the
c-list, and expects the budget-limited cleanup to spend a phase on
promises.

Both tests are marked as failing until the code fix is landed in the
next commit.
Previously, when a vat was terminated, and we delete the promise
c-list entries from its old state, the cleanup code was failing to
decrement the kpid's refcount properly. This resulted in a leak: those
promises could never be retired.

This commit updates the vat cleanup code to add a new phase, named
`promises`. This executes after `exports` and `imports`, but before
`kv`, and is responsible for both deleting the c-list entries and also
decrementing the refcounts of the corresponding promises. We do this
slowly, like we do exports and imports, because we don't know how many
there might be, and because those promise records might hold
references to other objects (in the resolution data), which could
trigger additional work. However, this work is unlikely to be
significant: the run-queue is usually empty, so these outstanding
promises are probably unresolved, and thus cannot beholding resolution
data.

All promises *decided* by the dead vat are rejected by the kernel
immediately during vat termination, because those rejections are
visible to userspace in other vats. In contrast, freeing the promise
records is *not* visible to userspace, just like how freeing imports
or exports are not visible to userspace, so this cleanup is safe to do
at a leisurely pace, rate-limited by `runPolicy.allowCleanup`.

The docs are updated to reflect the new `runPolicy` API:

* `budget.promises` is new, and respected by slow cleanup
* `work.promises` is reported to `runPolicy.didCleanup()`

The 'test.failing' marker was removed from the previously updated
tests.

I don't intend to add any remediation code: it requires a full
refcount audit to find such promises, and the mainnet kernel has only
ever terminated one vat so far, so I believe there cannot be very many
leaked promises, if any. Once this fix is applied, no new leaks will
occur.

fixes Agoric#10261
…goric#10268)

Previously, when a vat was terminated, and we delete the promise
c-list entries from its old state, the cleanup code was failing to
decrement the kpid's refcount properly. This resulted in a leak: those
promises could never be retired.

This commit updates the vat cleanup code to add a new phase, named
`promises`. This executes after `exports` and `imports`, but before
`kv`, and is responsible for both deleting the c-list entries and also
decrementing the refcounts of the corresponding promises. We do this
slowly, like we do exports and imports, because we don't know how many
there might be, and because those promise records might hold
references to other objects (in the resolution data), which could
trigger additional work. However, this work is unlikely to be
significant: the run-queue is usually empty, so these outstanding
promises are probably unresolved, and thus cannot beholding resolution
data.

All promises *decided* by the dead vat are rejected by the kernel
immediately during vat termination, because those rejections are
visible to userspace in other vats. In contrast, freeing the promise
records is *not* visible to userspace, just like how freeing imports
or exports are not visible to userspace, so this cleanup is safe to do
at a leisurely pace, rate-limited by `runPolicy.allowCleanup`.

The docs are updated to reflect the new `runPolicy` API:

* `budget.promises` is new, and respected by slow cleanup
* `work.promises` is reported to `runPolicy.didCleanup()`

I don't intend to add any remediation code: it requires a full
refcount audit to find such promises, and the mainnet kernel has only
ever terminated one vat so far, so I believe there cannot be very many
leaked promises, if any. Once this fix is applied, no new leaks will
occur.

fixes Agoric#10261
All vats have `vatParameters`, a mostly-arbitrary data record,
delivered as the second argument to their `buildRootObject()`
function. Dynamic vats get their vatParameters from the options bag
given to `E(vatAdminSvc).createVat()`. Static vats get them from the
kernel config record. When a vat is upgraded, the new incarnation gets
new vatParameters; these come from the options bag on
`E(adminNode).upgrade()`.

When received via `createVat()` or `upgrade()`, the vatParameters can
contain object and device references. VatParameters cannot include
promises.

Previously, the kernel delivered vatParameters to the vat, but did not
keep a copy. With this commit, the kernel retains a copy of
vatParameters (including a refcount on any kernel objects
therein). Internally, `vatKeeper.getVatParameters()` can be used to
retrieve this copy.  Only vats created or upgraded after this commit
lands will get retained vatParameters: for older vats this will return
`undefined`.

Retained vat parameters should make it easier to implement "upgrade
all vats", where the kernel perform a unilateral `upgrade()` on all
vats without userspace asking for it. When this is implemented, the
new incarnations will receive the same vatParameters as their
predecessors.

The slow-termination test was updated: it counts kvStore entries
precisely as we delete them all, so it requires an update each time we
add one.

fixes Agoric#8947
…ric#10270)

fix(swingset): retain vatParameters for vat creation and upgrade

All vats have `vatParameters`, a mostly-arbitrary data record,
delivered as the second argument to their `buildRootObject()`
function. Dynamic vats get their vatParameters from the options bag
given to `E(vatAdminSvc).createVat()`. Static vats get them from the
kernel config record. When a vat is upgraded, the new incarnation gets
new vatParameters; these come from the options bag on
`E(adminNode).upgrade()`.

When received via `createVat()` or `upgrade()`, the vatParameters
can contain object and device references. VatParameters cannot include
promises.

Previously, the kernel delivered vatParameters to the vat, but did not
keep a copy. With this commit, the kernel retains a copy of
vatParameters (including a refcount on any kernel objects
therein). Internally, `vatKeeper.getVatParameters()` can be used to
retrieve this copy.  Only vats created or upgraded after this commit
lands will get retained vatParameters: for older vats this will return
`undefined`.

Retained vat parameters should make it easier to implement "upgrade
all vats", where the kernel perform a unilateral `upgrade()` on all
vats without userspace asking for it. When this is implemented, the
new incarnations will receive the same vatParameters as their
predecessors.

fixes Agoric#8947
closes: https://github.com/Agoric/BytePitchPartnerEng/issues/23

## Description

Current version of `z:acceptance` tests do not cover PSM at all. The goal of this PR is to make sure we cover test cases in https://github.com/Agoric/BytePitchPartnerEng/issues/23 prepared by @otoole-brendan 

### Security Considerations

None.

### Scaling Considerations

None.

### Documentation Considerations

None.

### Testing Considerations

The tests assume that `anchorPerMinted` ratio is 1. I think this is a safe assumption because;
1. Unit tests and `boot` tests for the PSM has the same assumption
2. The value is read from terms. Therefore, it can only change by "replacing" the `USDC_axl` instance which is something we shouldn't worry about anytime soon.

### Upgrade Considerations

None.
refs: Agoric#10300

Incidental

Best reviewed commit-by-commit

## Description

While verifying Agoric#10300 I ran into some errors and lack of stdout streaming features. This is what I arrived at to let me process some slog files manually.

### Security Considerations

None

### Scaling Considerations

None production impacting

This adds a new block throttle mechanism to the ingest-slog tool, while relaxing the line based throttle.

### Documentation Considerations

None

### Testing Considerations

Manually tested with the slog sender detailed in Agoric#10300 (review).

### Upgrade Considerations

Affects chain software, but only the optional telemetry side. Not consensus affecting.
closes: Agoric#10269

## Description
Adds a slog sender which will build various contexts along the way and report them along with the slogs for better logs querying and identification

### Security Considerations
None

### Scaling Considerations
This uses a json file storage

### Documentation Considerations
This is a new slogger which can be opted into

### Testing Considerations
This will be deployed on testnets (already deployed on one of the testnets and log link is added in a comment below)

### Upgrade Considerations
This can be configured on existing deployments by bumping the telemetry package
…se` phase of `f:replace-price-feeds` (Agoric#10296)

closes: https://github.com/Agoric/BytePitchPartnerEng/issues/26
refs: https://github.com/Agoric/BytePitchPartnerEng/issues/22

## Description


This PR introduces a new script, `verifyPushedPrice`, which is executed during the `use` phase of the `n:upgrade-next` proposal. 
The purpose of this script is to set up the oracle and push an initial price for key brands such as Atom and stAtom. This functionality ensures that a price quote is available for the subsequent proposals and acceptance tests.

### Security Considerations


### Scaling Considerations


### Documentation Considerations


### Testing Considerations


The existing test file, `priceFeedUpdate.test.js`, has been updated to account for the new price feed calls made during the use phase, as well as take advantage of the new helper functions built.

### Upgrade Considerations
…st time related complexities

fix: apply change requests from PR review, resolve rebase conflicts, style fixes

* change `performAction.js` name to `submitBid.js`
* remove `Math.round` from `scale6`
* update indexing of bids and other constants in `config` object to improve readability (`auction.test.js`)
* move helper functions in `auction.test.js` to `test-lib/auction-lib.js`
* move `lib/vaults.mts` to `test-lib/vaults.mts`  and remove empty `lib` directory
* let it be known `sync-tools.js` is a stand-in code for Agoric#10171

Refs: Agoric/BytePitchPartnerEng#8

fix: style fixes

fix(acceptance-auction): lint fixes
…llision

Refs: Agoric/BytePitchPartnerEng#31

fix(auction-acceptance): formatting fixes

fix(auction-acceptance): formatting fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

acceptance test of bids surviving upgrades
8 participants