From 1a82c8aa399a3b71a7987d2134180a430948010e Mon Sep 17 00:00:00 2001 From: Alonso Rodriguez Date: Wed, 4 Dec 2024 11:30:17 +0100 Subject: [PATCH] Fix globalIndex bridge endpoint (#702) --- server/service.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/service.go b/server/service.go index d24e8a5e..cd556f44 100644 --- a/server/service.go +++ b/server/service.go @@ -464,6 +464,12 @@ func (s *bridgeService) GetBridge(ctx context.Context, req *pb.GetBridgeRequest) if err != nil { return nil, err } + mainnetFlag := deposit.NetworkID == 0 + var rollupIndex uint32 + if !mainnetFlag { + rollupIndex = deposit.NetworkID - 1 + } + localExitRootIndex := deposit.DepositCount return &pb.GetBridgeResponse{ Deposit: &pb.Deposit{ @@ -480,6 +486,7 @@ func (s *bridgeService) GetBridge(ctx context.Context, req *pb.GetBridgeRequest) ClaimTxHash: claimTxHash, Metadata: "0x" + hex.EncodeToString(deposit.Metadata), ReadyForClaim: deposit.ReadyForClaim, + GlobalIndex: etherman.GenerateGlobalIndex(mainnetFlag, rollupIndex, localExitRootIndex).String(), }, }, nil }