Skip to content

Commit 3b67499

Browse files
committed
wip
1 parent bb5c533 commit 3b67499

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

bridgesync/claimcalldata_test.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ func TestClaimCalldata(t *testing.T) {
272272
expectedClaim.GlobalIndex = big.NewInt(428)
273273
expectedClaim2.IsMessage = true
274274
expectedClaim2.GlobalIndex = big.NewInt(429)
275+
// Both logs originate from claimCaller in this scenario
276+
expectedClaim.FromAddress = claimCallerAddr
277+
expectedClaim2.FromAddress = claimCallerAddr
275278
expectedClaimBytes, err = encodeClaimCalldata(abi, "claimMessage", expectedClaim, proofLocal, proofRollup)
276279
require.NoError(t, err)
277280
expectedClaimBytes2, err := encodeClaimCalldata(abi, "claimMessage", expectedClaim2, proofLocal, proofRollup)
@@ -306,6 +309,9 @@ func TestClaimCalldata(t *testing.T) {
306309
expectedClaim.GlobalIndex = big.NewInt(430)
307310
expectedClaim2.IsMessage = true
308311
expectedClaim2.GlobalIndex = big.NewInt(430)
312+
// Both logs originate from claimCaller in this scenario
313+
expectedClaim.FromAddress = claimCallerAddr
314+
expectedClaim2.FromAddress = claimCallerAddr
309315
expectedClaimBytes, err = encodeClaimCalldata(abi, "claimMessage", expectedClaim, proofLocal, proofRollup)
310316
require.NoError(t, err)
311317
expectedClaimBytes2, err = encodeClaimCalldata(abi, "claimMessage", expectedClaim2, proofLocal, proofRollup)
@@ -332,6 +338,9 @@ func TestClaimCalldata(t *testing.T) {
332338
expectedClaim.GlobalIndex = big.NewInt(431)
333339
expectedClaim2.IsMessage = true
334340
expectedClaim2.GlobalIndex = big.NewInt(432)
341+
// Both logs originate from claimCaller in this scenario
342+
expectedClaim.FromAddress = claimCallerAddr
343+
expectedClaim2.FromAddress = claimCallerAddr
335344
expectedClaimBytes, err = encodeClaimCalldata(abi, "claimMessage", expectedClaim, proofLocal, proofRollup)
336345
require.NoError(t, err)
337346
expectedClaimBytes2, err = encodeClaimCalldata(abi, "claimMessage", expectedClaim2, proofLocal, proofRollup)
@@ -414,6 +423,9 @@ func TestClaimCalldata(t *testing.T) {
414423
expectedClaim.GlobalIndex = big.NewInt(437)
415424
expectedClaim2.IsMessage = false
416425
expectedClaim2.GlobalIndex = big.NewInt(438)
426+
// Both logs originate from claimCaller in this scenario
427+
expectedClaim.FromAddress = claimCallerAddr
428+
expectedClaim2.FromAddress = claimCallerAddr
417429
expectedClaimBytes, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim, proofLocal, proofRollup)
418430
require.NoError(t, err)
419431
expectedClaimBytes2, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim2, proofLocal, proofRollup)
@@ -448,6 +460,9 @@ func TestClaimCalldata(t *testing.T) {
448460
expectedClaim.GlobalIndex = big.NewInt(439)
449461
expectedClaim2.IsMessage = false
450462
expectedClaim2.GlobalIndex = big.NewInt(439)
463+
// Both logs originate from claimCaller in this scenario
464+
expectedClaim.FromAddress = claimCallerAddr
465+
expectedClaim2.FromAddress = claimCallerAddr
451466
expectedClaimBytes, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim, proofLocal, proofRollup)
452467
require.NoError(t, err)
453468
expectedClaimBytes2, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim2, proofLocal, proofRollup)
@@ -474,6 +489,9 @@ func TestClaimCalldata(t *testing.T) {
474489
expectedClaim.GlobalIndex = big.NewInt(440)
475490
expectedClaim2.IsMessage = false
476491
expectedClaim2.GlobalIndex = big.NewInt(441)
492+
// Both logs originate from claimCaller in this scenario
493+
expectedClaim.FromAddress = claimCallerAddr
494+
expectedClaim2.FromAddress = claimCallerAddr
477495
expectedClaimBytes, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim, proofLocal, proofRollup)
478496
require.NoError(t, err)
479497
expectedClaimBytes2, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim2, proofLocal, proofRollup)
@@ -502,6 +520,9 @@ func TestClaimCalldata(t *testing.T) {
502520
expectedClaim.GlobalIndex = big.NewInt(442)
503521
expectedClaim2.IsMessage = false
504522
expectedClaim2.GlobalIndex = big.NewInt(442)
523+
// Both logs originate from claimCaller in this scenario
524+
expectedClaim.FromAddress = claimCallerAddr
525+
expectedClaim2.FromAddress = claimCallerAddr
505526
expectedClaimBytes, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim, proofLocal, proofRollup)
506527
require.NoError(t, err)
507528
expectedClaimBytes2, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim2, proofLocal, proofRollup)
@@ -528,6 +549,9 @@ func TestClaimCalldata(t *testing.T) {
528549
expectedClaim.GlobalIndex = big.NewInt(443)
529550
expectedClaim2.IsMessage = false
530551
expectedClaim2.GlobalIndex = big.NewInt(444)
552+
// Both logs originate from claimCaller in this scenario
553+
expectedClaim.FromAddress = claimCallerAddr
554+
expectedClaim2.FromAddress = claimCallerAddr
531555
expectedClaimBytes, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim, proofLocal, proofRollup)
532556
require.NoError(t, err)
533557
expectedClaimBytes2, err = encodeClaimCalldata(abi, "claimAsset", expectedClaim2, proofLocal, proofRollup)
@@ -668,6 +692,8 @@ func TestClaimCalldata(t *testing.T) {
668692
expectedClaim3.IsMessage = true
669693
expectedClaim3.GlobalIndex = big.NewInt(429)
670694
// expectedClaim3.FromAddress = auth.From
695+
// Align FromAddress with actual caller observed (claimCaller)
696+
expectedClaim.FromAddress = claimCallerAddr
671697
expectedClaimBytes, err = encodeClaimCalldata(abi, "claimMessage", expectedClaim, proofLocal, proofRollup)
672698
require.NoError(t, err)
673699
expectedClaimBytes2, err = encodeClaimCalldata(abi, "claimMessage", expectedClaim2, proofLocal, proofRollup)
@@ -810,7 +836,8 @@ func TestClaimCalldata(t *testing.T) {
810836
// 1 ok 1 ok 1 ko (indirectx2, indirect, indirectx2) call claim message (diff global index)
811837
expectedClaim.IsMessage = true
812838
expectedClaim.GlobalIndex = big.NewInt(427)
813-
expectedClaim.FromAddress = claimTestAddr
839+
// The first emitted log corresponds to a call via claimCaller
840+
expectedClaim.FromAddress = claimCallerAddr
814841
expectedClaim2.IsMessage = true
815842
expectedClaim2.GlobalIndex = big.NewInt(427)
816843
expectedClaim2.FromAddress = claimTestAddr

0 commit comments

Comments
 (0)