-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add consume fuel to config * add fuel * increase add fuel * quick fix * added Config for Runtime * add infinite loop example * add error * infinite loop test * update infinite loop * rename * fix tests * clarified new fuel error variant * updated readme, cleanup --------- Co-authored-by: jakehemmerle <[email protected]>
- Loading branch information
1 parent
60ef356
commit 0db40ea
Showing
6 changed files
with
126 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[package] | ||
name = "infinite-loop" | ||
version = "0.1.0" | ||
authors = ["Entropy Cryptography <[email protected]>"] | ||
homepage = "https://entropy.xyz/" | ||
license = "Unlicense" | ||
repository = "https://github.com/entropyxyz/constraints" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
# This is required to compile constraints to a wasm module | ||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
ec-core = { workspace = true } | ||
|
||
# These are used by `cargo component` | ||
[package.metadata.component] | ||
package = "entropy:infinite-loop" | ||
|
||
[package.metadata.component.target] | ||
path = "../../wit" | ||
|
||
[package.metadata.component.dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#![no_std] | ||
|
||
extern crate alloc; | ||
use alloc::vec::Vec; | ||
use ec_core::{bindgen::Error, bindgen::*, export_program, prelude::*}; | ||
|
||
// TODO confirm this isn't an issue for audit | ||
register_custom_getrandom!(always_fail); | ||
|
||
pub struct InfiniteLoop; | ||
|
||
impl Program for InfiniteLoop { | ||
/// This is the only function required by the program runtime. `message` is the preimage of the curve element to be | ||
/// signed, eg. RLP-serialized Ethereum transaction request, raw x86_64 executable, etc. | ||
fn evaluate(_signature_request: SignatureRequest) -> Result<(), Error> { | ||
loop {} | ||
#[allow(unreachable_code)] | ||
Ok(()) | ||
} | ||
|
||
/// Since we don't use a custom hash function, we can just return `None` here. | ||
fn custom_hash(_data: Vec<u8>) -> Option<Vec<u8>> { | ||
None | ||
} | ||
} | ||
|
||
export_program!(InfiniteLoop); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters