Skip to content

Commit

Permalink
fix go import and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Jan 15, 2024
1 parent 74e1436 commit c9fbabe
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
1 change: 0 additions & 1 deletion rollup/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/agiledragon/gomonkey/v2 v2.9.0
github.com/gin-gonic/gin v1.9.1
github.com/go-resty/resty/v2 v2.7.0
github.com/orcaman/concurrent-map/v2 v2.0.1
github.com/prometheus/client_golang v1.14.0
github.com/scroll-tech/go-ethereum v1.10.14-0.20231130005111-38a3a9c9198c
github.com/smartystreets/goconvey v1.8.0
Expand Down
2 changes: 0 additions & 2 deletions rollup/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/orcaman/concurrent-map/v2 v2.0.1 h1:jOJ5Pg2w1oeB6PeDurIYf6k9PQ+aTITr/6lP/L/zp6c=
github.com/orcaman/concurrent-map/v2 v2.0.1/go.mod h1:9Eq3TG2oBe5FirmYWQfYO5iH1q0Jv47PLaNK++uCdOM=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down
2 changes: 2 additions & 0 deletions rollup/internal/controller/relayer/l1_relayer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ func testL1RelayerGasOracleConfirm(t *testing.T) {
l1Relayer.gasOracleSender.SendConfirmation(&sender.Confirmation{
ContextID: "gas-oracle-1",
IsSuccessful: true,
SenderType: types.SenderTypeL1GasOracle,
})
l1Relayer.gasOracleSender.SendConfirmation(&sender.Confirmation{
ContextID: "gas-oracle-2",
IsSuccessful: false,
SenderType: types.SenderTypeL1GasOracle,
})

// Check the database for the updated status using TryTimes.
Expand Down
19 changes: 9 additions & 10 deletions rollup/internal/controller/relayer/l2_relayer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,9 @@ func testL2RelayerCommitConfirm(t *testing.T) {
assert.NoError(t, err)

// Simulate message confirmations.
processingKeys := []string{"committed-1", "committed-2"}
isSuccessful := []bool{true, false}

batchOrm := orm.NewBatch(db)
batchHashes := make([]string, len(processingKeys))
batchHashes := make([]string, len(isSuccessful))
for i := range batchHashes {
batchMeta := &types.BatchMeta{
StartChunkIndex: 0,
Expand All @@ -181,11 +179,12 @@ func testL2RelayerCommitConfirm(t *testing.T) {
batchHashes[i] = batch.Hash
}

for i, key := range processingKeys {
for i, batchHash := range batchHashes {
l2Relayer.commitSender.SendConfirmation(&sender.Confirmation{
ContextID: key,
ContextID: batchHash,
IsSuccessful: isSuccessful[i],
TxHash: common.HexToHash("0x123456789abcdef"),
SenderType: types.SenderTypeCommitBatch,
})
}

Expand Down Expand Up @@ -219,11 +218,9 @@ func testL2RelayerFinalizeConfirm(t *testing.T) {
assert.NoError(t, err)

// Simulate message confirmations.
processingKeys := []string{"finalized-1", "finalized-2"}
isSuccessful := []bool{true, false}

batchOrm := orm.NewBatch(db)
batchHashes := make([]string, len(processingKeys))
batchHashes := make([]string, len(isSuccessful))
for i := range batchHashes {
batchMeta := &types.BatchMeta{
StartChunkIndex: 0,
Expand All @@ -236,11 +233,12 @@ func testL2RelayerFinalizeConfirm(t *testing.T) {
batchHashes[i] = batch.Hash
}

for i, key := range processingKeys {
for i, batchHash := range batchHashes {
l2Relayer.finalizeSender.SendConfirmation(&sender.Confirmation{
ContextID: key,
ContextID: batchHash,
IsSuccessful: isSuccessful[i],
TxHash: common.HexToHash("0x123456789abcdef"),
SenderType: types.SenderTypeFinalizeBatch,
})
}

Expand Down Expand Up @@ -307,6 +305,7 @@ func testL2RelayerGasOracleConfirm(t *testing.T) {
l2Relayer.gasOracleSender.SendConfirmation(&sender.Confirmation{
ContextID: confirmation.batchHash,
IsSuccessful: confirmation.isSuccessful,
SenderType: types.SenderTypeL2GasOracle,
})
}
// Check the database for the updated status using TryTimes.
Expand Down
1 change: 1 addition & 0 deletions rollup/internal/controller/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"gorm.io/gorm"

"scroll-tech/common/types"

"scroll-tech/rollup/internal/config"
"scroll-tech/rollup/internal/orm"
"scroll-tech/rollup/internal/utils"
Expand Down
1 change: 1 addition & 0 deletions rollup/internal/controller/sender/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"scroll-tech/common/docker"
"scroll-tech/common/types"
"scroll-tech/database/migrate"

"scroll-tech/rollup/internal/config"
)

Expand Down

0 comments on commit c9fbabe

Please sign in to comment.