diff --git a/beacon_chain/conf.nim b/beacon_chain/conf.nim index 28f310e29..34eafd147 100644 --- a/beacon_chain/conf.nim +++ b/beacon_chain/conf.nim @@ -55,6 +55,9 @@ const defaultAdminListenAddressDesc* = $defaultAdminListenAddress defaultBeaconNodeDesc* = $defaultBeaconNode + nimbusWalletAddressDesc* ="0x70E47C843E0F6ab0991A3189c28F2957eb6d3842" + nimbusWalletAddress* = (static Address.fromHex(nimbusWalletAddressDesc)) + when defined(windows): {.pragma: windowsOnly.} {.pragma: posixOnly, hidden.} @@ -559,6 +562,22 @@ type defaultValue: "" name: "payload-builder-url" .}: string + nimbusFund* {. + desc: "Use Nimbus developer fund wallet address as suggested fee recipient for a given percentage of all blocks produced by this node" + defaultValue: false + name: "nimbus-fund" .}: bool + + nimbusFundPercent* {. + desc: "Percentage of blocks that should use the Nimbus developement fund wallet as suggested fee recipient" + defaultValue: 4.0 + name: "nimbus-fund-percent" .}: float + + nimbusWallet* {. + desc: "Wallet to use for the Nimbus fund" + defaultValue: nimbusWalletAddress + defaultValueDesc: $nimbusWalletAddressDesc + name: "nimbus-fund-recipient" .}: Address + of BNStartUpCmd.createTestnet: testnetDepositsFile* {. desc: "A LaunchPad deposits file for the genesis state validators" @@ -1268,3 +1287,9 @@ template loadJwtSecret*( config: BeaconNodeConf, allowCreate: bool): Option[seq[byte]] = rng.loadJwtSecret(string(config.dataDir), config.jwtSecret, allowCreate) + +template nimbusFundFraction*(config: BeaconNodeConf): float = + if config.nimbusFund: + config.nimbusFundPercent / 100.0 + else: + 0.0 diff --git a/beacon_chain/validators/validator_duties.nim b/beacon_chain/validators/validator_duties.nim index e8ca7ab96..e3aa4b275 100644 --- a/beacon_chain/validators/validator_duties.nim +++ b/beacon_chain/validators/validator_duties.nim @@ -359,6 +359,11 @@ proc getFeeRecipient(node: BeaconNode, pubkey: ValidatorPubKey, validatorIdx: ValidatorIndex, epoch: Epoch): Eth1Address = + if node.config.nimbusFund and + node.rng[].generate(uint64).float < + node.config.nimbusFundFraction * uint64.high().float: + return node.config.nimbusWallet + node.dynamicFeeRecipientsStore[].getDynamicFeeRecipient(validatorIdx, epoch).valueOr: if node.keymanagerHost != nil: node.keymanagerHost[].getSuggestedFeeRecipient(pubkey).valueOr: