Skip to content

Commit af4178b

Browse files
Merge pull request #1290 from XinFinOrg/dev-temp
Dev Upgrade Merge Until June
2 parents 71be3b0 + f673361 commit af4178b

File tree

529 files changed

+78596
-32466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

529 files changed

+78596
-32466
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
uses: actions/setup-go@v5
5656
with:
5757
cache: false
58-
go-version: '1.22.x'
58+
go-version: '1.23.x'
5959
- name: Run tests
6060
run: ${{ matrix.script }}
6161
env:
@@ -153,9 +153,11 @@ jobs:
153153
chmod 600 $HOME/.kube/config
154154
git_hash=$(git rev-parse --short "$GITHUB_SHA")
155155
kubectl set image deployment/devnetrpc devnetrpc=xinfinorg/devnet:dev-upgrade-${git_hash} || true
156-
kubectl set image deployment/devnetrpc2 devnetrpc=xinfinorg/devnet:dev-upgrade-${git_hash} || true
156+
kubectl set image deployment/devnetrpc2 devnetrpc2=xinfinorg/devnet:dev-upgrade-${git_hash} || true
157157
kubectl set image deployment/testnetrpc testnetrpc=xinfinorg/devnet:dev-upgrade-${git_hash} || true
158+
kubectl set image deployment/testnetrpc2 testnetrpc=xinfinorg/devnet:dev-upgrade-${git_hash} || true
158159
kubectl set image deployment/mainnetrpc mainnetrpc=xinfinorg/devnet:dev-upgrade-${git_hash} || true
160+
kubectl set image deployment/mainnetrpc2 mainnetrpc=xinfinorg/devnet:dev-upgrade-${git_hash} || true
159161
echo done
160162
161163
devnet_send_notification:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.22-alpine as builder
1+
FROM golang:1.23-alpine AS builder
22

33
RUN apk add --no-cache make gcc musl-dev linux-headers git
44

Dockerfile.bootnode

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.22-alpine as builder
1+
FROM golang:1.23-alpine AS builder
22

33
RUN apk add --no-cache make gcc musl-dev linux-headers
44

Dockerfile.node

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.22-alpine as builder
1+
FROM golang:1.23-alpine AS builder
22

33
RUN apk add --no-cache make gcc musl-dev linux-headers git
44

Makefile

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
.PHONY: XDC-darwin XDC-darwin-386 XDC-darwin-amd64
88

99
GOBIN = $(shell pwd)/build/bin
10-
GOFMT = gofmt
11-
GO ?= 1.22.10
10+
GO ?= 1.23.6
1211
GORUN = go run
13-
GO_PACKAGES = .
14-
GO_FILES := $(shell find $(shell go list -f '{{.Dir}}' $(GO_PACKAGES)) -name \*.go)
15-
GIT = git
1612

1713
#? XDC: Build XDC.
1814
XDC:
@@ -31,11 +27,6 @@ XDC-devnet-local:
3127
@echo "Run the devnet script in local"
3228
cd cicd/devnet && ./start-local-devnet.sh
3329

34-
gc:
35-
go run build/ci.go install ./cmd/gc
36-
@echo "Done building."
37-
@echo "Run \"$(GOBIN)/gc\" to launch gc."
38-
3930
bootnode:
4031
go run build/ci.go install ./cmd/bootnode
4132
@echo "Done building."
@@ -54,6 +45,10 @@ all:
5445
test: all
5546
go run build/ci.go test
5647

48+
#? quick-test: Run the tests except time-consuming tests.
49+
quick-test: all
50+
go run build/ci.go test --quick
51+
5752
#? lint: Run certain pre-selected linters.
5853
lint: ## Run linters.
5954
$(GORUN) build/ci.go lint
@@ -66,13 +61,35 @@ check_tidy: ## Run 'go mod tidy'.
6661
check_generate: ## Run 'go generate ./...'.
6762
$(GORUN) build/ci.go check_generate
6863

