Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/rc3 #31

Merged
merged 129 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
8054de2
for order conflict
Geapefurit Jan 2, 2024
e959657
http://47.116.78.131:10083/issues/2561
dqli164 Jan 2, 2024
8c8ce2c
add TokenID column
dqli164 Jan 2, 2024
0ef10f0
bugfix: http://47.116.78.131:10083/issues/2569
dqli164 Jan 2, 2024
1e91083
delete comment
dqli164 Jan 2, 2024
2433fa2
bugfix: http://47.116.78.131:10083/issues/2565
dqli164 Jan 2, 2024
328c25c
fix infinite pull
dqli164 Jan 2, 2024
3dfed8e
add #
dqli164 Jan 2, 2024
0872d88
http://47.116.78.131:10083/issues/2571
dqli164 Jan 2, 2024
95ddd21
Merge branch 'bugfix/rc3' of github.com:web3eye-io/Web3Eye into bugfi…
dqli164 Jan 2, 2024
9504d72
fix page
dqli164 Jan 2, 2024
dd79d36
add tokenURIState
Geapefurit Jan 2, 2024
d3e4f08
reset key
dqli164 Jan 2, 2024
0c8f5fe
prevent default
dqli164 Jan 2, 2024
9d38373
Merge branch 'bugfix/rc3' of github.com:web3eye-io/Web3Eye into bugfi…
dqli164 Jan 2, 2024
effaca4
http://47.116.78.131:10083/issues/2567
dqli164 Jan 2, 2024
106323f
if lock failed in triggerSyncTask,do not return err
Geapefurit Jan 2, 2024
77ace8a
Merge branch 'bugfix/rc3' of https://github.com/web3eye-io/Web3Eye in…
Geapefurit Jan 2, 2024
4638026
bugfix: http://47.116.78.131:10083/issues/2566
dqli164 Jan 2, 2024
89dd35c
Merge branch 'bugfix/rc3' of github.com:web3eye-io/Web3Eye into bugfi…
dqli164 Jan 2, 2024
41f0ac6
search for storageKey
Geapefurit Jan 3, 2024
0d6403f
Merge branch 'bugfix/rc3' of https://github.com/web3eye-io/Web3Eye in…
Geapefurit Jan 3, 2024
7f0baba
search for storageKey
Geapefurit Jan 3, 2024
050387d
search for storageKey
Geapefurit Jan 3, 2024
a16cb30
add ids in search tokens
Geapefurit Jan 4, 2024
55fb001
check lint
Geapefurit Jan 4, 2024
2c0ccaa
bugfix for panic
Geapefurit Jan 4, 2024
8affebb
Merge branch 'bugfix/rc3' of https://github.com/web3eye-io/Web3Eye in…
Geapefurit Jan 4, 2024
96f893d
bugfix for panic
Geapefurit Jan 4, 2024
826db7c
add unmasher
Geapefurit Jan 4, 2024
a1e5ca5
donot convert vector if not parse the tokenURI
Geapefurit Jan 4, 2024
b2d8b3e
fixbug for ranker tokens
Geapefurit Jan 4, 2024
4faebee
fixbug for ranker tokens
Geapefurit Jan 4, 2024
9dffaaa
fixbug for ranker tokens
Geapefurit Jan 4, 2024
b957d58
not log err when getXXOnly have no results or many
Geapefurit Jan 4, 2024
aa7e1c8
just search right tokens
Geapefurit Jan 4, 2024
603c6c7
just search right tokens
Geapefurit Jan 4, 2024
dbd4ed3
just search right tokens
Geapefurit Jan 4, 2024
cab36ec
just search right tokens
Geapefurit Jan 4, 2024
b2a0246
reduce tx range
Geapefurit Jan 5, 2024
171bfee
reduce tx range
Geapefurit Jan 5, 2024
6bb5d79
check the uri and imageURL length
Geapefurit Jan 5, 2024
2aeac71
check the uri and imageURL length
Geapefurit Jan 5, 2024
a4206b0
check the uri and imageURL length
Geapefurit Jan 5, 2024
9bb61ad
fix panic bug
Geapefurit Jan 5, 2024
319dd83
add vector
dqli164 Jan 5, 2024
df78349
Merge branch 'bugfix/rc3' of github.com:web3eye-io/Web3Eye into bugfi…
dqli164 Jan 5, 2024
96db76c
format code
Geapefurit Jan 8, 2024
6d9837a
Merge branch 'bugfix/rc3' of https://github.com/web3eye-io/Web3Eye in…
Geapefurit Jan 8, 2024
7d9b752
format code
Geapefurit Jan 8, 2024
201312d
update deps
Geapefurit Jan 8, 2024
c0c4c1d
support backoff endpoint
Geapefurit Jan 8, 2024
8cabf0e
crypto/rand instead of math/rand
Geapefurit Jan 8, 2024
a16ff7b
test rps
Geapefurit Jan 8, 2024
452973b
add rps
Geapefurit Jan 8, 2024
cc0a309
add rps
Geapefurit Jan 8, 2024
72d9f6f
bugfix for get transfers
Geapefurit Jan 8, 2024
2c2b7e0
add state for index sol token
Geapefurit Jan 8, 2024
5e46489
add times for using endpoints
Geapefurit Jan 8, 2024
07f8dd1
add times for using endpoints
Geapefurit Jan 8, 2024
538475c
fix panic bug
Geapefurit Jan 9, 2024
f929507
fix panic bug
Geapefurit Jan 9, 2024
16becdb
backoff nodes
Geapefurit Jan 9, 2024
0a0b6e3
bugfix for panic
Geapefurit Jan 9, 2024
aec8563
bugfix for panic
Geapefurit Jan 9, 2024
d2ddbe4
check endpoint when dial
Geapefurit Jan 9, 2024
9db3e90
check endpoint when dial
Geapefurit Jan 9, 2024
2e437d2
add RPS Attr
dqli164 Jan 9, 2024
baf5ced
adjust backoff
Geapefurit Jan 9, 2024
216b2a5
Merge branch 'bugfix/rc3' of https://github.com/web3eye-io/Web3Eye in…
Geapefurit Jan 9, 2024
26367cf
adjust backoff
Geapefurit Jan 9, 2024
3eb137d
adjust word
Geapefurit Jan 9, 2024
ce20578
adjust word
Geapefurit Jan 9, 2024
20d965d
adjust word
Geapefurit Jan 9, 2024
c3cba61
delay 6s for search file
Geapefurit Jan 10, 2024
d1afbc3
log sync err
Geapefurit Jan 11, 2024
ff27c93
log err for check endpoints
Geapefurit Jan 11, 2024
3887b9f
check endpoints when index block
Geapefurit Jan 11, 2024
05620df
faied to parse info,if have no available endpoints
Geapefurit Jan 11, 2024
76315cb
faied to parse info,if have no available endpoints
Geapefurit Jan 11, 2024
da057cc
faied to parse info,if have no available endpoints
Geapefurit Jan 11, 2024
cd940ee
faied to parse info,if have no available endpoints
Geapefurit Jan 11, 2024
2a83a0f
bugfix:http://47.116.78.131:10083/issues/2631
dqli164 Jan 11, 2024
be355ec
bugfix:http://47.116.78.131:10083/issues/2625
dqli164 Jan 11, 2024
6f35980
skip check syncState when not support is_syncing
Geapefurit Jan 11, 2024
9c34c4a
Merge branch 'bugfix/rc3' of https://github.com/web3eye-io/Web3Eye in…
Geapefurit Jan 11, 2024
e0abfa5
http://47.116.78.131:10083/issues/2568
dqli164 Jan 11, 2024
93fba9e
http://47.116.78.131:10083/issues/2619
dqli164 Jan 11, 2024
dd6ec97
http://47.116.78.131:10083/issues/2618
dqli164 Jan 11, 2024
32a43c3
Merge branch 'bugfix/rc3' of github.com:web3eye-io/Web3Eye into bugfi…
dqli164 Jan 11, 2024
67c8142
add close icon
dqli164 Jan 11, 2024
1519051
add index for tokens
Geapefurit Jan 12, 2024
e2712a8
add index for tokens
Geapefurit Jan 12, 2024
2761e8c
Merge branch 'bugfix/rc3' of https://github.com/web3eye-io/Web3Eye in…
Geapefurit Jan 12, 2024
f32363e
add log for debug
Geapefurit Jan 12, 2024
9c6d30b
add lock when check endpoint status
Geapefurit Jan 12, 2024
c720bcf
add lock when check endpoint status
Geapefurit Jan 12, 2024
e892933
remake proto
Geapefurit Jan 12, 2024
1fbac5b
not check when check available
Geapefurit Jan 13, 2024
5a0d722
not check when check available
Geapefurit Jan 13, 2024
b0e9326
http://47.116.78.131:10083/issues/2567
dqli164 Jan 15, 2024
b589bbf
donot check sync state when checkEndpoint
Geapefurit Jan 15, 2024
8859276
Merge branch 'bugfix/rc3' of https://github.com/web3eye-io/Web3Eye in…
Geapefurit Jan 15, 2024
82c4767
donot check sync state when checkEndpoint
Geapefurit Jan 15, 2024
21d2a47
donot check sync state when checkEndpoint
Geapefurit Jan 15, 2024
66a948f
check milvus connect
Geapefurit Jan 15, 2024
740e11f
check milvus connect
Geapefurit Jan 15, 2024
facb6e9
add debug log to block-etl
Geapefurit Jan 16, 2024
959ddbc
just sync on task
Geapefurit Jan 16, 2024
71205bf
change index for milvus
Geapefurit Jan 19, 2024
ad7b416
change index for milvus
Geapefurit Jan 19, 2024
ab1b304
change index for milvus
Geapefurit Jan 19, 2024
9abfbbe
change index for milvus
Geapefurit Jan 19, 2024
cb6a2ae
auto flush
Geapefurit Jan 30, 2024
82b342d
auto flush
Geapefurit Jan 30, 2024
45c4b6c
auto flush
Geapefurit Jan 30, 2024
0148853
fix panic
Geapefurit Jan 30, 2024
f31d95f
desc to asc
Geapefurit Jan 30, 2024
fbec0a9
fixbug
Geapefurit Feb 1, 2024
b0a4517
add log
Geapefurit Feb 1, 2024
3da01a7
change search_list
Geapefurit Feb 1, 2024
a2c6e0a
change search_list
Geapefurit Feb 1, 2024
51dc1c4
add 200 block
Geapefurit Feb 1, 2024
59c1579
add sync blocks
Geapefurit Feb 1, 2024
666714a
increase dose
Geapefurit Feb 1, 2024
a2f383a
increase dose
Geapefurit Feb 1, 2024
b51973d
increase dose
Geapefurit Feb 1, 2024
95fb2c9
increase dose
Geapefurit Feb 1, 2024
b44da1f
fix bug for block-etl
Geapefurit Feb 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions block-etl/pkg/chains/IndexMGR.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import (
"time"

"github.com/NpoolPlatform/go-service-framework/pkg/logger"
"github.com/NpoolPlatform/libent-cruder/pkg/cruder"
"github.com/web3eye-io/Web3Eye/block-etl/pkg/chains/eth"
"github.com/web3eye-io/Web3Eye/block-etl/pkg/chains/sol"
endpointNMCli "github.com/web3eye-io/Web3Eye/nft-meta/pkg/client/v1/endpoint"

"github.com/web3eye-io/Web3Eye/common/chains"
common_eth "github.com/web3eye-io/Web3Eye/common/chains/eth"
common_sol "github.com/web3eye-io/Web3Eye/common/chains/sol"
"github.com/web3eye-io/Web3Eye/proto/web3eye"
Expand Down Expand Up @@ -47,8 +49,8 @@ func init() {
}

// TODO:should be registered
pMGR.EndpointChainIDHandlers[basetype.ChainType_Ethereum] = common_eth.GetEndpointChainID
pMGR.EndpointChainIDHandlers[basetype.ChainType_Solana] = common_sol.GetEndpointChainID
pMGR.EndpointChainIDHandlers[basetype.ChainType_Ethereum] = common_eth.CheckEndpointChainID
pMGR.EndpointChainIDHandlers[basetype.ChainType_Solana] = common_sol.CheckEndpointChainID
}

