File tree Expand file tree Collapse file tree 2 files changed +26
-19
lines changed Expand file tree Collapse file tree 2 files changed +26
-19
lines changed Original file line number Diff line number Diff line change @@ -132,15 +132,6 @@ export class Protocol<
132
132
public create ( childContainerProvider : ChildContainerProvider ) {
133
133
super . create ( childContainerProvider ) ;
134
134
135
- const runtime : ModuleContainer < any > = this . container . resolve ( "Runtime" ) ;
136
- runtime . moduleNames . forEach ( ( runtimeModuleName ) => {
137
- this . container . register ( runtimeModuleName , {
138
- useFactory : ( dependencyContainer ) => {
139
- return runtime . resolve ( runtimeModuleName ) ;
140
- } ,
141
- } ) ;
142
- } ) ;
143
-
144
135
// Register the BlockModules seperately since we need to
145
136
// inject them differently later
146
137
const ABSTRACT_MODULE_TYPES = [
@@ -189,6 +180,15 @@ export class Protocol<
189
180
) ;
190
181
}
191
182
} ) ;
183
+
184
+ const runtime : ModuleContainer < any > = this . container . resolve ( "Runtime" ) ;
185
+ runtime . moduleNames . forEach ( ( runtimeModuleName ) => {
186
+ this . container . register ( runtimeModuleName , {
187
+ useFactory : ( dependencyContainer ) => {
188
+ return runtime . resolve ( runtimeModuleName ) ;
189
+ } ,
190
+ } ) ;
191
+ } ) ;
192
192
}
193
193
194
194
public async start ( ) {
Original file line number Diff line number Diff line change 1
- import { WithZkProgrammable , ZkProgrammable } from "@proto-kit/common" ;
2
1
import { container } from "tsyringe" ;
2
+ import { Runtime } from "@proto-kit/module" ;
3
+ import { Balance } from "@proto-kit/sequencer/test/integration/mocks/Balance" ;
4
+ import { NoopRuntime } from "@proto-kit/sequencer/test/integration/mocks/NoopRuntime" ;
3
5
4
6
import {
5
7
AccountStateHook ,
6
8
BlockHeightHook ,
7
9
BlockProver ,
8
10
LastStateRootBlockHook ,
9
- MethodPublicOutput ,
10
11
Protocol ,
11
12
StateTransitionProver ,
12
13
} from "../src" ;
13
14
14
- class RuntimeMock implements WithZkProgrammable < undefined , MethodPublicOutput > {
15
- zkProgrammable : ZkProgrammable < undefined , MethodPublicOutput > =
16
- undefined as unknown as ZkProgrammable < undefined , MethodPublicOutput > ;
17
- }
18
-
19
15
export function createAndInitTestingProtocol ( ) {
20
16
const ProtocolClass = Protocol . from ( {
21
17
modules : {
@@ -35,11 +31,22 @@ export function createAndInitTestingProtocol() {
35
31
StateTransitionProver : { } ,
36
32
LastStateRoot : { } ,
37
33
} ) ;
38
- protocol . create ( ( ) => container . createChildContainer ( ) ) ;
39
34
40
- protocol . registerValue ( {
41
- Runtime : new RuntimeMock ( ) ,
35
+ const appChain = container . createChildContainer ( ) ;
36
+
37
+ appChain . register ( "Runtime" , {
38
+ useClass : Runtime . from ( {
39
+ modules : {
40
+ Balance,
41
+ NoopRuntime,
42
+ } ,
43
+ config : {
44
+ Balance : { } ,
45
+ NoopRuntime : { } ,
46
+ } ,
47
+ } ) ,
42
48
} ) ;
49
+ protocol . create ( ( ) => appChain . createChildContainer ( ) ) ;
43
50
44
51
return protocol ;
45
52
}
You can’t perform that action at this time.
0 commit comments