Finalization experiements
* Switched to FloodSub * Testnet0 switched to the minimal preset. All validators deployed on the master node.
This commit is contained in:
parent
21223d2627
commit
14374504cf
|
@ -343,7 +343,7 @@ proc proposeBlock(node: BeaconNode,
|
|||
|
||||
(e1d, newSeq[Deposit]())
|
||||
else:
|
||||
let e1d = await node.mainchainMonitor.getBeaconBlockRef()
|
||||
let e1d = node.mainchainMonitor.eth1Data
|
||||
|
||||
(e1d, node.mainchainMonitor.getPendingDeposits())
|
||||
|
||||
|
|
|
@ -207,12 +207,12 @@ else:
|
|||
keyFile, bootstrapNodes
|
||||
|
||||
var daemonFut = if bootstrapNodes.len == 0:
|
||||
newDaemonApi({PSNoSign, DHTFull, PSGossipSub},
|
||||
newDaemonApi({PSNoSign, DHTFull, PSFloodSub},
|
||||
id = keyFile,
|
||||
hostAddresses = @[hostAddress],
|
||||
announcedAddresses = announcedAddresses)
|
||||
else:
|
||||
newDaemonApi({PSNoSign, DHTFull, PSGossipSub, WaitBootstrap},
|
||||
newDaemonApi({PSNoSign, DHTFull, PSFloodSub, WaitBootstrap},
|
||||
id = keyFile,
|
||||
hostAddresses = @[hostAddress],
|
||||
announcedAddresses = announcedAddresses,
|
||||
|
|
|
@ -19,6 +19,7 @@ type
|
|||
depositQueue: AsyncQueue[QueueElement]
|
||||
|
||||
eth1Block: BlockHash
|
||||
eth1Data*: Eth1Data
|
||||
|
||||
QueueElement = (BlockHash, DepositData)
|
||||
|
||||
|
@ -38,6 +39,16 @@ contract(DepositContract):
|
|||
|
||||
const MIN_GENESIS_TIME = 0
|
||||
|
||||
proc updateEth1Data*(m: MainchainMonitor) {.async.} =
|
||||
let ns = m.web3.contractSender(DepositContract, m.depositContractAddress)
|
||||
|
||||
# TODO: use m.eth1Block for web3 calls
|
||||
let cnt = await ns.get_deposit_count().call()
|
||||
let htr = await ns.get_deposit_root().call()
|
||||
m.eth1Data.deposit_count = bytes_to_int(array[8, byte](cnt))
|
||||
m.eth1Data.deposit_root.data = array[32, byte](htr)
|
||||
m.eth1Data.block_hash.data = array[32, byte](m.eth1Block)
|
||||
|
||||
proc processDeposits(m: MainchainMonitor) {.async.} =
|
||||
while true:
|
||||
let (blkHash, data) = await m.depositQueue.popFirst()
|
||||
|
@ -66,6 +77,10 @@ proc processDeposits(m: MainchainMonitor) {.async.} =
|
|||
m.genesisStateFut.complete()
|
||||
m.genesisStateFut = nil
|
||||
# TODO: Set curBlock to blk number
|
||||
|
||||
# TODO: This should be progressing in more independent way.
|
||||
# The Eth1 cross-link can advance even when there are no new deposits.
|
||||
await m.updateEth1Data
|
||||
|
||||
proc isRunning*(m: MainchainMonitor): bool =
|
||||
not m.web3.isNil
|
||||
|
@ -105,16 +120,6 @@ proc run(m: MainchainMonitor) {.async.} =
|
|||
proc start*(m: MainchainMonitor) =
|
||||
asyncCheck m.run()
|
||||
|
||||
proc getBeaconBlockRef*(m: MainchainMonitor): Future[Eth1Data] {.async.} =
|
||||
let ns = m.web3.contractSender(DepositContract, m.depositContractAddress)
|
||||
|
||||
# TODO: use m.eth1Block for web3 calls
|
||||
let cnt = await ns.get_deposit_count().call()
|
||||
let htr = await ns.get_deposit_root().call()
|
||||
result.deposit_count = bytes_to_int(array[8, byte](cnt))
|
||||
result.deposit_root.data = array[32, byte](htr)
|
||||
result.block_hash.data = array[32, byte](m.eth1Block)
|
||||
|
||||
proc getPendingDeposits*(m: MainchainMonitor): seq[Deposit] =
|
||||
# This should be a simple accessor for the reference kept above
|
||||
m.pendingDeposits
|
||||
|
|
|
@ -41,8 +41,16 @@ iterator nodes: tuple[server, container: string, firstValidator, lastValidator:
|
|||
server = &"{nodeName}.do-ams3.nimbus.test.statusim.net"
|
||||
|
||||
for j in 0 ..< instancesCount:
|
||||
let firstIdx = baseIdx + j * validatorsPerNode
|
||||
let lastIdx = firstIdx + validatorsPerNode - 1
|
||||
var firstIdx, lastIdx: int
|
||||
if conf.network == "testnet0" and i == 0 and j == 0:
|
||||
firstIdx = conf.totalUserValidators
|
||||
lastIdx = conf.totalValidators
|
||||
elif true:
|
||||
firstIdx = 0
|
||||
lastIdx = 0
|
||||
else:
|
||||
firstIdx = baseIdx + j * validatorsPerNode
|
||||
lastIdx = firstIdx + validatorsPerNode
|
||||
yield (server, &"beacon-node-{conf.network}-{j+1}", firstIdx, lastIdx)
|
||||
|
||||
case conf.cmd
|
||||
|
@ -56,18 +64,18 @@ of redist_validators:
|
|||
keysList = ""
|
||||
networkDataFiles = conf.networkDataDir & "/{genesis.ssz,bootstrap_nodes.txt}"
|
||||
|
||||
for i in n.firstValidator..n.lastValidator:
|
||||
for i in n.firstValidator ..< n.lastValidator:
|
||||
let validatorKey = fmt"v{i:07}.privkey"
|
||||
keysList.add " "
|
||||
keysList.add conf.depositsDir / validatorKey
|
||||
|
||||
let dockerPath = &"/docker/{n.container}/data/BeaconNode"
|
||||
echo &"echo Distributing keys {n.firstValidator}..{n.lastValidator} to container {n.container}@{n.server} ... && \\"
|
||||
echo &" ssh {n.server} 'sudo rm -rf /tmp/nimbus && mkdir -p /tmp/nimbus' && \\"
|
||||
echo &"echo Syncing {n.lastValidator - n.firstValidator} keys starting from {n.firstValidator} to container {n.container}@{n.server} ... && \\"
|
||||
echo &" ssh {n.server} 'sudo rm -rf /tmp/nimbus && mkdir -p /tmp/nimbus/' && \\"
|
||||
echo &" rsync {networkDataFiles} {n.server}:/tmp/nimbus/net-data/ && \\"
|
||||
echo &" rsync {keysList} {n.server}:/tmp/nimbus/keys/ && \\"
|
||||
if keysList.len > 0: echo &" rsync {keysList} {n.server}:/tmp/nimbus/keys/ && \\"
|
||||
echo &" ssh {n.server} 'sudo mkdir -p {dockerPath}/validators && sudo rm -f {dockerPath}/validators/* && " &
|
||||
&"sudo mv /tmp/nimbus/keys/* {dockerPath}/validators/ && " &
|
||||
(if keysList.len > 0: &"sudo mv /tmp/nimbus/keys/* {dockerPath}/validators/ && " else: "") &
|
||||
&"sudo mv /tmp/nimbus/net-data/* {dockerPath}/ && " &
|
||||
&"sudo chown dockremap:docker -R {dockerPath}'"
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
CONST_PRESET=minimal
|
||||
NETWORK_TYPE=libp2p_daemon
|
||||
SHARD_COUNT=16
|
||||
SLOTS_PER_EPOCH=16
|
||||
SECONDS_PER_SLOT=30
|
||||
QUICKSTART_VALIDATORS=32
|
||||
RANDOM_VALIDATORS=160
|
||||
SHARD_COUNT=8
|
||||
SLOTS_PER_EPOCH=8
|
||||
SECONDS_PER_SLOT=6
|
||||
QUICKSTART_VALIDATORS=8
|
||||
RANDOM_VALIDATORS=120
|
||||
BOOTSTRAP_PORT=9000
|
||||
WEB3_URL=wss://goerli.infura.io/ws/v3/809a18497dd74102b5f37d25aae3c85a
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 173c7b4a86e6d75a69577166526b0f5840c45003
|
||||
Subproject commit 88b79e230005d8301c3ae950abdbf8ad55e37f19
|
|
@ -1 +1 @@
|
|||
Subproject commit 448a03ed4bd5837e18a3c50e10c6e31d25a6c9e5
|
||||
Subproject commit ae60eef4e8413e49fb0dbcae9a343fb479509fa0
|
Loading…
Reference in New Issue