Commit 3e8b062f authored by Adrian Sutton's avatar Adrian Sutton

op-node/p2p: Use the new block signing hash when producing gossip

Both legacy and new hashes are still accepted to avoid incompatibility if other nodes upgrade before the sequencer is upgraded.
parent 6f1d8d9a
...@@ -464,7 +464,7 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -464,7 +464,7 @@ func (cfg SystemConfig) Start() (*System, error) {
c.P2P = p c.P2P = p
if c.Driver.SequencerEnabled { if c.Driver.SequencerEnabled {
c.P2PSigner = &p2p.PreparedSigner{Signer: p2p.NewLegacyLocalSigner(cfg.Secrets.SequencerP2P)} c.P2PSigner = &p2p.PreparedSigner{Signer: p2p.NewLocalSigner(cfg.Secrets.SequencerP2P)}
} }
} }
......
...@@ -24,7 +24,7 @@ func LoadSignerSetup(ctx *cli.Context) (p2p.SignerSetup, error) { ...@@ -24,7 +24,7 @@ func LoadSignerSetup(ctx *cli.Context) (p2p.SignerSetup, error) {
return nil, fmt.Errorf("failed to read batch submitter key: %w", err) return nil, fmt.Errorf("failed to read batch submitter key: %w", err)
} }
return &p2p.PreparedSigner{Signer: p2p.NewLegacyLocalSigner(priv)}, nil return &p2p.PreparedSigner{Signer: p2p.NewLocalSigner(priv)}, nil
} }
// TODO: create remote signer // TODO: create remote signer
......
...@@ -49,7 +49,7 @@ func TestVerifyBlockSignature(t *testing.T) { ...@@ -49,7 +49,7 @@ func TestVerifyBlockSignature(t *testing.T) {
}{ }{
{ {
name: "Legacy", name: "Legacy",
newSigner: NewLegacyLocalSigner, newSigner: newLegacyLocalSigner,
}, },
{ {
name: "Updated", name: "Updated",
...@@ -102,3 +102,7 @@ func TestVerifyBlockSignature(t *testing.T) { ...@@ -102,3 +102,7 @@ func TestVerifyBlockSignature(t *testing.T) {
}) })
} }
} }
func newLegacyLocalSigner(priv *ecdsa.PrivateKey) *LocalSigner {
return &LocalSigner{priv: priv, hasher: LegacySigningHash}
}
...@@ -64,10 +64,6 @@ type LocalSigner struct { ...@@ -64,10 +64,6 @@ type LocalSigner struct {
hasher func(domain [32]byte, chainID *big.Int, payloadBytes []byte) (common.Hash, error) hasher func(domain [32]byte, chainID *big.Int, payloadBytes []byte) (common.Hash, error)
} }
func NewLegacyLocalSigner(priv *ecdsa.PrivateKey) *LocalSigner {
return &LocalSigner{priv: priv, hasher: LegacySigningHash}
}
func NewLocalSigner(priv *ecdsa.PrivateKey) *LocalSigner { func NewLocalSigner(priv *ecdsa.PrivateKey) *LocalSigner {
return &LocalSigner{priv: priv, hasher: SigningHash} return &LocalSigner{priv: priv, hasher: SigningHash}
} }
......
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