diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index 3ecd100759..aecf594020 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -82,17 +82,15 @@ jobs: run : forge coverage --report lcov - name : Prune coverage - run : lcov --remove ./lcov.info -o ./lcov.info.pruned 'src/mocks/*' 'src/test/*' 'scripts/*' 'node_modules/*' 'lib/*' + run : lcov --rc branch_coverage=1 --remove ./lcov.info -o ./lcov.info.pruned 'src/mocks/*' 'src/test/*' 'scripts/*' 'node_modules/*' 'lib/*' - - name: Report code coverage - uses: zgosalvez/github-actions-report-lcov@v3 + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - coverage-files: contracts/lcov.info.pruned - minimum-coverage: 0 - artifact-name: code-coverage-report - github-token: ${{ secrets.GITHUB_TOKEN }} - working-directory: contracts - update-comment: true + files: contracts/lcov.info.pruned + flags: contracts hardhat: if: github.event.pull_request.draft == false diff --git a/bridge-history-api/internal/utils/withdraw_trie.go b/bridge-history-api/internal/utils/withdraw_trie.go index 627f83635c..66efc4879f 100644 --- a/bridge-history-api/internal/utils/withdraw_trie.go +++ b/bridge-history-api/internal/utils/withdraw_trie.go @@ -4,7 +4,7 @@ import ( "github.com/scroll-tech/go-ethereum/common" ) -// MaxHeight is the maixium possible height of withdraw trie +// MaxHeight is the maximum possible height of withdraw trie const MaxHeight = 40 // WithdrawTrie is an append only merkle trie diff --git a/codecov.yml b/codecov.yml index 26ed42752e..a3ef51f029 100644 --- a/codecov.yml +++ b/codecov.yml @@ -36,3 +36,8 @@ flag_management: - type: project target: auto threshold: 1% + - name: contracts + statuses: + - type: project + target: auto + threshold: 1% diff --git a/contracts/src/README.md b/contracts/src/README.md index 212ad04260..b0ac540f63 100644 --- a/contracts/src/README.md +++ b/contracts/src/README.md @@ -4,7 +4,7 @@ This library includes contracts and interfaces needed to interact with the Scrol # Overview -## Instalation +## Installations ```bash npm install @scroll-tech/contracts diff --git a/contracts/src/gas-swap/GasSwap.sol b/contracts/src/gas-swap/GasSwap.sol index e962e2fa80..7b3800f417 100644 --- a/contracts/src/gas-swap/GasSwap.sol +++ b/contracts/src/gas-swap/GasSwap.sol @@ -124,7 +124,7 @@ contract GasSwap is ERC2771Context, Ownable, ReentrancyGuard { _outputTokenAmount = _outputTokenAmount - _fee; require(_outputTokenAmount >= _swap.minOutput, "insufficient output amount"); - // tranfer ETH to sender + // transfer ETH to sender (_success, ) = _sender.call{value: _outputTokenAmount}(""); require(_success, "transfer ETH failed"); diff --git a/rollup/internal/controller/relayer/relayer_test.go b/rollup/internal/controller/relayer/relayer_test.go index 519408aa4f..6ca76d8cf4 100644 --- a/rollup/internal/controller/relayer/relayer_test.go +++ b/rollup/internal/controller/relayer/relayer_test.go @@ -1,8 +1,11 @@ package relayer import ( + "crypto/rand" "encoding/json" + "math/big" "os" + "strconv" "testing" "github.com/scroll-tech/go-ethereum/common" @@ -52,6 +55,10 @@ func setupEnv(t *testing.T) { MaxOpenNum: base.DBConfig.MaxOpenNum, MaxIdleNum: base.DBConfig.MaxIdleNum, } + port, err := rand.Int(rand.Reader, big.NewInt(10000)) + assert.NoError(t, err) + svrPort := strconv.FormatInt(port.Int64()+50000, 10) + cfg.L2Config.RelayerConfig.ChainMonitor.BaseURL = "http://localhost:" + svrPort // Create l2geth client. l2Cli, err = base.L2Client() diff --git a/rollup/tests/bridge_test.go b/rollup/tests/bridge_test.go index 34a6ba6d69..57ab7dac11 100644 --- a/rollup/tests/bridge_test.go +++ b/rollup/tests/bridge_test.go @@ -2,7 +2,10 @@ package tests import ( "context" + "crypto/rand" + "math/big" "net/http" + "strconv" "strings" "testing" @@ -84,6 +87,11 @@ func setupEnv(t *testing.T) { l2Auth, err = bind.NewKeyedTransactorWithChainID(rollupApp.Config.L1Config.RelayerConfig.GasOracleSenderPrivateKey, base.L2gethImg.ChainID()) assert.NoError(t, err) + + port, err := rand.Int(rand.Reader, big.NewInt(10000)) + assert.NoError(t, err) + svrPort := strconv.FormatInt(port.Int64()+40000, 10) + rollupApp.Config.L2Config.RelayerConfig.ChainMonitor.BaseURL = "http://localhost:" + svrPort } func mockChainMonitorServer(baseURL string) (*http.Server, error) { diff --git a/rollup/tests/process_start_test.go b/rollup/tests/process_start_test.go index 58fe9eef9e..83189cb97f 100644 --- a/rollup/tests/process_start_test.go +++ b/rollup/tests/process_start_test.go @@ -31,19 +31,19 @@ func testProcessStartEnableMetrics(t *testing.T) { db := setupDB(t) defer database.CloseDB(db) - port, err := rand.Int(rand.Reader, big.NewInt(2000)) + port, err := rand.Int(rand.Reader, big.NewInt(10000)) assert.NoError(t, err) - svrPort := strconv.FormatInt(port.Int64()+50000, 10) + svrPort := strconv.FormatInt(port.Int64()+10000, 10) rollupApp.RunApp(t, cutils.EventWatcherApp, "--metrics", "--metrics.addr", "localhost", "--metrics.port", svrPort) - port, err = rand.Int(rand.Reader, big.NewInt(2000)) + port, err = rand.Int(rand.Reader, big.NewInt(10000)) assert.NoError(t, err) - svrPort = strconv.FormatInt(port.Int64()+50000, 10) + svrPort = strconv.FormatInt(port.Int64()+20000, 10) rollupApp.RunApp(t, cutils.GasOracleApp, "--metrics", "--metrics.addr", "localhost", "--metrics.port", svrPort) - port, err = rand.Int(rand.Reader, big.NewInt(2000)) + port, err = rand.Int(rand.Reader, big.NewInt(10000)) assert.NoError(t, err) - svrPort = strconv.FormatInt(port.Int64()+50000, 10) + svrPort = strconv.FormatInt(port.Int64()+30000, 10) rollupApp.RunApp(t, cutils.RollupRelayerApp, "--metrics", "--metrics.addr", "localhost", "--metrics.port", svrPort) rollupApp.WaitExit()