Skip to content

Commit 4233b6a

Browse files
committed
feat: allow blobs, buckets to process metadata/recovery hash
1 parent 8fca9fe commit 4233b6a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/util/LibBlob.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ library LibBlob {
300300
encoded[1] = params.source.encodeCborBlobHashOrNodeId();
301301
encoded[2] = params.blobHash.encodeCborBlobHashOrNodeId();
302302
// TODO: this value is currently hardcoded, but it'll eventually use the same method above
303-
encoded[3] = hex"0000000000000000000000000000000000000000000000000000000000000000".encodeCborFixedArray();
303+
encoded[3] = bytes(params.metadataHash).length == 0
304+
? hex"0000000000000000000000000000000000000000000000000000000000000000".encodeCborFixedArray()
305+
: params.metadataHash.encodeCborBlobHashOrNodeId();
304306
encoded[4] = encodeSubscriptionId(params.subscriptionId);
305307
encoded[5] = params.size.encodeCborUint64();
306308
encoded[6] = params.ttl == 0 ? LibWasm.encodeCborNull() : params.ttl.encodeCborUint64();

src/util/LibBucket.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ library LibBucket {
145145
encoded[2] = params.blobHash.encodeCborBlobHashOrNodeId();
146146
// TODO: this currently is hardcoded to a 32 byte array of all zeros, but should use the method above
147147
// Once https://github.com/hokunet/ipc/issues/300 is merged, this'll need to change
148-
encoded[3] = hex"0000000000000000000000000000000000000000000000000000000000000000".encodeCborFixedArray();
148+
encoded[3] = bytes(params.recoveryHash).length == 0
149+
? hex"0000000000000000000000000000000000000000000000000000000000000000".encodeCborFixedArray()
150+
: params.recoveryHash.encodeCborBlobHashOrNodeId();
149151
encoded[4] = params.size.encodeCborUint64();
150152
encoded[5] = params.ttl == 0 ? LibWasm.encodeCborNull() : params.ttl.encodeCborUint64();
151153
encoded[6] = params.metadata.encodeCborKeyValueMap();

0 commit comments

Comments
 (0)