Skip to content

Commit

Permalink
Merge branch 'develop' into fix-bridge-history-api-write-db
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Dec 13, 2023
2 parents 04006b3 + b8c463f commit 3f9e500
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 18 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bridge-history-api/internal/utils/withdraw_trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ flag_management:
- type: project
target: auto
threshold: 1%
- name: contracts
statuses:
- type: project
target: auto
threshold: 1%
2 changes: 1 addition & 1 deletion contracts/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/gas-swap/GasSwap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
7 changes: 7 additions & 0 deletions rollup/internal/controller/relayer/relayer_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package relayer

import (
"crypto/rand"
"encoding/json"
"math/big"
"os"
"strconv"
"testing"

"github.com/scroll-tech/go-ethereum/common"
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 8 additions & 0 deletions rollup/tests/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package tests

import (
"context"
"crypto/rand"
"math/big"
"net/http"
"strconv"
"strings"
"testing"

Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions rollup/tests/process_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3f9e500

Please sign in to comment.