@typeberry/lib 0.5.10-ca4935b → 0.5.10-ec38e0b

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.
Files changed (50) hide show
  1. package/package.json +1 -1
  2. package/packages/jam/block/work-package.d.ts +7 -7
  3. package/packages/jam/block/work-package.d.ts.map +1 -1
  4. package/packages/jam/block/work-package.js +12 -12
  5. package/packages/jam/executor/pvm-executor.d.ts +7 -0
  6. package/packages/jam/executor/pvm-executor.d.ts.map +1 -1
  7. package/packages/jam/executor/pvm-executor.js +15 -0
  8. package/packages/jam/in-core/externalities/refine.d.ts +2 -2
  9. package/packages/jam/in-core/externalities/refine.d.ts.map +1 -1
  10. package/packages/jam/in-core/externalities/refine.js +10 -3
  11. package/packages/jam/in-core/externalities/refine.test.js +53 -0
  12. package/packages/jam/in-core/in-core.d.ts +7 -22
  13. package/packages/jam/in-core/in-core.d.ts.map +1 -1
  14. package/packages/jam/in-core/in-core.js +16 -184
  15. package/packages/jam/in-core/in-core.test.js +47 -15
  16. package/packages/jam/in-core/is-authorized.d.ts +33 -0
  17. package/packages/jam/in-core/is-authorized.d.ts.map +1 -0
  18. package/packages/jam/in-core/is-authorized.js +72 -0
  19. package/packages/jam/in-core/is-authorized.test.d.ts +2 -0
  20. package/packages/jam/in-core/is-authorized.test.d.ts.map +1 -0
  21. package/packages/jam/in-core/is-authorized.test.js +125 -0
  22. package/packages/jam/in-core/refine.d.ts +34 -0
  23. package/packages/jam/in-core/refine.d.ts.map +1 -0
  24. package/packages/jam/in-core/refine.js +176 -0
  25. package/packages/jam/in-core/refine.test.d.ts +2 -0
  26. package/packages/jam/in-core/refine.test.d.ts.map +1 -0
  27. package/packages/jam/in-core/refine.test.js +6 -0
  28. package/packages/jam/jam-host-calls/accumulate/bless.js +9 -9
  29. package/packages/jam/jam-host-calls/externalities/partial-state.d.ts +1 -1
  30. package/packages/jam/jam-host-calls/externalities/refine-externalities.d.ts +1 -1
  31. package/packages/jam/jam-host-calls/externalities/refine-externalities.d.ts.map +1 -1
  32. package/packages/jam/jam-host-calls/general/fetch.d.ts +40 -40
  33. package/packages/jam/jam-host-calls/general/fetch.d.ts.map +1 -1
  34. package/packages/jam/jam-host-calls/general/fetch.js +30 -30
  35. package/packages/jam/jam-host-calls/general/fetch.test.js +17 -14
  36. package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.d.ts +2 -2
  37. package/packages/jam/transition/accumulate/accumulation-result-merge-utils.js +48 -39
  38. package/packages/jam/transition/externalities/accumulate-externalities.d.ts +2 -2
  39. package/packages/jam/transition/externalities/accumulate-externalities.d.ts.map +1 -1
  40. package/packages/jam/transition/externalities/accumulate-externalities.js +20 -7
  41. package/packages/jam/transition/externalities/accumulate-externalities.test.js +74 -4
  42. package/packages/jam/transition/externalities/index.d.ts +1 -0
  43. package/packages/jam/transition/externalities/index.d.ts.map +1 -1
  44. package/packages/jam/transition/externalities/index.js +1 -0
  45. package/packages/jam/transition/externalities/is-authorized-fetch-externalities.d.ts +22 -0
  46. package/packages/jam/transition/externalities/is-authorized-fetch-externalities.d.ts.map +1 -0
  47. package/packages/jam/transition/externalities/is-authorized-fetch-externalities.js +41 -0
  48. package/packages/jam/transition/externalities/refine-fetch-externalities.d.ts +7 -7
  49. package/packages/jam/transition/externalities/refine-fetch-externalities.d.ts.map +1 -1
  50. package/packages/jam/transition/externalities/refine-fetch-externalities.js +17 -9
@@ -0,0 +1,41 @@
1
+ import { BytesBlob } from "#@typeberry/bytes";
2
+ import { general } from "#@typeberry/jam-host-calls";
3
+ import { getEncodedConstants } from "./fetch-externalities.js";
4
+ export class IsAuthorizedFetchExternalities {
5
+ chainSpec;
6
+ params;
7
+ context = general.FetchContext.IsAuthorized;
8
+ constructor(chainSpec, params) {
9
+ this.chainSpec = chainSpec;
10
+ this.params = params;
11
+ }
12
+ constants() {
13
+ return getEncodedConstants(this.chainSpec);
14
+ }
15
+ // TODO [ToDr] Return encoded work package E(p)
16
+ workPackage() {
17
+ return BytesBlob.empty();
18
+ }
19
+ authConfiguration() {
20
+ return this.params.authConfiguration;
21
+ }
22
+ authToken() {
23
+ return this.params.authToken;
24
+ }
25
+ // TODO [ToDr] Return encoded refinement context
26
+ refineContext() {
27
+ return BytesBlob.empty();
28
+ }
29
+ // TODO [ToDr] Return encoded work items
30
+ allWorkItems() {
31
+ return BytesBlob.empty();
32
+ }
33
+ // TODO [ToDr] Return single work item summary
34
+ oneWorkItem(_workItem) {
35
+ return null;
36
+ }
37
+ // TODO [ToDr] Return work item payload
38
+ workItemPayload(_workItem) {
39
+ return null;
40
+ }
41
+ }
@@ -1,5 +1,5 @@
1
1
  import type { EntropyHash } from "#@typeberry/block";
