Skip to content

Commit

Permalink
fix: skip registration on L1 and Proof submission chain if not config…
Browse files Browse the repository at this point in the history
…ured
  • Loading branch information
kripa432 committed Aug 5, 2024
1 parent cebee9a commit 053769a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
3 changes: 2 additions & 1 deletion docs/plaintext.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The below example shows how you can use the key names which will be taken from t
"<raw-watchtower-private-key e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef>"
],
"operator_private_key": "<raw-operator-private-key e.g. abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789>",
"eth_rpc_url": "<Mainnet RPC URL>",
"eth_rpc_url": "e.g. wss://ethereum-rpc.publicnode.com",
"proof_submission_rpc_url": "e.g. https://rpc.witnesschain.com"
}
```
5 changes: 4 additions & 1 deletion watchtower-operator/commands/deregister_op_from_avs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ func DeRegisterOperatorFromAVSCmd() *cli.Command {
},
Action: func(cCtx *cli.Context) error {
config := operator_config.GetConfigFromContext(cCtx)
DeRegisterOperatorFromAVS(config)
if len(config.EthRPCUrl) != 0 {
DeRegisterOperatorFromAVS(config)
}

return nil
},
}
Expand Down
10 changes: 7 additions & 3 deletions watchtower-operator/commands/deregister_watchtower.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ func DeRegisterWatchtowerCmd() *cli.Command {
},
Action: func(cCtx *cli.Context) error {
config := operator_config.GetConfigFromContext(cCtx)
DeRegisterWatchtower(config)
config.EthRPCUrl = config.ProofSubmissionRPC
DeRegisterWatchtower(config)
if len(config.EthRPCUrl) != 0 {
DeRegisterWatchtower(config)
}
if len(config.ProofSubmissionRPC) != 0 {
config.EthRPCUrl = config.ProofSubmissionRPC
DeRegisterWatchtower(config)
}
return nil
},
}
Expand Down
4 changes: 3 additions & 1 deletion watchtower-operator/commands/register_op_to_avs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ func RegisterOperatorToAVSCmd() *cli.Command {
},
Action: func(cCtx *cli.Context) error {
config := operator_config.GetConfigFromContext(cCtx)
RegisterOperatorToAVS(config)
if len(config.EthRPCUrl) != 0 {
RegisterOperatorToAVS(config)
}
return nil
},
}
Expand Down
13 changes: 10 additions & 3 deletions watchtower-operator/commands/register_watchtower.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ func RegisterWatchtowerCmd() *cli.Command {
},
Action: func(cCtx *cli.Context) error {
config := operator_config.GetConfigFromContext(cCtx)
RegisterWatchtower(config)
config.EthRPCUrl = config.ProofSubmissionRPC
RegisterWatchtower(config)
if len(config.EthRPCUrl) != 0 {
// register on L1
RegisterWatchtower(config)
}

if len(config.ProofSubmissionRPC) != 0 {
// register on Proof submission chain
config.EthRPCUrl = config.ProofSubmissionRPC
RegisterWatchtower(config)
}
return nil
},
}
Expand Down

0 comments on commit 053769a

Please sign in to comment.