Skip to content

Commit 0c9f423

Browse files
chore: remove openvm::entry!(main) from examples (#2105)
Also I added `use openvm` just in case because we say: > If you write a program that only imports openvm in Cargo.toml but does not import it anywhere in your crate, the Rust linker may optimize away the dependency, which will cause a compile error. To fix this, you may need to explicitly import the openvm crate in your code. --------- Co-authored-by: Jonathan Wang <[email protected]>
1 parent 21d3f5e commit 0c9f423

File tree

7 files changed

+7
-14
lines changed

7 files changed

+7
-14
lines changed

examples/algebra/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
extern crate alloc;
22

3+
use openvm as _;
34
use openvm_algebra_guest::{moduli_macros::*, IntMod};
45

56
// This macro will create two structs, `Mod1` and `Mod2`,

examples/ecc/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// [!region imports]
22
use hex_literal::hex;
3+
use openvm as _;
34
use openvm_algebra_guest::IntMod;
45
use openvm_ecc_guest::weierstrass::WeierstrassPoint;
56
use openvm_k256::{Secp256k1Coord, Secp256k1Point};

examples/i256/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#![allow(clippy::needless_range_loop)]
2-
openvm::entry!(main);
32

43
use core::array;
54

65
use alloy_primitives::I256;
7-
8-
openvm::entry!(main);
6+
use openvm as _;
97

108
const N: usize = 16;
119
type Matrix = [[I256; N]; N];

examples/keccak/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
openvm::entry!(main);
2-
31
// [!region imports]
42
use core::hint::black_box;
53

64
use hex::FromHex;
5+
use openvm as _;
76
use openvm_keccak256::keccak256;
87
// [!endregion imports]
98

109
// [!region main]
11-
openvm::entry!(main);
12-
1310
pub fn main() {
1411
let test_vectors = [
1512
(

examples/pairing/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
use hex_literal::hex;
33
// [!endregion pre]
44
// [!region imports]
5+
use openvm as _;
56
use openvm_algebra_guest::{field::FieldExtension, IntMod};
67
use openvm_ecc_guest::AffinePoint;
78
use openvm_pairing::{

examples/sha256/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
openvm::entry!(main);
2-
31
// [!region imports]
42
use core::hint::black_box;
53

64
use hex::FromHex;
5+
use openvm as _;
76
use openvm_sha2::sha256;
87
// [!endregion imports]
98

109
// [!region main]
11-
openvm::entry!(main);
12-
1310
pub fn main() {
1411
let test_vectors = [(
1512
"",

examples/u256/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#![allow(clippy::needless_range_loop)]
2-
openvm::entry!(main);
32

43
use core::array;
54

5+
use openvm as _;
66
use openvm_ruint::aliases::U256;
77

8-
openvm::entry!(main);
9-
108
const N: usize = 16;
119
type Matrix = [[U256; N]; N];
1210

0 commit comments

Comments
 (0)