@@ -1237,11 +1237,14 @@ func (c *DBFT) validateDecryptedTx(head *types.Header, decryptedTx *types.Transa
12371237 if decryptedTx .Nonce () != envelope .Nonce () {
12381238 return fmt .Errorf ("decryptedTx nonce mismatch: decryptedNonce %v, envelopeNonce %v" , decryptedTx .Nonce (), envelope .Nonce ())
12391239 }
1240+
12401241 // Ensure the gasprice is high enough to replace the envelope transaction
12411242 baseFee := head .BaseFee
12421243 if decryptedTx .EffectiveGasTipCmp (envelope , baseFee ) < 0 {
12431244 return fmt .Errorf ("decryptedTx underpriced: EffectiveGasTip needed %v, EffectiveGasTip permitted %v" , envelope .EffectiveGasTipValue (baseFee ), decryptedTx .EffectiveGasTipValue (baseFee ))
12441245 }
1246+
1247+ // Ensure envelope sender matches decrypted sender.
12451248 envelopeFrom , err := types .Sender (c .signerConfig , envelope )
12461249 if err != nil {
12471250 return fmt .Errorf ("%w: failed to retrieve envelope sender: %w" , txpool .ErrInvalidSender , err )
@@ -1253,6 +1256,13 @@ func (c *DBFT) validateDecryptedTx(head *types.Header, decryptedTx *types.Transa
12531256 if envelopeFrom != decryptedFrom {
12541257 return fmt .Errorf ("decryptedTx from mismatch: decryptedFrom %v, envelopeFrom %v" , decryptedFrom , envelopeFrom )
12551258 }
1259+
1260+ // Ensure decrypted hash matches the one specified in an unencrypted part of Envelope data.
1261+ expectedH := antimev .GetEncryptedHash (envelope )
1262+ if decryptedTx .Hash ().Cmp (expectedH ) != 0 {
1263+ return fmt .Errorf ("decryptedTx hash mismatch: expected %s, got %s" , expectedH , decryptedTx .Hash ())
1264+ }
1265+
12561266 return nil
12571267}
12581268
0 commit comments