Skip to content

Commit

Permalink
adapt to cess 0.7.6 (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode committed Jan 31, 2024
1 parent 62e8810 commit e26c85d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
3 changes: 1 addition & 2 deletions configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "time"
// account
const (
// CESS token precision
CESSTokenPrecision = 1_000_000_000_000
CESSTokenPrecision = 1_000_000_000_000_000_000
// MinimumBalance is the minimum balance required for the program to run
// The unit is pico
MinimumBalance = 2 * CESSTokenPrecision
Expand All @@ -24,7 +24,6 @@ const (
Header_BucketName = "BucketName"
Header_Account = "Account"
Header_Operation = "Operation"
TokenDated = 60 * 60 * 24 * 30
)

const FileCacheExpirationTime = 720
Expand Down
2 changes: 1 addition & 1 deletion configs/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
// Name space
NameSpace = Name
// version
Version = Name + " " + "v0.3.5 pre-release"
Version = Name + " " + "v0.3.5"
// description
Description = "Object storage service based on CESS network"
)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ go 1.20

require (
github.com/AstaFrode/go-libp2p v0.26.4-0.20231113143058-912296254d44
github.com/CESSProject/cess-go-sdk v0.4.22
github.com/CESSProject/cess-go-sdk v0.5.0
github.com/CESSProject/go-keyring v0.0.0-20220614131247-ee3a8da30fde
github.com/CESSProject/p2p-go v0.2.11
github.com/CESSProject/p2p-go v0.3.0
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.2.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ github.com/AstaFrode/go-peertaskqueue v0.8.2-0.20231108073729-990e433425a4 h1:fu
github.com/AstaFrode/go-peertaskqueue v0.8.2-0.20231108073729-990e433425a4/go.mod h1:0YcQDsyTRKBTK9yE22DQgiwQndGFvenqMvD6Spkxl28=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/CESSProject/cess-go-sdk v0.4.22 h1:d9xnRHaaudntJEHy0cCXysuNfj+cfvfdOs3QsLnF21o=
github.com/CESSProject/cess-go-sdk v0.4.22/go.mod h1:IamF02Ng+FQvThFbQRtpEpPzmlPOXqQzgaF9YDE0YhY=
github.com/CESSProject/cess-go-sdk v0.5.0 h1:N87Trs+Btt3mftpRxMt7ZeI7va4v/SaT4OiZxi00KA4=
github.com/CESSProject/cess-go-sdk v0.5.0/go.mod h1:IamF02Ng+FQvThFbQRtpEpPzmlPOXqQzgaF9YDE0YhY=
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.2.11 h1:2o1YzM1YcJhVsZYLAuyWKJ4ib3WA3Qpt6pllVlmKzik=
github.com/CESSProject/p2p-go v0.2.11/go.mod h1:SMwJt5Zpk98k+d2J5gsN+0Forr7MbqOYWbHLd3mBLrI=
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/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
16 changes: 15 additions & 1 deletion node/putHandle.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (n *Node) putHandle(c *gin.Context) {
}

if filename == "" {
filename = "null.ces"
filename = "null"
}

if len(filename) < 3 {
Expand Down Expand Up @@ -410,6 +410,20 @@ func (n *Node) putHandle(c *gin.Context) {
return
}

txhash, err := n.GenerateStorageOrder(
roothash,
recordInfo.SegmentInfo,
recordInfo.Owner,
recordInfo.Filename,
recordInfo.Buckname,
recordInfo.Filesize,
)
if err != nil {
n.Upfile("err", fmt.Sprintf("[%s] GenerateStorageOrder failed, tx: %s err: %v", roothash, txhash, err))
} else {
n.Upfile("info", fmt.Sprintf("[%s] GenerateStorageOrder suc: %s", roothash, txhash))
}

n.Upfile("info", fmt.Sprintf("[%v] [%s] uploaded successfully", clientIp, roothash))
c.JSON(http.StatusOK, roothash)
}
Expand Down
3 changes: 2 additions & 1 deletion node/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ func (n *Node) trackFile(trackfile string) error {
if err != nil {
return errors.Wrapf(err, "[%s] [%s] [GenerateStorageOrder]", txhash, roothash)
}
time.Sleep(pattern.BlockInterval * 2)
n.Track("info", fmt.Sprintf("[%s] GenerateStorageOrder: %s", roothash, txhash))
time.Sleep(pattern.BlockInterval * 3)
storageOrder, err = n.QueryStorageOrder(roothash)
if err != nil {
return errors.Wrapf(err, "[%s] [QueryStorageOrder]", roothash)
Expand Down

0 comments on commit e26c85d

Please sign in to comment.