-
Notifications
You must be signed in to change notification settings - Fork 226
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
test(internal): fake vstorage advance blockHeight #10933
Conversation
Deploying agoric-sdk with
|
Latest commit: |
68416ba
|
Status: | ✅ Deploy successful! |
Preview URL: | https://30ee7db8.agoric-sdk.pages.dev |
Branch Preview URL: | https://mhofman-fake-vstorage-blocks.agoric-sdk.pages.dev |
blockHeight: '0', | ||
values: oldVal != null ? [oldVal] : [], | ||
blockHeight: String(currentBlockHeight), | ||
values: !streamCell && oldVal != null ? [oldVal] : [], |
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.
Suggestion for clarifying the StreamCell reset behavior:
case 'append': {
trace('toStorage append', message);
/** @type {StorageEntry[]} */
const newEntries = message.args;
for (const [key, value] of newEntries) {
value != null || Fail`attempt to append with no value`;
let oldVal = data.get(key);
let streamCell;
if (oldVal != null) {
try {
streamCell = JSON.parse(oldVal);
assert(isStreamCell(streamCell));
} catch (_err) {
streamCell = undefined;
}
// StreamCells reset at block boundaries.
if (streamCell?.blockHeight !== currentBlockHeight) {
streamCell = undefined;
oldVal = undefined;
}
}
if (streamCell === undefined) {
streamCell = {
blockHeight: String(currentBlockHeight),
values: oldVal != null ? [oldVal] : [],
};
}
streamCell.values.push(value);
data.set(key, JSON.stringify(streamCell));
}
break;
}
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.
Sorry this was set on auto merge. I did consider something along those lines. I agree it does read better
refs: #10933 ## Description Forgot some test updates in the previous PR Also it was on automerge so I couldn't include @gibson042 's [review suggestion](#10933 (comment)) ### Security Considerations None ### Scaling Considerations None ### Documentation Considerations Internal test hooks ### Testing Considerations Updated unit tests of fake storage ### Upgrade Considerations None
refs: #10890
refs: #10931
Description
Add a driver to update the block height in fake vstorage cells.
Add test of
sequence: false
based deletion.Security Considerations
None
Scaling Considerations
None
Documentation Considerations
Internal test hooks
Testing Considerations
Updated unit tests of fake storage
Upgrade Considerations
None