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

Loading player…

Space Warp Summit 🛸 Understanding the FVM - Raul Kripalani

ETHGlobalMon, Oct 9, 2023, 12:00 AM

Join Raul Kripalani from Protocol Labs for a talk titled "Understanding the FVM". Hack the future of Filecoin! The launch of the Filecoin Virtual Machine is almost here. Come celebrate this momentous occasion and launch your first FVM application alongside hundreds of developers worldwide. Complete with talks and workshops from ecosystem leaders like Filecoin founder Juan Benet, get ready to explore the frontier of web3 and win over $150,000+ in prizes. ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

foreign [Applause] [Music] with that uh we are ready for our next incredible speaker I want to bring on Raul to talk about a lot more intricacies of the fem so without further Ado let's welcome rolls aye aye hi carte hi everybody very excited to be here I'm just gonna quickly share my screen and I'm gonna be talking through understanding the podcast ebm today just to give you a little bit of information I know you were all focused on building but it's uh ideal to have just a second there you go I think uh I think we're good with a share now fantastic all right so hey my name is Raul preplani I'm the fem Project Lead uh very excited to be here very excited about everything that's going to happen over the over the course of the next week's uh we have been working on the Falcon project for as Modi said for a little over a year uh we launched in July last year we launched the fem to the Falcon Network so really the fem is already powering uh Old State Transitions and mainnet um I'll talk more about that in a second uh but this is the next big milestone is just around the corner 40 days away fathom if everything goes right febin will hit mainnet around in the first week of of March um in in that time period uh so yeah really excited to be here and to get all of this ecosystem and this realm of opportunities are dick stride it so um one goal into too much detail because I only have 15 minutes but my goal today is to touch on the things that I think you need to know as an ethereum developer onboarding into the five coin evm um honestly our goal was to make things just work and to deliver that that kind of experience so I we don't really expect a lot of Divergence and we don't expect a lot of kind of like hey what's going on here moments uh but I think it's really important for you to know how things work under the hood because it will make your journey easier and more frictionless as your as you're moving forward so having said that as Blondie mentioned the fem project delivers on chain compatibility to the FICO Network just wanted to leave with that and this is basically uh what the fem looks like as I said the fem was really introduced to the falcoin network in July 2022 with Milestone one it is a web assembly execute webassembly based execution environment it is using wasn't time under the hood it has been conceived and built from the ground up to support multiple runtime so really it's it's really inspired by the concept of hypervises from the realm of virtual machines and so on and the evm a testament to that is that the first run time that we're actually programmable runtime that was shipping to to the fem is the evl runtime but we will have further runtimes down the line like for example the wasem need if we also called it native runtime uh secure my script and other potential things that could be layered on top of the fem uh so that it's possible to run different kinds of programs on top of on top of the fdm and on the podcast Network now the fem itself is very much inspired by the by the Unix architecture and is built around the concept of Sysco so basically everything that is running inside the fvm whenever it needs access to the environment or it needs to escape that sandbox it would perform a Cisco and some of those Primitives are for example data accesses which all revolve around the concept of my pld which stands for interplanetary link data that is our data model in the Falcon blockchain it is also the data model of ibfs and all state reads and writes translate into ibld States and rights by assess goals this also the fem also has we're introducing foreign addressing support so this is the ability for um or to assign addresses that are actually means something that respects some semantics of another Gene like for example if you're in addressing and I'll go into that in a second it is also prepared of repairing the way to introduce the concept of abstract accounts and it also has the ability to to perform a resource metering by a gas accounting so having said that um we're launching evm compatibility right and ebm compatibility is enabled by six uh key elements first of all the buy coin evm runtime which we uh nickname febim uh for a short name ethereum address support ethereum Account Support ethereum transaction and signature support and the the ethereum Json RPC which allows for seamless compatibility with tooling and libraries and also actual events I'm gonna cover the first five just to kind of like give you a little bit of a glimpse into how things work under the hood a one cover a one cup of the sixth uh but if you if you want more information on how how that works at the protocol level just pick me on slack or a Discord now uh let's dive into the Litecoin evm runtime uh what you need to know is that the evm runtime is basically an actor on the five coin chain an actor is code that lives on the chain on the filecoin chain and it is wasn't code that gets run within the water run type now the which is the fem now the EDM runtime itself uh is as I said one more actor and it contains a slim down ebm interpreter which has been specifically which we've specifically optimized for for Watson environments it is ethecarium Paris Fork compatible and it supports all note codes and all pre-compiles so basically EDM bytecode that you deploy to the Five Point ebm runtime should just work and this is the experience that we're really trying to Target there are some caveats which I'll talk about in the in the later on but if at one point you find that there is some some contract that you're trying to deploy that doesn't just work and it's not due to those caveats just let us know because our bonus is to make uh that a portability seamless now it integrates with a fodcoin environment and basically it performs reads and writes by fem syscalls uh I mentioned those earlier and it Maps the storage of the evm storage into the iplt data model we've introduced a new data structure called the camp to support this and it also introduces besides the ethereum standard pre-combust that are available in the Paris Fork it also introduces a number of Five Point specific pre-compiles that give you access to filecoin specific system five point system features I'll also cover those in a sec in a few minutes one important thing is that the evm runtime does not perform ethereum gas accounting everything related to when is your contract going to hold how is gas going to be charged how is gas use going to be measured and so on it's all based on file coin on Falcon gas usage this ebm runtime is introduced by the FIP by by 54 so if you want to take a look at that and kind of like go into the the deep deep details of how things work that is a really good reference to you now just to talk about ethereum addresses so the T headline here is that Phi coin is able to work and recognize ethereum addresses uh how do we make this work fightcoin since the beginning has had the ability to have multiple addressing schemes and we use this before the ebm already so we've got F0 addresses zero addresses that start with F0 or t0 if you're working with the test net T stands for for test so F0 t0 are ID addresses F1 addresses are SEC p256 K1 accounts F2 addresses are not a contactors and F3 addresses are BLS accounts we've introduced a new address class which is which is F4 so every address that you see prefix web F4 belongs to this address class we're calling it the delegated address class so basically this address class uh has F4 and then it has a number which in the case of ethereum is 10 and this maps to the ID of another actor which is designated as the address manager for that entire space so basically every address that you see starting with f or one zero is an ethereum address so I've put an example down here uh this f f port f410 address maps to this ethereum address and it looks like completely different but really the payload of that address is exactly the same as just encoded with base64 and in our case so that's why it looks slightly different there are on explorers most explorers are actually prepared to display the eth address to recognize each address as as they exist the Json RPC endpoint also recognizes and translates its IT addresses transparently it just it just works so everywhere that you would use an address you could use a eth address whenever whether it's an Explorer or whether it's the ethereum Json RPC endpoint uh ethereum addresses are introduced by the specification up there so if you want to take a look uh then then that if you want to understand a little bit more then that's the that's the link cool so we've also introduced the ability uh We've also modeled ethereum accounts uh so there's a new kind of factor in filecoin it's called the ethereum account and it represents a theorem externally on accounts so these are accounts that are backed by a key and basically what happens is that uh when you first send to an ethereum address uh well when the protocol would create is what we call the placeholder actor and a placeholder can transition into an ethereum account or it can transition into an ethereum contract depending on what happens next so if something deplies a smart contract onto that address it will magically convert into an ethereum account if that address suddenly sends a transaction uh that is assigned transaction to the gene it will automatically transition into into an ethereum account and this is completely transparent you don't need to know about this but when you go to an Explorer when you first send uh funds to yourself through faucet and hyberspace or whatever you go to an explore word you will likely see that your address is a placeholder and the first time that you send a transaction from that address through your metamask wanted or any other wallet it will transition into an ethereum account another thing worth mentioning is that we support ethereum transactions of type 2. so these are rlp encoded signed ethereum transactions with the original SEC with the original ecd DSA signature scheme with SEC b256 and we only support team key mentioning this we only support eip1559 transactions and this is because these because file coins since the beginning has been using uh the base V model has been using the eip1559 in in filecoin terms and translated into into the Falcon blockchain and that's why we only support this kind of transaction so if you most tools and kits and so on that Zack and others are going to tell you about after after this presentation already uh sending type 2 transactions to to uh to Phi coin but I I just thought it would be worth to mention here now at the RPC level we also support if has to make gas Max priority feedback gas and fee history so I completely implemented uh and usually tools called these methods to to automatically return uh gas values now when you submit an ethereum transaction through the Json RPC endpoint these behind the scenes are translated to flycoin messages carrying a dedicated signature uh in the future I mentioned that we're going to be implementing account abstraction uh this is a key part of that transition towards account structure because in the future we when we have it when we see when the protocol sees a delegated address it will just hand off that signature validation to an actor on Jing which can be anything so this will allow actors arbitrary options through work as senders however right now the validation during this Transit during this transition period is performed directly in the protocol but this whole process should be entirely transparent to you once again if you have any troubles around this make sure to to Ping us via your support channels so I also mentioned that a key element of making uh Phi coin work with existing ethereum tools and libraries so that this so that deploying on filecoin can leverage the very rich ecosystem of tools and libraries that exist for part coin uh automatically is the Json RPC endpoint So Below does the reference implementation of the filecoin protocol supports the ethereum Json RPC API Lotus is also the client that's currently powering hyperspace the hyperspace testnet we expect other clients like forest and Venus and so on we'll also join that test net but for for now we know that notice is implementing this this Json RPC as I said this this enables immediate ethereum tool compatibility things like hard hat remix Foundry brownie they just work with fibroid and there are the your the URLs for hyperspace down here there's a list of the methods that that have been that we've implemented in that in that RPC if there is these are the standard methods we are aware that other ethereum clients have specific methods which then tools end up relying on to like what we do specific things if at one point uh you're missing a method then let us know okay so one key another key element that I wanted to stress about the filecoin protocol and building on filecoin is that much of five coins verifiable storage crypto economy and basically everything that happens at the final coin today uh concentrates around the concept of built-in address so these are implicit smart contracts that exist in the protocol so it's very likely that if that when you're building file print specific use cases like data dials or lending pools that integrate with a minor after or you're building compute networks or you're building things like that uh you will want to interact with these built an actors uh to query what is the power of the storage provider or what is the current status of this particular deal in the storage deal in the network right so there's a list of of the actors that you likely want to interact with these are also defined in the file coins back and there is a YouTube talk there there's a talk on YouTube that one of our core devoted present gave a few months ago that goes into into this so if you want to check that out uh he does a really good Deep dive into all of the actors and how all of this works and I think it could serve as a really good tutorial uh to get we'll start pretty quickly now to interact with these built-in actors you might be asking well how do I hold out to these built-10 actors we wanted to make it really easy uh so what do what do we do we worked with uh zondax to build a set of solidity libraries that just behave expose a number of salinity functions that behind the hood do all the plumbing work to call these built-in actors uh so basically what you'll see this library is pretty it's it's it's very like a one-to-one mapping with the methods exposed by by built-in actors uh so this means that a slightly low level and what I expect may be happening as as a result of this hackathon is that we'll see higher level libraries built on top of these solidity libraries uh that do kind of like common recipes uh and do like higher level options using those direct calls into the built and Raptors uh so check out the solidity libraries that's the URL I know that Zach is going to go into this as well after after this talk so I'm very excited to see to see his demo as well because he's building with the solidity hybrids well we've uh deployed so pour this hackathon and perpetually uh we have deployed a network called hyperspace this is a developer testnet filecoin up until now had a test net which was called calibration net but it's mostly targeted towards storage providers and hyperspace is a test net that is uh built for developers before reaching hyperspace we had been the fem team had been had been delivering almost on a weekly or buy or every two weeks between during kind of like that that range we were constantly deploying uh new versions of the fvm and by the way the Hat Fab hackathon was running on Alpha versions of of the of the fem so that was in November just two two months ago it's crazy to see how much has happened in just two months um they were running those kind of like Alpha releases were were being delivered on a Tesla called wannabe so if you participated in hack febim then you were targeting all your development against wannabe there's an this hybrid space is a new testnet that is deploying beta quantity releases so while wannabe was deploying Alpha quality releases bleeding edge uh hyperspace is deploying beta quantity releases and as a one key one key difference is that hyperspace is a test net that will upgrade instead of resetting so we're striving to preserve all of the state and contracts without breakages that you Deploy on hybrispace so when there's a new upgrade uh when there is a new release broader to hyperspace it will be through an upgrade and we're actually expecting two of those in the next weeks we're expecting the carbonado 3 release which is the feature freeze release and we're expecting the final release as well which is the candidate which is the one that will go into into mainland now a few resources there you've got five coin you've got that channeled on Falcon slack uh to if you wanna if you have any problems with rpcs with explorers or with the test net itself availability or whatever transactions are slow whatever just ping us on on that channel uh you can very easily add this network to your metamask wallet or to other waters that support um that support the web3 library uh by uh chainless.org so just go into their search for hyperspace and tick include test sets because hybrid hyperspace is a test that to get that you'll be able to add it quickly and also there is the state the status page for for hyperspace test Set uh two things worth mentioning is that their hyperspace has miners that are very happy to do deal making with you so if you're a data dialysis or whatever you need uh you want to have deals on the network to test against then they can work with them because they'll be very happy to to to create deals for you even though there are already a number of deals in the in the in the network so if you go into the Phil Fox Explorer which I'll introduce next and go into the deals tab you'll see all the deals that already exist in the network also this network has miners with different fault with different floating patterns so these are miners that fail to prove during their deadline and so on so that their sectors go into into 4 fault are marked as Ponte so that you can test things like lending pools and things that depend on the status and the reputation and the quality of service of a minor so these are uh some of the these are the explorers and hosted endpoints that are available for for hyperspace you've got left you've got barracks and you've got Phil Fox as explorers that are currently operating with hyperspace there are other explorers that we expect well also that are currently that are supporting wannabe but we expect them to transition to to hyperspace soon as well and there are the URLs to for the hosted RPC endpoint so that we've got glyph serving and an end pointer we've got chain stack serving and endpoints as well cool so as I said uh tools that we know work well uh with five coin are metamask uh remakes hard hat uh are all working seamlessly with with five coin uh we are aware as well that Foundry uh works at we have some tests uh people have tested with Foundry and the reports are good uh but we would like if if you're inclined and work with Foundry if you if you're if you encounter any troubles with it let us know same with brownie and uh having said that I wanted to go into I went to kind of like stride ending my top with some highlighting some notable differences that I think as a developer you need to know when you develop for a theater four or five coins uh four five coin CVO so some notable differences with regards to um versus the ethereum uh evm is that concerning execution bare value sense so this is transfer of values which in the Falcon protocol are mapped to the method number zero of two smart contracts well not trade our smart contract Lodge so just a bear send to a Smart contract logic that is not a method call will not trigger it will not trigger any smart contract logic this is a small number of cases that this is a feature that is already used in in the ethereum protocol as far as as we're aware uh but it's it's a difference that they need to be aware aware of uh there is also concerning op codes we've got the call code opcode is not supported it has been deprecated in ethereum in our case we because it's deprecated we decided not to support it and to drop support for it and there are some small differences with regards to self-destruct Behavior which we believe make the behavior safer than it is in ethereum like for example if a self-destructured contract gets funds after it calls self-destruct but before the transaction ends in ethereum those funds would be lost and flag when they're not um so and there are some other op codes that behave slightly differently but it should be things like difficulty because we don't have the concept of difficulty things like coinbase and other things uh behave differently but we believe those should not cause any functional Divergence and one big one that I did want to mention is concerning gas gas metering and execution hold are performed according to the final coin gas model and not according to the ethereum gas model so this means in the Falcon gas model is meant to be updated very in a very agile minor manner such that it tracks with High Fidelity the real execution costs of code and as well uh it tracks the fine coin gas model actually charges per bytecode of wasm instruction uh sorry it charges per wasn't instruction which also means that over time the ebm runtime is going to be changing its bytecode as as we go through different network upgrades uh it's going to become more optimized it's going to enter to use new functionality libraries are going to change uh so it is not a good idea to hard code specific gas values in ebm smart contracts that you deploy to filecoin because the gas model is very very Dynamic and Falcon as opposed to ethereum so this is a really important point that I wanted to highlight and a few other so that's the third Point here alfalcon gas costs are not stable over Network upgrades and um the second point there is that gas limits set when calling pre-compiles do not apply so just do almost end the stock and I'm a little bit over time just wanted to say there are some Advanced kind of like functionalities that we've uh added to the filecoin evm implementation are file coin pre-comb Bots there are four five coin pre-compans there is resolve address lookup delegated address contactor ID these are exposed through the solidity Library so that's uh you see an example of that on the on the right they're specified on this fit if you have any questions about these uh we will be adding more documentation in the next in the next days but if you have any questions about these uh for now just bring this on on Slack and also there is the ability to handle native messages so if so in Phi coin we have this concept of a method number which is part of the message that indicates which method in the after should be called and in order to handle arbitrary messages sent to ethereum contracts that carry method numbers arbitrary method numbers you need to implement uh this uh this function in your solidity smart contract currently I only expect this to be necessary if you're using uh if you're creating a deal client um contract because the market actor will call into the deal client to validate the client the deal proposal through a native call and there is already a example of repo in a template that does this for you uh it's I believe Zach is going to be introducing it but if not ping us on on slack uh it's it's the deal client contract so this you could use the code in that in that contract uh to handle these kinds of calls that are performed over native calls into your into your solidity spark contract cool so that's uh everything from me uh good luck and happy hacks and I'll be on slack you've got my Twitter there if you want to contact me uh and I'll also be on the on on discourse uh sorry on uh Discord not discourse yes yes thank you that was great so very comprehensive you on everything that's happening oh this should be really fun

Automatic transcript — names and jargon may be misspelled.