Skip to content

Commit

Permalink
fix (#1082)
Browse files Browse the repository at this point in the history
  • Loading branch information
arayikhalatyan authored Dec 16, 2024
1 parent bcc5c42 commit 11632d3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 13 additions & 1 deletion book/src/custom-extensions/bigint.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ pub fn main() {
}
```

To be able to import the `U256` struct, add the following to your `Cargo.toml` file:

```toml
openvm-bigint-guest = { git = "https://github.com/openvm-org/openvm.git" }
```

## `I256`

The `I256` struct is a 256-bit signed integer type. The `I256` struct is very similar to the `U256` struct.
Expand Down Expand Up @@ -150,6 +156,12 @@ pub fn main() {
}
```

To be able to import the `I256` struct, add the following to your `Cargo.toml` file:

```toml
openvm-bigint-guest = { git = "https://github.com/openvm-org/openvm.git" }
```

## External Functions

The Bigint Guest extension provides another way to use the native implementation. It provides external functions that are meant to be linked to other external libraries. The external libraries can use these functions as a hook for the 256 bit integer native implementations. Enabled only when the `target_os = "zkvm"`. All of the functions are defined as `unsafe extern "C" fn`. Also, note that you must enable the feature `export-intrinsics` to make them globally linkable.
Expand Down Expand Up @@ -194,4 +206,4 @@ For the guest program to build successfully add the following to your `.toml` fi

```toml
[app_vm_config.bigint]
```
```
8 changes: 7 additions & 1 deletion book/src/custom-extensions/keccak.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ pub fn main() {
}
```

To be able to import the `keccak256` function, add the following to your `Cargo.toml` file:

```toml
openvm-keccak256-guest = { git = "https://github.com/openvm-org/openvm.git" }
```

## Native Keccak256

Keccak guest extension also provides another way to use the native Keccak-256 implementation. It provides a function that is meant to be linked to other external libraries. The external libraries can use this function as a hook for the Keccak-256 native implementation. Enabled only when the target is `zkvm`.
Expand Down Expand Up @@ -65,4 +71,4 @@ For the guest program to build successfully add the following to your `.toml` fi

```toml
[app_vm_config.keccak256]
```
```

0 comments on commit 11632d3

Please sign in to comment.