Skip to content

Commit

Permalink
Merge pull request #11414 from vegaprotocol/11408-relax-arbitrum-check
Browse files Browse the repository at this point in the history
feat: relax unecessary finality checks on Arbitrum to allow for insta…
  • Loading branch information
wwestgarth authored Jun 27, 2024
2 parents 5422481 + 60ca571 commit df5bb62
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

- [11209](https://github.com/vegaprotocol/vega/issues/11209) - Publish ongoing games data.
- [11242](https://github.com/vegaprotocol/vega/issues/11242) - Add configuration to visor to help control binary retries a bit better.
- [11408](https://github.com/vegaprotocol/vega/issues/11408) - Relax finality check to allow instant deposits over the `Arbitrum` bridge.
- [11196](https://github.com/vegaprotocol/vega/issues/11196) - Add an active field in the price monitoring bounds payload.
- [11211](https://github.com/vegaprotocol/vega/issues/11211) - Liquidation engine includes `vAMM` shapes as available volume.
- [11217](https://github.com/vegaprotocol/vega/issues/11217) - Allow market proposals to override risk factors.
Expand Down
10 changes: 5 additions & 5 deletions cmd/vega/commands/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,11 @@ func (n *Command) startBlockchainClients() error {

n.primaryEthConfirmations = ethclient.NewEthereumConfirmations(n.conf.Ethereum, n.primaryEthClient, nil, ethclient.FinalityStateFinalized)

// for arbitrum we can use the weaker check for finality and only require that the block is marked as "safe".
// This is because "safe" means that the batch has been send to L1 Ethereum and from then on its "final" on
// Arbitrum. If the batched-transaction is part of a re-org on Ethereum, it doesn't matter to Vega because core
// is only looking at the Arbitrum blocks we don't track the batch, so we don't need to wait for full finality.
n.secondaryEthConfirmations = ethclient.NewEthereumConfirmations(n.conf.Ethereum, n.secondaryEthClient, nil, ethclient.FinalityStateSafe)
// for arbitrum the finality state of a block is in now way connected to the Arbitrum network reaching consensus so Vega gains nothing
// from waiting for safe/finalized. Instead we just wait for the event to be seen in the latest block and rely on the consensus check
// Vega performs itself with node-votes. If each validator is running their own Arbitrum node, or is using a node that they need trustworthy
// then this is sufficient. A far as is know, block reorgs do not happen on Arbitrum.
n.secondaryEthConfirmations = ethclient.NewEthereumConfirmations(n.conf.Ethereum, n.secondaryEthClient, nil, ethclient.FinalityStateLatest)

return nil
}
Expand Down
5 changes: 5 additions & 0 deletions core/client/eth/ethereum_confirmations.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ func (e *EthereumConfirmations) Check(block uint64) error {
return err
}

// if finality state is "latest" we do not need to check as this will already be done by the confirmations count
if e.finState == nil {
return nil
}

finalized, err := e.finalizedHeight(context.Background())
if err != nil {
return err
Expand Down

0 comments on commit df5bb62

Please sign in to comment.