[go: up one dir, main page]

Kernel SDK: add whitelist update case to outbox message encoding

Context

Updates the encoding for outbox messages from the kernel SDK following the merging of !9412 (merged).

Manually testing the MR

cd src/kernel_sdk/ && make test

Toy rollup

use tezos_data_encoding::enc::BinWriter;
use tezos_smart_rollup::{
    kernel_entry, michelson::MichelsonBytes, outbox::OutboxMessage, prelude::Runtime,
    types::PublicKeyHash,
};

fn write_outbox_message(host: &mut impl Runtime, whitelist_update: Vec<PublicKeyHash>) {
    let update = Some(whitelist_update).try_into().unwrap();
    let message: OutboxMessage<MichelsonBytes> = OutboxMessage::WhitelistUpdate(update);
    let mut output = Vec::default();
    message.bin_write(&mut output).unwrap();
    host.write_output(&output).unwrap();
}

pub fn entry(host: &mut impl Runtime) {
    let whitelist: Vec<PublicKeyHash> = vec![
        PublicKeyHash::from_b58check("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx").unwrap(),
        PublicKeyHash::from_b58check("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN").unwrap(),
    ];
    write_outbox_message(host, whitelist);
}

kernel_entry!(entry);

inputs.json:

[
  [
    {
      "external":
      "0000000023030b01d1a37c088a1221b636bb5fccb35e05181038ba7c000000000764656661756c74"
    }
  ]
]
$ export TZWITTER_L1_CONTRACT="KT1..."
$ cargo build --release --target wasm32-unknown-unknown
$ ./path/to/octez-smart-rollup-wasm-debugger --kernel target/wasm32-unknown-unknown/release/outbox_kernel_whitelist.wasm --inputs inputs.json 
> step inbox
Loaded 1 inputs at level 0
Evaluation took 11000000000 ticks so far
Status: Waiting for input
Internal_status: Collect
> show outbox at level 0
Outbox has 1 messages:

tz1KqTpEZ7Yob
tz1gjaF81ZRRv
> 

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Julien Coolen

Merge request reports

Loading