Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Add testnet chain and Xiao Long Bao state machine #489

Merged

Conversation

ChihChengLiang
Copy link
Contributor

@ChihChengLiang ChihChengLiang commented Apr 7, 2019

What was wrong?

Part of #488

We need a state machine class and a chain class for the testnet. Unfortunately, for the state machine it requires a specific name. A choice with better taste than foo might be food, and the lowest hanging food outside of the coworking space is the Xiao Long Bao.

How was it fixed?

  • Create a state machine fork XiaoLongBaoStateMachine
  • Create a chain class TestnetChain
  • Side quest: Fix coro_get_canonical_head_root
  • Protect them with some tests

Cute Animal Picture

Xiao Long Bao at Nanxiang Mantou Dian 1

@ChihChengLiang ChihChengLiang changed the title [WIP] Add testnet chain and Xiao Long Bao state machine Add testnet chain and Xiao Long Bao state machine Apr 8, 2019
eth2/beacon/state_machines/forks/xiao_long_bao/configs.py Outdated Show resolved Hide resolved
GENESIS_SLOT=GENESIS_SLOT,
GENESIS_EPOCH=slot_to_epoch(GENESIS_SLOT, SLOTS_PER_EPOCH),
TARGET_COMMITTEE_SIZE=2,
SHARD_COUNT=2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With SLOTS_PER_EPOCH == 4, TARGET_COMMITTEE_SIZE == 2 and SHARD_COUNT == 2, does this mean we need at least 16 validators?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I understand, do we need to specify 16 validators somewhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah just that in #465 we use 8 validators. Not a problem. Ignore me. 😅

Slot,
)

GENESIS_SLOT = Slot(2**32)
Copy link
Contributor Author

@ChihChengLiang ChihChengLiang Apr 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈Just realized that I defined GENESIS_SLOT in the chain constants and in the state machine. It seems wrong to treat them as a constant in the state machine and should be parameterizable from the chain. But maybe access this constant from the Serenity config for the time being and address the issue after #896 to resolved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#896?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/eth2/beacon/chains/test_chains.py Outdated Show resolved Hide resolved
@pytest.mark.parametrize(
"sm_klass",
(
XiaoLongBaoStateMachine,
Copy link
Contributor

@hwwhww hwwhww Apr 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding SerenityStateMachine? Would it pass the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It passes the test.

)
from .constants import (
TESTNET_CHAIN_ID,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move it after from eth2.beacon.state_machines.forks.serenity.configs import ....

hwwhww and others added 2 commits April 18, 2019 18:38
Co-Authored-By: ChihChengLiang <chihchengliang@gmail.com>
@ChihChengLiang ChihChengLiang merged commit 3601633 into ethereum:master Apr 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants