-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update l2 bridge config whenever l1 config is updated
- Loading branch information
Showing
43 changed files
with
1,007 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package host | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
"go.uber.org/zap" | ||
|
||
hostprovider "github.com/initia-labs/opinit-bots/provider/host" | ||
|
||
nodetypes "github.com/initia-labs/opinit-bots/node/types" | ||
"github.com/initia-labs/opinit-bots/types" | ||
) | ||
|
||
func (h *Host) updateProposerHandler(ctx types.Context, args nodetypes.EventHandlerArgs) error { | ||
bridgeId, proposer, finalizedOutputIndex, finalizedL2BlockNumber, err := hostprovider.ParseMsgUpdateProposer(args.EventAttributes) | ||
if err != nil { | ||
return errors.Wrap(err, "failed to parse update proposer event") | ||
} | ||
if bridgeId != h.BridgeId() { | ||
return nil | ||
} | ||
|
||
ctx.Logger().Warn("update proposer", | ||
zap.Uint64("bridge_id", bridgeId), | ||
zap.String("proposer", proposer), | ||
zap.Uint64("finalized_output_index", finalizedOutputIndex), | ||
zap.Uint64("finalized_l2_block_number", finalizedL2BlockNumber), | ||
) | ||
|
||
h.UpdateProposer(proposer) | ||
return nil | ||
} | ||
|
||
func (h *Host) updateChallengerHandler(ctx types.Context, args nodetypes.EventHandlerArgs) error { | ||
bridgeId, challenger, finalizedOutputIndex, finalizedL2BlockNumber, err := hostprovider.ParseMsgUpdateChallenger(args.EventAttributes) | ||
if err != nil { | ||
return errors.Wrap(err, "failed to parse update challenger event") | ||
} | ||
if bridgeId != h.BridgeId() { | ||
return nil | ||
} | ||
|
||
ctx.Logger().Info("update challenger", | ||
zap.Uint64("bridge_id", bridgeId), | ||
zap.String("challenger", challenger), | ||
zap.Uint64("finalized_output_index", finalizedOutputIndex), | ||
zap.Uint64("finalized_l2_block_number", finalizedL2BlockNumber), | ||
) | ||
|
||
h.UpdateChallenger(challenger) | ||
return nil | ||
} |
Oops, something went wrong.