Skip to content

Commit 751c01a

Browse files
committed
wip
1 parent a1f9ccd commit 751c01a

File tree

9 files changed

+28
-3
lines changed

9 files changed

+28
-3
lines changed

contracts/subsidies/sources/subsidies.move

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ public fun register_blob(
330330
root_hash: u256,
331331
size: u64,
332332
encoding_type: u8,
333+
chunk_size: u64,
333334
deletable: bool,
334335
write_payment: &mut Coin<WAL>,
335336
ctx: &mut TxContext,
@@ -341,6 +342,7 @@ public fun register_blob(
341342
root_hash,
342343
size,
343344
encoding_type,
345+
chunk_size,
344346
deletable,
345347
write_payment,
346348
ctx,

contracts/subsidies/tests/subsidies_tests.move

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ fun register_default_blob(
636636
ROOT_HASH,
637637
UNENCODED_SIZE,
638638
RS2,
639+
0, // chunk_size: 0 for RS2 encoding (non-chunked)
639640
deletable,
640641
&mut fake_coin,
641642
ctx,

contracts/walrus/sources/system/redstuff.move

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ fun test_chunked_encoding_single_chunk() {
208208

209209
#[test]
210210
fun test_compute_num_chunks() {
211-
let chunk_size = DEFAULT_CHUNK_SIZE;
211+
// 10 MB default chunk size (same as Rust DEFAULT_CHUNK_SIZE)
212+
let chunk_size = 10 * 1024 * 1024;
212213
// Small blob: 1 chunk
213214
assert_eq!(compute_num_chunks(1000, chunk_size), 1);
214215

crates/walrus-sui/benches/gas_cost_bench.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ fn prepare_blob_metadata() -> BlobObjectMetadata {
290290
unencoded_size: size,
291291
encoded_size: resource_size,
292292
encoding_type,
293+
chunk_size: 0, // RS2 blobs don't use chunks
293294
}
294295
}
295296

crates/walrus-sui/src/client.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ pub struct BlobObjectMetadata {
286286
pub encoded_size: u64,
287287
/// The encoding type of the blob.
288288
pub encoding_type: EncodingType,
289+
/// The chunk size for chunked blobs (0 for non-chunked blobs).
290+
pub chunk_size: u64,
289291
}
290292

291293
impl<const V: bool> TryFrom<&BlobMetadataWithId<V>> for BlobObjectMetadata {
@@ -296,12 +298,20 @@ impl<const V: bool> TryFrom<&BlobMetadataWithId<V>> for BlobObjectMetadata {
296298
.metadata()
297299
.encoded_size()
298300
.context("cannot compute encoded size")?;
301+
302+
// Extract chunk_size from metadata (0 for non-chunked blobs)
303+
let chunk_size = match metadata.metadata() {
304+
walrus_core::metadata::BlobMetadata::V2(v2) => v2.chunk_size,
305+
_ => 0, // RS2 blobs don't have chunk_size
306+
};
307+
299308
Ok(Self {
300309
blob_id: *metadata.blob_id(),
301310
root_hash: metadata.metadata().compute_root_hash(),
302311
unencoded_size: metadata.metadata().unencoded_length(),
303312
encoded_size,
304313
encoding_type: metadata.metadata().encoding_type(),
314+
chunk_size,
305315
})
306316
}
307317
}

crates/walrus-sui/src/client/transaction_builder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ impl WalrusPtbBuilder {
351351
self.pt_builder.pure(blob_metadata.unencoded_size)?,
352352
self.pt_builder
353353
.pure(u8::from(blob_metadata.encoding_type))?,
354+
self.pt_builder.pure(blob_metadata.chunk_size)?,
354355
self.pt_builder.pure(persistence.is_deletable())?,
355356
self.wal_coin_arg()?,
356357
];
@@ -389,6 +390,7 @@ impl WalrusPtbBuilder {
389390
self.pt_builder.pure(blob_metadata.unencoded_size)?,
390391
self.pt_builder
391392
.pure(u8::from(blob_metadata.encoding_type))?,
393+
self.pt_builder.pure(blob_metadata.chunk_size)?,
392394
self.pt_builder.pure(persistence.is_deletable())?,
393395
self.wal_coin_arg()?,
394396
];

crates/walrus-sui/src/system_setup.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ fn compile_package_inner_blocking(
101101
build_config: MoveBuildConfig,
102102
chain_id: Option<String>,
103103
) -> Result<(CompiledPackage, MoveBuildConfig)> {
104+
tracing::info!(
105+
?package_path,
106+
?build_config,
107+
chain_id,
108+
"Compiling Walrus package"
109+
);
104110
let build_config = resolve_lock_file_path(build_config, &package_path)?;
105111

106112
// Set the package ID to zero.
@@ -116,7 +122,7 @@ fn compile_package_inner_blocking(
116122
};
117123

118124
let run_bytecode_verifier = true;
119-
let print_diags_to_stderr = false;
125+
let print_diags_to_stderr = true;
120126
let config = BuildConfig {
121127
config: build_config.clone(),
122128
run_bytecode_verifier,

crates/walrus-sui/tests/test_walrus_sui.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ async fn test_register_certify_blob() -> anyhow::Result<()> {
165165
unencoded_size: size,
166166
encoded_size: resource_size,
167167
encoding_type,
168+
chunk_size: 0, // RS2 blobs don't use chunks
168169
};
169170

170171
let blob_obj = walrus_client
@@ -256,6 +257,7 @@ async fn test_register_certify_blob() -> anyhow::Result<()> {
256257
unencoded_size: size,
257258
encoded_size: resource_size,
258259
encoding_type,
260+
chunk_size: 0, // RS2 blobs don't use chunks
259261
};
260262

261263
let blob_obj = walrus_client

scripts/local-testbed.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ usage() {
4545
}
4646

4747
run_node() {
48-
cmd="./target/release/walrus-node run --config-path $working_dir/$1.yaml ${2:-} \
48+
cmd="RUST_LOG=debug ./target/release/walrus-node run --config-path $working_dir/$1.yaml ${2:-} \
4949
|& tee $working_dir/$1.log"
5050
echo "Running within tmux: '$cmd'..."
5151
tmux new -d -s "$1" "$cmd"

0 commit comments

Comments
 (0)