Skip to content

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.

  1. 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,
      },
    });
  2. Changes in generating signature and creating/submitting an action:

    before v0.6.0
    const 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.

  1. 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 in deploymentFile field.
  • Remove the stackrApp field.
  • Remove domain.chainId and domain.verifyingContract fields.
  • Rename enableEmptyBlocks to allowEmptyBlocks in sequencer field.
  1. If you are passing any of isSandbox, disableBuilder, disableVulcanSync or disableL1Sync arguments to MicroRollup, 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.

  1. Delete existing registration.
$ rm deployment.json && rm db.sqlite
  1. 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
  1. In your stackr.config.ts file, rename the batchSize and batchTime fields to blockSize and blockTime respectively.

  2. Update the REGISTRY_CONTRACT variable in your .env to point to the updated contract. Refer to Network Configuration for the new address.

  3. 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:

  1. 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
  1. 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.

  2. Restore this dumped state JSON file as the new genesis state.

$ mv latest-state.json genesis-state.json