Skip to content

Commit

Permalink
Fix 079 reg (#243)
Browse files Browse the repository at this point in the history
* update for 0.7.10

* update go mod
  • Loading branch information
AstaFrode authored Feb 22, 2024
1 parent 30c5ae5 commit 5439787
Show file tree
Hide file tree
Showing 14 changed files with 396 additions and 262 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ If you are using the test network, Please join the [CESS discord](https://discor
### Method one
Download the latest release of the binary application directly at:
```
wget https://github.com/CESSProject/cess-bucket/releases/download/v0.7.8/bucket0.7.8.linux-amd64.tar.gz
wget https://github.com/CESSProject/cess-bucket/releases/download/v0.7.10/bucket0.7.10.linux-amd64.tar.gz
```
### Method two
Compile the binary program from the storage node source code and follow the process as follows:
Expand Down
62 changes: 54 additions & 8 deletions cmd/console/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func runCmd(cmd *cobra.Command, args []string) {
if firstReg {
n.SetInitStage(node.Stage_Register, "[ok] Registering...")
stakingAcc := n.GetStakingAcc()
if stakingAcc != "" {
if stakingAcc != "" && stakingAcc != n.GetSignatureAcc() {
out.Ok(fmt.Sprintf("Specify staking account: %s", stakingAcc))
txhash, err := n.RegisterSminerAssignStaking(n.GetEarningsAcc(), n.GetPeerPublickey(), stakingAcc, spaceTiB)
if err != nil {
Expand Down Expand Up @@ -661,13 +661,59 @@ func runCmd(cmd *cobra.Command, args []string) {
if n.GetPodr2Key().Spk == nil || n.GetPodr2Key().Spk.N == nil {
buf, err := os.ReadFile(n.DataDir.Podr2PubkeyFile)
if err != nil {
out.Err(fmt.Sprintf("[ReadFile Podr2PubkeyFile] %v", err))
os.Exit(1)
}
err = n.SetPublickey(buf)
if err != nil {
out.Err("invalid podr2 public key in the file")
os.Exit(1)
var podr2PubkeyResponse *pb.Podr2PubkeyResponse
for i := 0; i < len(teeEndPointList); i++ {
delay = 30
suc = false
out.Tip(fmt.Sprintf("Will request master public key to %v", teeEndPointList[i]))
for tryCount := uint8(0); tryCount <= 3; tryCount++ {
if !strings.Contains(teeEndPointList[i], "443") {
dialOptions = []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
} else {
dialOptions = []grpc.DialOption{grpc.WithTransportCredentials(configs.GetCert())}
}
podr2PubkeyResponse, err = n.GetPodr2Pubkey(
teeEndPointList[i],
&pb.Request{StorageMinerAccountId: n.GetSignatureAccPulickey()},
time.Duration(time.Second*delay),
dialOptions,
nil,
)
if err != nil {
if strings.Contains(err.Error(), configs.Err_ctx_exceeded) {
delay += 30
continue
}
if strings.Contains(err.Error(), configs.Err_tee_Busy) {
delay += 10
continue
}
out.Err(fmt.Sprintf("[GetMasterPubkey] %v", err))
} else {
suc = true
}
break
}
if suc {
break
}
}
if suc && podr2PubkeyResponse != nil {
err = n.SetPublickey(podr2PubkeyResponse.Pubkey)
if err != nil {
out.Err("invalid podr2 public key from tee")
os.Exit(1)
}
} else {
out.Err("Unable to get podr2 public key from all tees, program exits.")
os.Exit(1)
}
} else {
err = n.SetPublickey(buf)
if err != nil {
out.Err("invalid podr2 public key in the file")
os.Exit(1)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion configs/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (
// Name is the name of the program
Name = "bucket"
// version
Version = "v0.7.9"
Version = "v0.7.10"
// Description is the description of the program
Description = "Storage node implementation in CESS networks"
// NameSpace is the cached namespace
Expand Down
40 changes: 18 additions & 22 deletions examples/calctag/calctag.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ import (
"fmt"
"log"
"os"
"strings"
"time"

"github.com/CESSProject/cess-bucket/configs"
"github.com/CESSProject/cess-bucket/node"
sutils "github.com/CESSProject/cess-go-sdk/utils"
p2pgo "github.com/CESSProject/p2p-go"
"github.com/CESSProject/p2p-go/pb"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

const helpInfo string = `help information:
Expand Down Expand Up @@ -88,23 +83,24 @@ func main() {
log.Println("[CalcSHA256] ", err)
os.Exit(1)
}
var requestGenTag = &pb.RequestGenTag{
FragmentData: buf,
FragmentName: "",
CustomData: hash,
FileName: "",
}
var dialOptions []grpc.DialOption
if !strings.Contains(tee, "443") {
dialOptions = []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
} else {
dialOptions = []grpc.DialOption{grpc.WithTransportCredentials(configs.GetCert())}
}
_, err = n.RequestGenTag(tee, requestGenTag, time.Duration(time.Minute*10), dialOptions, nil)
if err != nil {
log.Println("[RequestGenTag] ", err)
os.Exit(1)
}
_ = hash
// var requestGenTag = &pb.RequestGenTag{
// FragmentData: buf,
// FragmentName: "",
// CustomData: hash,
// FileName: "",
// }
// var dialOptions []grpc.DialOption
// if !strings.Contains(tee, "443") {
// dialOptions = []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
// } else {
// dialOptions = []grpc.DialOption{grpc.WithTransportCredentials(configs.GetCert())}
// }
// _, err = n.RequestGenTag(tee, requestGenTag, time.Duration(time.Minute*10), dialOptions, nil)
// if err != nil {
// log.Println("[RequestGenTag] ", err)
// os.Exit(1)
// }

log.Println("[RequestGenTag] suc")
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/AstaFrode/go-libp2p v0.26.4-0.20231113143058-912296254d44
github.com/CESSProject/cess-go-sdk v0.5.0
github.com/CESSProject/cess_pois v0.4.22
github.com/CESSProject/p2p-go v0.3.0
github.com/CESSProject/p2p-go v0.3.2
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.1
github.com/gin-contrib/cors v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ github.com/CESSProject/cess_pois v0.4.22 h1:RxQRg8A3z79mt19Jb5yd39lIjBSWKBih1KLI
github.com/CESSProject/cess_pois v0.4.22/go.mod h1:rztEZjjG+MbKzVgh5WtQcZc/7ZDkBvDNABc7Em8BKPc=
github.com/CESSProject/go-keyring v0.0.0-20220614131247-ee3a8da30fde h1:5MDRjjtg6PEhqyVjupwaapN96cOZiddOGAYwKQeaTu0=
github.com/CESSProject/go-keyring v0.0.0-20220614131247-ee3a8da30fde/go.mod h1:RUXBd3ROP98MYepEEa0Y0l/T0vQlIKqFJxI/ocdnRLM=
github.com/CESSProject/p2p-go v0.3.0 h1:PdwbLBri3qYwIHxaG4BHHS3ETH1BlVRCnBG87jr5cQg=
github.com/CESSProject/p2p-go v0.3.0/go.mod h1:SMwJt5Zpk98k+d2J5gsN+0Forr7MbqOYWbHLd3mBLrI=
github.com/CESSProject/p2p-go v0.3.2 h1:l0x/TneDZfirKqFZev+9zRFFQ29RHgbc4GNX2VpLWwM=
github.com/CESSProject/p2p-go v0.3.2/go.mod h1:SMwJt5Zpk98k+d2J5gsN+0Forr7MbqOYWbHLd3mBLrI=
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/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
Expand Down
Loading

0 comments on commit 5439787

Please sign in to comment.