Skip to content

Commit ee572bb

Browse files
quantumquantum
authored andcommitted
fix
1 parent a275490 commit ee572bb

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

packages/rs-sdk/src/sdk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::mock::MockResponse;
77
use crate::mock::{provider::GrpcContextProvider, MockDashPlatformSdk};
88
use crate::platform::transition::put_settings::PutSettings;
99
use crate::platform::{Fetch, Identifier};
10-
use arc_swap::{ArcSwapAny, ArcSwapOption};
10+
use arc_swap::ArcSwapOption;
1111
use dapi_grpc::mock::Mockable;
1212
use dapi_grpc::platform::v0::{Proof, ResponseMetadata};
1313
#[cfg(not(target_arch = "wasm32"))]
@@ -1117,7 +1117,7 @@ impl SdkBuilder {
11171117
dump_dir: self.dump_dir.clone(),
11181118
proofs:self.proofs,
11191119
internal_cache: Default::default(),
1120-
context_provider:ArcSwapAny::new( Some(Arc::new(context_provider))),
1120+
context_provider: ArcSwapOption::new(Some(Arc::new(context_provider))),
11211121
cancel_token: self.cancel_token,
11221122
metadata_last_seen_height: Arc::new(atomic::AtomicU64::new(0)),
11231123
metadata_height_tolerance: self.metadata_height_tolerance,

packages/rs-sdk/src/sync.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ where
9595
}
9696

9797
/// Worker function that runs the provided future and sends the result back to the caller using oneshot channel.
98+
#[cfg(not(target_arch = "wasm32"))]
9899
async fn worker<F: Future>(
99100
fut: F,
100101
// response: oneshot::Sender<F::Output>,

packages/scripts/build-wasm.sh

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,29 @@ USE_WASM_PACK=false
2626
while [[ $# -gt 0 ]]; do
2727
case $1 in
2828
-p|--package)
29+
if [[ $# -lt 2 ]]; then
30+
echo "Error: Missing argument for $1"
31+
usage
32+
exit 1
33+
fi
2934
PACKAGE_NAME="$2"
3035
shift 2
3136
;;
3237
-t|--target)
38+
if [[ $# -lt 2 ]]; then
39+
echo "Error: Missing argument for $1"
40+
usage
41+
exit 1
42+
fi
3343
TARGET_TYPE="$2"
3444
shift 2
3545
;;
3646
-o|--opt-level)
47+
if [[ $# -lt 2 ]]; then
48+
echo "Error: Missing argument for $1"
49+
usage
50+
exit 1
51+
fi
3752
OPT_LEVEL="$2"
3853
shift 2
3954
;;
@@ -139,41 +154,40 @@ if [ "$OPT_LEVEL" != "none" ] && command -v wasm-opt &> /dev/null; then
139154
# Check wasm-opt version to determine available options
140155
WASM_OPT_VERSION=$(wasm-opt --version 2>/dev/null || echo "")
141156

142-
# Base optimization flags that work with all versions
143-
BASE_FLAGS=(
144-
--code-folding
145-
--const-hoisting
146-
--dce
157+
# Core optimization flags that should work with most versions
158+
CORE_FLAGS=(
147159
--strip-producers
148160
-Oz
149161
--enable-bulk-memory
150162
--enable-nontrapping-float-to-int
151-
-tnh
152163
--flatten
153164
--rereloop
154165
-Oz
155166
--converge
156167
--vacuum
157-
--dce
158-
--gsi
159-
--inlining-optimizing
160168
--merge-blocks
161169
--simplify-locals
162-
--optimize-added-constants
163-
--optimize-casts
164-
--optimize-instructions
165-
--optimize-stack-ir
166170
--remove-unused-brs
167171
--remove-unused-module-elements
168172
--remove-unused-names
169-
--remove-unused-types
170-
--post-emscripten
171173
-Oz
172174
-Oz
173175
)
174176

175177
# Additional flags to test for compatibility
176178
OPTIONAL_FLAGS=(
179+
"--code-folding"
180+
"--const-hoisting"
181+
"--dce"
182+
"-tnh"
183+
"--gsi"
184+
"--inlining-optimizing"
185+
"--optimize-added-constants"
186+
"--optimize-casts"
187+
"--optimize-instructions"
188+
"--optimize-stack-ir"
189+
"--remove-unused-types"
190+
"--post-emscripten"
177191
"--generate-global-effects"
178192
"--abstract-type-refining"
179193
)
@@ -188,9 +202,9 @@ if [ "$OPT_LEVEL" != "none" ] && command -v wasm-opt &> /dev/null; then
188202
fi
189203
done
190204

191-
# Run optimization with base flags and any supported optional flags
205+
# Run optimization with core flags and any supported optional flags
192206
wasm-opt \
193-
"${BASE_FLAGS[@]}" \
207+
"${CORE_FLAGS[@]}" \
194208
"${SUPPORTED_FLAGS[@]}" \
195209
"$WASM_PATH" \
196210
-o \

0 commit comments

Comments
 (0)