Skip to content

Commit 5c981ef

Browse files
committed
Fix slot identity preimage
Identity preimages must be 52 bytes long (32 prefix + 20 address). The slot identity preimage did not follow this.
1 parent 39fd356 commit 5c981ef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rolling-shutter/keyperimpl/gnosis/newslot.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,12 @@ func transactionSubmittedEventToIdentityPreimage(
314314
}
315315

316316
func makeSlotIdentityPreimage(slot uint64) identitypreimage.IdentityPreimage {
317-
// 32 bytes of zeros plus the block number as big endian (ie starting with lots of zeros as well)
318-
// this ensures the block identity preimage is always alphanumerically before any transaction
319-
// identity preimages.
317+
// 32 bytes of zeros plus the block number as 20 byte big endian (ie starting with lots of
318+
// zeros as well). This ensures the block identity preimage is always alphanumerically before
319+
// any transaction identity preimages, because sender addresses cannot be that small.
320320
var buf bytes.Buffer
321321
buf.Write(common.BigToHash(common.Big0).Bytes())
322-
buf.Write(common.BigToHash(new(big.Int).SetUint64(slot)).Bytes())
322+
buf.Write(common.BigToHash(new(big.Int).SetUint64(slot)).Bytes()[12:])
323323

324324
return identitypreimage.IdentityPreimage(buf.Bytes())
325325
}

0 commit comments

Comments
 (0)