Skip to content

Commit a38d134

Browse files
committed
Patch chopsticks-core to expose resetStorageLayers on Block
1 parent 66843e5 commit a38d134

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff --git a/dist/cjs/blockchain/block.js b/dist/cjs/blockchain/block.js
2+
index d751a928b5c04a4fac2d9bb3e69df09b8d65187c..5fe2bb034834407e9c8b09bd1b1c6da6e25b1be5 100644
3+
--- a/dist/cjs/blockchain/block.js
4+
+++ b/dist/cjs/blockchain/block.js
5+
@@ -167,10 +167,17 @@ class Block {
6+
/**
7+
* Pop a layer from the storage stack.
8+
*/ popStorageLayer() {
9+
- _class_private_field_get(this, _storages).pop();
10+
+ _class_private_field_get(this, _storages).pop();
11+
+ }
12+
+ resetStorageLayers(targetCount) {
13+
+ const s = _class_private_field_get(this, _storages);
14+
+ while (s.length > targetCount) s.pop();
15+
}
16+
- /**
17+
- * Get storage diff.
18+
+ get storageLayerCount() {
19+
+ return _class_private_field_get(this, _storages).length;
20+
+ }
21+
+ /**
22+
+ * Get storage diff.
23+
*/ async storageDiff() {
24+
const storage = {};
25+
for (const layer of _class_private_field_get(this, _storages)){
26+
diff --git a/dist/esm/blockchain/block.js b/dist/esm/blockchain/block.js
27+
index edff7f74638a5c21c5f73c6831708b46eb6a576c..c9b9687bb6cc0169e1cad54bce99efb1c950cc1f 100644
28+
--- a/dist/esm/blockchain/block.js
29+
+++ b/dist/esm/blockchain/block.js
30+
@@ -157,10 +157,16 @@ import { RemoteStorageLayer, StorageLayer, StorageValueKind } from './storage-la
31+
/**
32+
* Pop a layer from the storage stack.
33+
*/ popStorageLayer() {
34+
- this.#storages.pop();
35+
+ this.#storages.pop();
36+
+ }
37+
+ resetStorageLayers(targetCount) {
38+
+ while (this.#storages.length > targetCount) this.#storages.pop();
39+
}
40+
- /**
41+
- * Get storage diff.
42+
+ get storageLayerCount() {
43+
+ return this.#storages.length;
44+
+ }
45+
+ /**
46+
+ * Get storage diff.
47+
*/ async storageDiff() {
48+
const storage = {};
49+
for (const layer of this.#storages){

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"@esbuild/*": "0.25.9",
3838
"glob": "^11.0.0",
3939
"brace-expansion": "^5.0.2",
40-
"node-gyp": "^11.0.0"
40+
"node-gyp": "^11.0.0",
41+
"@acala-network/chopsticks-core@npm:1.3.1": "patch:@acala-network/chopsticks-core@npm%3A1.3.1#~/.yarn/patches/@acala-network-chopsticks-core-npm-1.3.1-9f30da61ad.patch"
4142
},
4243
"packageManager": "yarn@4.14.1",
4344
"dependencies": {

0 commit comments

Comments
 (0)