Skip to content

Commit 31d7747

Browse files
fix: resolve wormhole contract compilation and dependency issues for stylus 0.9.0
- Update import statements to use prelude::* for automatic trait imports - Add lib crate-type to enable use as dependency in tests - Add no_std configuration to main.rs - Remove conflicting panic handler configuration - Fix dependency resolution between wormhole-contract and pyth-receiver tests All tests now pass with stylus-sdk 0.9.0 compatibility Co-Authored-By: [email protected] <[email protected]>
1 parent 1b62ed1 commit 31d7747

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

target_chains/stylus/contracts/wormhole/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@ motsu.workspace = true
2727
base64 = "0.21"
2828

2929
[lib]
30+
name = "wormhole_contract"
3031
crate-type = ["lib", "cdylib"]
32+
33+
[[bin]]
34+
name = "wormhole-contract"
35+
path = "src/main.rs"
36+
required-features = ["export-abi"]

target_chains/stylus/contracts/wormhole/src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@ extern crate alloc;
55
#[global_allocator]
66
static ALLOC: mini_alloc::MiniAlloc = mini_alloc::MiniAlloc::INIT;
77

8-
#[cfg(all(not(any(feature = "std", feature = "export-abi")), feature = "main"))]
9-
#[panic_handler]
10-
fn panic(_info: &core::panic::PanicInfo) -> ! {
11-
loop {}
12-
}
138

149
mod types;
1510
use types::{GuardianSet, GuardianSignature, VerifiedVM, WormholeError};
1611

1712
use alloc::{vec, vec::Vec};
1813
use stylus_sdk::{
19-
prelude::{entrypoint, public, storage},
14+
prelude::*,
2015
storage::{StorageMap, StorageUint, StorageAddress, StorageBool},
2116
alloy_primitives::{Address, FixedBytes, U256, keccak256},
2217
};
@@ -413,4 +408,4 @@ impl IWormhole for WormholeContract {
413408
Err(WormholeError::InvalidVAAFormat)
414409
}
415410
}
416-
#[cfg(test)] mod tests;
411+
#[cfg(test)] mod tests;

target_chains/stylus/contracts/wormhole/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![cfg_attr(not(feature = "export-abi"), no_main)]
2+
#![cfg_attr(not(feature = "export-abi"), no_std)]
23

34
#[cfg(feature = "export-abi")]
45
fn main() {

0 commit comments

Comments
 (0)