New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

How to use Executable Consensus Pyspec by Hsiao-Wei Wang | Devcon Bogotá

DevconSat, Oct 7, 2023, 12:00 AM

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on Swarm, IPFS and more. https://archive.devcon.org/archive/watch/6/how-to-use-executable-consensus-pyspec/ Ethereum consensus pyspec (https://github.com/ethereum/consensus-specs) is an executable specification that serves as a reference for consensus layer devs. It is also used for creating the test case vectors for client teams. In this lightning talk, we will have a tutorial on how to run the Ethereum consensus pyspec. And bonus, learn how to write a test by yourself! Speaker(s): Hsiao-Wei Wang Track: Layer 1 Protocol Keywords: pyspec,consensus,beacon chain Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum Learn more about devcon: https://www.devcon.org/ Learn more about ethereum: https://ethereum.org/ Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. Devcon 6 was held in Bogotá, Colombia on Oct 11 - 14, 2022. Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/

Transcript

foreign [Music] I work at Eastern Foundation consensus or risk IND team so this is a lightning Talk of the consensus piece so you can found the code days with this URL or the QR code and this is a cc0 open source python project now we have like more than 100 contributors so far and most of them are actually Eastern core deaths and thank you for your contributions okay so this project has three main purposes so first this is the center of Australian core consensus space and second it is also executable and verifiable Python program like you can use it to run the consensus logic with and the third it's also our test Factor generators for the clients the consensus layer clients to test their implementations with and so if there's a new feature that we are thinking about to apply it in the consensus side like the big engine side so you might try to prototype it with the markdown files that I will introduce later and and we will implement it in markdown files and we'll do the test and the test vectors would be generated with the python programs test case like the pi test if you have used python before and for kind things they can download the test vectors to test their implementations so um if you understand this process you can see that oh sorry um the space is now important and unique component in the whole clrd process and it also helps us to found some very basic bugs before cleansing started to program to actually prototype and test it um also it helps tie things to sync with the Core specs more efficiently the reason why we chose python instead of other language was that because it's probably I think python is probably the most readable programming language for most developers like you can say like python are just pseudo codes okay now let's see how to read it you know so I shouldn't stand it so this is the specs folders and here you can see some um the blue ones are the main hard folks that already be implied and the yellow green parts are the work in progress features also inside one of the directory you can find that the specs are actually written in the markdown files the most important entry might be the big engine spec and as is also like for choice or p2b interface in it and we can Define the constants and configurations just like you are writing markdown and in the tables so looks like this and we also Define the classes uh the SSC containers so listed objects are for the consensus objects because we use it to do the serialization in the consensus object uh so this is the example of the state transition functions we can just write down the uh speak write down the python functions in the code block of in the markdown files and um and also you can see there are some assertions so if the input is if the assertion throws and exceptions then we could say that okay the input is invalid because it doesn't pass the test okay that's some more useful links for you to understand more about the spec itself and also um so this is a elf I still call it the elf in the past uh in the past week in the setup dot Pi file so it is the program that helps us to pass the markdown files and convert them into a Python program and so the readers they don't have to reading the the pi file they can just read the markdown files which are more readable no Excel example of um so if the phase 0 is the base layer of all consensus specs and out here if you want to understand art here you have to merge merge extend extend the first zero space and new features in the art here so and as well the Bell tricks they have to merge three of them so I have one minute I have to do how to use spice fake and so installation is easy just install from PI API or from source code with this command okay this is a very basic hello world example and this is a symbol to you can just write hello into the gravity of the beacon block and in the first line is you can import the whole many electric specs as we need it to speak like that you can use it as a playground and see the example code in pi spec to try to play with it okay this is how to write your first Pi specter's case okay you can there are already some existing um helper functions to help you to prepare your the beacon block or to manipulate the beacon state with and there are some assertions here these are for us to set our test scores of this test case and important part is here like you can see there are some Guild python yell comments and it is us us to force to Output the test vectors for example this one we output the pre-state and the side become blocks and the post state so output file will be later and the list is the pure functions for the guidance to test with documents if you want to see more documents you see the urls and okay so this is the most important page actually so how to contribute with pi speak if you are interested in helping with consensus later on the I think Pi spec is a really good start to learn and contribute with and there's some different labels that you can participate in and you can do it from just fixing a little typo or to submitting a bug report and if it's got accepted and I think the app will be happy to give you the rewards and we also have looking for some in-house resource for pi spec implementations so if you are interesting and feel free to reach out to me or if you want to participate or have any questions thank you thank you Sean

Automatic transcript — names and jargon may be misspelled.