2
- import { type BytesBlob } from "#@typeberry/bytes";
2
+ import { BytesBlob } from "#@typeberry/bytes";
3
3
  import type { ChainSpec } from "#@typeberry/config";
4
4
  import { general } from "#@typeberry/jam-host-calls";
5
5
  import type { U64 } from "#@typeberry/numbers";
@@ -9,14 +9,14 @@ export declare class RefineFetchExternalities implements general.IRefineFetch {
9
9
  constructor(chainSpec: ChainSpec);
10
10
  constants(): BytesBlob;
11
11
  entropy(): EntropyHash;
12
- authorizerTrace(): BytesBlob | null;
12
+ authorizerTrace(): BytesBlob;
13
13
  workItemExtrinsic(_workItem: U64 | null, _index: U64): BytesBlob | null;
14
14
  workItemImport(_workItem: U64 | null, _index: U64): BytesBlob | null;
15
- workPackage(): BytesBlob | null;
16
- authorizer(): BytesBlob | null;
17
- authorizationToken(): BytesBlob | null;
18
- refineContext(): BytesBlob | null;
19
- allWorkItems(): BytesBlob | null;
15
+ workPackage(): BytesBlob;
16
+ authConfiguration(): BytesBlob;
17
+ authToken(): BytesBlob;
18
+ refineContext(): BytesBlob;
19
+ allWorkItems(): BytesBlob;
20
20
  oneWorkItem(_workItem: U64): BytesBlob | null;
21
21
  workItemPayload(_workItem: U64): BytesBlob | null;
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"refine-fetch-externalities.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/externalities/refine-fetch-externalities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAG9C,qBAAa,wBAAyB,YAAW,OAAO,CAAC,YAAY;IAGvD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAFtC,QAAQ,CAAC,OAAO,+BAA+B;gBAElB,SAAS,EAAE,SAAS;IAEjD,SAAS,IAAI,SAAS;IAKtB,OAAO,IAAI,WAAW;IAItB,eAAe,IAAI,SAAS,GAAG,IAAI;IAInC,iBAAiB,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAIvE,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAIpE,WAAW,IAAI,SAAS,GAAG,IAAI;IAI/B,UAAU,IAAI,SAAS,GAAG,IAAI;IAI9B,kBAAkB,IAAI,SAAS,GAAG,IAAI;IAItC,aAAa,IAAI,SAAS,GAAG,IAAI;IAIjC,YAAY,IAAI,SAAS,GAAG,IAAI;IAIhC,WAAW,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAI7C,eAAe,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;CAGlD"}
1
+ {"version":3,"file":"refine-fetch-externalities.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/externalities/refine-fetch-externalities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAS,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAG9C,qBAAa,wBAAyB,YAAW,OAAO,CAAC,YAAY;IAGvD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAFtC,QAAQ,CAAC,OAAO,+BAA+B;gBAElB,SAAS,EAAE,SAAS;IAEjD,SAAS,IAAI,SAAS;IAKtB,OAAO,IAAI,WAAW;IAKtB,eAAe,IAAI,SAAS;IAK5B,iBAAiB,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAKvE,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAKpE,WAAW,IAAI,SAAS;IAKxB,iBAAiB,IAAI,SAAS;IAK9B,SAAS,IAAI,SAAS;IAKtB,aAAa,IAAI,SAAS;IAK1B,YAAY,IAAI,SAAS;IAIzB,WAAW,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAI7C,eAAe,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;CAGlD"}
@@ -1,4 +1,4 @@
1
- import { Bytes } from "#@typeberry/bytes";
1
+ import { Bytes, BytesBlob } from "#@typeberry/bytes";
2
2
  import { HASH_SIZE } from "#@typeberry/hash";
3
3
  import { general } from "#@typeberry/jam-host-calls";
4
4
  import { getEncodedConstants } from "./fetch-externalities.js";
@@ -15,29 +15,37 @@ export class RefineFetchExternalities {
15
15
  entropy() {
16
16
  return Bytes.zero(HASH_SIZE).asOpaque();
17
17
  }
18
+ // TODO [ToDr] implement
18
19
  authorizerTrace() {
19
- return null;
20
+ return BytesBlob.empty();
20
21
  }
22
+ // TODO [ToDr] implement
21
23
  workItemExtrinsic(_workItem, _index) {
22
24
  return null;
23
25
  }
26
+ // TODO [ToDr] implement
24
27
  workItemImport(_workItem, _index) {
25
28
  return null;
26
29
  }
30
+ // TODO [ToDr] implement
27
31
  workPackage() {
28
- return null;
32
+ return BytesBlob.empty();
29
33
  }
30
- authorizer() {
31
- return null;
34
+ // TODO [ToDr] implement
35
+ authConfiguration() {
36
+ return BytesBlob.empty();
32
37
  }
33
- authorizationToken() {
34
- return null;
38
+ // TODO [ToDr] implement
39
+ authToken() {
40
+ return BytesBlob.empty();
35
41
  }
42
+ // TODO [ToDr] implement
36
43
  refineContext() {
37
- return null;
44
+ return BytesBlob.empty();
38
45
  }
46
+ // TODO [ToDr] implement
39
47
  allWorkItems() {
40
- return null;
48
+ return BytesBlob.empty();
41
49
  }
42
50
  oneWorkItem(_workItem) {
43
51
  return null;