@@ -38,7 +38,9 @@ func newBridgeState(
3838var BridgeStateEmpty = newBridgeState (common .EmptyHash , common .EmptyHash , big .NewInt (0 ))
3939
4040type BridgeStateGetter interface {
41- GetBridgeState (ctx context.Context , blockHash common.Hash ) (* BridgeState , error )
41+ GetBridgeState (
42+ ctx context.Context , execShardBlockHash common.Hash , mainShardBlockHash common.Hash ,
43+ ) (* BridgeState , error )
4244}
4345
4446type bridgeStateGetter struct {
@@ -61,14 +63,16 @@ func NewBridgeStateGetter(
6163 }
6264}
6365
64- func (b * bridgeStateGetter ) GetBridgeState (ctx context.Context , blockHash common.Hash ) (* BridgeState , error ) {
65- exists , err := b .contactExistsAtBlock (ctx , blockHash )
66+ func (b * bridgeStateGetter ) GetBridgeState (
67+ ctx context.Context , execShardBlockHash common.Hash , mainShardBlockHash common.Hash ,
68+ ) (* BridgeState , error ) {
69+ exists , err := b .contactExistsAtBlock (ctx , execShardBlockHash )
6670 if err != nil {
6771 return nil , err
6872 }
6973 if ! exists {
7074 b .logger .Warn ().
71- Any (logging .FieldBlockHash , blockHash ).
75+ Any (logging .FieldBlockHash , execShardBlockHash ).
7276 Msg ("L2 bridge contract does not exist at specified block, empty state will be returned" )
7377 return & BridgeStateEmpty , nil
7478 }
@@ -78,9 +82,9 @@ func (b *bridgeStateGetter) GetBridgeState(ctx context.Context, blockHash common
7882 var l1MessageHash common.Hash
7983 eg .Go (func () error {
8084 const method = "l1MessageHash"
81- ret , err := callContract [bytes32 ](gCtx , b .nilClient , blockHash , b .contractAddr , b .abi , method )
85+ ret , err := callContract [bytes32 ](gCtx , b .nilClient , mainShardBlockHash , b .contractAddr , b .abi , method )
8286 if err != nil {
83- return b .callError (method , blockHash , err )
87+ return b .callError (method , mainShardBlockHash , err )
8488 }
8589 l1MessageHash = common .BytesToHash (ret [:])
8690 return nil
@@ -89,9 +93,9 @@ func (b *bridgeStateGetter) GetBridgeState(ctx context.Context, blockHash common
8993 var l2ToL1Root common.Hash
9094 eg .Go (func () error {
9195 const method = "getL2ToL1Root"
92- ret , err := callContract [bytes32 ](gCtx , b .nilClient , blockHash , b .contractAddr , b .abi , method )
96+ ret , err := callContract [bytes32 ](gCtx , b .nilClient , mainShardBlockHash , b .contractAddr , b .abi , method )
9397 if err != nil {
94- return b .callError (method , blockHash , err )
98+ return b .callError (method , mainShardBlockHash , err )
9599 }
96100 l2ToL1Root = common .BytesToHash (ret [:])
97101 return nil
@@ -100,9 +104,9 @@ func (b *bridgeStateGetter) GetBridgeState(ctx context.Context, blockHash common
100104 var depositNonce * big.Int
101105 eg .Go (func () error {
102106 const method = "getLatestDepositNonce"
103- ret , err := callContract [* big.Int ](gCtx , b .nilClient , blockHash , b .contractAddr , b .abi , method )
107+ ret , err := callContract [* big.Int ](gCtx , b .nilClient , mainShardBlockHash , b .contractAddr , b .abi , method )
104108 if err != nil {
105- return b .callError (method , blockHash , err )
109+ return b .callError (method , mainShardBlockHash , err )
106110 }
107111 depositNonce = ret
108112 return nil
0 commit comments