Skip to content

Commit

Permalink
finish once osp
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Mar 28, 2024
1 parent 5c6c886 commit 0d2c8c6
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions system_tests/bold_challenge_protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
modes "github.com/OffchainLabs/bold/challenge-manager/types"
l2stateprovider "github.com/OffchainLabs/bold/layer2-state-provider"
"github.com/OffchainLabs/bold/solgen/go/bridgegen"
"github.com/OffchainLabs/bold/solgen/go/challengeV2gen"
"github.com/OffchainLabs/bold/solgen/go/mocksgen"
"github.com/OffchainLabs/bold/solgen/go/rollupgen"
challenge_testing "github.com/OffchainLabs/bold/testing"
Expand Down Expand Up @@ -388,9 +389,7 @@ func TestChallengeProtocolBOLD(t *testing.T) {
manager.Start(ctx)
managerB.Start(ctx)

filterer, err := rollupgen.NewRollupUserLogicFilterer(assertionChain.RollupAddress(), l1client)
Require(t, err)
userLogic, err := rollupgen.NewRollupUserLogic(assertionChain.RollupAddress(), l1client)
filterer, err := challengeV2gen.NewEdgeChallengeManagerFilterer(assertionChain.RollupAddress(), l1client)
Require(t, err)

fromBlock := uint64(0)
Expand All @@ -410,26 +409,20 @@ func TestChallengeProtocolBOLD(t *testing.T) {
End: &toBlock,
Context: ctx,
}
it, err := filterer.FilterAssertionConfirmed(filterOpts, nil)
it, err := filterer.FilterEdgeConfirmedByOneStepProof(filterOpts, nil, nil)
Require(t, err)
for it.Next() {
if it.Error() != nil {
t.Fatalf("Error in filter iterator: %v", it.Error())
}
assertion, err := userLogic.GetAssertion(&bind.CallOpts{}, it.Event.AssertionHash)
Require(t, err)
if assertion.SecondChildBlock != 0 {
continue
}
creationInfo, err := assertionChain.ReadAssertionCreationInfo(ctx, protocol.AssertionHash{Hash: it.Event.AssertionHash})
Require(t, err)
tx, _, err := l1client.TransactionByHash(ctx, creationInfo.TransactionHash)
t.Log("Received event of OSP confirmation!")
tx, _, err := l1client.TransactionByHash(ctx, it.Event.Raw.TxHash)
Require(t, err)
signer := types.NewCancunSigner(tx.ChainId())
address, err := signer.Sender(tx)
Require(t, err)
if address == l1info.GetDefaultTransactOpts("Asserter", ctx).From {
t.Logf("Assertion from honest party confirmed by challenge win %#x", it.Event.AssertionHash)
t.Log("Honest party won OSP, impossible for evil party to win if honest party continues")
Require(t, it.Close())
return
}
Expand Down

0 comments on commit 0d2c8c6

Please sign in to comment.