func GetIndexMGR() *indexMGR {
Expand All @@ -57,17 +59,17 @@ func GetIndexMGR() *indexMGR {

func (pmgr *indexMGR) Run(ctx context.Context) {
for {
pmgr.checkNewEndpoints(ctx, basetype.EndpointState_EndpointDefault)
pmgr.checkNewEndpoints(ctx, basetype.EndpointState_EndpointAvaliable)
pmgr.checkNewEndpoints(ctx, basetype.EndpointState_EndpointError)
pmgr.checkNewEndpoints(ctx, basetype.EndpointState_EndpointUnstable)
pmgr.checkAvaliableEndpoints(ctx)
pmgr.checkEndpoints(ctx, basetype.EndpointState_EndpointDefault)
pmgr.checkEndpoints(ctx, basetype.EndpointState_EndpointAvailable)
pmgr.checkEndpoints(ctx, basetype.EndpointState_EndpointError)
pmgr.checkEndpoints(ctx, basetype.EndpointState_EndpointUnstable)
pmgr.checkAvailableEndpoints(ctx)
<-time.NewTicker(UpdateInterval).C
}
}

// check for the newly created endpoints
func (pmgr *indexMGR) checkNewEndpoints(ctx context.Context, state basetype.EndpointState) {
func (pmgr *indexMGR) checkEndpoints(ctx context.Context, state basetype.EndpointState) {
conds := &endpoint.Conds{
State: &web3eye.Uint32Val{
Op: "eq",
Expand Down Expand Up @@ -98,12 +100,13 @@ func (pmgr *indexMGR) checkNewEndpoints(ctx context.Context, state basetype.Endp

chainID, err := handler(ctx, info.Address)
if err != nil {
logger.Sugar().Errorf("endpoint %v not available, err: %v", info.ID, err)
info.State = basetype.EndpointState_EndpointError
return
}

info.ChainID = chainID
info.State = basetype.EndpointState_EndpointAvaliable
info.State = basetype.EndpointState_EndpointAvailable
}()

updateInfos = append(updateInfos, &endpoint.EndpointReq{
Expand Down Expand Up @@ -134,11 +137,11 @@ func (pmgr *indexMGR) checkNewEndpoints(ctx context.Context, state basetype.Endp
}

// check erver chantype-chainid available endpoints and update it to indexer
func (pmgr *indexMGR) checkAvaliableEndpoints(ctx context.Context) {
func (pmgr *indexMGR) checkAvailableEndpoints(ctx context.Context) {
conds := &endpoint.Conds{
State: &web3eye.Uint32Val{
Op: "eq",
Value: uint32(basetype.EndpointState_EndpointAvaliable),
Op: cruder.EQ,
Value: uint32(basetype.EndpointState_EndpointAvailable),
},
}

Expand All @@ -159,6 +162,18 @@ func (pmgr *indexMGR) checkAvaliableEndpoints(ctx context.Context) {
endpointGroups[info.ChainType][info.ChainID] = []string{}
}
endpointGroups[info.ChainType][info.ChainID] = append(endpointGroups[info.ChainType][info.ChainID], info.Address)
if info.RPS == 0 {
info.RPS = 1
}

err = chains.GetEndpintIntervalMGR().GoAheadEndpoint(&chains.EndpointInterval{
Address: info.Address,
MinInterval: time.Second / time.Duration(info.RPS),
MaxInterval: time.Minute,
})
if err != nil {
logger.Sugar().Warnw("checkAvailableEndpoints", "Msg", "failed to put endpoints to redis", "Error", err)
}
}

// check if have no endpoints,will be stop
Expand Down
34 changes: 0 additions & 34 deletions block-etl/pkg/chains/eth/check.go

This file was deleted.

2 changes: 1 addition & 1 deletion block-etl/pkg/chains/eth/price.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (e *EthIndexer) IndexOrder(ctx context.Context, logs []*types.Log) ([]*Cont
}
}

_, err := orderNMCli.CreateOrders(ctx, &order.CreateOrdersRequest{Infos: ordersReq})
_, err := orderNMCli.UpsertOrders(ctx, &order.UpsertOrdersRequest{Infos: ordersReq})
if err != nil {
return nil, fmt.Errorf("failed store orders to db,err: %v", err)
}
Expand Down
37 changes: 26 additions & 11 deletions block-etl/pkg/chains/eth/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package eth

import (
"context"
"fmt"
"time"

"github.com/NpoolPlatform/go-service-framework/pkg/logger"
Expand All @@ -12,9 +13,9 @@ import (
)

const (
CheckTopicInterval = time.Second * 10
CheckTopicInterval = time.Second * 5
FindContractCreator = false
redisExpireDefaultTime = time.Second * 10
redisExpireDefaultTime = time.Second * 5
)

type EthIndexer struct {
Expand Down Expand Up @@ -43,60 +44,68 @@ func (e *EthIndexer) IndexBlock(ctx context.Context, taskBlockNum chan uint64) {
for {
select {
case num := <-taskBlockNum:
logger.Sugar().Infow("IndexBlock", "BlockNum", num, "DebugMsg", "start to parse")
block, err := e.CheckBlock(ctx, num)
if err != nil {
logger.Sugar().Errorw("IndexBlock", "BlockNum", num, "Error", err)
continue
}

if block.ParseState == basetype.BlockParseState_BlockTypeFinish {
if block.ParseState != basetype.BlockParseState_BlockTypeStart {
continue
}

err = func() error {
err := e.checkOkEndpoints()
if err != nil {
return err
}
logger.Sugar().Infow("IndexBlock", "BlockNum", num, "DebugMsg", "start IndexBlockLogs")

blockLogs, err := e.IndexBlockLogs(ctx, block.BlockNumber)
if err != nil {
return err
}
logger.Sugar().Infow("IndexBlock", "BlockNum", num, "DebugMsg", "start IndexTransfer")

filteredT1, err := e.IndexTransfer(ctx, blockLogs.TransferLogs, block.BlockTime)
if err != nil {
return err
}
logger.Sugar().Infow("IndexBlock", "BlockNum", num, "DebugMsg", "start IndexToken")

contractT1, err := e.IndexToken(ctx, filteredT1)
if err != nil {
return err
}
logger.Sugar().Infow("IndexBlock", "BlockNum", num, "DebugMsg", "start IndexContract")

err = e.IndexContract(ctx, contractT1, FindContractCreator)
if err != nil {
return err
}
logger.Sugar().Infow("IndexBlock", "BlockNum", num, "DebugMsg", "start IndexOrder")

contractT2, err := e.IndexOrder(ctx, blockLogs.OrderLogs)
if err != nil {
return err
}

logger.Sugar().Infow("IndexBlock", "BlockNum", num, "DebugMsg", "start order IndexContract")
err = e.IndexContract(ctx, contractT2, FindContractCreator)
if err != nil {
return err
}
return nil
}()

if err != nil {
logger.Sugar().Errorw("IndexBlock", "BlockNum", num, "Error", err)
}

remark := ""
parseState := basetype.BlockParseState_BlockTypeFinish
if err != nil {
logger.Sugar().Errorw("IndexBlock", "BlockNum", num, "Error", err)
remark = err.Error()
parseState = basetype.BlockParseState_BlockTypeFailed
}

logger.Sugar().Infow("IndexBlock", "BlockNum", num, "DebugMsg", "start order UpdateBlock")
_, err = blockNMCli.UpdateBlock(ctx, &blockProto.UpdateBlockRequest{
Info: &blockProto.BlockReq{
ID: &block.ID,
Expand All @@ -117,11 +126,17 @@ func (e *EthIndexer) OnNoAvalibleEndpoints(event func()) {
e.ONAEEvents = append(e.ONAEEvents, event)
}

func (e *EthIndexer) UpdateEndpoints(endpoints []string) {
e.OkEndpoints = endpoints
func (e *EthIndexer) checkOkEndpoints() error {
if len(e.OkEndpoints) == 0 {
for _, v := range e.ONAEEvents {
v()
}
return fmt.Errorf("have no available endpoints")
}
return nil
}

func (e *EthIndexer) UpdateEndpoints(endpoints []string) {
e.OkEndpoints = endpoints
_ = e.checkOkEndpoints()
}
Loading
Loading