ovrclk / akash

@@ -1,6 +1,9 @@
Loading
1 1
package v1beta2
2 2
3 -
import "github.com/ovrclk/akash/types/unit"
3 +
import (
4 +
	"github.com/ovrclk/akash/types/unit"
5 +
	"github.com/ovrclk/akash/validation/constants"
6 +
)
4 7
5 8
// This is the validation configuration that acts as a hard limit
6 9
// on what the network accepts for deployments. This is never changed
@@ -14,7 +17,7 @@
Loading
14 17
	MaxUnitMemory uint64
15 18
	// MaxUnitStorage is the maximum number of bytes of storage that a unit can consume
16 19
	MaxUnitStorage uint64
17 -
	// MaxUnitCount is the maximum number of replias of a service
20 +
	// MaxUnitCount is the maximum number of replicas of a service
18 21
	MaxUnitCount uint
19 22
	// MaxUnitPrice is the maximum price that a unit can have
20 23
	MaxUnitPrice uint64
@@ -35,6 +38,8 @@
Loading
35 38
	MaxGroupMemory uint64
36 39
	// MaxGroupStorage is the maximum total amount of storage requested per group
37 40
	MaxGroupStorage uint64
41 +
	// MaxGroupVolumes is the maximum amount of volumes per group
42 +
	MaxGroupVolumes int
38 43
}
39 44
40 45
var validationConfig = ValidationConfig{
@@ -55,6 +60,7 @@
Loading
55 60
	MaxGroupCPU:     512 * 1000,
56 61
	MaxGroupMemory:  1024 * unit.Gi,
57 62
	MaxGroupStorage: 32 * unit.Ti,
63 +
	MaxGroupVolumes: constants.MaxGroupVolumes,
58 64
}
59 65
60 66
func GetValidationConfig() ValidationConfig {

@@ -129,6 +129,10 @@
Loading
129 129
		return nil, errors.Errorf("error: invalid unit storage, cannot be nil")
130 130
	}
131 131
132 +
	if len(u) > validationConfig.MaxGroupVolumes {
133 +
		return nil, errors.Errorf("error: invalid amount of volumes (%v > %v)", len(u), validationConfig.MaxGroupVolumes)
134 +
	}
135 +
132 136
	storage := make([]sdk.Int, 0, len(u))
133 137
134 138
	for i := range u {

@@ -11,6 +11,7 @@
Loading
11 11
	"github.com/ovrclk/akash/manifest"
12 12
	providerUtil "github.com/ovrclk/akash/provider/cluster/util"
13 13
	types "github.com/ovrclk/akash/types/v1beta2"
14 +
	"github.com/ovrclk/akash/validation/constants"
14 15
	dtypes "github.com/ovrclk/akash/x/deployment/types/v1beta2"
15 16
)
16 17
@@ -419,6 +420,10 @@
Loading
419 420
			}
420 421
421 422
			// validate storage's attributes and parameters
423 +
			if len(compute.Resources.Storage) > constants.MaxGroupVolumes {
424 +
				return errors.Errorf("sdl: compute.storage exceeds maximum amount of volumes (%v > %v)", compute.Resources.Storage, constants.MaxGroupVolumes)
425 +
			}
426 +
422 427
			volumes := make(map[string]v2ResourceStorage)
423 428
			for _, volume := range compute.Resources.Storage {
424 429
				// making deepcopy here as we gonna merge compute attributes and service parameters for validation below
Files Coverage
app 77.28%
client 2.84%
cmd 8.67%
deploy/cmd 0.00%
events 7.36%
manifest 80.95%
provider 33.53%
pubsub 89.18%
sdkutil 38.33%
sdl 71.22%
testutil 90.67%
types 28.34%
util 43.11%
x 37.72%
docgen/main.go 0.00%
integration/test_helpers.go 5.40%
validation/manifest.go 94.78%
Project Totals (357 files) 38.25%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading