@helios-lang/contract-utils 0.2.21 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -94,7 +94,10 @@ export class DagCompiler {
|
|
|
94
94
|
validator.$hashDependencies.forEach((v) => buildValidator(v))
|
|
95
95
|
|
|
96
96
|
// get the dependencies
|
|
97
|
-
const
|
|
97
|
+
const hashDepHashes = this.getHashDepHashes(
|
|
98
|
+
validator,
|
|
99
|
+
Object.keys(hashTypes)
|
|
100
|
+
)
|
|
98
101
|
const moduleDeps = getModuleDependencies(validator)
|
|
99
102
|
|
|
100
103
|
const excludeUserFuncs = new Set(Object.keys(this.cachedUserFuncs))
|
|
@@ -105,7 +108,7 @@ export class DagCompiler {
|
|
|
105
108
|
moduleDeps,
|
|
106
109
|
{
|
|
107
110
|
optimize: true,
|
|
108
|
-
hashDependencies:
|
|
111
|
+
hashDependencies: hashDepHashes,
|
|
109
112
|
allValidatorHashTypes: hashTypes,
|
|
110
113
|
dependsOnOwnHash: validator.$dependsOnOwnHash,
|
|
111
114
|
parameters: parameters,
|
|
@@ -140,7 +143,7 @@ export class DagCompiler {
|
|
|
140
143
|
Array.from(moduleDeps.values()),
|
|
141
144
|
{
|
|
142
145
|
optimize: false,
|
|
143
|
-
hashDependencies:
|
|
146
|
+
hashDependencies: hashDepHashes,
|
|
144
147
|
allValidatorHashTypes: hashTypes,
|
|
145
148
|
ownHash: validator.$dependsOnOwnHash ? ownHash : undefined,
|
|
146
149
|
parameters: parameters,
|
|
@@ -236,13 +239,14 @@ export class DagCompiler {
|
|
|
236
239
|
/**
|
|
237
240
|
* @private
|
|
238
241
|
* @param {LoadedValidator} validator
|
|
242
|
+
* @param {string[]} allValidators - add a dummy `#` for all validators that aren't hash dependencies (the optimizer will remove them, but the IR name resolution will fail if we don't have them)
|
|
239
243
|
* @returns {{[name: string]: string}} - TODO: do we really need the purpose?
|
|
240
244
|
*/
|
|
241
|
-
|
|
245
|
+
getHashDepHashes(validator, allValidators) {
|
|
242
246
|
/**
|
|
243
247
|
* @type {{[name: string]: string}}
|
|
244
248
|
*/
|
|
245
|
-
const
|
|
249
|
+
const hashes = {}
|
|
246
250
|
|
|
247
251
|
validator.$hashDependencies.forEach((dep) => {
|
|
248
252
|
const k = dep.$name
|
|
@@ -254,10 +258,16 @@ export class DagCompiler {
|
|
|
254
258
|
)
|
|
255
259
|
}
|
|
256
260
|
|
|
257
|
-
|
|
261
|
+
hashes[k] = v.toHex()
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
allValidators.forEach((v) => {
|
|
265
|
+
if (!(v in hashes)) {
|
|
266
|
+
hashes[v] = "#"
|
|
267
|
+
}
|
|
258
268
|
})
|
|
259
269
|
|
|
260
|
-
return
|
|
270
|
+
return hashes
|
|
261
271
|
}
|
|
262
272
|
|
|
263
273
|
/**
|
|
@@ -70,9 +70,10 @@ export class DagCompiler {
|
|
|
70
70
|
/**
|
|
71
71
|
* @private
|
|
72
72
|
* @param {LoadedValidator} validator
|
|
73
|
+
* @param {string[]} allValidators - add a dummy `#` for all validators that aren't hash dependencies (the optimizer will remove them, but the IR name resolution will fail if we don't have them)
|
|
73
74
|
* @returns {{[name: string]: string}} - TODO: do we really need the purpose?
|
|
74
75
|
*/
|
|
75
|
-
private
|
|
76
|
+
private getHashDepHashes;
|
|
76
77
|
/**
|
|
77
78
|
* Also returns the hash types of any hash-dependencies
|
|
78
79
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DagCompiler.d.ts","sourceRoot":"","sources":["../../src/context/DagCompiler.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DagCompiler.d.ts","sourceRoot":"","sources":["../../src/context/DagCompiler.js"],"names":[],"mappings":"AA6SA;;;GAGG;AACH,iDAHW,eAAe,GACb,MAAM,EAAE,CAsBpB;AA3TD;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;GAEG;AACH;IA6BI;;;OAGG;IACH,iBAHW,WAAW,cACX,UAAU,EAOpB;IArCD;;;;OAIG;IACH,qBAAG;IAEH;;;;OAIG;IACH,wBAAM;IAEN;;;;OAIG;IACH,kCAAgB;IAEhB;;;;OAIG;IACH,iCAAe;IAQX,iDAA4B;IAKhC;;;;;;OAMG;IACH,kBANW,eAAe,EAAE,cACjB,OAAO,MAAM,EAAE,GAAG,CAAC,aACnB,OAAO;;SAEL,iBAAiB,CA8H7B;IAED;;;;;OAKG;IACH,4BA6BC;IAED;;;;;OAKG;IACH,yBA0BC;IAED;;;;;OAKG;IACH,qBAoBC;CACJ;0BAhSY,OAAO,mBAAmB,EAAE,WAAW;yBACvC,OAAO,kBAAkB,EAAE,UAAU;8BACrC,OAAO,+BAA+B,EAAE,eAAe;0BACvD,OAAO,sBAAsB,EAAE,WAAW;0CAC1C,OAAO,sBAAsB,EAAE,2BAA2B"}
|