Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ jobs:
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
deploy_report_page: true
archive_results: true
run_flaky_tests: true
run_api_system_tests: true
run_flaky_tests: false
run_api_system_tests: false
run_cli_system_tests: true
run_tenderly_tests: false
run_tokenomics_system_tests: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly-staging-tenderly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ concurrency:
cancel-in-progress: true
on:
schedule:
# Runs every two days at 6am UTC
- cron: '0 6 */2 * *'
# Runs every five days at 6am UTC
- cron: '0 6 */5 * *'
workflow_dispatch:

jobs:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ warp-*_output.txt
warp
minio
mc
store
store
s3mgrt
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.0

require (
github.com/0chain/errors v1.0.3
github.com/0chain/gosdk v1.18.13-0.20241209154844-07366a2c2666
github.com/0chain/gosdk v1.18.14
github.com/go-resty/resty/v2 v2.7.0
github.com/herumi/bls-go-binary v1.31.0
github.com/shopspring/decimal v1.3.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/0chain/common v1.18.3 h1:42dYOv2KyMTSanuS67iDtfv+ErbSRqR8NJ3MG72MwaI=
github.com/0chain/common v1.18.3/go.mod h1:Lapu2Tj7z5Sm4r+X141e7vsz4NDODTEypeElYAP3iSw=
github.com/0chain/errors v1.0.3 h1:QQZPFxTfnMcRdt32DXbzRQIfGWmBsKoEdszKQDb0rRM=
github.com/0chain/errors v1.0.3/go.mod h1:xymD6nVgrbgttWwkpSCfLLEJbFO6iHGQwk/yeSuYkIc=
github.com/0chain/gosdk v1.18.13-0.20241209154844-07366a2c2666 h1:xnvnaDeuMFadWR4bM0iiXm7CArjt8V9aBsdx3xcevDs=
github.com/0chain/gosdk v1.18.13-0.20241209154844-07366a2c2666/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw=
github.com/0chain/gosdk v1.18.14 h1:N/PwLmUVQe1qM0eDuEDSQRB97a03Fp+I5W67cF0Zgsw=
github.com/0chain/gosdk v1.18.14/go.mod h1:8unFy9Dx2YyPKMYPDGR3MFhUEymbAfQcRDm9bobVLGw=
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/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
Expand Down
18 changes: 18 additions & 0 deletions internal/api/model/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ func NewRegisterBlobberTransactionData(scRegisterBlobberRequest *StorageNode) Tr
}
}

func NewKillBlobberTransactionData(killBlobberRequest *KillBlobberRequest) TransactionData {
return TransactionData{
Name: "kill_blobber",
Input: *killBlobberRequest,
}
}

