1
1
import { Bool , Provable , Struct } from "o1js" ;
2
- import { range } from "@proto-kit/common" ;
2
+ import { range , RollupMerkleTreeWitness } from "@proto-kit/common" ;
3
3
4
4
import { constants } from "../Constants" ;
5
5
@@ -60,15 +60,22 @@ export class StateTransitionProvableBatch extends Struct({
60
60
ProvableStateTransitionType ,
61
61
constants . stateTransitionProverBatchSize
62
62
) ,
63
+
64
+ merkleWitnesses : Provable . Array (
65
+ RollupMerkleTreeWitness ,
66
+ constants . stateTransitionProverBatchSize
67
+ ) ,
63
68
} ) {
64
69
public static fromMappings (
65
70
transitions : {
66
71
transition : ProvableStateTransition ;
67
72
type : ProvableStateTransitionType ;
73
+ merkleWitnesses : RollupMerkleTreeWitness ;
68
74
} [ ]
69
75
) : StateTransitionProvableBatch {
70
76
const batch = transitions . map ( ( entry ) => entry . transition ) ;
71
77
const transitionTypes = transitions . map ( ( entry ) => entry . type ) ;
78
+ const merkleWitnesses = transitions . map ( ( entry ) => entry . merkleWitnesses ) ;
72
79
73
80
// Check that order is correct
74
81
let normalSTsStarted = false ;
@@ -88,12 +95,14 @@ export class StateTransitionProvableBatch extends Struct({
88
95
return new StateTransitionProvableBatch ( {
89
96
batch,
90
97
transitionTypes,
98
+ merkleWitnesses,
91
99
} ) ;
92
100
}
93
101
94
102
public static fromTransitions (
95
103
transitions : ProvableStateTransition [ ] ,
96
- protocolTransitions : ProvableStateTransition [ ]
104
+ protocolTransitions : ProvableStateTransition [ ] ,
105
+ merkleWitnesses : RollupMerkleTreeWitness [ ]
97
106
) : StateTransitionProvableBatch {
98
107
const array = transitions . slice ( ) . concat ( protocolTransitions ) ;
99
108
@@ -113,12 +122,14 @@ export class StateTransitionProvableBatch extends Struct({
113
122
return new StateTransitionProvableBatch ( {
114
123
batch : array ,
115
124
transitionTypes,
125
+ merkleWitnesses,
116
126
} ) ;
117
127
}
118
128
119
129
private constructor ( object : {
120
130
batch : ProvableStateTransition [ ] ;
121
131
transitionTypes : ProvableStateTransitionType [ ] ;
132
+ merkleWitnesses : RollupMerkleTreeWitness [ ] ;
122
133
} ) {
123
134
super ( object ) ;
124
135
}
0 commit comments