chg: proof util receipt bytes fix
MODIFY
src/utils/proof_util.ts
src/utils/proof_util.ts
@@ -177,7 +177,7 @@ export class ProofUtil {
parentNodes: stack.map(s => s.raw),
root: ProofUtil.getRawHeader(block).receiptTrie,
path: rlp.encode(receipt.transactionIndex),
- value: rlp.decode(rawReceiptNode.value),
+ value: ProofUtil.isTypedReceipt(receipt) ? rawReceiptNode.value : rlp.decode(rawReceiptNode.value)
};
resolve(prf);
});
@@ -185,6 +185,10 @@ export class ProofUtil {
});
}
+ static isTypedReceipt(receipt) {
+ return receipt.status !== undefined && receipt.status !== null && receipt.type !== "0x0" && receipt.type !== "0x";
+ }
+
// getStateSyncTxHash returns block's tx hash for state-sync receipt
// Bor blockchain includes extra receipt/tx for state-sync logs,
// but it is not included in transactionRoot or receiptRoot.
@@ -219,8 +223,7 @@ export class ProofUtil {
];
}),
]);
- const hexType = Converter.toHex(receipt.type);
- if (receipt.status != null && hexType !== '0x0' && hexType !== '0x') {
+ if (ProofUtil.isTypedReceipt(receipt)) {
encodedData = Buffer.concat([ethUtils.toBuffer(receipt.type), encodedData]);
}
return encodedData;

chg: proof util receipt bytes fix