forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Statediff Geth Handle conflicts (#244) * Handle conflicts * Update go mod file versions * Make lint changes Disassociate block number from the indexer object Update ipld-eth-db ref Refactor builder code to make it reusable Use prefix comparison for account selective statediffing Update builder unit tests Add mode to write to CSV files in statediff file writer (#249) * Change file writing mode to csv files * Implement writer interface for file indexer * Implement option for csv or sql in file mode * Close files in CSV writer * Add tests for CSV file mode * Implement CSV file for watched addresses * Separate test configs for CSV and SQL * Refactor common code for file indexer tests Update indexer to include block hash in receipts and logs (#256) * Update indexer to include block hash in receipts and logs * Upgrade ipld-eth-db image in docker-compose to run tests Use watched addresses from direct indexing params by default while serving statediff APIs (#262) * Use watched addresses from direct indexing params in statediff APIs by default * Avoid using indexer object when direct indexing is off * Add nil check before accessing watched addresses from direct indexing params Rebase missed these changes needed at 1.10.20 Flags cleanup for CLI changes and linter complaints Linter appeasements to achieve perfection enforce go 1.18 for check (#267) * enforce go 1.18 for check * tests on 1.18 as well * adding db yml for possible change in docker-compose behavior in yml parsing Add indexer tests for handling non canonical blocks (#254) * Add indexer tests for header and transactions in a non canonical block * Add indexer tests for receipts in a non-canonical block and refactor * Add indexer tests for logs in a non-canonical block * Add indexer tests for state and storage nodes in a non-canonical block * Add indexer tests for non-canonical block at another height * Avoid passing address of a pointer * Update refs in GitHub workflow * Add genesis file path to stack-orchestrator config in GitHub workflow * Add descriptive comments fix non-deterministic ordering in unit tests Refactor indexer tests to avoid duplicate code (#270) * Refactor indexer tests to avoid duplicate code * Refactor file mode indexer tests * Fix expected db stats for sqlx after tx closure * Refactor indexer tests for legacy block * Refactor mainnet indexer tests * Refactor tests for watched addressess methods * Fix query in legacy indexer test rebase and resolve onto 1.10.23... still error out of index related to GetLeafKeys changed trie.Commit behavior was subtle about not not flushing to disk without an Update * no merge nodeset throws nil * linter appeasement Cerc refactor (#281) * first pass cerc refactor in cicd * 1st attempt to publish binary to git.vdb.to from github release * docker build step mangled * docker build step mangled * wrong username for docker login... which still succeeded * circcicd is not cerccicd * bad hostname adding manual override of binary publish to git.vdb.to for development/emergency (#282) Cerc io publish fix (#284) * adding manual override of binary publish to git.vdb.to for development/emergency * Create manual_binary_publish.yaml (#283) * github did not pick up workflow added outside of its UI and I still cannot spell cerc right rawdb helper functions for cold levelDB sync export Jenkins reborn (#285) * initial build and output testing... lots of trial and error * clean up for working (but failing) unit test geth with ubuntu foundation image
- Loading branch information
1 parent
e5eb32a
commit 5d9ed6a
Showing
185 changed files
with
25,470 additions
and
143 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,15 @@ | ||
name: checks | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
linter-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.18" | ||
check-latest: true | ||
- uses: actions/checkout@v2 | ||
- name: Run linter | ||
run: go run build/ci.go lint |
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,21 @@ | ||
name: MANUAL Override Publish geth binary to release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
giteaPublishTag: | ||
description: 'Package to publish TO on gitea; e.g. v1.10.25-statediff-4.2.1-alpha' | ||
required: true | ||
cercContainerTag: | ||
description: 'Tagged Container to extract geth binary FROM' | ||
required: true | ||
jobs: | ||
build: | ||
name: Manual override publish of geth binary FROM tagged release TO TAGGED package on git.vdb.to | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Copy ethereum binary file | ||
run: docker run --rm --entrypoint cat git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{ github.event.inputs.cercContainerTag }} /usr/local/bin/geth > geth-linux-amd64 | ||
- name: curl | ||
uses: enflo/curl-action@master | ||
with: | ||
curl: --user cerccicd:${{ secrets.GITEA_TOKEN }} --upload-file geth-linux-amd64 https://git.vdb.to/api/packages/cerc-io/generic/go-ethereum/${{ github.event.inputs.giteaPublishTag }}/geth-linux-amd64 |
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,21 @@ | ||
name: MANUAL Override Publish geth binary to release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
giteaPublishTag: | ||
description: 'Package to publish TO on gitea; e.g. v1.10.25-statediff-4.2.1-alpha' | ||
required: true | ||
cercContainerTag: | ||
description: 'Tagged Container to extract geth binary FROM' | ||
required: true | ||
jobs: | ||
build: | ||
name: Manual override publish of geth binary FROM tagged release TO TAGGED package on git.vdb.to | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Copy ethereum binary file | ||
run: docker run --rm --entrypoint cat git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{ github.event.inputs.cercContainerTag }} /usr/local/bin/geth > geth-linux-amd64 | ||
- name: curl | ||
uses: enflo/curl-action@master | ||
with: | ||
curl: --user circcicd:${{ secrets.GITEA_TOKEN }} --upload-file geth-linux-amd64 https://git.vdb.to/api/packages/cerc-io/generic/go-ethereum/${{ github.event.inputs.giteaPublishTag }}/geth-linux-amd64 |
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,7 @@ | ||
name: Build and test | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
run-tests: | ||
uses: ./.github/workflows/tests.yml |
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,36 @@ | ||
name: Publish geth to release | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
run-tests: | ||
uses: ./.github/workflows/tests.yml | ||
build: | ||
name: Run docker build and publish | ||
needs: run-tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run docker build | ||
run: docker build -t cerc-io/go-ethereum -f Dockerfile . | ||
- name: Get the version | ||
id: vars | ||
run: | | ||
echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) | ||
echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) | ||
- name: Tag docker image | ||
run: docker tag cerc-io/go-ethereum git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} | ||
- name: Tag docker image | ||
run: docker tag git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.tag}} | ||
- name: Docker Login | ||
run: echo ${{ secrets.GITEA_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin | ||
- name: Docker Push | ||
run: docker push git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} | ||
- name: Docker Push TAGGED | ||
run: docker push git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.tag}} | ||
- name: Copy ethereum binary file | ||
run: docker run --rm --entrypoint cat git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} /usr/local/bin/geth > geth-linux-amd64 | ||
- name: curl | ||
uses: enflo/curl-action@master | ||
with: | ||
curl: --user cerccicd:${{ secrets.GITEA_TOKEN }} --upload-file geth-linux-amd64 https://git.vdb.to/api/packages/cerc-io/generic/go-ethereum/${{ github.event.inputs.giteaPublishTag }}/geth-linux-amd64 |
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,142 @@ | ||
name: Tests for Geth that are used in multiple jobs. | ||
|
||
on: | ||
workflow_call: | ||
|
||
env: | ||
stack-orchestrator-ref: ${{ github.event.inputs.stack-orchestrator-ref || 'f2fd766f5400fcb9eb47b50675d2e3b1f2753702'}} | ||
ipld-eth-db-ref: ${{ github.event.inputs.ipld-ethcl-db-ref || 'be345e0733d2c025e4082c5154e441317ae94cf7' }} | ||
GOPATH: /tmp/go | ||
|
||
jobs: | ||
build: | ||
name: Run docker build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run docker build | ||
run: docker build -t cerc-io/go-ethereum . | ||
|
||
geth-unit-test: | ||
name: Run geth unit test | ||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: on | ||
steps: | ||
- name: Create GOPATH | ||
run: mkdir -p /tmp/go | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.18" | ||
check-latest: true | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run unit tests | ||
run: | | ||
make test | ||
statediff-unit-test: | ||
name: Run state diff unit test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create GOPATH | ||
run: mkdir -p /tmp/go | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.18" | ||
check-latest: true | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run docker compose | ||
run: | | ||
docker-compose up -d | ||
- name: Give the migration a few seconds | ||
run: sleep 30; | ||
|
||
- name: Run unit tests | ||
run: make statedifftest | ||
|
||
private-network-test: | ||
name: Start Geth in a private network. | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create GOPATH | ||
run: mkdir -p /tmp/go | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.18" | ||
check-latest: true | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
path: "./go-ethereum" | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.stack-orchestrator-ref }} | ||
path: "./stack-orchestrator/" | ||
repository: vulcanize/stack-orchestrator | ||
fetch-depth: 0 | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.ipld-eth-db-ref }} | ||
repository: cerc-io/ipld-eth-db | ||
path: "./ipld-eth-db/" | ||
fetch-depth: 0 | ||
|
||
- name: Create config file | ||
run: | | ||
echo vulcanize_ipld_eth_db=$GITHUB_WORKSPACE/ipld-eth-db/ > $GITHUB_WORKSPACE/config.sh | ||
echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ >> $GITHUB_WORKSPACE/config.sh | ||
echo db_write=true >> $GITHUB_WORKSPACE/config.sh | ||
echo genesis_file_path=start-up-files/go-ethereum/genesis.json >> $GITHUB_WORKSPACE/config.sh | ||
cat $GITHUB_WORKSPACE/config.sh | ||
- name: Compile Geth | ||
run: | | ||
cd $GITHUB_WORKSPACE/stack-orchestrator/helper-scripts | ||
./compile-geth.sh -e docker -p $GITHUB_WORKSPACE/config.sh | ||
cd - | ||
- name: Run docker compose | ||
run: | | ||
docker-compose \ | ||
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \ | ||
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db-sharding.yml" \ | ||
--env-file $GITHUB_WORKSPACE/config.sh \ | ||
up -d --build | ||
- name: Make sure the /root/transaction_info/STATEFUL_TEST_DEPLOYED_ADDRESS exists within a certain time frame. | ||
shell: bash | ||
run: | | ||
COUNT=0 | ||
ATTEMPTS=15 | ||
docker ps | ||
until $(docker compose -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db-sharding.yml" -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" cp go-ethereum:/root/transaction_info/STATEFUL_TEST_DEPLOYED_ADDRESS ./STATEFUL_TEST_DEPLOYED_ADDRESS) || [[ $COUNT -eq $ATTEMPTS ]]; do echo -e "$(( COUNT++ ))... \c"; sleep 10; done | ||
[[ $COUNT -eq $ATTEMPTS ]] && echo "Could not find the successful contract deployment" && (exit 1) | ||
cat ./STATEFUL_TEST_DEPLOYED_ADDRESS | ||
sleep 15; | ||
- name: Create a new transaction. | ||
shell: bash | ||
run: | | ||
docker compose -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db-sharding.yml" -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" exec go-ethereum /bin/bash /root/transaction_info/NEW_TRANSACTION | ||
echo $? | ||
- name: Make sure we see entries in the header table | ||
shell: bash | ||
run: | | ||
rows=$(docker compose -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db-sharding.yml" -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" exec ipld-eth-db psql -U vdbm -d vulcanize_testing -AXqtc "SELECT COUNT(*) FROM eth.header_cids") | ||
[[ "$rows" -lt "1" ]] && echo "We could not find any rows in postgres table." && (exit 1) | ||
echo $rows | ||
docker compose -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db-sharding.yml" -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" exec ipld-eth-db psql -U vdbm -d vulcanize_testing -AXqtc "SELECT * FROM eth.header_cids" |
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
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,7 @@ | ||
# Build Geth in a stock Go builder container | ||
FROM golang:1.15.5 as builder | ||
|
||
#RUN apk add --no-cache make gcc musl-dev linux-headers git | ||
|
||
ADD . /go-ethereum | ||
RUN cd /go-ethereum && make geth |
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,50 @@ | ||
pipeline { | ||
agent any | ||
|
||
stages { | ||
stage('Build') { | ||
steps { | ||
script{ | ||
docker.withRegistry('https://git.vdb.to'){ | ||
echo 'Building geth image...' | ||
//def geth_image = docker.build("cerc-io/go-ethereum:jenkinscicd") | ||
echo 'built geth image' | ||
} | ||
} | ||
} | ||
} | ||
stage('Test') { | ||
agent { | ||
docker { | ||
image 'cerc-io/foundation:jenkinscicd' | ||
//image 'cerc-io/foundation_alpine:jenkinscicd' | ||
} | ||
} | ||
|
||
environment { | ||
GO111MODULE = "on" | ||
CGO_ENABLED = 1 | ||
//GOPATH = "${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}" | ||
//GOPATH = "/go" | ||
GOPATH = "/tmp/go" | ||
//GOMODCACHE = "/go/pkg/mod" | ||
GOCACHE = "${WORKSPACE}/.cache/go-build" | ||
GOENV = "${WORKSPACE}/.config/go/env" | ||
GOMODCACHE = "/tmp/go/pkg/mod" | ||
GOWORK="" | ||
//GOFLAGS="" | ||
|
||
} | ||
steps { | ||
echo 'Testing ...' | ||
//sh '/usr/local/go/bin/go test -p 1 -v ./...' | ||
sh 'make test' | ||
} | ||
} | ||
stage('Packaging') { | ||
steps { | ||
echo 'Packaging ...' | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,10 +4,31 @@ | |
|
||
.PHONY: geth android ios evm all test clean | ||
|
||
BIN = $(GOPATH)/bin | ||
|
||
## Migration tool | ||
GOOSE = $(BIN)/goose | ||
$(BIN)/goose: | ||
go get -u github.com/pressly/goose/cmd/goose | ||
|
||
GOBIN = ./build/bin | ||
GO ?= latest | ||
GORUN = env GO111MODULE=on go run | ||
|
||
#Database | ||
HOST_NAME = localhost | ||
PORT = 5432 | ||
USER = vdbm | ||
PASSWORD = password | ||
|
||
# Set env variable | ||
# `PGPASSWORD` is used by `createdb` and `dropdb` | ||
export PGPASSWORD=$(PASSWORD) | ||
|
||
#Test | ||
TEST_DB = vulcanize_public | ||
TEST_CONNECT_STRING = postgresql://$(USER):$(PASSWORD)@$(HOST_NAME):$(PORT)/$(TEST_DB)?sslmode=disable | ||
|
||
geth: | ||
$(GORUN) build/ci.go install ./cmd/geth | ||
@echo "Done building." | ||
|
@@ -29,7 +50,7 @@ ios: | |
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library." | ||
|
||
test: all | ||
$(GORUN) build/ci.go test | ||
$(GORUN) build/ci.go test -v | ||
|
||
lint: ## Run linters. | ||
$(GORUN) build/ci.go lint | ||
|
@@ -48,3 +69,13 @@ devtools: | |
env GOBIN= go install ./cmd/abigen | ||
@type "solc" 2> /dev/null || echo 'Please install solc' | ||
@type "protoc" 2> /dev/null || echo 'Please install protoc' | ||
|
||
.PHONY: statedifftest | ||
statedifftest: | $(GOOSE) | ||
GO111MODULE=on go get github.com/stretchr/testify/[email protected] | ||
GO111MODULE=on MODE=statediff go test -p 1 ./statediff/... -v | ||
|
||
.PHONY: statediff_filewriting_test | ||
statediff_filetest: | $(GOOSE) | ||
GO111MODULE=on go get github.com/stretchr/testify/[email protected] | ||
GO111MODULE=on MODE=statediff STATEDIFF_DB=file go test -p 1 ./statediff/... -v |
Oops, something went wrong.