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.
* option to avoid gas estimationi * Quality Gate (0xPolygon#61) * add linters * fix: lint fix * fix: lint make file * feat: sonar * fix: remove unused files * try to include coverage * fix: change sonar cloud project key * small fix * fix: comments --------- Co-authored-by: Rachit Sonthalia <[email protected]> * ensure tx order (0xPolygon#64) * ensure tx order * fix: linter * change namespace (0xPolygon#65) * fix nonce too low (0xPolygon#67) * Nonce too low issues fix (0xPolygon#75) * Serial nonce update (0xPolygon#74) * feat: prepare txns before routines * fix: remove forcedNonce feature * feat: uts * fix: lint * lint fix --------- Co-authored-by: Goran Rojovic <[email protected]> Co-authored-by: Goran Rojovic <[email protected]> * feat: implement SQL lite storage (0xPolygon#72) * feat: initial scaffolding * feat: insert implementation * feat: change column types based on the SQL lite supported types * feat: changed schema, first version of CRUD operations implementation * refactor: extract common parts to helper functions * chore: add comments * fix: linter config warning * refactor: simplify in-memory storage and fix deadlocks in case of errors * feat: instantiate either in memory or sql storage * chore: add comment * test: fully covered memstorage feat minor renames * feat: add github.com/mattn/go-sqlite3 as direct dependency * fix: adapt the DB schema, fix issues and add unit tests for sql storage * feat: increase coverage * test: add some more unit tests * fix: group variables * refactor: rename PersistenceFilename config parameter * fix: rename helper function (address comment part 1) * feat: introduce meddler * chore: remove useless comments * fix: revert update logic to manually constructing SQL and address comments from @joanestebanr (part 1) * fix: change some columns types (address comment from @joanestebanr 2nd part) * fix: use meddler to construct on fly update statement, address comments from @joanestebanr (part 3) * feat: remove in memory storage, change block_number to BIGINT (address @joanestebanr part 4) * fix: remove redundant code * feat: simplify building of UPDATE clause * rebase fix * refactor: build base select and base delete statement dynamically (address comment from @arnaubennassar) * test: concurrent write to the database unit test --------- Co-authored-by: Goran Rojovic <[email protected]> * Rename config parameter `DBPath` to `StoragePath` (0xPolygon#77) * fix if a tx is finalized very fast (0xPolygon#84) * fix * comment * # This is a combination of 3 commits. # This is the 1st commit message: Merge `dev` into upstream v0.2.1 # This is the commit message #2: Fix lint errs # This is the commit message #3: Comment interface method * parent 4da7722 author Vui-Chee <[email protected]> 1731548943 +0800 committer Vui-Chee <[email protected]> 1731548943 +0800 parent 1b8de9d author Vui-Chee <[email protected]> 1731476344 +0800 committer Vui-Chee <[email protected]> 1731548582 +0800 Merge `dev` into upstream v0.2.1 Fix lint errs Comment interface method Fix configure (#3) * fix configure * keep the same with genesis Silence sonar cloud go mod tidy Add back hex ut to keep consistent with `dev` --------- Co-authored-by: Arnau <[email protected]> Co-authored-by: Goran Rojovic <[email protected]> Co-authored-by: Rachit Sonthalia <[email protected]> Co-authored-by: Toni Ramírez <[email protected]> Co-authored-by: Stefan Negovanović <[email protected]> Co-authored-by: Goran Rojovic <[email protected]> Co-authored-by: Alonso Rodriguez <[email protected]>
- Loading branch information
1 parent
6018d38
commit 4891711
Showing
47 changed files
with
3,928 additions
and
1,179 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,60 @@ | ||
--- | ||
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: | ||
if: false | ||
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.