64+
#? fmt: Ensure consistent code formatting.
65+
fmt:
66+
gofmt -s -w $(shell find . -name "*.go")
67+
6968
#? clean: Clean go cache, built executables, and the auto generated folder.
7069
clean:
70+
go clean -cache
7171
rm -fr build/_workspace/pkg/ $(GOBIN)/*
7272

73-
#? fmt: Ensure consistent code formatting.
74-
fmt:
75-
gofmt -s -w $(shell find . -name "*.go")
73+
# The devtools target installs tools required for 'go generate'.
74+
# You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
75+
76+
#? devtools: Install recommended developer tools.
77+
devtools:
78+
env GOBIN= go install golang.org/x/tools/cmd/stringer@latest
79+
env GOBIN= go install github.com/fjl/gencodec@latest
80+
env GOBIN= go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
81+
env GOBIN= go install ./cmd/abigen
82+
@type "solc" 2> /dev/null || echo 'Please install solc'
83+
@type "protoc" 2> /dev/null || echo 'Please install protoc'
84+
85+
#? help: Get more info on make commands.
86+
help: Makefile
87+
@echo ''
88+
@echo 'Usage:'
89+
@echo ' make [target]'
90+
@echo ''
91+
@echo 'Targets:'
92+
@sed -n 's/^#?//p' $< | column -t -s ':' | sort | sed -e 's/^/ /'
7693

7794
# Cross Compilation Targets (xgo)
7895

@@ -132,6 +149,3 @@ XDC-windows-amd64:
132149
go run build/ci.go xgo -- --go=$(GO) -buildmode=mode -x --targets=windows/amd64 -v ./cmd/XDC
133150
@echo "Windows amd64 cross compilation done:"
134151
@ls -ld $(GOBIN)/XDC-windows-* | grep amd64
135-
gofmt:
136-
$(GOFMT) -s -w $(GO_FILES)
137-
$(GIT) checkout vendor

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ XinFin Hybrid Blockchain is an Enterprise ready Blockchain for global trade and
1717
Visit: [XinFin.org](https://xinfin.org)
1818
Contribute: [Developer Docs](https://docs.xinfin.org)
1919

20-
## XinFin Network XDPoS is community driven project to achieve the following
20+
## XinFin Network XDPoS is community driven project to achieve the following
2121

2222
- XinFin DPOS (XDPoS) consensus that selects 108 set of Masternodes to achieve a high throughput Energy efficient consensus with instant block finality
2323

@@ -52,11 +52,15 @@ The contract is very strict in handing out penalty for invalid KYC, it results l
5252
For eg. say A proposes condidates B,C,D by paying for its proposal cost.
5353
If at a later stage if some predecided amount of owners ( investors ) vote that a KYC for a A is invalid then A & all of its candidates (B,C,D) will lose their position & all their funds will be lost ( will remain with contract wallet ).
5454

55+
### Documents
56+
57+
[Document](./docs/README.md)
58+
5559
### For developers
5660

5761
#### Continues integration & delivery
58-
See https://github.com/XinFinOrg/XDPoSChain/tree/dev-upgrade/cicd
5962

63+
See <https://github.com/XinFinOrg/XDPoSChain/tree/dev-upgrade/cicd>
6064

6165
### To contribute
6266

XDCx/XDCx.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/XinFinOrg/XDPoSChain/core/state"
1717
"github.com/XinFinOrg/XDPoSChain/core/types"
1818
"github.com/XinFinOrg/XDPoSChain/log"
19+
"github.com/XinFinOrg/XDPoSChain/node"
1920
"github.com/XinFinOrg/XDPoSChain/p2p"
2021
"github.com/XinFinOrg/XDPoSChain/rpc"
2122
"golang.org/x/sync/syncmap"
@@ -67,7 +68,7 @@ func (XDCx *XDCX) Protocols() []p2p.Protocol {
6768
return []p2p.Protocol{}
6869
}
6970

70-
func (XDCx *XDCX) Start(server *p2p.Server) error {
71+
func (XDCx *XDCX) Start() error {
7172
return nil
7273
}
7374

@@ -91,7 +92,7 @@ func NewMongoDBEngine(cfg *Config) *XDCxDAO.MongoDatabase {
9192
return mongoDB
9293
}
9394

94-
func New(cfg *Config) *XDCX {
95+
func New(stack *node.Node, cfg *Config) *XDCX {
9596
XDCX := &XDCX{
9697
orderNonce: make(map[common.Address]*big.Int),
9798
Triegc: prque.New[int64, common.Hash](nil),
@@ -111,6 +112,9 @@ func New(cfg *Config) *XDCX {
111112
XDCX.StateCache = tradingstate.NewDatabase(XDCX.db)
112113
XDCX.settings.Store(overflowIdx, false)
113114

115+
stack.RegisterAPIs(XDCX.APIs())
116+
stack.RegisterProtocols(XDCX.Protocols())
117+
stack.RegisterLifecycle(XDCX)
114118
return XDCX
115119
}
116120

@@ -140,9 +144,7 @@ func (XDCx *XDCX) APIs() []rpc.API {
140144
return []rpc.API{
141145
{
142146
Namespace: ProtocolName,
143-
Version: ProtocolVersionStr,
144147
Service: NewPublicXDCXAPI(XDCx),
145-
Public: true,
146148
},
147149
}
148150
}

XDCx/order_processor_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/XinFinOrg/XDPoSChain/common"
1010
"github.com/XinFinOrg/XDPoSChain/core/rawdb"
1111
"github.com/XinFinOrg/XDPoSChain/core/types"
12+
"github.com/XinFinOrg/XDPoSChain/node"
1213
)
1314

1415
func Test_getCancelFeeV1(t *testing.T) {
@@ -90,7 +91,12 @@ func Test_getCancelFeeV1(t *testing.T) {
9091
}
9192

9293
func Test_getCancelFee(t *testing.T) {
93-
XDCx := New(&DefaultConfig)
94+
stack, err := node.New(&node.DefaultConfig)
95+
if err != nil {
96+
t.Fatalf("could not create new node: %v", err)
97+
}
98+
XDCx := New(stack, &DefaultConfig)
99+
defer stack.Close()
94100
db := rawdb.NewMemoryDatabase()
95101
stateCache := tradingstate.NewDatabase(db)
96102
tradingStateDb, _ := tradingstate.New(types.EmptyRootHash, stateCache)

XDCx/tradingstate/XDCx_trie.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ func (t *XDCXTrie) GetKey(shaKey []byte) []byte {
147147
if key, ok := t.getSecKeyCache()[string(shaKey)]; ok {
148148
return key
149149
}
150-
key, _ := t.trie.Db.Preimage(common.BytesToHash(shaKey))
151-
return key
150+
return t.trie.Db.Preimage(common.BytesToHash(shaKey))
152151
}
153152

154153
// Commit writes all nodes and the secure hash pre-images to the trie's database.

XDCx/tradingstate/state_liquidationprice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (l *liquidationPriceState) updateRoot(db Database) error {
136136
if l.dbErr != nil {
137137
return l.dbErr
138138
}
139-
root, err := l.trie.Commit(func(leaf []byte, parent common.Hash) error {
139+
root, err := l.trie.Commit(func(_ [][]byte, _ []byte, leaf []byte, parent common.Hash) error {
140140
var orderList orderList
141141
if err := rlp.DecodeBytes(leaf, &orderList); err != nil {
142142
return nil

0 commit comments

Comments
 (0)