TicketUpgrade

A simple strategy to upgrade your smart rollup is the "byte ticket strategy".

The idea is simple:

  • split your kernel into chunks
  • send the root hash to a smart contract
  • this smart contract sends a byte ticket representing the root hash to your rollup
  • your rollup proceed to the upgrade

Requirement

  • Your rollup should have the type byte ticket
  • Your rollup should be deployed with the TicketUpgrade service
  • Deploying a smart contract on L1 that acts as a proxy

Deploy a smart contract

TODO: provide a minimal example:

Here is the minimal specification of the smart contract:

  • one entrypoint that accepts bytes
  • check the signature of the sender (you can also check the authencity of the bytes with a multisig or what you prefer)
  • mint a byte ticket, the content of the bytes is the input of the entrypoint
  • send the byte ticket to your rollup address

How to install the service

Let's say you have your application, if you want to add the service, the only things you have to do is the following:

extern crate rock_n_rollup;
use rock_n_rollup::core::{Runtime, Application};
use rock_n_rollup::services::ticket_upgrade::TicketUpgrade;

#[rock_n_rollup::main]
fn kernel_entry<R: Runtime>(application: &mut Application<R>) {
    application
        .service(TicketUpgrade::new("KT1...")) // Put the address of your L1 contract
        .run()
}
fn main(){}

Then when your kernel will receive a root hash from this contract, it will proceed to the installation of your new kernel.

Split your kernel

As you did to originate your kernel, you will have to split your new kernel with the tezos-smart-rollup-installer.

$ smart-rollup-installer get-reveal-installer --upgrade-to my_kernel.wasm --output installer.hex --preimages-dir wasm_2_0_0

Place the generated chunks in the good folder.

Then you need to retrieve the root hash:

$ cat installer.hex | tail -c 33

You can send the resulting output directly to your smart contract and your kernel will be upgraded!!