ccc icon indicating copy to clipboard operation
ccc copied to clipboard

feat(core): CKB_TX_MESSAGE_ALL

Open XuJiandong opened this issue 8 months ago • 3 comments

described in: https://github.com/nervosnetwork/rfcs/pull/446

XuJiandong avatar May 07 '25 08:05 XuJiandong

🦋 Changeset detected

Latest commit: 396dbb442891c0e62857c38265096837f9183995

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
Name Type
@ckb-ccc/core Patch
@ckb-ccc/eip6963 Patch
@ckb-ccc/joy-id Patch
@ckb-ccc/lumos-patches Patch
@ckb-ccc/nip07 Patch
@ckb-ccc/okx Patch
@ckb-ccc/rei Patch
@ckb-ccc/shell Patch
@ckb-ccc/spore Patch
@ckb-ccc/ssri Patch
@ckb-ccc/udt Patch
@ckb-ccc/uni-sat Patch
@ckb-ccc/utxo-global Patch
@ckb-ccc/xverse Patch
@ckb-ccc/ccc Patch
ckb-ccc Patch
@ckb-ccc/connector Patch
@ckb-ccc/examples Patch
@ckb-ccc/ccc-playground Patch
@ckb-ccc/connector-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar May 07 '25 08:05 changeset-bot[bot]

integration tests: https://github.com/xxuejie/ckb-tx-message-all-test-vector-utils/pull/2

XuJiandong avatar May 08 '25 01:05 XuJiandong

I noticed that the logic of hashBytes[Opt]ToHasher can actually be replaced by mol.Bytes[Opt]. I suggest using mol.Bytes[Opt].encode directly to save some code here.

According to the RFC:

The length of the witness field, packed in little-endian encoded unsigned 32-bit integer. The full witness field, or the full content returned by Load Witness syscall, given the correct index and source

The hashBytesToHasher function follows the RFC mentioned above(Although It uses the same encoding as Molecule bytes, it doesn't mention molecule encoding). I believe this version is much cleaner and easier to understand.

The hashBytesOptToHasher function adds an extra header, based on BytesOpt encoding. When BytesOpt is none, it results in zero bytes, so we include an extra header to differentiate it. Here, I've added a molecule encode, according to the RFC.

XuJiandong avatar May 13 '25 01:05 XuJiandong