-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[WIP] Hybrid Casper FFG Implementation #8654
Conversation
The current testnet seems to be outdated. So currently we use a tmp spec for testing.
As many comments noted at vyperlang/vyper#566, those two are mostly equivalent except edge cases. So it's good enough for testing.
ethabi does not support the later yet. We just need to remember that it has 10 decimal places.
Otherwise it looks like broken
Well, let's start an EIP-1011 testnet then? Happy to set this up. Other clients working on that spec can join at any point. |
@5chdn Need some more polishing and testing, and in particular, we need to have a validator implementation (probably just an external one through JSONRPC endpoints). Otherwise we cannot interact with the Casper contract. Many of the current parameters used here will also likely need to be changed because EIP1011 has not been finalized. But anyway, no matter testing locally, privately or publicly, I think having a testnet is important, and I'll definitely try to get it done soon. Besides, I think @djrtwo, and in particular, the py-evm group is planning to launch another new testnet soon. So we may also consider to join that. |
@5chdn Yeah, the testnet will be pretty boring without validators 😝. There was one written in pyethapp that is now deprecated. Harmony was also implementing one, but it was for the pre-EIP spec. Vyper just released some updates that we needed on the python side of things to get the EIP implementation going in py-evm. Trying to get out any implementation next week and start coordinating a multi-client testnet from there. @sorpaas You should theoretically be able to open up the block, add a non |
A note on transaction queue: currently we mark vote transactions as service transactions, so propagation should have no issue, and we can implement DoS methods with this. However, to "fully fill" a block with vote transactions, this may require to extend |
We can use json config to customize them now.
cc @5chdn Just spinned up a testnet using this branch so that we can test out whether the networking and txpool propagation works alright, before we get the testnet from @djrtwo. 😃 You can also use this to test any validator implementation against Casper revision 0.2.0. Please PM me if you need any testnet tokens. :)
Specifications:
|
This comment has been minimized.
This comment has been minimized.
ethcore/src/engines/hybrid_casper.rs
Outdated
|
||
/// Casper-specific fork choice. | ||
pub fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> ForkChoice { | ||
let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "deserailzling" (also several times below)
ethcore/src/engines/hybrid_casper.rs
Outdated
|
||
let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); | ||
metadata.vote_gas_used = receipt.gas_used; | ||
receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe unwrap_or_else(U256::zero)
would be better: It avoids creating the zero U256
if there was a receipt.
ethcore/src/engines/hybrid_casper.rs
Outdated
|
||
/// Casper-specific fork choice. | ||
pub fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> ForkChoice { | ||
let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwrap_or_else(Default::default)
would avoid unnecessarily instantiating HybridCasperMetadata
(also a few times below).
Putting this on ice as per dev call last week. Are you continuing work on this branch or shall we close it? |
No. Let's close this for now. |
😢 |
cc #7162, djrtwo/EIPs#5. This is a work-in-progress. Do not merge. Reviews/comments/grumbles are highly appreciated.
This implements EIP-1011. Currently we have initialization/deployment, vote transactions validation/sorting, fork choice and finalization implemented. Command line options are not added and there's no block reward issuance modifications for ease of testing. EIP-1011's current specification is not compatible with the old testnet, so only local testing is possible.
Current known issues:
TransactionPicker
which picks the next transaction to be included in a block.