@proto-kit/protocol 0.1.1-develop.299 → 0.1.1-develop.335

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.
@@ -30,7 +30,7 @@ declare const AccountState_base: (new (value: {
30
30
  };
31
31
  export declare class AccountState extends AccountState_base {
32
32
  }
33
- export declare class AccountStateModule extends ProvableTransactionHook<object> {
33
+ export declare class AccountStateModule extends ProvableTransactionHook<Record<string, never>> {
34
34
  accountState: StateMap<PublicKey, AccountState>;
35
35
  onTransaction({ transaction }: BlockProverExecutionData): void;
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AccountStateModule.d.ts","sourceRoot":"","sources":["../../src/blockmodules/AccountStateModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAE3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9E,qBAAa,YAAa,SAAQ,iBAEhC;CAAG;AAEL,qBAAa,kBAAmB,SAAQ,uBAAuB,CAAC,MAAM,CAAC;IAC7C,YAAY,oCAGlC;IAEK,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE,wBAAwB,GAAG,IAAI;CActE"}
1
+ {"version":3,"file":"AccountStateModule.d.ts","sourceRoot":"","sources":["../../src/blockmodules/AccountStateModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAE3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9E,qBAAa,YAAa,SAAQ,iBAEhC;CAAG;AAEL,qBAAa,kBAAmB,SAAQ,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5D,YAAY,oCAGlC;IAEK,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE,wBAAwB,GAAG,IAAI;CActE"}
@@ -1 +1 @@
1
- {"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../src/model/Path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,KAAK,oBAAoB,EAAY,MAAM,MAAM,CAAC;AAIlE;;GAEG;AACH,qBAAa,IAAI;IACf;;;;;OAKG;WACW,OAAO,CAAC,KAAK,EAAE,MAAM;IAInC;;;;;;OAMG;WACW,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,KAAK;IAQzE;;;;;;;OAOG;WACW,OAAO,CAAC,OAAO,EAC3B,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACtC,GAAG,EAAE,OAAO,GACX,KAAK;CAIT"}
1
+ {"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../src/model/Path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,KAAK,oBAAoB,EAAsB,MAAM,MAAM,CAAC;AAI5E;;GAEG;AACH,qBAAa,IAAI;IACf;;;;;OAKG;WACW,OAAO,CAAC,KAAK,EAAE,MAAM;IAInC;;;;;;OAMG;WACW,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,KAAK;IAQzE;;;;;;;OAOG;WACW,OAAO,CAAC,OAAO,EAC3B,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACtC,GAAG,EAAE,OAAO,GACX,KAAK;CAIT"}
@@ -8,6 +8,7 @@ import { StateServiceProvider } from "../state/StateServiceProvider";
8
8
  import { StateService } from "../state/StateService";
9
9
  import { ProtocolModule } from "./ProtocolModule";
10
10
  import { ProtocolEnvironment } from "./ProtocolEnvironment";
11
+ import { AccountStateModule } from "../blockmodules/AccountStateModule";
11
12
  export type GenericProtocolModuleRecord = ModulesRecord<TypedClass<ProtocolModule<unknown>>>;
12
13
  interface BlockProverType extends ProtocolModule<object>, BlockProvable {
13
14
  }
@@ -16,21 +17,17 @@ interface StateTransitionProverType extends ProtocolModule<object>, StateTransit
16
17
  export interface ProtocolCustomModulesRecord {
17
18
  BlockProver: TypedClass<BlockProverType>;
18
19
  StateTransitionProver: TypedClass<StateTransitionProverType>;
20
+ AccountState: TypedClass<AccountStateModule>;
19
21
  }
20
22
  export interface ProtocolModulesRecord extends GenericProtocolModuleRecord, ProtocolCustomModulesRecord {
21
23
  }
22
24
  export interface ProtocolDefinition<Modules extends ProtocolModulesRecord> {
23
25
  modules: Modules;
24
- /**
25
- * @deprecated
26
- */
27
- state?: StateService;
28
26
  config?: ModulesConfig<Modules>;
29
27
  }
30
28
  export declare class Protocol<Modules extends ProtocolModulesRecord> extends ModuleContainer<Modules> implements ProtocolEnvironment {
31
29
  static from<Modules extends ProtocolModulesRecord>(modules: ProtocolDefinition<Modules>): TypedClass<Protocol<Modules>>;
32
30
  definition: ProtocolDefinition<Modules>;
33
- private readonly stateServiceProviderInstance;
34
31
  constructor(definition: ProtocolDefinition<Modules>);
35
32
  get stateService(): StateService;
36
33
  get stateServiceProvider(): StateServiceProvider;
@@ -43,16 +40,19 @@ export declare class Protocol<Modules extends ProtocolModulesRecord> extends Mod
43
40
  create(childContainerProvider: ChildContainerProvider): void;
44
41
  }
45
42
  export declare const VanillaProtocol: {
46
- create(stateService?: StateService): TypedClass<Protocol<{
43
+ create(): TypedClass<Protocol<{
47
44
  StateTransitionProver: typeof StateTransitionProver;
48
45
  BlockProver: typeof BlockProver;
46
+ AccountState: typeof AccountStateModule;
49
47
  }>>;
50
48
  from<AdditonalModules extends GenericProtocolModuleRecord>(additionalModules: AdditonalModules, config: ModulesConfig<AdditonalModules & {
51
49
  StateTransitionProver: typeof StateTransitionProver;
52
50
  BlockProver: typeof BlockProver;
53
- }>, stateService?: StateService): TypedClass<Protocol<AdditonalModules & {
51
+ AccountState: typeof AccountStateModule;
52
+ }>): TypedClass<Protocol<AdditonalModules & {
54
53
  StateTransitionProver: typeof StateTransitionProver;
55
54
  BlockProver: typeof BlockProver;
55
+ AccountState: typeof AccountStateModule;
56
56
  }>>;
57
57
  };
58
58
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../src/protocol/Protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EAEtB,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAa,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,MAAM,2BAA2B,GAAG,aAAa,CACrD,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CACpC,CAAC;AAEF,UAAU,eAAgB,SAAQ,cAAc,CAAC,MAAM,CAAC,EAAE,aAAa;CAAG;AAE1E,UAAU,yBACR,SAAQ,cAAc,CAAC,MAAM,CAAC,EA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C"}
@@ -2,9 +2,9 @@ import { log, ModuleContainer, } from "@proto-kit/common";
2
2
  import { Lifecycle } from "tsyringe";
3
3
  import { StateTransitionProver } from "../prover/statetransition/StateTransitionProver";
4
4
  import { BlockProver } from "../prover/block/BlockProver";
5
- import { StateServiceProvider } from "../state/StateServiceProvider";
6
5
  import { ProvableTransactionHook } from "./ProvableTransactionHook";
7
6
  import { NoopTransactionHook } from "../blockmodules/NoopTransactionHook";
7
+ import { AccountStateModule } from "../blockmodules/AccountStateModule";
8
8
  export class Protocol extends ModuleContainer {
9
9
  // .from() to create Protocol
10
10
  static from(modules) {
@@ -16,16 +16,13 @@ export class Protocol extends ModuleContainer {
16
16
  }
17
17
  constructor(definition) {
18
18
  super(definition);
19
- this.stateServiceProviderInstance = new StateServiceProvider(
20
- // eslint-disable-next-line etc/no-deprecated
21
- this.definition.state);
22
19
  this.definition = definition;
23
20
  }
24
21
  get stateService() {
25
- return this.stateServiceProviderInstance.stateService;
22
+ return this.stateServiceProvider.stateService;
26
23
  }
27
24
  get stateServiceProvider() {
28
- return this.stateServiceProviderInstance;
25
+ return this.container.resolve("StateServiceProvider");
29
26
  }
30
27
  decorateModule(moduleName, containedModule) {
31
28
  log.debug(`Decorated ${moduleName}`);
@@ -70,21 +67,22 @@ export class Protocol extends ModuleContainer {
70
67
  }
71
68
  }
72
69
  export const VanillaProtocol = {
73
- create(stateService) {
70
+ create() {
74
71
  return VanillaProtocol.from({}, {
75
72
  BlockProver: {},
76
73
  StateTransitionProver: {},
77
- }, stateService);
74
+ AccountState: {},
75
+ });
78
76
  },
79
- from(additionalModules, config, stateService) {
77
+ from(additionalModules, config) {
80
78
  return Protocol.from({
81
79
  modules: {
82
80
  StateTransitionProver,
83
81
  BlockProver,
82
+ AccountState: AccountStateModule,
84
83
  ...additionalModules,
85
84
  },
86
85
  config,
87
- state: stateService,
88
86
  });
89
87
  },
90
88
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BlockProver.d.ts","sourceRoot":"","sources":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IAY/C,KAAK,CACV,WAAW,EAAE,sBAAsB,EACnC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,GACvB,uBAAuB;IAInB,gBAAgB,CACrB,WAAW,EAAE,sBAAsB,EACnC,UAAU,EAAE,oBAAoB,EAChC,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,kBAAkB,CAAC,EACzC,aAAa,EAAE,wBAAwB,GACtC,uBAAuB;CAQ3B"}
@@ -129,6 +129,9 @@ export class BlockProverProgrammable extends ZkProgrammable {
129
129
  // Check transaction list
130
130
  publicInput.transactionsHash.assertEquals(proof1.publicInput.transactionsHash, errors.transactionsHashNotMatching("publicInput.from -> proof1.from"));
131
131
  proof1.publicOutput.transactionsHash.assertEquals(proof2.publicInput.transactionsHash, errors.transactionsHashNotMatching("proof1.to -> proof2.from"));
132
+ // Check networkhash
133
+ publicInput.networkStateHash.assertEquals(proof1.publicInput.networkStateHash, errors.transactionsHashNotMatching("publicInput.from -> proof1.from"));
134
+ publicInput.networkStateHash.assertEquals(proof2.publicInput.networkStateHash, errors.transactionsHashNotMatching("proof1.to -> proof2.from"));
132
135
  return new BlockProverPublicOutput({
133
136
  stateRoot: proof2.publicOutput.stateRoot,
134
137
  transactionsHash: proof2.publicOutput.transactionsHash,
@@ -1,7 +1,5 @@
1
1
  import { Field } from "o1js";
2
2
  export type ReturnType<FunctionType extends Function> = FunctionType extends (...args: any[]) => infer Return ? Return : any;
3
- export type UnTypedClass = new (...args: any[]) => any;
4
- export type TypedClass<Class> = new (...args: any[]) => Class;
5
3
  export type Subclass<Class extends new (...args: any) => any> = (new (...args: any) => InstanceType<Class>) & {
6
4
  [Key in keyof Class]: Class[Key];
7
5
  } & {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAsB,MAAM,MAAM,CAAC;AAGjD,MAAM,MAAM,UAAU,CAAC,YAAY,S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M,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;CACjC,GAAG;IAAE,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;CAAE,CAAC;AAEvC,wBAAgB,YAAY,IAAI,eAAe,CAoB9C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,4CAgC1C;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAKjE"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "MIT",
4
4
  "private": false,
5
5
  "type": "module",
6
- "version": "0.1.1-develop.299+fbe92e3",
6
+ "version": "0.1.1-develop.335+e295596",
7
7
  "scripts": {
8
8
  "build": "tsc -p tsconfig.json",
9
9
  "dev": "tsc -p tsconfig.json --watch",
@@ -31,5 +31,5 @@
31
31
  "@jest/globals": "^29.5.0",
32
32
  "@types/lodash": "^4.14.194"
33
33
  },
34
- "gitHead": "fbe92e36c7103001875d853888ab3b6728936cc9"
34
+ "gitHead": "e295596f3d539c122e538ad2df470e900c7c7cf8"
35
35
  }
@@ -10,7 +10,7 @@ export class AccountState extends Struct({
10
10
  nonce: UInt64,
11
11
  }) {}
12
12
 
13
- export class AccountStateModule extends ProvableTransactionHook<object> {
13
+ export class AccountStateModule extends ProvableTransactionHook<Record<string, never>> {
14
14
  @protocolState() public accountState = StateMap.from<PublicKey, AccountState>(
15
15
  PublicKey,
16
16
  AccountState
package/src/model/Path.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-extraneous-class */
2
2
  /* eslint-disable @shopify/no-fully-static-classes */
3
- import { Field, type FlexibleProvablePure, Poseidon } from "o1js";
3
+ import { Field, type FlexibleProvablePure, Poseidon, Provable } from "o1js";
4
4
 
5
5
  import { stringToField } from "../utils/utils";
6
6
 
@@ -21,6 +21,7 @@ import { ProtocolModule } from "./ProtocolModule";
21
21
  import { ProvableTransactionHook } from "./ProvableTransactionHook";
22
22
  import { NoopTransactionHook } from "../blockmodules/NoopTransactionHook";
23
23
  import { ProtocolEnvironment } from "./ProtocolEnvironment";
24
+ import { AccountStateModule } from "../blockmodules/AccountStateModule";
24
25
 
25
26
  export type GenericProtocolModuleRecord = ModulesRecord<
26
27
  TypedClass<ProtocolModule<unknown>>
@@ -35,6 +36,7 @@ interface StateTransitionProverType
35
36
  export interface ProtocolCustomModulesRecord {
36
37
  BlockProver: TypedClass<BlockProverType>;
37
38
  StateTransitionProver: TypedClass<StateTransitionProverType>;
39
+ AccountState: TypedClass<AccountStateModule>;
38
40
  }
39
41
 
40
42
  export interface ProtocolModulesRecord
@@ -43,11 +45,6 @@ export interface ProtocolModulesRecord
43
45
 
44
46
  export interface ProtocolDefinition<Modules extends ProtocolModulesRecord> {
45
47
  modules: Modules;
46
-
47
- /**
48
- * @deprecated
49
- */
50
- state?: StateService;
51
48
  config?: ModulesConfig<Modules>;
52
49
  }
53
50
 
@@ -68,22 +65,17 @@ export class Protocol<Modules extends ProtocolModulesRecord>
68
65
 
69
66
  public definition: ProtocolDefinition<Modules>;
70
67
 
71
- private readonly stateServiceProviderInstance = new StateServiceProvider(
72
- // eslint-disable-next-line etc/no-deprecated
73
- this.definition.state
74
- );
75
-
76
68
  public constructor(definition: ProtocolDefinition<Modules>) {
77
69
  super(definition);
78
70
  this.definition = definition;
79
71
  }
80
72
 
81
73
  public get stateService(): StateService {
82
- return this.stateServiceProviderInstance.stateService;
74
+ return this.stateServiceProvider.stateService;
83
75
  }
84
76
 
85
77
  public get stateServiceProvider(): StateServiceProvider {
86
- return this.stateServiceProviderInstance;
78
+ return this.container.resolve<StateServiceProvider>("StateServiceProvider");
87
79
  }
88
80
 
89
81
  public decorateModule(
@@ -157,14 +149,14 @@ export class Protocol<Modules extends ProtocolModulesRecord>
157
149
  }
158
150
 
159
151
  export const VanillaProtocol = {
160
- create(stateService?: StateService) {
152
+ create() {
161
153
  return VanillaProtocol.from(
162
154
  {},
163
155
  {
164
156
  BlockProver: {},
165
157
  StateTransitionProver: {},
166
- },
167
- stateService
158
+ AccountState: {},
159
+ }
168
160
  );
169
161
  },
170
162
 
@@ -174,14 +166,15 @@ export const VanillaProtocol = {
174
166
  AdditonalModules & {
175
167
  StateTransitionProver: typeof StateTransitionProver;
176
168
  BlockProver: typeof BlockProver;
169
+ AccountState: typeof AccountStateModule;
177
170
  }
178
- >,
179
- stateService?: StateService
171
+ >
180
172
  ): TypedClass<
181
173
  Protocol<
182
174
  AdditonalModules & {
183
175
  StateTransitionProver: typeof StateTransitionProver;
184
176
  BlockProver: typeof BlockProver;
177
+ AccountState: typeof AccountStateModule;
185
178
  }
186
179
  >
187
180
  > {
@@ -189,11 +182,11 @@ export const VanillaProtocol = {
189
182
  modules: {
190
183
  StateTransitionProver,
191
184
  BlockProver,
185
+ AccountState: AccountStateModule,
192
186
  ...additionalModules,
193
187
  },
194
188
 
195
189
  config,
196
- state: stateService,
197
190
  });
198
191
  },
199
- };
192
+ };
@@ -289,6 +289,16 @@ export class BlockProverProgrammable extends ZkProgrammable<
289
289
  errors.transactionsHashNotMatching("proof1.to -> proof2.from")
290
290
  );
291
291
 
292
+ // Check networkhash
293
+ publicInput.networkStateHash.assertEquals(
294
+ proof1.publicInput.networkStateHash,
295
+ errors.transactionsHashNotMatching("publicInput.from -> proof1.from")
296
+ );
297
+ publicInput.networkStateHash.assertEquals(
298
+ proof2.publicInput.networkStateHash,
299
+ errors.transactionsHashNotMatching("proof1.to -> proof2.from")
300
+ );
301
+
292
302
  return new BlockProverPublicOutput({
293
303
  stateRoot: proof2.publicOutput.stateRoot,
294
304
  transactionsHash: proof2.publicOutput.transactionsHash,
@@ -10,10 +10,6 @@ export type ReturnType<FunctionType extends Function> = FunctionType extends (
10
10
  ? Return
11
11
  : any;
12
12
 
13
- export type UnTypedClass = new (...args: any[]) => any;
14
-
15
- export type TypedClass<Class> = new (...args: any[]) => Class;
16
-
17
13
  export type Subclass<Class extends new (...args: any) => any> = (new (
18
14
  ...args: any
19
15
  ) => InstanceType<Class>) & {