github.com/ledgerwatch/erigon-lib@v1.0.0/chain/aura_config.go (about) 1 /* 2 Copyright 2023 The Erigon contributors 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package chain 18 19 import ( 20 "github.com/ledgerwatch/erigon-lib/common" 21 "github.com/ledgerwatch/erigon-lib/common/hexutility" 22 ) 23 24 // Different ways of specifying validators. 25 type ValidatorSetJson struct { 26 // A simple list of authorities. 27 List []common.Address `json:"list"` 28 // Address of a contract that indicates the list of authorities. 29 SafeContract *common.Address `json:"safeContract"` 30 // Address of a contract that indicates the list of authorities and enables reporting of their misbehaviour using transactions. 31 Contract *common.Address `json:"contract"` 32 // A map of starting blocks for each validator set. 33 Multi map[uint64]*ValidatorSetJson `json:"multi"` 34 } 35 36 // AuRaConfig is the consensus engine configs for proof-of-authority based sealing. 37 type AuRaConfig struct { 38 StepDuration *uint64 `json:"stepDuration"` // Block duration, in seconds. 39 Validators *ValidatorSetJson `json:"validators"` // Valid authorities 40 41 // Starting step. Determined automatically if not specified. 42 // To be used for testing only. 43 StartStep *uint64 `json:"startStep"` 44 ValidateScoreTransition *uint64 `json:"validateScoreTransition"` // Block at which score validation should start. 45 ValidateStepTransition *uint64 `json:"validateStepTransition"` // Block from which monotonic steps start. 46 ImmediateTransitions *bool `json:"immediateTransitions"` // Whether transitions should be immediate. 47 BlockReward *uint64 `json:"blockReward"` // Reward per block in wei. 48 // Block at which the block reward contract should start being used. This option allows one to 49 // add a single block reward contract transition and is compatible with the multiple address 50 // option `block_reward_contract_transitions` below. 51 BlockRewardContractTransition *uint64 `json:"blockRewardContractTransition"` 52 /// Block reward contract address which overrides the `block_reward` setting. This option allows 53 /// one to add a single block reward contract address and is compatible with the multiple 54 /// address option `block_reward_contract_transitions` below. 55 BlockRewardContractAddress *common.Address `json:"blockRewardContractAddress"` 56 // Block reward contract addresses with their associated starting block numbers. 57 // 58 // Setting the block reward contract overrides `block_reward`. If the single block reward 59 // contract address is also present then it is added into the map at the block number stored in 60 // `block_reward_contract_transition` or 0 if that block number is not provided. Therefore both 61 // a single block reward contract transition and a map of reward contract transitions can be 62 // used simultaneously in the same configuration. In such a case the code requires that the 63 // block number of the single transition is strictly less than any of the block numbers in the 64 // map. 65 BlockRewardContractTransitions map[uint]common.Address `json:"blockRewardContractTransitions"` 66 // Block at which maximum uncle count should be considered. 67 MaximumUncleCountTransition *uint64 `json:"maximumUncleCountTransition"` 68 // Maximum number of accepted uncles. 69 MaximumUncleCount *uint `json:"maximumUncleCount"` 70 // Strict validation of empty steps transition block. 71 StrictEmptyStepsTransition *uint `json:"strictEmptyStepsTransition"` 72 // The random number contract's address, or a map of contract transitions. 73 RandomnessContractAddress map[uint64]common.Address `json:"randomnessContractAddress"` 74 // The addresses of contracts that determine the block gas limit starting from the block number 75 // associated with each of those contracts. 76 BlockGasLimitContractTransitions map[uint64]common.Address `json:"blockGasLimitContractTransitions"` 77 // The block number at which the consensus engine switches from AuRa to AuRa with POSDAO 78 // modifications. 79 PosdaoTransition *uint64 `json:"PosdaoTransition"` 80 // Stores human-readable keys associated with addresses, like DNS information. 81 // This contract is primarily required to store the address of the Certifier contract. 82 Registrar *common.Address `json:"registrar"` 83 84 // See https://github.com/gnosischain/specs/blob/master/execution/withdrawals.md 85 WithdrawalContractAddress *common.Address `json:"withdrawalContractAddress"` 86 87 RewriteBytecode map[uint64]map[common.Address]hexutility.Bytes `json:"rewriteBytecode"` 88 } 89 90 // String implements the stringer interface, returning the consensus engine details. 91 func (c *AuRaConfig) String() string { 92 return "aura" 93 }