Skip to content

Commit

Permalink
fix next key (#729)
Browse files Browse the repository at this point in the history
* first keys is checked properly

* bump beta
  • Loading branch information
ermalkaleci authored Apr 4, 2024
1 parent 301c532 commit afaaad3
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion executor/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@acala-network/chopsticks-executor",
"description": "Chopsticks executor",
"version": "0.10.0-1",
"version": "0.10.0-2",
"license": "Apache-2.0",
"type": "module",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks",
"version": "0.10.0-1",
"version": "0.10.0-2",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"bin": "./chopsticks.cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-core",
"version": "0.10.0-1",
"version": "0.10.0-2",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"type": "module",
Expand Down
27 changes: 27 additions & 0 deletions packages/core/src/blockchain/get-keys-paged.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,31 @@ describe('getKeysPaged', () => {
'0x94533e05c34400caee0d8976774f0dd064443ba500633e46053c7a0a68b8ef3392a72b59fc8b67b7020000e8d2a526a4a22d1e0300000000',
])
})

it('firstKey is checked properly', async () => {
const layer2 = new StorageLayer(storageLayer)
layer2.setAll([
['0x1111111111111111111111111111111111111111111111111111111111111111_00', '0x00'],
['0xcd710b30bd2eab0352ddcc26417aa19463c716fb8fff3de61a883bb76adb34a2', '0x00'],
])

expect(
await layer2.getKeysPaged(
'0xcd710b30bd2eab0352ddcc26417aa19463c716fb8fff3de61a883bb76adb34a2',
1,
'0xcd710b30bd2eab0352ddcc26417aa19463c716fb8fff3de61a883bb76adb34a2',
),
).toEqual([])

const layer3 = new StorageLayer(layer2)
layer3.setAll([['0x1111111111111111111111111111111111111111111111111111111111111111_01', '0x01']])

expect(
await layer3.getKeysPaged(
'0xcd710b30bd2eab0352ddcc26417aa19463c716fb8fff3de61a883bb76adb34a2',
1,
'0xcd710b30bd2eab0352ddcc26417aa19463c716fb8fff3de61a883bb76adb34a2',
),
).toEqual([])
})
})
2 changes: 1 addition & 1 deletion packages/core/src/blockchain/storage-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export class StorageLayer implements StorageLayerProvider {
if (idx !== -1) {
if (includeFirst) {
const key = this.#keys[idx]
if (key && key.startsWith(prefix)) {
if (key && key.startsWith(prefix) && key > startKey) {
foundNextKey(key)
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-db",
"version": "0.10.0-1",
"version": "0.10.0-2",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-testing",
"version": "0.10.0-1",
"version": "0.10.0-2",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-utils",
"version": "0.10.0-1",
"version": "0.10.0-2",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"type": "module",
Expand Down

0 comments on commit afaaad3

Please sign in to comment.