diff --git a/ci/docker-rust/Dockerfile b/ci/docker-rust/Dockerfile index 095616c11a..ca82879cce 100644 --- a/ci/docker-rust/Dockerfile +++ b/ci/docker-rust/Dockerfile @@ -29,9 +29,10 @@ RUN set -x \ && rustup component add rustfmt \ && rustup component add clippy \ && cargo install cargo-audit \ - && cargo install svgbob_cli \ && cargo install mdbook \ && cargo install mdbook-linkcheck \ + && cargo install svgbob_cli \ + && cargo install wasm-pack \ && rustc --version \ && cargo --version \ && curl -OL https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP \ diff --git a/crate-features/Cargo.toml b/crate-features/Cargo.toml index b83c578752..f9c177c7a1 100644 --- a/crate-features/Cargo.toml +++ b/crate-features/Cargo.toml @@ -19,13 +19,16 @@ lazy_static = { version = "1.4.0", features = ["spin", "spin_no_std"] } libc = { version = "0.2.62", features = ["extra_traits"] } rand_chacha = { version = "0.2.2" } regex-syntax = { version = "0.6.12" } -reqwest = { version = "0.11.2", default-features = false, features = ["blocking", "rustls-tls", "json"] } -ring = { version = "0.16.17" } serde = { version = "1.0.100", features = ["rc"] } ed25519-dalek = { version = "=1.0.1", features = ["serde"] } syn_0_15 = { package = "syn", version = "0.15.42", features = ["extra-traits", "fold", "full"] } syn_1_0 = { package = "syn", version = "1.0.3", features = ["extra-traits", "fold", "full"] } winapi = { version = "0.3.8", features=["basetsd", "consoleapi", "errhandlingapi", "fileapi", "handleapi", "impl-debug", "impl-default", "knownfolders", "libloaderapi", "memoryapi", "minwinbase", "minwindef", "ntdef", "ntsecapi", "ntstatus", "objbase", "processenv", "processthreadsapi", "profileapi", "shlobj", "std", "synchapi", "sysinfoapi", "timezoneapi", "utilapiset", "winbase", "wincon", "windef", "winerror", "winnls", "winnt", "winreg", "winsock2", "winuser", "ws2def", "ws2ipdef", "ws2tcpip", "wtypesbase"] } + +[target.'cfg(not(target_family = "wasm"))'.dependencies] +reqwest = { version = "0.11.2", default-features = false, features = ["blocking", "rustls-tls", "json"] } +ring = { version = "0.16.17" } + [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/programs/bpf/rust/custom_heap/src/lib.rs b/programs/bpf/rust/custom_heap/src/lib.rs index fc3ec780f5..605afcbddb 100644 --- a/programs/bpf/rust/custom_heap/src/lib.rs +++ b/programs/bpf/rust/custom_heap/src/lib.rs @@ -26,8 +26,8 @@ unsafe impl std::alloc::GlobalAlloc for BumpAllocator { 0x42 as *mut u8 } else { const POS_PTR: *mut usize = HEAP_START_ADDRESS as *mut usize; - const TOP_ADDRESS: usize = HEAP_START_ADDRESS + HEAP_LENGTH; - const BOTTOM_ADDRESS: usize = HEAP_START_ADDRESS + size_of::<*mut u8>(); + const TOP_ADDRESS: usize = HEAP_START_ADDRESS as usize + HEAP_LENGTH; + const BOTTOM_ADDRESS: usize = HEAP_START_ADDRESS as usize + size_of::<*mut u8>(); let mut pos = *POS_PTR; if pos == 0 { diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 7ca1ce72b5..40ae36e1f7 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -90,3 +90,6 @@ rustc_version = "0.4" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lib] +crate-type = ["cdylib", "rlib"] diff --git a/sdk/program/Cargo.toml b/sdk/program/Cargo.toml index 3143445a8f..5da12d89c5 100644 --- a/sdk/program/Cargo.toml +++ b/sdk/program/Cargo.toml @@ -55,3 +55,6 @@ rustc_version = "0.4" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lib] +crate-type = ["cdylib", "rlib"] diff --git a/sdk/program/src/entrypoint.rs b/sdk/program/src/entrypoint.rs index 8a17cf696d..df34b35844 100644 --- a/sdk/program/src/entrypoint.rs +++ b/sdk/program/src/entrypoint.rs @@ -28,7 +28,7 @@ pub type ProcessInstruction = pub const SUCCESS: u64 = 0; /// Start address of the memory region used for program heap. -pub const HEAP_START_ADDRESS: usize = 0x300000000; +pub const HEAP_START_ADDRESS: u64 = 0x300000000; /// Length of the heap memory region used for program heap. pub const HEAP_LENGTH: usize = 32 * 1024; @@ -70,7 +70,7 @@ macro_rules! custom_heap_default { #[cfg(all(not(feature = "custom-heap"), target_arch = "bpf"))] #[global_allocator] static A: $crate::entrypoint::BumpAllocator = $crate::entrypoint::BumpAllocator { - start: $crate::entrypoint::HEAP_START_ADDRESS, + start: $crate::entrypoint::HEAP_START_ADDRESS as usize, len: $crate::entrypoint::HEAP_LENGTH, }; };