From 5e0ee73b958becaed02d7252f8b4905c862347dc Mon Sep 17 00:00:00 2001 From: Rachel Franks Date: Fri, 22 Jul 2022 14:48:57 -0500 Subject: [PATCH] fix oldstyle bitflip --- arbstate/inbox.go | 3 ++- das/dastree/dastree.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arbstate/inbox.go b/arbstate/inbox.go index 14faeea191..6adb84c58d 100644 --- a/arbstate/inbox.go +++ b/arbstate/inbox.go @@ -213,8 +213,9 @@ func RecoverPayloadFromDasBatch( if preimages != nil { if version == 0 { + treeLeaf := dastree.FlatHashToTreeLeaf(dataHash) preimages[dataHash] = payload - preimages[dastree.FlatHashToTreeHash(dataHash)] = dastree.FlatHashToTreeLeaf(dataHash) + preimages[crypto.Keccak256Hash(treeLeaf)] = treeLeaf } else { dastree.RecordHash(recordPreimage, payload) } diff --git a/das/dastree/dastree.go b/das/dastree/dastree.go index 9803d45a9f..d23eb230b2 100644 --- a/das/dastree/dastree.go +++ b/das/dastree/dastree.go @@ -101,7 +101,7 @@ func HashBytes(preimage ...[]byte) []byte { func FlatHashToTreeHash(flat bytes32) bytes32 { // Forms a degenerate dastree that's just a single leaf // note: the inner preimage may be larger than the 64 kB standard - return arbmath.FlipBit(crypto.Keccak256Hash(append([]byte{LeafByte}, flat[:]...)), 0) + return arbmath.FlipBit(crypto.Keccak256Hash(FlatHashToTreeLeaf(flat)), 0) } func FlatHashToTreeLeaf(flat bytes32) []byte {