Commit 778dba38 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #5699 from ethereum-optimism/feat/wd-comments

op-chain-ops: better comments
parents 4611198b c7f6fd49
...@@ -202,6 +202,10 @@ func main() { ...@@ -202,6 +202,10 @@ func main() {
dryRun := ctx.Bool("dry-run") dryRun := ctx.Bool("dry-run")
noCheck := ctx.Bool("no-check") noCheck := ctx.Bool("no-check")
if noCheck {
panic("must run with check on")
}
// Perform the migration // Perform the migration
res, err := genesis.MigrateDB(ldb, config, block, &migrationData, !dryRun, noCheck) res, err := genesis.MigrateDB(ldb, config, block, &migrationData, !dryRun, noCheck)
if err != nil { if err != nil {
......
...@@ -57,7 +57,9 @@ func (w *LegacyWithdrawal) Encode() ([]byte, error) { ...@@ -57,7 +57,9 @@ func (w *LegacyWithdrawal) Encode() ([]byte, error) {
return out, nil return out, nil
} }
// Decode will decode a serialized LegacyWithdrawal // Decode will decode a serialized LegacyWithdrawal. There is a known inconsistency
// where the decoded `msg.sender` is not authenticated. A round trip of encoding and
// decoding with a spoofed withdrawal will result in a different message being recovered.
func (w *LegacyWithdrawal) Decode(data []byte) error { func (w *LegacyWithdrawal) Decode(data []byte) error {
if len(data) < len(predeploys.L2CrossDomainMessengerAddr)+4 { if len(data) < len(predeploys.L2CrossDomainMessengerAddr)+4 {
return fmt.Errorf("withdrawal data too short: %d", len(data)) return fmt.Errorf("withdrawal data too short: %d", len(data))
...@@ -68,6 +70,8 @@ func (w *LegacyWithdrawal) Decode(data []byte) error { ...@@ -68,6 +70,8 @@ func (w *LegacyWithdrawal) Decode(data []byte) error {
return fmt.Errorf("invalid selector: 0x%x", data[0:4]) return fmt.Errorf("invalid selector: 0x%x", data[0:4])
} }
// This should be the L2CrossDomainMessenger address but is not guaranteed
// to be.
msgSender := data[len(data)-len(predeploys.L2CrossDomainMessengerAddr):] msgSender := data[len(data)-len(predeploys.L2CrossDomainMessengerAddr):]
raw := data[4 : len(data)-len(predeploys.L2CrossDomainMessengerAddr)] raw := data[4 : len(data)-len(predeploys.L2CrossDomainMessengerAddr)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment