We're actually doing this in Rootstock. I had the same thoughts about weakening the security of the hash function, but I don't know any successful freestart attack on SHA-256. This is how we handle it:
Rootstock tag Embedding
The embedding consist of a binary tag including the hash of the Rootstock block header, and it must be unique (there should not be a way to create a Bitcoin block that can be associated with two different Rootstock blocks). There is no accepted standard of where a tag for Merge-mining should be located. It can be located in the coinbase field of the coinbase transaction (the first transaction of a block), in the outputs of the coinbase transaction (generally as an OP_RETURN payload), or in the remaining transactions.
Rootstock standarizes that the tag is located in the coinbase transaction. To specify a Rootstock block hash, the coinbase transaction has to include the RSK tag in any part, generally an input or output script. The RSK tag is: ROOTSTOCK:RskBlockHeaderHash
“ROOTSTOCK:” is the ASCII string consisting of the bytes: 524f4f5453544f434b3a
RskBlockHeaderHash is the hash of the Rootstock Block header in binary format.
The Rootstock tag is meant to be included following the OP_RETURN OP_PUSHDATA1 opcodes, but this is not mandatory.
The following additional restrictions apply:
The number of bytes after RskBlockHeaderHash to the end of the coinbase transaction must be lower or equal to 128 bytes.
The trail of raw bytes must not contain the binary string "ROOTSTOCK:". 52 4f 4f 54 53 54 4f 43 4b 3a
The probability of the RSK tag to appear by chance is negligible, but pool servers must not rule out the possibility of a rogue Bitcoin address included in an output of the coinbase transaction having this pattern, and being used as an attack to break the validity of the merge-mined header.
The limitation on the number of bytes past the tag generally means that the tag is located within the last 4 outputs of the coinbase transaction.
This restriction allows to create a compressed SPV proof for Rootstock that consist of:
The Bitcoin header (80 bytes)
A Merkle Branch to the Coinbase transaction (approximately 320 bytes)
A mid-state of SHA-256 consuming the head of the coinbase transaction (32 bytes)
A 64 byte aligned chunk containing a trail of the coinbase transaction, including the RSK tag (max. 232 bytes). The trail allows to build a proof that the trail belongs to the coinbase transaction as a free-start hash starting with the given mid-state.
Currently the maximum size of a SPV merge-mining proof is 843 bytes.
Also we may extend the tag to 22 bytes to prevent a OP_HASH160
OP_EQUALVERIFY from being a possible Rootstock tag.
A GMaxwell says, I suppose this has already been done.
Do you think it should be better to use a short second transaction to store the tag? It requires more space and it requires having mature UTXOs ready to be consumed for this purpose. That complicates everything.
regards