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 (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Nov 30, 2023
1 parent 9533761 commit df91c51
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
repository: taikoxyz/taiko-mono
path: ${{ env.TAIKO_MONO_DIR }}
ref: based_contestable_zkrollup_improved
ref: based_contestable_zkrollup_improved_log

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
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.

2 changes: 1 addition & 1 deletion integration_test/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DEPLOYMENT_JSON=$(cat $TAIKO_MONO_DIR/packages/protocol/deployments/deploy_l1.js
TAIKO_L1_CONTRACT_ADDRESS=$(echo $DEPLOYMENT_JSON | jq '.taiko' | sed 's/\"//g')
L1_SIGNAL_SERVICE_CONTRACT_ADDRESS=$(echo $DEPLOYMENT_JSON | jq '.signal_service' | sed 's/\"//g')
TAIKO_TOKEN_CONTRACT_ADDRESS=$(echo $DEPLOYMENT_JSON | jq '.taiko_token' | sed 's/\"//g')
ADDRESS_MANAGER_CONTRACT_ADDRESS=$(echo $DEPLOYMENT_JSON | jq '.address_manager_for_rollup' | sed 's/\"//g')
ADDRESS_MANAGER_CONTRACT_ADDRESS=$(echo $DEPLOYMENT_JSON | jq '.rollup_address_manager' | sed 's/\"//g')
GUARDIAN_PROVER_CONTRACT_ADDRESS=$(echo $DEPLOYMENT_JSON | jq '.guardian_prover' | sed 's/\"//g')
ASSIGNMENT_HOOK_CONTRACT_ADDRESS=$(echo $DEPLOYMENT_JSON | jq '.assignment_hook' | sed 's/\"//g')
TIMELOCK_CONTROLLER=$(echo $DEPLOYMENT_JSON | jq '.timelock_controller' | sed 's/\"//g')
Expand Down
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
2 changes: 1 addition & 1 deletion prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (p *Prover) onBlockProposed(
// via API for liveness checks.
if p.IsGuardianProver() {
if err := p.signBlock(ctx, event.BlockId); err != nil {
return fmt.Errorf("faile to sign block data (eventID %d): %w", event.BlockId, err)
return fmt.Errorf("failed to sign block data (eventID %d): %w", event.BlockId, err)
}
}

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 df91c51

Please sign in to comment.