-
Notifications
You must be signed in to change notification settings - Fork 214
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
set roundId to 1 & write to vstorage at start #10291
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure parts of this are not right; not certain enough to request changes, though.
} = t.context; | ||
|
||
await setupVaults(collateralBrandKey, managerIndex, setup); | ||
|
||
const instancePre = agoricNamesRemotes.instance['ATOM-USD price feed']; | ||
|
||
await priceFeedDrivers[collateralBrandKey].setPrice(15.99); | ||
|
||
t.like(readLatest('published.priceFeed.ATOM-USD_price_feed.latestRound'), { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test before setPrice
(and after the core-eval) to match the problem we saw in practice, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test before that shows that roundID is 1.
The test on line 148 (it'll move, so early in '2. trigger liquidation by changing price') checks after the coreEval and before setting prices again. Do you want another check in this test ('setupVaults')?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm. I think I wasn't reading this quite right. no, I don't see any more tests that I want.
@@ -180,6 +180,9 @@ export const prepareFluxAggregatorKit = async ( | |||
}), | |||
), | |||
}); | |||
const now = await E(timerPresence).getCurrentTimestamp(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can put a remote call like that in the critical path to defining this kind. If this doesn't cause a null-upgrade test to fail, I think we're missing some coverage.
Define all exo classes/kits before any incoming method calls from other vats -- in the first "crank".
-- https://docs.agoric.com/guides/zoe/contract-upgrade.html#crank
How about a helper.startInitializingVstorage(timerPresence)
thing that returns synchronously but asynchronously gets a timestamp and initializes vstorage?
const trace = makeTracer('RoundsM', false); | ||
const trace = makeTracer('RoundsM', true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to turn that on in production?
(I don't object. I'm just checking that you didn't mean to turn it back off.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back and forth. I settled on yes, because we're diagnosing issues here, and it would give some added visibility.
const rounds = makeScalarBigMapStore('rounds', { durable: true }); | ||
const details = makeScalarBigMapStore('details', { durable: true }); | ||
// @ts-expect-error append-only except for reset | ||
this.state.rounds = rounds; | ||
// @ts-expect-error append-only except for reset | ||
this.state.details = details; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this already done in the init function? Are we clobbering these 2 map stores?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right. I will drop the externally invoked function, and "improve" the initializer.
// @ts-expect-error append-only except for reset | ||
this.state.details = details; | ||
|
||
details.init( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not confident that I know the invariants of the state.details
map stores. @michaelfig or @turadg are you able to tell from a quick look that this is OK?
answeredInRound: 0n, | ||
}); | ||
|
||
rounds.init(roundId, round); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, I'm not confident about this.
Deploying agoric-sdk with Cloudflare Pages
|
d7a3337
to
9fcf745
Compare
Use a minimum start time and roundId of 1 because zero is treated as an outlier in the code There are places in the code and tests that compare roundId and round start time to 0 and 1, so make it easier by starting from 1. Refactored some tests, mostly by adding a round before the previous tests to let state get past zero and one. refactor: set roundId to 1 & write to vstorage at start use a minimum start time and roundId of 1 because zero is treated as an outlier in the code There are places in the code and tests that compare roundId and round start time to 0 and 1, so make it easier by starting from 1. Refactored some tests, mostly by adding a round before the previous tests to let state get past zero and one.
9fcf745
to
84d09c7
Compare
I dropped the changes in fluxAggregator, and did everything in The one issue is that the The invariants on round progression are enforced in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
presuming we test roundid between the core-eval and setPrice, as discussed
refs: #9886
Description
Some tests in DevNet indicate that the Oracles need the roundID in vstorage to be reset so they can sync.
Security Considerations
Not a security issue.
Scaling Considerations
Not directly a scaling concern. (see #8400).
Documentation Considerations
not user visible. It would be nice if the protocol between oracles and fluxAggregators were documented somewhere
Testing Considerations
updated the a3p tests to increment the roundId before the upgrade and show that this upgrade resets it.
Upgrade Considerations
This change is to the fluxAggregator which is already being started afresh in this proposal.