Upgrade Guide
This page has instructions on upgrading your Micro-Rollup to a specific or latest versions of the Stackr SDK and CLI.
Upgrading to v0.6.0
This release introduces breaking changes in how to write action schemas, state transition functions, and creating and submitting an action.
-
Changes in writing action schemas and STFs:
before v0.6.0// schemas.ts const UpdateCounterSchema = new ActionSchema("update-counter", { amount: SolidityType.UINT, }); // transitions.ts const increment: STF<CounterState, { amount: number }> = { handler: ({ state, inputs }) => { state += inputs.amount; return state; }, }; // index.ts const mru = await MicroRollup({ config: stackrConfig, actionSchemas: [UpdateCounterSchema], stateMachines: [machine], stfSchemaMap: { increment: UpdateCounterSchema, }, });
-
Changes in generating signature and creating/submitting an action:
before v0.6.0const inputs = { amount: 1 }; const signature = await wallet.signTypedData( UpdateCounterSchema.domain, UpdateCounterSchema.EIP712TypedData.types, inputs ); const incrementAction = UpdateCounterSchema.actionFrom({ inputs, signature, msgSender: wallet.address, }); await mru.submitAction("increment", incrementAction);
Upgrading to v0.5.2
This release introduces some breaking changes in StackrConfig
and MicroRollup
.
- In your
stackr.config.ts
file,
- Remove the line which imports the
deployment.json
file. The file is now directly read by the SDK. If you renamed this file, specify the path indeploymentFile
field. - Remove the
stackrApp
field. - Remove
domain.chainId
anddomain.verifyingContract
fields. - Rename
enableEmptyBlocks
toallowEmptyBlocks
insequencer
field.
- If you are passing any of
isSandbox
,disableBuilder
,disableVulcanSync
ordisableL1Sync
arguments toMicroRollup
, they should be moved to the config now, in corresponding sections.
Upgrading to v0.5.0
To upgrade your existing application to SDK version v0.5.0 from any older version, you need to perform a "squash fork". It basically is a new registration and deployment of your application but using the previous latest state as the new genesis state.
- Delete existing registration.
$ rm deployment.json && rm db.sqlite
- Update the SDK version in your
package.json
and the Stackr CLI version as well.
$ npm install @stackr/sdk@v0.5.0
$ npm install -g @stackr/cli
-
In your
stackr.config.ts
file, rename thebatchSize
andbatchTime
fields toblockSize
andblockTime
respectively. -
Update the
REGISTRY_CONTRACT
variable in your.env
to point to the updated contract. Refer to Network Configuration for the new address. -
Re-register and re-deploy your MRU as a new application.
$ stackr register
$ stackr deploy
With this, you now have a new application with the restored state! ✨
Backing up your Micro-Rollup state
To get your application's latest state dumped into a JSON file, follow these steps:
- Update the SDK version in your
package.json
. If you are upgrading from version < v0.4.3, update to v0.4.3 first for this step.
$ npm install @stackr/sdk@v0.4.3
-
Try to boot up the application. It should fail with an error stating "SDK version mismatch with Vulcan" and will dump your MRU's latest state into a
latest-state.json
file. -
Restore this dumped state JSON file as the new genesis state.
$ mv latest-state.json genesis-state.json