func NewCreateFreeAllocationTransactionData(scRestGetFreeAllocationBlobbersResponse *SCRestGetFreeAllocationBlobbersResponse) TransactionData {
return TransactionData{
Name: "free_allocation_request",
Expand Down Expand Up @@ -507,6 +514,7 @@ type BlobberRequirements struct {
ExpirationDate int64 `json:"expiration_date"`
ReadPriceRange PriceRange `json:"read_price_range"`
WritePriceRange PriceRange `json:"write_price_range"`
StorageVersion int64 `json:"storage_version"`
}

type PriceRange struct {
Expand Down Expand Up @@ -630,6 +638,10 @@ type SCRestGetBlobberResponse struct {
ReadData int64 `json:"read_data"`
ChallengesPassed int64 `json:"challenges_passed"`
ChallengesCompleted int64 `json:"challenges_completed"`

//todo:
StorageVersion int64 `json:"storage_version"`
ManagingWallet string `json:"managing_wallet"`
}

type SCRestGetBlobbersResponse struct {
Expand Down Expand Up @@ -670,6 +682,10 @@ type FreeAllocationRequest struct {
Marker string `json:"marker,omitempty"`
}

type KillBlobberRequest struct {
ProviderID string `json:"provider_id,omitempty"`
}

type SCRestGetAllocationResponse struct {
ID string `json:"id"`
Tx string `json:"tx"`
Expand Down Expand Up @@ -712,6 +728,8 @@ type StorageNode struct {
LastHealthCheck int64 `json:"last_health_check"`
PublicKey string `json:"-"`
StakePoolSettings StakePoolSettings `json:"stake_pool_settings"`
StorageVersion int64 `json:"storage_version"`
ManagingWallet string `json:"managing_wallet"`
}

type StorageNodeGeolocation struct {
Expand Down
1 change: 1 addition & 0 deletions internal/api/model/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ func DefaultBlobberRequirements(id, publicKey string) BlobberRequirements {
},
OwnerId: id,
OwnerPublicKey: publicKey,
StorageVersion: 1,
}
}
67 changes: 66 additions & 1 deletion internal/api/util/client/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,8 @@ func (c *APIClient) RegisterBlobber(t *test.SystemTest,
wallet *model.Wallet,
storageNode *model.StorageNode,
requiredTransactionStatus int,
expectedResponse string) string {
expectedResponse string,
requireIdVerification bool) string {
t.Log("Registering blobber...")

registerBlobberTransactionPutResponse, resp, err := c.V1TransactionPut(
Expand Down Expand Up @@ -954,6 +955,18 @@ func (c *APIClient) RegisterBlobber(t *test.SystemTest,
return false
}

if requireIdVerification {
var storageNode model.StorageNode

// Unmarshal the JSON string into the StorageNode struct
err := json.Unmarshal([]byte(registerBlobberTransactionGetConfirmationResponse.Transaction.TransactionOutput), &storageNode)
if err != nil {
t.Log("Error unmarshalling JSON:", err)
return false
}
return registerBlobberTransactionGetConfirmationResponse.Status == requiredTransactionStatus && storageNode.ID == expectedResponse
}

return registerBlobberTransactionGetConfirmationResponse.Status == requiredTransactionStatus && registerBlobberTransactionGetConfirmationResponse.Transaction.TransactionOutput == expectedResponse
})

Expand All @@ -962,6 +975,58 @@ func (c *APIClient) RegisterBlobber(t *test.SystemTest,
return registerBlobberTransactionPutResponse.Entity.Hash
}

func (c *APIClient) KillBlobber(t *test.SystemTest,
wallet *model.Wallet,
killBlobberRequest *model.KillBlobberRequest,
requiredTransactionStatus int) string {
t.Log("Killing blobber...")

killBlobberTransactionPutResponse, resp, err := c.V1TransactionPut(
t,
model.InternalTransactionPutRequest{
Wallet: wallet,
ToClientID: StorageSmartContractAddress,
TransactionData: model.NewKillBlobberTransactionData(killBlobberRequest),
Value: tokenomics.IntToZCN(0),
TxnType: SCTxType,
},
HttpOkStatus)
require.Nil(t, err)
require.NotNil(t, resp)
require.NotNil(t, killBlobberTransactionPutResponse)

var killBlobberTransactionGetConfirmationResponse *model.TransactionGetConfirmationResponse

wait.PoolImmediately(t, time.Minute*2, func() bool {
killBlobberTransactionGetConfirmationResponse, resp, err = c.V1TransactionGetConfirmation(
t,
model.TransactionGetConfirmationRequest{
Hash: killBlobberTransactionPutResponse.Entity.Hash,
},
HttpOkStatus)

if err != nil {
t.Log("Error killing blobber : ", err)
return false
}

if resp == nil {
fmt.Println("got nil response : ", resp)
return false
}

if killBlobberTransactionGetConfirmationResponse == nil {
fmt.Println("got nil txn confirmation response : ", killBlobberTransactionGetConfirmationResponse)
return false
}

return killBlobberTransactionGetConfirmationResponse.Status == requiredTransactionStatus
})

wallet.IncNonce()
return killBlobberTransactionPutResponse.Entity.Hash
}

func (c *APIClient) CreateFreeAllocation(t *test.SystemTest,
wallet *model.Wallet,
scRestGetFreeAllocationBlobbersResponse *model.SCRestGetFreeAllocationBlobbersResponse,
Expand Down
16 changes: 16 additions & 0 deletions internal/api/util/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,23 @@ type Config struct {
BlobberOwnerWalletMnemonics string `yaml:"blobber_owner_wallet_mnemonics"`
OwnerWalletMnemonics string `yaml:"owner_wallet_mnemonics"`
DropboxAccessToken string `yaml:"dropboxAccessToken"`
DropboxRefreshToken string `yaml:"dropboxRefreshToken"`
GdriveAccessToken string `yaml:"gdriveAccessToken"`
GdriveRefreshToken string `yaml:"gdriveRefreshToken"`
ConnectionString string `yaml:"connectionString"`
AccountName string `yaml:"accountName"`
ContainerName string `yaml:"container"`
AzureAccessKey string `yaml:"azureAccessKey"`
GoogleCloudAccessToken string `yaml:"googleCloudAccessToken"`
GoogleCloudRefreshToken string `yaml:"googleCloudRefreshToken"`
GoogleClientId string `yaml:"googleClientId"`
GoogleClientSecret string `yaml:"googleClientSecret"`
OneDriveAccessToken string `yaml:"oneDriveAccessToken"`
OneDriveRefreshToken string `yaml:"oneDriveRefreshToken"`
BoxAccessToken string `yaml:"boxAccessToken"`
BoxRefreshToken string `yaml:"boxRefreshToken"`
BoxClientId string `yaml:"boxClientId"`
BoxClientSecret string `yaml:"boxClientSecret"`
}

func Parse(configPath string) *Config {
Expand Down
7 changes: 1 addition & 6 deletions internal/cli/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,6 @@ type Terms struct {
WritePrice int64 `json:"write_price"`
}

type Settings struct {
Delegate_wallet string `json:"delegate_wallet"`
Num_delegates int `json:"num_delegates"`
Service_charge float64 `json:"service_charge"`
}

type BlobberInfo struct {
Id string `json:"id"`
Url string `json:"url"`
Expand Down Expand Up @@ -380,6 +374,7 @@ type BlobberDetails struct {
IsShutdown bool `json:"is_shutdown"`
IsRestricted bool `json:"is_restricted"`
NotAvailable bool `json:"not_available"`
StorageVersion int64 `json:"storage_version"`
}

type Validator struct {
Expand Down
Loading
Loading