Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
test(all): improve test running time && update bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Nov 30, 2023
1 parent 9533761 commit 3f6eaa9
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 134 deletions.
2 changes: 1 addition & 1 deletion bindings/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b20ff337693efc3191a00ff883d258de322fdf3c
9d497eae8fd1886dad7ab27bc9c31cb95af9ada5
293 changes: 178 additions & 115 deletions bindings/gen_guardian_prover.go

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions bindings/gen_taiko_timelock_controller.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions integration_test/nodes/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ cd $TAIKO_MONO_DIR/packages/protocol &&
TAIKO_TOKEN_NAME="Taiko Token Test" \
TAIKO_TOKEN_SYMBOL=TTKOt \
L2_GENESIS_HASH=$L2_GENESIS_HASH \
MIN_GUARDIANS=5 \
forge script script/DeployOnL1.s.sol:DeployOnL1 \
--fork-url http://localhost:18545 \
--broadcast \
Expand Down
32 changes: 20 additions & 12 deletions pkg/rpc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"math/big"
"os"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -106,23 +107,30 @@ func WaitReceipt(
ticker.Stop()
}()

for {
select {
case <-ctxWithTimeout.Done():
// If we are running tests, we don't need to wait for `waitL1OriginPollingInterval` seconds
// at first, just start fetching the receipt immediately.
if os.Getenv("RUN_TESTS") == "" {
<-time.After(waitL1OriginPollingInterval)
}

for ; true; <-ticker.C {
if ctxWithTimeout.Err() != nil {
return nil, ctxWithTimeout.Err()
case <-ticker.C:
receipt, err := client.TransactionReceipt(ctxWithTimeout, tx.Hash())
if err != nil {
continue
}
}

if receipt.Status != types.ReceiptStatusSuccessful {
return nil, fmt.Errorf("transaction reverted, hash: %s", tx.Hash())
}
receipt, err := client.TransactionReceipt(ctxWithTimeout, tx.Hash())
if err != nil {
continue
}

return receipt, nil
if receipt.Status != types.ReceiptStatusSuccessful {
return nil, fmt.Errorf("transaction reverted, hash: %s", tx.Hash())
}

return receipt, nil
}

return nil, fmt.Errorf("failed to find the receipt for transaction %s", tx.Hash())
}

// BlockProofStatus represents the proving status of the given L2 block.
Expand Down
4 changes: 2 additions & 2 deletions prover/prover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (s *ProverTestSuite) TestContestWrongBlocks() {

if contestedEvent.Tier >= encoding.TierSgxAndPseZkevmID {
approvedSink := make(chan *bindings.GuardianProverApproved)
approvedSub, err := s.p.rpc.GuardianProver.WatchApproved(nil, approvedSink, []uint64{})
approvedSub, err := s.p.rpc.GuardianProver.WatchApproved(nil, approvedSink, [](*big.Int){})
s.Nil(err)
defer func() {
approvedSub.Unsubscribe()
Expand All @@ -276,7 +276,7 @@ func (s *ProverTestSuite) TestContestWrongBlocks() {
s.Nil(s.p.selectSubmitter(encoding.TierGuardianID).SubmitProof(context.Background(), <-s.p.proofGenerationCh))
approvedEvent := <-approvedSink

s.Equal(header.Number.Uint64(), approvedEvent.BlockId)
s.Equal(header.Number.Uint64(), approvedEvent.OperationId)
return
}

Expand Down

0 comments on commit 3f6eaa9

Please sign in to comment.