-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(swing-store): Delete transcript spans in stopUsingTranscript as i…
…n rollover (#10060) Fixes #10054 ## Description The first commits from #10055, [by request](#10055 (review)), culminating in a fix of #10054 by introducing a `closeSpan` helper to support both span rollover and `stopUsingTranscript`. ### Security Considerations None known. ### Scaling Considerations If anything, a negligible reduction in transcriptStore size. ### Documentation Considerations None known. ### Testing Considerations Covered by unit tests. ### Upgrade Considerations This is kernel code that can be used at any node restart (i.e., because the configuration is consensus-independent, it doesn't even need to wait for a chain software upgrade).
- Loading branch information
Showing
3 changed files
with
219 additions
and
164 deletions.
There are no files selected for viewing
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,26 @@ | ||
/** | ||
* Assert that the contents of `array` are | ||
* [like]{@link https://github.com/avajs/ava/blob/main/docs/03-assertions.md#likeactual-selector-message} | ||
* those of `expected`, including having matching lengths, with pretty diffs in | ||
* case of mismatch. | ||
* | ||
* @param {import('ava').ExecutionContext} t | ||
* @param {unknown[]} array | ||
* @param {unknown[]} expected | ||
* @param {string} [message] | ||
*/ | ||
export const arrayIsLike = (t, array, expected, message) => { | ||
const actualLength = array.length; | ||
const expectedLength = expected.length; | ||
const actualExcess = actualLength - expectedLength; | ||
const comparable = | ||
actualExcess > 0 | ||
? [...expected, ...Array.from({ length: actualExcess })] | ||
: expected; | ||
t.like(array, comparable, message); | ||
|
||
if (actualLength === expectedLength) return; | ||
|
||
const extended = [...array, ...Array.from({ length: -actualExcess })]; | ||
t.deepEqual(extended, array, message); | ||
}; |
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
Oops, something went wrong.