Skip to content

Commit

Permalink
Base idle (#48)
Browse files Browse the repository at this point in the history
* update SubmitIdleMetadata

* update p2p to v0.0.20

* update p2p to v0.0.21

* update QueryTeeInfoList
  • Loading branch information
AstaFrode committed May 16, 2023
1 parent 4ecca75 commit bfe70dc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,6 @@ func reconnectChainClient(rpcAddr []string) (*gsrpc.SubstrateAPI, error) {
return api, err
}

func createPrefixedKey(method, prefix string) []byte {
return append(xxhash.New128([]byte(prefix)).Sum(nil), xxhash.New128([]byte(method)).Sum(nil)...)
func createPrefixedKey(pallet, method string) []byte {
return append(xxhash.New128([]byte(pallet)).Sum(nil), xxhash.New128([]byte(method)).Sum(nil)...)
}
5 changes: 4 additions & 1 deletion core/chain/tee.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package chain

import (
"fmt"
"log"

"github.com/CESSProject/sdk-go/core/utils"
Expand Down Expand Up @@ -56,15 +57,17 @@ func (c *chainClient) QueryTeeInfoList() ([]TeeWorkerInfo, error) {
if err != nil {
return list, errors.Wrap(err, "[GetKeysLatest]")
}

set, err := c.api.RPC.State.QueryStorageAtLatest(keys)
if err != nil {
return list, errors.Wrap(err, "[QueryStorageAtLatest]")
}

for _, elem := range set {
for _, change := range elem.Changes {
var teeWorker TeeWorkerInfo
if err := codec.Decode(change.StorageData, &teeWorker); err != nil {
println(err)
fmt.Println(err)
continue
}
list = append(list, teeWorker)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/CESSProject/sdk-go
go 1.19

require (
github.com/CESSProject/p2p-go v0.0.20
github.com/CESSProject/p2p-go v0.0.21
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/cbergoon/merkletree v0.2.0
github.com/centrifuge/go-substrate-rpc-client/v4 v4.0.12
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSu
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CESSProject/p2p-go v0.0.20 h1:lu8QXaDtWssOkfcu7rF33LOFgGCZ01bnNIYSEdP9w8c=
github.com/CESSProject/p2p-go v0.0.20/go.mod h1:Ur2x/oD/oxteLGrEQ1hK3ZZwEZ3H8ta3cLP2zFxB96Y=
github.com/CESSProject/p2p-go v0.0.21 h1:ZRNIwufHU6x4Kzryt3dZNaDWrnR0baeoJYZGZJaLl6w=
github.com/CESSProject/p2p-go v0.0.21/go.mod h1:Ur2x/oD/oxteLGrEQ1hK3ZZwEZ3H8ta3cLP2zFxB96Y=
github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM=
github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
Expand Down

0 comments on commit bfe70dc

Please sign in to comment.