Skip to content

Commit

Permalink
Fix go_test_all (#117)
Browse files Browse the repository at this point in the history
* fix TestConfigDataMarshalUnmarshal

* fix alt-da test

* turn on go-test-all

* mod SEPOLIA_RPC_URL
  • Loading branch information
blockchaindevsh authored Dec 10, 2024
1 parent 0ea3b73 commit 23d9265
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ jobs:
done
export ENABLE_ANVIL=true
export SEPOLIA_RPC_URL="https://ci-sepolia-l1-archive.optimism.io"
export SEPOLIA_RPC_URL="http://88.99.30.186:8545"
gotestsum --format=testname \
--junitfile=./tmp/test-results/results.xml \
Expand Down Expand Up @@ -1343,10 +1343,10 @@ workflows:
# on_changes: op-e2e,packages/contracts-bedrock/src
# uses_artifacts: true
# requires: ["contracts-bedrock-build"]
# - go-test:
# name: go-test-all
# requires:
# - contracts-bedrock-build
- go-test:
name: go-test-all
requires:
- contracts-bedrock-build
- go-test-kurtosis:
name: op-deployer-integration
module: op-deployer
Expand Down
4 changes: 2 additions & 2 deletions op-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,10 +837,10 @@ type L1DependenciesConfig struct {
// SoulGasTokenConfig configures the SoulGasToken deployment to L2.
type SoulGasTokenConfig struct {
// UseSoulGasToken is a flag that indicates if the system is using SoulGasToken
UseSoulGasToken bool `json:"useSoulGasToken"`
UseSoulGasToken bool `json:"useSoulGasToken,omitempty"`
// IsSoulBackedByNative is a flag that indicates if the SoulGasToken is backed by native.
// Only effective when UseSoulGasToken is true.
IsSoulBackedByNative bool `json:"isSoulBackedByNative"`
IsSoulBackedByNative bool `json:"isSoulBackedByNative,omitempty"`
}

// DependencyContext is the contextual configuration needed to verify the L1 dependencies,
Expand Down
33 changes: 27 additions & 6 deletions op-node/rollup/derive/altda_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func TestAltDADataSource(t *testing.T) {
nc := 0
firstChallengeExpirationBlock := uint64(95)

// for reusing after pipeline is reset
successfulReceipts := make(map[common.Hash]types.Receipts)
for i := uint64(0); i <= pcfg.ChallengeWindow+pcfg.ResolveWindow; i++ {
parent := l1Refs[len(l1Refs)-1]
// create a new mock l1 ref
Expand All @@ -117,8 +119,6 @@ func TestAltDADataSource(t *testing.T) {
}
l1Refs = append(l1Refs, ref)
logger.Info("new l1 block", "ref", ref)
// called for each l1 block to sync challenges
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)

// pick a random number of commitments to include in the l1 block
c := rng.Intn(4)
Expand Down Expand Up @@ -149,6 +149,12 @@ func TestAltDADataSource(t *testing.T) {
txs = append(txs, tx)

}

successfulReceipts[ref.Hash] = successfulReceiptsForTxs(txs)
// called by `getTxSucceed` to fetch tx status
l1F.ExpectFetchReceipts(ref.Hash, nil, successfulReceipts[ref.Hash], nil)
// called for each l1 block to sync challenges
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)
logger.Info("included commitments", "count", c)
l1F.ExpectInfoAndTxsByHash(ref.Hash, testutils.RandomBlockInfo(rng), txs, nil)
// called once per derivation
Expand Down Expand Up @@ -205,6 +211,8 @@ func TestAltDADataSource(t *testing.T) {
ref = l1Refs[i]
logger.Info("re deriving block", "ref", ref, "i", i)

// called by `getTxSucceed` to fetch tx status
l1F.ExpectFetchReceipts(ref.Hash, nil, successfulReceipts[ref.Hash], nil)
if i == len(l1Refs)-1 {
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)
}
Expand All @@ -220,8 +228,6 @@ func TestAltDADataSource(t *testing.T) {
}
l1Refs = append(l1Refs, ref)
logger.Info("new l1 block", "ref", ref)
// called for each l1 block to sync challenges
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)

// pick a random number of commitments to include in the l1 block
c := rng.Intn(4)
Expand Down Expand Up @@ -251,6 +257,10 @@ func TestAltDADataSource(t *testing.T) {
txs = append(txs, tx)

}
// called by `getTxSucceed` to fetch tx status
l1F.ExpectFetchReceipts(ref.Hash, nil, successfulReceiptsForTxs(txs), nil)
// called for each l1 block to sync challenges
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)
logger.Info("included commitments", "count", c)
l1F.ExpectInfoAndTxsByHash(ref.Hash, testutils.RandomBlockInfo(rng), txs, nil)
}
Expand Down Expand Up @@ -282,6 +292,13 @@ func TestAltDADataSource(t *testing.T) {
finalitySignal.AssertExpectations(t)
}

func successfulReceiptsForTxs(txs []*types.Transaction) (receipts types.Receipts) {
for _, tx := range txs {
receipts = append(receipts, &types.Receipt{TxHash: tx.Hash(), Status: types.ReceiptStatusSuccessful})
}
return
}

// This tests makes sure the pipeline returns a temporary error if data is not found.
func TestAltDADataSourceStall(t *testing.T) {
logger := testlog.Logger(t, log.LevelDebug)
Expand Down Expand Up @@ -350,7 +367,6 @@ func TestAltDADataSourceStall(t *testing.T) {
ParentHash: parent.Hash,
Time: parent.Time + l1Time,
}
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)
// mock input commitments in l1 transactions
input := testutils.RandomData(rng, 2000)
comm, _ := storage.SetInput(ctx, input)
Expand All @@ -369,6 +385,9 @@ func TestAltDADataSourceStall(t *testing.T) {

txs := []*types.Transaction{tx}

// called by `getTxSucceed` to fetch tx status
l1F.ExpectFetchReceipts(ref.Hash, nil, successfulReceiptsForTxs(txs), nil)
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)
l1F.ExpectInfoAndTxsByHash(ref.Hash, testutils.RandomBlockInfo(rng), txs, nil)

// delete the input from the DA provider so it returns not found
Expand Down Expand Up @@ -472,7 +491,6 @@ func TestAltDADataSourceInvalidData(t *testing.T) {
ParentHash: parent.Hash,
Time: parent.Time + l1Time,
}
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)
// mock input commitments in l1 transactions with an oversized input
input := testutils.RandomData(rng, altda.MaxInputSize+1)
comm, _ := storage.SetInput(ctx, input)
Expand Down Expand Up @@ -520,6 +538,9 @@ func TestAltDADataSourceInvalidData(t *testing.T) {

txs := []*types.Transaction{tx1, tx2, tx3}

// called by `getTxSucceed` to fetch tx status
l1F.ExpectFetchReceipts(ref.Hash, nil, successfulReceiptsForTxs(txs), nil)
l1F.ExpectFetchReceipts(ref.Hash, nil, types.Receipts{}, nil)
l1F.ExpectInfoAndTxsByHash(ref.Hash, testutils.RandomBlockInfo(rng), txs, nil)

src, err := factory.OpenData(ctx, ref, batcherAddr)
Expand Down

0 comments on commit 23d9265

Please sign in to comment.