7
7
"golang.org/x/crypto/blake2b"
8
8
9
9
"github.com/iotaledger/hive.go/crypto/ed25519"
10
+ "github.com/iotaledger/hive.go/ierrors"
10
11
"github.com/iotaledger/hive.go/lo"
11
12
"github.com/iotaledger/hive.go/runtime/ioutils"
12
13
"github.com/iotaledger/hive.go/runtime/options"
@@ -41,8 +42,10 @@ type BasicOutputYaml struct {
41
42
}
42
43
43
44
type ConfigYaml struct {
44
- NetworkName string `yaml:"networkName"`
45
- Bech32HRP string `yaml:"bech32Hrp"`
45
+ NetworkName string `yaml:"networkName"`
46
+ Bech32HRP string `yaml:"bech32Hrp"`
47
+ TargetCommitteeSize uint8 `yaml:"targetCommitteeSize"`
48
+ SlotsPerEpochExponent uint8 `yaml:"slotsPerEpochExponent"`
46
49
47
50
FilePath string `yaml:"filepath"`
48
51
@@ -51,19 +54,19 @@ type ConfigYaml struct {
51
54
BasicOutputs []BasicOutputYaml `yaml:"basicOutputs"`
52
55
}
53
56
54
- func TestnetProtocolParameters (networkName string , bech32HRP iotago.NetworkPrefix ) iotago.ProtocolParameters {
57
+ func TestnetProtocolParameters (networkName string , bech32HRP iotago.NetworkPrefix , targetCommitteeSize uint8 , slotsPerEpochExponent uint8 ) iotago.ProtocolParameters {
55
58
return iotago .NewV3SnapshotProtocolParameters (
56
59
iotago .WithNetworkOptions (networkName , bech32HRP ),
57
60
iotago .WithStorageOptions (100 , 1 , 100 , 1000 , 1000 , 1000 ),
58
61
iotago .WithWorkScoreOptions (500 , 110_000 , 7_500 , 40_000 , 90_000 , 50_000 , 40_000 , 70_000 , 5_000 , 15_000 ),
59
- iotago .WithTimeProviderOptions (0 , time .Now ().Unix (), 10 , 8 ),
62
+ iotago .WithTimeProviderOptions (0 , time .Now ().Unix (), 10 , slotsPerEpochExponent ),
60
63
iotago .WithLivenessOptions (10 , 15 , 4 , 7 , 100 ),
61
64
iotago .WithSupplyOptions (4600000000000000 , 63 , 1 , 17 , 32 , 21 , 70 ),
62
65
iotago .WithCongestionControlOptions (1 , 1 , 1 , 400_000_000 , 250_000_000 , 50_000_000 , 1000 , 100 ),
63
66
iotago .WithStakingOptions (3 , 10 , 10 ),
64
67
iotago .WithVersionSignalingOptions (7 , 5 , 7 ),
65
68
iotago .WithRewardsOptions (8 , 11 , 2 , 384 ),
66
- iotago .WithTargetCommitteeSize (16 ),
69
+ iotago .WithTargetCommitteeSize (targetCommitteeSize ),
67
70
iotago .WithChainSwitchingThreshold (10 ),
68
71
)
69
72
}
@@ -74,8 +77,16 @@ func GenerateFromYaml(hostsFile string) ([]options.Option[snapshotcreator.Option
74
77
return nil , err
75
78
}
76
79
77
- fmt .Printf ("generating protocol parameters for network %s with bech32HRP %s\n " , configYaml .NetworkName , configYaml .Bech32HRP )
78
- protocolParams := TestnetProtocolParameters (configYaml .NetworkName , iotago .NetworkPrefix (configYaml .Bech32HRP ))
80
+ if configYaml .TargetCommitteeSize == 0 {
81
+ return nil , ierrors .Errorf ("targetCommitteeSize must be greater than 0" )
82
+ }
83
+
84
+ if configYaml .SlotsPerEpochExponent == 0 {
85
+ return nil , ierrors .Errorf ("slotsPerEpochExponent must be greater than 0" )
86
+ }
87
+
88
+ fmt .Printf ("generating protocol parameters for network: %s, bech32HRP: %s, targetCommitteeSize: %d, slotsPerEpochExponent: %d\n " , configYaml .NetworkName , configYaml .Bech32HRP , configYaml .TargetCommitteeSize , configYaml .SlotsPerEpochExponent )
89
+ protocolParams := TestnetProtocolParameters (configYaml .NetworkName , iotago .NetworkPrefix (configYaml .Bech32HRP ), configYaml .TargetCommitteeSize , configYaml .SlotsPerEpochExponent )
79
90
80
91
accounts := make ([]snapshotcreator.AccountDetails , 0 , len (configYaml .Validators )+ len (configYaml .BlockIssuers ))
81
92
for _ , validator := range configYaml .Validators {
0 commit comments