Documentation
¶
Index ¶
- func ApplyNetworkRulesPatch(rules *opera.Rules, patch NetworkRulesPatch) error
- func DeriveValidatorKey(id int) (privKeyHex string, pubKey string, address string, err error)
- func GenerateJsonGenesis(jsonFile string, validatorStakes []uint64, rules *opera.Rules, ...) error
- func ValidateNetworkRulesPatch(patch NetworkRulesPatch) error
- func WriteValidatorKeystore(privKeyHex, datastoreDir string) error
- type BigIntValue
- type BlocksPatch
- type DagPatch
- type Duration
- type EconomyPatch
- type EmitterPatch
- type EpochsPatch
- type GasPatch
- type GasPowerPatch
- type NetworkRulesPatch
- type UpgradesPatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyNetworkRulesPatch ¶
func ApplyNetworkRulesPatch(rules *opera.Rules, patch NetworkRulesPatch) error
func DeriveValidatorKey ¶
DeriveValidatorKey derives a fake validator private key, pubkey and address from validator ID.
func GenerateJsonGenesis ¶
func GenerateJsonGenesis( jsonFile string, validatorStakes []uint64, rules *opera.Rules, clientVersions []string, ) error
GenerateJsonGenesis generates a genesis json file with the given number of validators and network rules configurations. The file is written to the given path.
Every node of a network imports the same file, so the parts of it that depend on the client version - currently the subsidies registry - are chosen to suit the oldest client of the network. The versions are the ones the clients report for themselves; see docker.ClientVersions.
func ValidateNetworkRulesPatch ¶
func ValidateNetworkRulesPatch(patch NetworkRulesPatch) error
func WriteValidatorKeystore ¶
WriteValidatorKeystore writes a validator key to a sonic-compatible keystore in datastoreDir.
Types ¶
type BigIntValue ¶
BigIntValue accepts YAML scalar values for big integers.
func (BigIntValue) MarshalJSON ¶
func (b BigIntValue) MarshalJSON() ([]byte, error)
func (BigIntValue) MarshalYAML ¶
func (b BigIntValue) MarshalYAML() (any, error)
func (*BigIntValue) UnmarshalJSON ¶
func (b *BigIntValue) UnmarshalJSON(data []byte) error
func (*BigIntValue) UnmarshalYAML ¶
func (b *BigIntValue) UnmarshalYAML(node *yaml.Node) error
type BlocksPatch ¶
type Duration ¶
Duration is a YAML/JSON helper for inter.Timestamp fields. It accepts either duration strings (e.g. "15s") or integer nanoseconds.
func NewDuration ¶
func (Duration) MarshalJSON ¶
type EconomyPatch ¶
type EconomyPatch struct {
BlockMissedSlack *uint64 `yaml:"BlockMissedSlack,omitempty" json:"BlockMissedSlack,omitempty"`
Gas *GasPatch `yaml:"Gas,omitempty" json:"Gas,omitempty"`
MinGasPrice *BigIntValue `yaml:"MinGasPrice,omitempty" json:"MinGasPrice,omitempty"`
MinBaseFee *BigIntValue `yaml:"MinBaseFee,omitempty" json:"MinBaseFee,omitempty"`
ShortGasPower *GasPowerPatch `yaml:"ShortGasPower,omitempty" json:"ShortGasPower,omitempty"`
LongGasPower *GasPowerPatch `yaml:"LongGasPower,omitempty" json:"LongGasPower,omitempty"`
}
type EmitterPatch ¶
type EpochsPatch ¶
type GasPatch ¶
type GasPatch struct {
MaxEventGas *uint64 `yaml:"MaxEventGas,omitempty" json:"MaxEventGas,omitempty"`
EventGas *uint64 `yaml:"EventGas,omitempty" json:"EventGas,omitempty"`
ParentGas *uint64 `yaml:"ParentGas,omitempty" json:"ParentGas,omitempty"`
ExtraDataGas *uint64 `yaml:"ExtraDataGas,omitempty" json:"ExtraDataGas,omitempty"`
BlockVotesBaseGas *uint64 `yaml:"BlockVotesBaseGas,omitempty" json:"BlockVotesBaseGas,omitempty"`
BlockVoteGas *uint64 `yaml:"BlockVoteGas,omitempty" json:"BlockVoteGas,omitempty"`
EpochVoteGas *uint64 `yaml:"EpochVoteGas,omitempty" json:"EpochVoteGas,omitempty"`
MisbehaviourProofGas *uint64 `yaml:"MisbehaviourProofGas,omitempty" json:"MisbehaviourProofGas,omitempty"`
}
type GasPowerPatch ¶
type GasPowerPatch struct {
AllocPerSec *uint64 `yaml:"AllocPerSec,omitempty" json:"AllocPerSec,omitempty"`
MaxAllocPeriod *Duration `yaml:"MaxAllocPeriod,omitempty" json:"MaxAllocPeriod,omitempty"`
StartupAllocPeriod *Duration `yaml:"StartupAllocPeriod,omitempty" json:"StartupAllocPeriod,omitempty"`
MinStartupGas *uint64 `yaml:"MinStartupGas,omitempty" json:"MinStartupGas,omitempty"`
}
type NetworkRulesPatch ¶
type NetworkRulesPatch struct {
Dag *DagPatch `yaml:"Dag,omitempty" json:"Dag,omitempty"`
Emitter *EmitterPatch `yaml:"Emitter,omitempty" json:"Emitter,omitempty"`
Epochs *EpochsPatch `yaml:"Epochs,omitempty" json:"Epochs,omitempty"`
Blocks *BlocksPatch `yaml:"Blocks,omitempty" json:"Blocks,omitempty"`
Economy *EconomyPatch `yaml:"Economy,omitempty" json:"Economy,omitempty"`
Upgrades *UpgradesPatch `yaml:"Upgrades,omitempty" json:"Upgrades,omitempty"`
}
NetworkRulesPatch defines a set of network rules that can be applied to the network. Network rules contains all the fields in sonic's opera.Rules, but all fields are optional and only the non-nil fields will be applied to the network.
This type is used to define the initial rule set in the genesis, by applying the diff to the default rules: opera.FakeNetRules(opera.GetSonicUpgrades()) Additionally it can be sent serialized using json to change the network rules during execution.
func NewRulesPatchFromOperaRules ¶
func NewRulesPatchFromOperaRules(rules opera.Rules) (NetworkRulesPatch, error)
func (*NetworkRulesPatch) PrettyPrint ¶
func (p *NetworkRulesPatch) PrettyPrint() string
func (*NetworkRulesPatch) UnmarshalYAML ¶
func (p *NetworkRulesPatch) UnmarshalYAML(node *yaml.Node) error
type UpgradesPatch ¶
type UpgradesPatch struct {
Berlin *bool `yaml:"Berlin,omitempty" json:"Berlin,omitempty"`
London *bool `yaml:"London,omitempty" json:"London,omitempty"`
Llr *bool `yaml:"Llr,omitempty" json:"Llr,omitempty"`
Sonic *bool `yaml:"Sonic,omitempty" json:"Sonic,omitempty"`
Allegro *bool `yaml:"Allegro,omitempty" json:"Allegro,omitempty"`
Brio *bool `yaml:"Brio,omitempty" json:"Brio,omitempty"`
SingleProposerBlockFormation *bool `yaml:"SingleProposerBlockFormation,omitempty" json:"SingleProposerBlockFormation,omitempty"`
GasSubsidies *bool `yaml:"GasSubsidies,omitempty" json:"GasSubsidies,omitempty"`
TransactionBundles *bool `yaml:"TransactionBundles,omitempty" json:"TransactionBundles,omitempty"`
TransactionPriorities *bool `yaml:"TransactionPriorities,omitempty" json:"TransactionPriorities,omitempty"`
}