forked from 0xPolygon/zkevm-ethtx-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'v0.2.1' into upstream/v0.2.1-dev
* tag 'v0.2.1': fix if a tx is finalized very fast (0xPolygon#84) Rename config parameter `DBPath` to `StoragePath` (0xPolygon#77) feat: implement SQL lite storage (0xPolygon#72) Nonce too low issues fix (0xPolygon#75) fix nonce too low (0xPolygon#67) change namespace (0xPolygon#65) ensure tx order (0xPolygon#64) Quality Gate (0xPolygon#61) option to avoid gas estimationi
- Loading branch information
Showing
46 changed files
with
3,896 additions
and
1,145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
name: Test unit | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'release/**' | ||
pull_request: | ||
|
||
jobs: | ||
test-unit: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: [ 1.21.x ] | ||
goarch: [ "amd64" ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
env: | ||
GOARCH: ${{ matrix.goarch }} | ||
|
||
- name: Test | ||
run: make test-unit | ||
|
||
- name: Archive code coverage results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: code-coverage-report | ||
path: coverage.out | ||
|
||
sonar-cloud: | ||
needs: test-unit | ||
name: SonarCloud | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
|
||
- name: Download code coverage results | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: code-coverage-report | ||
|
||
- name: Analyze with SonarCloud | ||
uses: sonarsource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
test/sepolia.keystore | ||
test/ethtxmanager-persistence.json | ||
test/ethtxmanager-persistence.json.tmp | ||
coverage.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
with-expecter: true | ||
dir: "mocks" | ||
filename: "{{.InterfaceName | lower }}.generated.go" | ||
mockname: "{{.InterfaceName}}" | ||
outpkg: "mocks" | ||
packages: | ||
github.com/0xPolygon/zkevm-ethtx-manager/types: | ||
interfaces: | ||
EthermanInterface: | ||
config: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package common | ||
|
||
import "github.com/ethereum/go-ethereum/common" | ||
|
||
const ( | ||
// Base10 decimal base | ||
Base10 = 10 | ||
// Gwei represents 1000000000 wei | ||
Gwei = 1000000000 | ||
|
||
// SQLLiteDriverName is the name for the SQL lite driver | ||
SQLLiteDriverName = "sqlite3" | ||
) | ||
|
||
// ToAddressPtr converts a string to a common.Address pointer or returns nil if empty. | ||
func ToAddressPtr(addr string) *common.Address { | ||
if addr == "" { | ||
return nil | ||
} | ||
|
||
address := common.HexToAddress(addr) | ||
return &address | ||
} | ||
|
||
// ToUint64Ptr is a helper to create uint64 pointer | ||
func ToUint64Ptr(v uint64) *uint64 { | ||
return &v | ||
} | ||
|
||
// SlicePtrsToSlice converts a slice of pointers to a slice of values. | ||
func SlicePtrsToSlice[T any](ptrSlice []*T) []T { | ||
// Create a new slice to hold the values | ||
res := make([]T, len(ptrSlice)) | ||
// Dereference each pointer and add the value to the result slice | ||
for i, ptr := range ptrSlice { | ||
if ptr != nil { | ||
res[i] = *ptr | ||
} | ||
} | ||
return res | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.