Skip to content

Commit

Permalink
feat: improve bridge pause (#381) (#382)
Browse files Browse the repository at this point in the history
* feat: improve bridge pause

* Update main_loops.go

(cherry picked from commit e99f6a6)

Co-authored-by: Facundo Medica <[email protected]>
  • Loading branch information
mergify[bot] and facundomedica authored Oct 6, 2022
1 parent 18fde18 commit dfe2aa0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
7 changes: 0 additions & 7 deletions orchestrator/eth_event_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,6 @@ func (p *gravityOrchestrator) CheckForEvents(
valsetUpdates := filterValsetUpdateEventsByNonce(valsetUpdatedEvents, lastEventResp.EventNonce)
deployedERC20Updates := filterERC20DeployedEventsByNonce(erc20DeployedEvents, lastEventResp.EventNonce)

// Don't send anything other than valsetUpdates
if p.ethMergePause {
deposits = []*wrappers.GravitySendToCosmosEvent{}
withdraws = []*wrappers.GravityTransactionBatchExecutedEvent{}
deployedERC20Updates = []*wrappers.GravityERC20DeployedEvent{}
}

if len(deposits) > 0 || len(withdraws) > 0 || len(valsetUpdates) > 0 || len(deployedERC20Updates) > 0 {

if err := p.gravityBroadcastClient.SendEthereumClaims(
Expand Down
36 changes: 19 additions & 17 deletions orchestrator/main_loops.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ var estimatedGasCosts = []int64{
func (p *gravityOrchestrator) Start(ctx context.Context) error {
var pg loops.ParanoidGroup

pg.Go(func() error {
// scan all the events emitted by ethereum gravity contract
// from the last block (we get the last block from cosmos)
// broadcast all the eth events to cosmos as "claims"
return p.EthOracleMainLoop(ctx)
})
if !p.ethMergePause {
pg.Go(func() error {
// scan all the events emitted by ethereum gravity contract
// from the last block (we get the last block from cosmos)
// broadcast all the eth events to cosmos as "claims"
return p.EthOracleMainLoop(ctx)
})
}

if !p.ethMergePause {
pg.Go(func() error {
Expand All @@ -83,17 +85,17 @@ func (p *gravityOrchestrator) Start(ctx context.Context) error {
return p.EthSignerMainLoop(ctx)
})

// Let this function run as is. If we see errors caused by this loop, then
// we might need to enable batch confirms.
pg.Go(func() error {
// Gets the latest valset available and updating it on the ethereum
// smartcontract if needed. Also gets all the pending transaction
// batches and it's signatures from cosmos and send it to the
// ethereum if that batch of token is profitable, wasn't sent yet
// by another node (checking the nonce) and it is not currently
// in the eth node node mempool.
return p.RelayerMainLoop(ctx)
})
if !p.ethMergePause {
pg.Go(func() error {
// Gets the latest valset available and updating it on the ethereum
// smartcontract if needed. Also gets all the pending transaction
// batches and it's signatures from cosmos and send it to the
// ethereum if that batch of token is profitable, wasn't sent yet
// by another node (checking the nonce) and it is not currently
// in the eth node node mempool.
return p.RelayerMainLoop(ctx)
})
}

return pg.Wait()
}
Expand Down

0 comments on commit dfe2aa0

Please sign in to comment.