mirror of
https://github.com/eth-act/ere.git
synced 2026-04-03 03:00:17 -04:00
jolt: Guest program compilation with stock rust compiler. (#116)
This commit is contained in:
11
tests/jolt/stock_nightly_no_std/Cargo.toml
Normal file
11
tests/jolt/stock_nightly_no_std/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "addition_no_std"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
guest = []
|
||||
|
||||
[dependencies]
|
||||
jolt-sdk = { git = "https://github.com/a16z/jolt", rev = "55b9830a3944dde55d33a55c42522b81dd49f87a" }
|
||||
|
||||
[workspace]
|
||||
26
tests/jolt/stock_nightly_no_std/src/main.rs
Normal file
26
tests/jolt/stock_nightly_no_std/src/main.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
#![cfg_attr(feature = "guest", no_std)]
|
||||
#![no_main]
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use core::sync::atomic::Ordering;
|
||||
use core::sync::atomic::AtomicU16;
|
||||
use jolt_sdk as jolt;
|
||||
|
||||
#[jolt::provable]
|
||||
fn foo() {
|
||||
let a: AtomicU16 = core::hint::black_box(AtomicU16::new(5));
|
||||
let b: AtomicU16 = core::hint::black_box(AtomicU16::new(7));
|
||||
|
||||
if a.load(Ordering::SeqCst) + b.load(Ordering::SeqCst) != 12 {
|
||||
panic!("Something went wrong!");
|
||||
}
|
||||
|
||||
let mut v: Vec<AtomicU16> = Vec::new();
|
||||
v.push(AtomicU16::new(5));
|
||||
v.push(AtomicU16::new(7));
|
||||
|
||||
if v[0].load(Ordering::SeqCst) + v[1].load(Ordering::SeqCst) != 12 {
|
||||
panic!("Something went wrong!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user