Skip to content

Commit 388fcc8

Browse files
authored
remove outdated reorgme from repo (#205)
1 parent cdbaaee commit 388fcc8

10 files changed

Lines changed: 29 additions & 1959 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -53,57 +53,3 @@ jobs:
5353
run: |
5454
make test
5555
56-
## NOTE: currently disabled running reorgme tests on gh-actions
57-
## but certainly recommend to run them locally!
58-
#
59-
# test-with-reorgme:
60-
# env:
61-
# GOPATH: ${{ github.workspace }}
62-
# GO111MODULE: on
63-
64-
# defaults:
65-
# run:
66-
# working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
67-
68-
# strategy:
69-
# matrix:
70-
# go-version: [1.16.x]
71-
# os: [ubuntu-latest]
72-
73-
# runs-on: ${{ matrix.os }}
74-
75-
# steps:
76-
# - name: Install Go
77-
# uses: actions/setup-go@v2
78-
# with:
79-
# go-version: ${{ matrix.go-version }}
80-
# - name: Checkout code
81-
# uses: actions/checkout@v2
82-
# with:
83-
# path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
84-
# - name: Install node
85-
# uses: actions/setup-node@v1
86-
# with:
87-
# node-version: '14.x'
88-
# - uses: actions/cache@master
89-
# id: yarn-cache
90-
# with:
91-
# path: |
92-
# ./tools/testchain/node_modules
93-
# key: ${{ runner.os }}-install-reorgme-${{ hashFiles('./tools/testchain/package.json', './tools/testchain/yarn.lock') }}
94-
# - name: Yarn install
95-
# run: cd ./tools/testchain && yarn install --network-concurrency 1
96-
# - name: Start testchain
97-
# run: make start-testchain-detached
98-
# - name: testchain logs
99-
# run: make testchain-logs &> /tmp/chain.log &
100-
# - name: Test
101-
# timeout-minutes: 20
102-
# run: |
103-
# make test-with-reorgme
104-
# - name: 'Upload chain logs'
105-
# uses: actions/upload-artifact@v2
106-
# with:
107-
# name: testchain-logs
108-
# path: /tmp/chain.log
109-
# retention-days: 5

Makefile

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ install:
5656
# Run baseline tests
5757
test: check-testchain-running go-test
5858

59-
# Run tests with reorgme
60-
test-with-reorgme: check-reorgme-running
61-
REORGME=true $(MAKE) go-test
62-
6359
# Go test short-hand, and skip testing go-ethereum
6460
go-test: test-clean
6561
GOGC=off go test $(TEST_FLAGS) $(MOD_VENDOR) -race -run=$(TEST) `go list ./... | grep -v go-ethereum`
@@ -74,7 +70,6 @@ test-clean:
7470
.PHONY: tools
7571
tools:
7672
cd ./ethtest/testchain && pnpm install
77-
cd ./ethtest/reorgme && pnpm install
7873

7974

8075
#
@@ -106,24 +101,6 @@ check-testchain-running:
106101
|| { echo "*****"; echo "Oops! testchain is not running. Please run 'make start-testchain' in another terminal."; echo "*****"; exit 1; }
107102

108103

109-
#
110-
# Reorgme
111-
#
112-
start-reorgme:
113-
cd ./ethtest/reorgme && pnpm start:server
114-
115-
start-reorgme-detached:
116-
cd ./ethtest/reorgme && pnpm start:server:detached
117-
118-
stop-reorgme-detached:
119-
cd ./ethtest/reorgme && pnpm start:stop:detached
120-
121-
reorgme-logs:
122-
cd ./ethtest/reorgme && pnpm chain:logs
123-
124-
check-reorgme-running:
125-
cd ./ethtest/reorgme && bash isRunning.sh
126-
127104

128105
#
129106
# Dep management

ethmonitor/ethmonitor_test.go

Lines changed: 0 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import (
55
"fmt"
66
"math/big"
77
"net/http"
8-
"os"
9-
"os/exec"
10-
"strings"
118
"testing"
129
"time"
1310

@@ -145,153 +142,6 @@ func TestMonitorBasic(t *testing.T) {
145142
assert.Equal(t, 1, monitor.NumSubscribers())
146143
}
147144

148-
func GetIp(index uint) string {
149-
output, err := exec.Command("yarn", "--silent", "--cwd", "../tools/reorgme", "chain:ip", "0").CombinedOutput()
150-
151-
if err != nil {
152-
os.Stderr.WriteString(err.Error())
153-
}
154-
155-
return strings.Replace(string(output), "\n", "", 1)
156-
}
157-
158-
func WaitBlock(ctx context.Context, provider *ethrpc.Provider) error {
159-
var lastBlock = uint64(0)
160-
161-
fmt.Println("Waiting a block")
162-
163-
for {
164-
block, err := provider.BlockNumber(ctx)
165-
if err != nil {
166-
return err
167-
}
168-
169-
if lastBlock == 0 {
170-
lastBlock = block
171-
}
172-
173-
if block != lastBlock {
174-
return nil
175-
}
176-
}
177-
}
178-
179-
func Fork(index uint) string {
180-
fmt.Println("Forking...")
181-
output, err := exec.Command("yarn", "--silent", "--cwd", "../tools/reorgme", "chain:fork").CombinedOutput()
182-
183-
if err != nil {
184-
os.Stderr.WriteString(err.Error())
185-
}
186-
187-
fmt.Println("Forked!")
188-
189-
return string(output)
190-
}
191-
192-
func Join(index uint) string {
193-
fmt.Println("Joining...")
194-
output, err := exec.Command("yarn", "--silent", "--cwd", "../tools/reorgme", "chain:join").CombinedOutput()
195-
196-
if err != nil {
197-
os.Stderr.WriteString(err.Error())
198-
}
199-
200-
fmt.Println("Joined!")
201-
202-
return string(output)
203-
}
204-
205-
func TestMonitorWithReorgme(t *testing.T) {
206-
if strings.ToLower(os.Getenv("REORGME")) != "true" {
207-
t.Logf("REORGME is not enabled, skipping this test case.")
208-
return
209-
}
210-
211-
ip := GetIp(0)
212-
213-
provider, err := ethrpc.NewProvider("http://" + ip + ":8545/")
214-
assert.NoError(t, err)
215-
216-
monitorOptions := ethmonitor.DefaultOptions
217-
monitorOptions.PollingInterval = 5 * time.Millisecond
218-
219-
monitor, err := ethmonitor.NewMonitor(provider, monitorOptions)
220-
assert.NoError(t, err)
221-
222-
go func(t *testing.T) {
223-
err := monitor.Run(context.Background())
224-
if err != nil {
225-
panic(err)
226-
}
227-
}(t)
228-
defer monitor.Stop()
229-
230-
sub := monitor.Subscribe("TestMonitorWithReorgme")
231-
defer sub.Unsubscribe()
232-
233-
events := make([]*ethmonitor.Block, 0)
234-
235-
go func() {
236-
for {
237-
select {
238-
case blocks := <-sub.Blocks():
239-
_ = blocks
240-
for _, b := range blocks {
241-
events = append(events, b)
242-
fmt.Println("event:", b.Event, "block:", b.NumberU64(), b.Hash().Hex(), "parent:", b.ParentHash().Hex(), "# logs:", len(b.Logs))
243-
}
244-
case <-sub.Done():
245-
return
246-
}
247-
}
248-
}()
249-
250-
Fork(0)
251-
events = make([]*ethmonitor.Block, 0)
252-
253-
WaitBlock(context.Background(), provider)
254-
WaitBlock(context.Background(), provider)
255-
256-
time.Sleep(2 * time.Second)
257-
258-
for _, b := range events {
259-
assert.Equal(t, b.Event, ethmonitor.Added)
260-
}
261-
262-
revertedEvents := events
263-
events = make([]*ethmonitor.Block, 0)
264-
265-
Join(0)
266-
267-
// Wait for reorg
268-
WaitBlock(context.Background(), provider)
269-
WaitBlock(context.Background(), provider)
270-
271-
time.Sleep(2 * time.Second)
272-
273-
offset := 0
274-
for _, e := range events {
275-
if e.Block.Hash() == revertedEvents[len(revertedEvents)-1].Hash() {
276-
break
277-
}
278-
279-
offset++
280-
}
281-
282-
for i, b := range revertedEvents {
283-
ri := len(revertedEvents) - 1 - i + offset
284-
rb := events[ri]
285-
286-
// Should revert last blocks
287-
assert.Equal(t, rb.Block.Number(), b.Block.Number())
288-
assert.Equal(t, rb.Block.Hash(), b.Block.Hash())
289-
assert.Equal(t, b.Event, ethmonitor.Removed)
290-
}
291-
292-
monitor.Stop()
293-
}
294-
295145
func TestMonitorFeeHistory(t *testing.T) {
296146
const N = 1
297147

ethtest/reorgme.go

Lines changed: 0 additions & 7 deletions
This file was deleted.

ethtest/reorgme/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

ethtest/reorgme/isRunning.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

ethtest/reorgme/package.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)