Skip to content

Commit 39f2d25

Browse files
committed
Avoiding encode entryption key
1 parent 6f282c4 commit 39f2d25

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

common/types/message/message.go

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,29 @@ type BundleTaskDetail struct {
112112
BundleInfo *OpenVMBundleInfo `json:"bundle_info,omitempty"`
113113
}
114114

115+
type RawBytes []byte
116+
117+
func (r RawBytes) MarshalJSON() ([]byte, error) {
118+
if r == nil {
119+
return []byte("null"), nil
120+
}
121+
// Marshal the []byte as a JSON array of numbers
122+
rn := make([]uint16, len(r))
123+
for i := range r {
124+
rn[i] = uint16(r[i])
125+
}
126+
return json.Marshal(rn)
127+
}
128+
115129
// ChunkInfo is for calculating pi_hash for chunk
116130
type ChunkInfo struct {
117-
ChainID uint64 `json:"chain_id"`
118-
PrevStateRoot common.Hash `json:"prev_state_root"`
119-
PostStateRoot common.Hash `json:"post_state_root"`
120-
WithdrawRoot common.Hash `json:"withdraw_root"`
121-
DataHash common.Hash `json:"data_hash"`
122-
IsPadding bool `json:"is_padding"`
123-
TxBytes []byte `json:"tx_bytes"`
131+
ChainID uint64 `json:"chain_id"`
132+
PrevStateRoot common.Hash `json:"prev_state_root"`
133+
PostStateRoot common.Hash `json:"post_state_root"`
134+
WithdrawRoot common.Hash `json:"withdraw_root"`
135+
DataHash common.Hash `json:"data_hash"`
136+
IsPadding bool `json:"is_padding"`
137+
// TxBytes []byte `json:"tx_bytes"`
124138
TxBytesHash common.Hash `json:"tx_data_digest"`
125139
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
126140
PostMsgQueueHash common.Hash `json:"post_msg_queue_hash"`
@@ -129,7 +143,7 @@ type ChunkInfo struct {
129143
BlockCtxs []BlockContextV2 `json:"block_ctxs"`
130144
PrevBlockhash common.Hash `json:"prev_blockhash"`
131145
PostBlockhash common.Hash `json:"post_blockhash"`
132-
EncryptionKey []byte `json:"encryption_key"`
146+
EncryptionKey RawBytes `json:"encryption_key"`
133147
}
134148

135149
// BlockContextV2 is the block context for euclid v2
@@ -192,7 +206,7 @@ type OpenVMBatchInfo struct {
192206
ChainID uint64 `json:"chain_id"`
193207
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
194208
PostMsgQueueHash common.Hash `json:"post_msg_queue_hash"`
195-
EncryptionKey []byte `json:"encryption_key"`
209+
EncryptionKey RawBytes `json:"encryption_key"`
196210
}
197211

198212
// BatchProof includes the proof info that are required for batch verification and rollup.
@@ -253,7 +267,7 @@ type OpenVMBundleInfo struct {
253267
PrevBatchHash common.Hash `json:"prev_batch_hash"`
254268
BatchHash common.Hash `json:"batch_hash"`
255269
MsgQueueHash common.Hash `json:"msg_queue_hash"`
256-
EncryptionKey []byte `json:"encryption_key"`
270+
EncryptionKey RawBytes `json:"encryption_key"`
257271
}
258272

259273
// OpenVMBundleProof includes the proof info that are required for verification of a bundle of batch proofs.

0 commit comments

Comments
 (0)