6 releases

0.3.0 Oct 11, 2023
0.2.0 Sep 13, 2023
0.1.3 Sep 11, 2023
0.1.0 Aug 30, 2023

#18 in #memory-region

Download history 5/week @ 2024-01-08 33/week @ 2024-01-15 19/week @ 2024-01-22 124/week @ 2024-01-29 126/week @ 2024-02-05 245/week @ 2024-02-12 313/week @ 2024-02-19 205/week @ 2024-02-26 44/week @ 2024-03-04 37/week @ 2024-03-11 35/week @ 2024-03-18 20/week @ 2024-03-25 27/week @ 2024-04-01 2/week @ 2024-04-08 12/week @ 2024-04-15 7/week @ 2024-04-22

51 downloads per month
Used in 2 crates (via piecrust)

MPL-2.0 license

31KB
544 lines

π-crust

Repository Build Status Documentation

piecrust is a Rust workspace containing two crates, piecrust and piecrust-uplink, that together form the WASM virtual machine for running, handling and creating Dusk smart contracts.

Workspace Members

  • piecrust: WASM virtual machine for running Dusk's smart contracts.
  • piecrust-uplink: The library that allows you to create smart contracts directly on top of piecrust.

Project Structure

The project is organized as follows:

  • contracts: Contains a number of example smart contracts that can be ran against the piecrust virtual machine.
  • piecrust: Contains the source code and README for the WASM virtual machine.
  • piecrust-uplink: Contains the source code and README for the smart contract development kit.

Build and Test

To build and test the crate one will need a Rust toolchain, Make, and the wasm-tools binary.

sudo apt install -y make # ubuntu/debian - adapt to own system
cargo install wasm-tools
make test

Release History

To see the release history for this project, please see the Changelogs of each individual workspace member.

License

This code is licensed under the Mozilla Public License Version 2.0 (MPL-2.0). Please see the LICENSE for further details.

Contribute

If you want to contribute to this project, please check the CONTRIBUTING file.


lib.rs:

Library for creating and managing copy-on-write memory-mapped regions.

The core functionality is offered by the Mmap struct, which is a read-write memory region that keeps track of which pages have been written to.

Example

use crumbles::Mmap;

let mut mmap = Mmap::new(65536, 65536)?;

// When first created, the mmap is not dirty.
assert_eq!(mmap.dirty_pages().count(), 0);

mmap[24] = 42;
// After writing a single byte, the page it's on is dirty.
assert_eq!(mmap.dirty_pages().count(), 1);

Limitations

This crate currently only builds for 64-bit Unix targets. This is because it relies on various features of libc which are not available in other targets.

Dependencies

~260KB