Skip to content

Commit 068d798

Browse files
authored
chore: merge main to develop post release v2.1.0
Merge pull request #1273 from razor-network/main
2 parents fd91fc4 + 1467c79 commit 068d798

39 files changed

+688
-79
lines changed

.github/workflows/ci.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Checkout code
2323
uses: actions/checkout@v4
2424
- name: Setup Node.js
25-
uses: actions/setup-node@v3
25+
uses: actions/setup-node@v4
2626
with:
2727
node-version: "20"
2828
- name: Setup Go
@@ -62,7 +62,7 @@ jobs:
6262
env:
6363
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6464
run: goveralls -coverprofile=coverage.txt -service=github
65-
- uses: bissolli/gh-action-persist-workspace@v1
65+
- uses: bissolli/gh-action-persist-workspace@v2
6666
with:
6767
action: persist
6868

@@ -75,7 +75,7 @@ jobs:
7575
uses: actions/checkout@v4
7676

7777
- name: Setup Node.js
78-
uses: actions/setup-node@v3
78+
uses: actions/setup-node@v4
7979
with:
8080
node-version: "20"
8181

@@ -105,7 +105,7 @@ jobs:
105105
mv razor_go.linux-amd64.tar.gz ../../
106106
107107
- name: Upload AMD Artifact
108-
uses: actions/upload-artifact@v3
108+
uses: actions/upload-artifact@v4
109109
with:
110110
name: razor_go.linux-amd64.tar.gz
111111
path: razor_go.linux-amd64.tar.gz
@@ -117,7 +117,7 @@ jobs:
117117
uses: actions/checkout@v4
118118

119119
- name: Setup Node.js
120-
uses: actions/setup-node@v3
120+
uses: actions/setup-node@v4
121121
with:
122122
node-version: "20"
123123

@@ -147,7 +147,7 @@ jobs:
147147
mv razor_go.linux-arm64.tar.gz ../../
148148
149149
- name: Upload ARM Artifact
150-
uses: actions/upload-artifact@v3
150+
uses: actions/upload-artifact@v4
151151
with:
152152
name: razor_go.linux-arm64.tar.gz
153153
path: razor_go.linux-arm64.tar.gz
@@ -166,17 +166,17 @@ jobs:
166166
fetch-depth: 0
167167

168168
- name: Setup Node.js
169-
uses: actions/setup-node@v3
169+
uses: actions/setup-node@v4
170170
with:
171171
node-version: "20"
172172

173173
- name: Download Artifacts AMD
174-
uses: actions/download-artifact@v3
174+
uses: actions/download-artifact@v4
175175
with:
176176
name: razor_go.linux-amd64.tar.gz
177177

178178
- name: Download Artifacts ARM
179-
uses: actions/download-artifact@v3
179+
uses: actions/download-artifact@v4
180180
with:
181181
name: razor_go.linux-arm64.tar.gz
182182

.github/workflows/develop.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ jobs:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
1818
- name: Setup Node.js
19-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@v4
2020
with:
2121
node-version: "20"
2222
- name: Setup Go
2323
uses: actions/setup-go@v2
2424
with:
2525
go-version: 1.23
2626
- name: Cache npm modules
27-
uses: actions/cache@v2
27+
uses: actions/cache@v4
2828
with:
2929
path: ~/.npm
3030
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
3131
restore-keys: |
3232
${{ runner.os }}-node-
3333
3434
- name: Cache Go dependencies
35-
uses: actions/cache@v2
35+
uses: actions/cache@v4
3636
with:
3737
path: ~/go/pkg/mod
3838
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@@ -68,7 +68,7 @@ jobs:
6868
env:
6969
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7070
run: goveralls -coverprofile=coverage.txt -service=github
71-
- uses: bissolli/gh-action-persist-workspace@v1
71+
- uses: bissolli/gh-action-persist-workspace@v2
7272
with:
7373
action: persist
7474

.github/workflows/release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ jobs:
1313
- name: Checkout code
1414
uses: actions/checkout@v4
1515
- name: Setup Node.js
16-
uses: actions/setup-node@v3
16+
uses: actions/setup-node@v4
1717
with:
1818
node-version: "20"
1919
- name: Setup Go
2020
uses: actions/setup-go@v2
2121
with:
2222
go-version: 1.23
2323
- name: Cache npm modules
24-
uses: actions/cache@v2
24+
uses: actions/cache@v4
2525
with:
2626
path: ~/.npm
2727
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
2828
restore-keys: |
2929
${{ runner.os }}-node-
3030
3131
- name: Cache Go dependencies
32-
uses: actions/cache@v2
32+
uses: actions/cache@v4
3333
with:
3434
path: ~/go/pkg/mod
3535
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@@ -65,7 +65,7 @@ jobs:
6565
env:
6666
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6767
run: goveralls -coverprofile=coverage.txt -service=github
68-
- uses: bissolli/gh-action-persist-workspace@v1
68+
- uses: bissolli/gh-action-persist-workspace@v2
6969
with:
7070
action: persist
7171

block/block.go

+20
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,26 @@ func (bm *BlockMonitor) updateLatestBlock() {
6464
bm.mu.Lock()
6565
defer bm.mu.Unlock()
6666

67+
// Check if the fetched block number is less than the last recorded block number.
68+
if bm.latestBlock != nil && header.Number.Uint64() < bm.latestBlock.Number.Uint64() {
69+
logrus.Warnf("Fetched block number %d is less than the last recorded block number %d. Switching to the next best RPC endpoint.",
70+
header.Number.Uint64(), bm.latestBlock.Number.Uint64())
71+
72+
// Attempt to switch to the next best RPC endpoint.
73+
if bm.rpcManager != nil {
74+
switched, err := bm.rpcManager.SwitchToNextBestRPCClient()
75+
if err != nil {
76+
logrus.Errorf("Failed to switch RPC endpoint: %v", err)
77+
} else if switched {
78+
logrus.Info("Switched to the next best RPC endpoint.")
79+
bm.updateClient()
80+
} else {
81+
logrus.Warn("Retaining the current best RPC endpoint as no valid alternate was found.")
82+
}
83+
}
84+
return
85+
}
86+
6787
// Update the latest block only if it changes.
6888
if bm.latestBlock == nil || header.Number.Uint64() != bm.latestBlock.Number.Uint64() {
6989
bm.latestBlock = header

0 commit comments

Comments
 (0)