Rollup State
Basis of Rollup for compute
Stackr-JS comes with a base RollupState
base class that can be extended to create a custom rollup.
You need to provide the StateVariable
and StateTransport
types to the
RollupState
class which you defined previously.
Extending RollupState
You need to extend the RollupState
class and implement 4 methods:
constructor
You need to call the super constructor with the StateVariable
type for it to be able to use the defined state
createTransport
This method is used to create a transport object that will be used to wrap a StateVariable.
getState
This is the opposite of createTransport
and is used to extract the state from a transport object.
calculateRoot
This method is used to calculate the state root of the rollup. The idea behind is that the rollups must converge into single state root that is succint representation of the state of the rollup.
Final RollupState
Overall the final rollup state could look like this: