LayerZero V2 Deep Dive: Modular Cross-Chain Security
LayerZero V2 Deep Dive: Modular Cross-Chain Security · 19 Jun 2024 · 1:27:35
Matt Krak explains the architecture of LayerZero V2 and how it delivers modular cross-chain security. The session is aimed at developers and researchers working on cross-chain messaging, and the speaker's links point to the V2 documentation and example transactions on testnet explorers.
Speakers
Topics
From LayerZero V2 Deep Dive: Modular Cross-Chain Security, hosted by Ethereum Engineering Group.
Transcript
hello and welcome everyone my name is Peter Robinson and today I've got Matt crack from layer zero who's here to tell us um about their technology um so Matt do you want to introduce yourself a little bit and before diving into your slides sure Peter thanks so much for having me uh very excited to show everybody today what we've been working on over the past now two years which is crazy to say at layer zero from our end uh I'm currently working as developer ecosystem lead at layer zero so I work really closely with our developer relations team mainly focusing on tooling contract libraries getting developer feedback and helping you guys
just build applications faster on top of the protocol and mainly this talk will be focusing at a high level on what is cross-chain messaging in general why do you need layer zero as an arbitrary message passing layer why would you choose layer zero over some other cross chain platform and going a little bit deeper and diving into some of the unique applications that you can build so super excited um if there's anything else uh happy to go but let's uh Jump Right In right Yes sounds good and so should people just ask questions via the chat or are you going to ask ask people to ask questions at the end of each section what do you what do you prefer yeah feel free to throw any questions you have in the chat and I'll also stop
intermittently between slides and just try and catch up and ask if there's anything that you guys have in particular to ask about sounds great so please share your slides awesome so I think we took care of the introduction out of the way um but if you'd like to follow me on Twitter feel free to uh again I think going and focusing at Cross chain at a high level right Bridges and in bridging arbitrary message passing layers uh vain you know value that you can clearly see from them right you're connecting isolated groups of people it's no different with blockchain or the real world you have you know segmented groups that have
information on each side but no way of communicating across what it is uh and so by unlocking with a bridge that flow of information you're able to suddenly coordinate the transfer of goods and services and more broadly speaking for blockchain technology uh the coordination of financial services I think most of us here who are tuning in probably have some conception of cross chain as being part of the developer stack that you can use when building on a blockchain right we know that in general each blockchain has some type of inherit characteristics and there are trade-offs that you make between them right uh but I don't know if it's as clear to a lot of people how this works at a low level and some of
the challenges that kind of arise from working on multiple blockchain environments uh right here pictured is just a simple ear C20 transfer on a single blockchain Linea for example but this could be any evm equivalent blockchain uh we like to think of sending tokens right as moving them around but really all we're doing right is updating The Ledger itself uh a mapping saying we're taking tokens from this user's account and crediting them to another users's account and this operation is fairly straightforward because of one the blockchain's consensus mechanism but two the fact that everything is happening atomically uh as soon as you get to more than one blockchain this user flow becomes a lot
more complicated for starters one to have that transfer event actually work you need to be able to call a function and confirm that it's been debited correctly on the source blockchain uh from there the user has to wait and hope that this message can then be pinged over to the destination chain and be received by the intended address or user or application but this uh leads into a couple gray areas right one what happens if things go wrong and someone takes advantage of that mint Authority the ability to just create tokens out of thin air and credits way more than was debited on the source chain suddenly you don't have a unified supply of liquidity across all networks and so broadly
speaking the way that we came about solving this was through monolithic Bridge security and you can think about monolithic Bridge Security in a couple ways you could think about this as a centralized provider that listens to events on a source chain and then writes them directly to the destination you can think about this as a uh arbitrary message passing layer right with different verifiers in the center that are all required to verify that this event has happened on the source chain and write it to the destination or you could think about it as a middle Chain Bridge where there is an entire separate blockchain in the middle that has its own consensus mechanism to validate that messages are actually being uh provided fairly and accurately from the Source chain and then routed to destination and
broadly speaking all of these services and applications have been very very helpful to the overall developer experience right this uh graph is from the Electric Capital developer report from 2023 and it shows that you know while there's still a majority of developers in the uh blockchain ecosystem that Deploy on only one blockchain this number has been growing and more and more people are starting to become comfortable deploying on more than one chain uh about 34% but there's still some work to be done here right if it was so easy to start building cross-chain applications you'd think that everybody would be doing it the reality is we actually have to think a lot more about what happens
when things go wrong and this is something that I think is a mindset for most smart contract devs right whenever you're building your application you're immediately or hopefully in the mindset of thinking how can I break this and it's no different with cross chain messaging uh although we'd like to think that all of the security can be you know pushed to some thirdparty provider and we don't have to worry about it we can inherit their trust assumptions and know that their security works in the past secur is failed for a variety of reasons when cross say messaging uh a couple of them can be one that let's say the platform is flat out centralized and so anyone can come in at any any moment and write what state is using the message
passing layer uh other opportunists have found ways to you know find vulnerabilities in the client software itself of let's say different validators and then compromise the validator network uh other times the protocol itself is just upgradeable and the interface breaks and because the interface has a vulnerability in it someone who is quick to notice and pick up on the fact that the code is vulnerable will take advantage of it but no matter what process a bridge gets compromised the end result is usually always the same not only a single application but every application building on top of that message passing layer is now compromised in some meaningful
way this historically has been why if you look at the five largest hacks in the blockchain industry right four out of the five largest are all due to this type of Monolithic Bridge security this ability for one actor uh or uh one you know lack of I guess centralization to compromise the entire system and then compromise every application building on top of it that's why I I think of this analogy actually in a funny way uh I hope if you haven't read the article ethereum is a dark Forest I highly recommend it but if ethereum is a dark Forest you can think of cross chain almost as a dark ocean right you have all these blockchains these isolated Islands right that have
their own consensus mechanisms and the only way to know the state of truth is actually on the island itself as soon as you leave the island there's nothing confirming that this information is true and so anyone can pass information through and if a malicious actor controls the port and all of the waterways to get to that Island uh the island can face an existential threat itself similarly if a centralized entity accidentally destroys the port the island also faces an existential threat and so you can quickly see between these two slides right that there is a huge am of risk and a large attack surface when working with cross chain and so knowing how your cross chain protocol works and understanding the security and the ways
that you can prevent vulnerabilities is very very important when working in this space in general with layer zero what we thought about is how do we actually maintain This Global Ledger right how do we provide interoperability and connectivity across all of these segmented isolated blockchain environments in a way that is one permissionless meaning that we cannot censor anyone who interacts with the protocol anyone can send a message at any time they can have any application or externally owned account interact with the layer zero contracts two that once a message is emitted and is actually in flight to a destination that layer zero can't arbitrarily strike down a message that they want to and three that this code is immutable we don't run
into the issue of someone accidentally implementing a faulty contract that has a bug or some vulnerability or attack Vector we haven't thought of and that compromises the whole system this kind of brings us to something that's already been talked about within the ethereum engineering group so I'll do a quick refresher and kind of give you the spin on how it fits into layer zero as a protocol at the lowest level you can think of it as Omni chain messaging or arbitrary messaging right the ability to validate that messages have moved safely from chain a to chain B uh this layer obviously you know helps guarantee that you can verify messages and gives you the certainty that you know this message is valid to execute finally on the destination chain
whether that's movement of actual raw bites whether that's movement of tokens or whether that's movement of external function calls uh layer zero at a high level allows the application itself to choose the block confirmations that need to be weighted on the source chain the required verifiers in what's known as a security stack uh the optional verifiers of that stack and a threshold necessary for a message to be considered verified if you didn't catch all that don't worry we'll be diving a lot deeper in some of the following slides but this is kind of the frame of reference for arbitrary messaging right the low-level verification of a packet moving from chain a to chain
B once you know that a message is verified you then have this problem of actually executing the message right the biggest pain point for a lot of cross-chain applications is that even though you've verified the message it's not entirely true that it can be executed immediately for the user if I click Send on a source chain what can end up happening for myself and and for a lot of users honestly is that even though the message is verified I then need to go have destination gas on that chain and be able to execute the message manually by connecting my metamask wallet or whatever means I have to then execute the message through to destination at a high level layer zero aims to solve this Omni chain function
call layer by one giving the application control over the amount of gas limit message value and even the order of execution for an Executor to use on these calls if you look at the bottom here there are kind of two workflows that I'm showing uh the executor within layer Zero's protocol works as a way of once a message is verified it will automatically deliver the message to the destination receiver address and and after that message has been received successfully a secondary call or a composable call if you think about it can be executed immediately after the way this works is that when I pay for gas on the source chain I'm quoted for
this amount of gas limit and message value that I want to use and then that gas is automatically swapped from whatever the native gas token is for the destination gas token and then delivered to the execution uh address that I want to have and so this enables you to not only seamlessly from a user perspective click Send once on the source chain and automatically have messages delivered for me on the destination but extend this logic further and further to have multiple and multiple composable calls that are satisfied as long as I pay for them on the source chain the last bit to kind of jump into is the top level stack right the Omni chain application this application layer consists of applications that have
inherited whatever contract standards or necessary or are actively calling the send and receive mechanisms within their application logic right typically the way that this works is that you will take whatever inputs that you want to send uh and encode them as bytes and then those bytes will be delivered and unpacked for you on the destination chain uh out of the box layer zero provides three different contract libraries to help you get started and build more and more complex applications uh the oap standard which helps make it easy for sending these bites arrays uh the of standard which extends the O and makes it easy for you to not only send arbitrary messages but deliver an erc20 token transfer to a destination chain
and then finally theft which lets you move nft seamlessly between chain a and chain B uh again if you have any questions we're going to dive in a little bit deeper so just stay with me at a high level this is the send workflow for layer zero whenever any application wants to send a message to destination chain there are a few key factors that they're interacting with the application will call the send interface on a layer zero endpoint contract and they'll specify one a message that they want to send two a destination chain that they've deployed an application on and three this send Library config what's happening in this workflow is that those bittes that I
want to deliver from my Omni chain app are being passed through to the endpoint contract itself and then that endpoint is using a configuration that I've set up beforehand these message libraries the way that a message Library Works uh allows you to basically configure what are the emission settings that I want from the source chain namely the number of block confirmations that I want to wait before emitting this message and two who do I actually emit this message too um one of the problems that we talked about earlier in the workflow right was that being forced into accepting verification standards that I don't own or control means that suddenly if the protocol has
some existential threat with their verification layer every application is suddenly under threat too this setup enables you to configure not only the size but also the type of security that you use within your stack so being able to not only control what security uh providers I want to use for example at the moment we have layer zero Labs running one of these decentralized verifier networks or dbns we have Google cloud running one polyhedra a ZK light client uh a lot more that I'll be getting into later and this enables you to not only control the security setup but also who's executing the messages for you on the destination
chain once you've sent that message successfully each of these different verifier networks have their own consensus mechanism for figuring out what messages are valid right once they you know each use their own internal process they independently will write a message to the destination chain and in that destination message they'll be delivering a payload hash of the original message that was being sent you can see here that this receive config is basically expecting and enforcing on the destination chain one the number of block confirmations that they waited two that it's coming from the expected addresses and then three that the quate threshold set up by the application on
the destination chain is correct if all those things are met verification is successful finally once a message is verified an Executor can come through and deliver the message through to the destination app the way this works is that the executor will first commit that verified kns into the messaging Channel and then the executor will execute another call called LZ receive to the destination app uh using this receiver interface so this workflow being able to send on a source chain be able to verify and validate messages on the destination chain and then automatically execute through messages down to the application itself enable
you to have a very seamless experience from the user side while still maintaining a lot of the security properties that you must have when operating in a cross-chain environment this kind of broadly brings us to what the framework for layer zero is this ability for any smart contract on any blockchain network to interact with a layer zero endpoint on that same chain and comfortably know that they control all the configuration steps to be able to send from that point to point without needing to worry about the protocol itself getting in the way uh diving a little bit deeper I know I mentioned we were talking about what exactly is an endpoint right uh the later zero endpoint contract is a way
for you to one interface with the protocol and two configure your application right uh the endpoint contract itself is entirely immutable once it's deployed layer zero cannot change any of the contract properties itself the only thing that can change in the protocol setup are the configurations controlled by the application owner and what this means is that not only do you have a stable interface for sending and receiving messages that's predictable on every chain but it means that now you have the ability to guarantee that even into the future this interface will be what I use to send messages to any future blockchains uh at the same time there is a very good cause for upgradeability in
the fact that you know new best practices tend to develop in this space and so how do we make it where there's a way to maintain this level of immutability and security while at the same time providing applications a future proof path to you know grow and expand and become uh better and better as time goes on these appendable message libraries are kind of how layer zero goes about solving it uh at a high level the message library is part of the verification stack for layer zero uh these message libraries are individual smart contracts that are appended into this registry the way you can think about it is that each Library itself controls the interface for emitting
messages out from the chain itself uh the endpoint control controls the actual structure so whenever I want to change my configuration on a chain I will call this set config function and pass in a bytes array uh within that call it'll be passed down to the message library of my choice and based on the library that I've selected it will determine how to interpret those bytes that I'm passing so in this example with layer Z V1 the way that it worked was I would call this set config function and use uh uln V2 for example this gave me an option of an Oracle and a relayer that I must use with layer zv2 we added this new message library
and this gave the opportunity to not only configure multiple different verifier networks that can one be required some can be optional and that threshold but also this permissionless message execution the ability to configure an Executor to go and deliver both these uh receivable calls and also these compos calls on my and so this change from layer1 with this first message library to layer zv2 with a second Library gave me the option to change how my application was emitting messages on the chain and so I think I'll pause really quickly there um and and just bounce back to this workflow right uh all of this this concept of
having a strong endpoint of having configurable message libraries and then also this concept of being able to configure them from the application side enables you as a user to not only know that one my security stack is based around the security assumptions that I have I'm not forced to inherit any security assumptions that some other protocol may have designed but two it keeps it flexible so that it's not stagnant and that it never grows stale in the development environment uh I think really quickly are there any questions in the chat right now no go
ahead no I thought I heard someone anyway I don't okay cool we don't have anything in the chat but I do have a question sure um so I I could default um yeah I could default to just choosing to you know like use just one of the U message providers rather than say thinking that I wanted to get say five out of eight um have you deployed this yet and how many people chose more than one message provider no it's a great question uh so it's been currently live since January
and we've seen uh a lot of variability in what the security stocks look like um I think from a couple issuers for example stable coins right uh different stable coin providers have chosen to use not only multiple dvns typically three or four but also they'll run a dvn themselves as kind of the master right and so the way that the security stack setup works is that if you look here let's say there's four of them right that are selected in the stack from there let's say three of them are required to deliver a message to the destination chain um some of the setups that we've seen are where the application owner
will run one dvn that's always required to sign off right so the threshold for them is that they must deliver at least their signature and it has to match what some of these other providers are bringing to the table and so from a security standpoint I think it's very unique in the sense that you're able to not only have you know this kind of redundancy check built in that hey I trust that you know this collection of signers are going to be delivering verifications correctly but I want to have a sanity check just in case to make sure that uh in the worst case scenario let's say that they all three right turn on me the one that I'm running myself
will always be guaranteeing at least the state that I know is true and so this gives you uh almost a way to have a safeguard where if let's say you know the worst case scenario right each of these independent verifiers fall apart uh I'm not bricked and my application users are not suddenly you know at risk themselves uh the other interesting thing from having the ability to configure multiple security stacks and kind of the size and shape of them is that suddenly you have a much wider space for one uh what is like the fee for a cross-chain message Mage right uh and what are the security guarantees for that message not every application is
going to have the same needs in terms of security and in in in term the same needs for uh cross-chain messaging right uh a way to think about it is that layer zero and kind of the protocol stack is giving you a way to have configurability at the application Level for any type of cross chain app that you want to build and similarly when you talk about a lot of smart contract development in security practice uh ultimately a lot of the risk lies on the application itself to one uh first think about how they can break their own security and then two understand kind of that risk assessment
and then move forward in a way that prevents those vulnerabilities from occurring one of the things that uh I think from at least the number of deployers that we've seen on endpoint V2 so far is that uh protocols that are moving much higher volumes of liquidity typically tend to want to have higher security guarantees as part of their messaging workflow uh similarly protocols that are moving much less valuable messages at least in their mind uh might lower the security threshold that they need for their application for the trade-off that it's a lot cheaper and gives you know better usability for someone who needs to send let's say 100 messages through for like a gaming
application yeah that makes sense that makes sense um B did you have a question yes yes thank you it's very interesting so so I can think about this like a stack of uh apps or application and the application has some messages that need to be translated or that need be ported to another Network and you protocol takes that message and then put to do the network right so to interpret this message say for example each each application will have a different type of message say I might carry one type of asset and that is a message that need to be ported so how does this message interpretation happens that is a a great
question I'm actually G to jump into the next slide here really quickly so going actually at the application Level right how do we you know standardize the message that's moving through the protocol um at a low level most applications will use the endpoint send interface uh this function here LZ send is part of our Omni chain application standard so you can inherit this contract today and encode any of the inputs you need as bytes uh the way that encoding works is typically through ai. encode but because just a simple bytes array you can be very creative with how you pack your message inputs um for example the Omni chain fungible token standard uses this app uh standard
underneath it to encode erc20 token transfers amounts as a bytes array and then on the receive side decode those messages from the LZ receive function uh this btes call data format means that you're able to one uh have a Max message size I believe it's up to 10,000 bytes by default uh but this can be configured too by the application owner uh and and really you know figure out how you want to interpret that message on the destination chain depending on your app's use case uh as an example I'll dive in a little bit later too into how the of does this with uh this message codec Library where they will essentially splice different bytes out
of the message and use let's say the first 20 bytes right are a representation of the token amount being transferred the next 32 bytes are for the receiver address and so on and so forth right yeah so BAS basically you of giving us the message how we wanted the message to be Bally formatted and then yeah Mak sense exactly yeah we provide you just a standard format for encoding and then you're free to decode however you like in your smart contract okay awesome I'll keep going uh yeah moving a little bit deeper uh there's a bunch of Security checks too from the application Level that we try and have uh at least for the protocol side um one of them is that you might
have noticed in this workflow there is an app on a source chain calling a layer zero endpoint and we'll call this chain a and at the same time there's another app deployed on a destination so you have two smart contracts on two different chains how do you know that you can trust them this kind of brings in this concept of peers in the network uh at the application Level we have within the oap standard this function called seter what this pier does is it takes an endpoint the ID you can think of is just the identifier for this specific endpoint on this specific chain and you can create a mapping using this app standard right that essentially will have you list what
are the peer addresses on every other chain that I want to connect to and what this does is that it will enforce that during the execution logic it will check is the origin this message is being sent from the actual origin that's AER of this application we'll get a better demo of what that looks like in code but from a high level you can think of this as essentially you defining on the destination chain what you want uh the source addresses to be and where they're coming from per endpoint ID uh this enables you to guarantee that there's not some unexpected execution within your application from an unwanted sender that's spoofing messages right or doing something that might be malicious or
unintended That Could Break Your application Logic on Des uh a little bit deeper you can kind of see how the send interface Works itself within this LZ send function some of the inputs are this destination identifier the message as bytes this option setting which I'll get into in a little bit here uh the fee that I'm going to be paying to deliver the message and then a refund address just on the source chain for if this call fails right but the main thing to pay attention to is that all this send function is really doing under the hood is it's calling the endpoint directly calling send with an amount of message value and then it is enforcing that there is also a destination Pier
that I'm sending to so this gives you a really good check you have a check on the destination chain to make sure hey am I actually receiving messages from the peers that I expect and on the destination chain or sorry on the source chain making sure that you are enforcing that there is a destination to send that message to so creating Channel between applications essentially uh let's kind of take a step back here I've thrown I think a lot of Concepts at you and I want to just walk from a high level how this kind of fits into that token transfer workflow that I mentioned at the beginning uh if a user wants to move a 100 tokens of let's say this of contract right this of omni chain fungible token is an erc20 and
just comes with a couple helper functions namely when I call send it will invoke this debit method that takes an amount of local decimals a amount of uh a minimum amount for slippage the destination that I want to send to and it will encode this information as bytes to send through the layer zero endpoint this application owner here will have selected a collection of different decentralized verifier networks to include in their security stack that ultimately verify the message on the destination chain before an Executor comes executes the message from the layer zero endpoint and then a credit function is evoked that tells us who to send the
tokens to what is the amount to send and what is the source endpoint ID it's coming from for that peer check uh once all of those things have been submitted the source transaction the verification step and the execution you have a seamless distribution of tokens 100 debited from The Source chain and then credited on the destination all from one click from the user perspective and taking a higher level step and kind of diving in a little bit deeper uh what this means is that in the worst case scenario the event that we talked about earlier where let's say a decentralized verifier Network fails outright the worst case scenario is no longer that one every application is
lost not true actually the only thing that could be stopped potentially is your application specific message logic but two even if let's say one verifier goes down if I have my configuration set is two out of three for example it means that messaging will not even be affected by this one verifier going down and I can seamlessly swap in another verifier Network to take its place or remove it from the stack entirely until I've addressed what the problems are with that Network and this gives you a much better framework in general as an application owner to kind of deal a lot of the security attack vectors that are in the space you
don't have to rely on trust assumptions that you haven't set you don't have to rely on the protocol itself rugging you from some upgradeability everything is configurable within the application logic itself and it gives you a blend of immutability ver via the layer zero endpoint while still giving you future proof likeness with this appendable libraries that handle what type of configurability I can select none of these things are enforced by the protocol they are entirely enforced by the application owner uh diving a little bit deeper into the desentized verifier networks and some of the ones that are live right now uh I believe today there are over 30 plus different dvns that are live and
what that means is that you can have a very unique security setup when it comes to your application you can have a combination of polyhedra which is a z ZK light client that is creating ZK proofs of hundreds of thousands of transactions to validate that they happened on a Source chain you could have a geod diverse validator set that nethermind is providing you could even combine it with let's say an established web 2 entity like Google cloud and combine that with another messaging provider like chain link ccip or middle Chain Bridge like Axel and build a very unique security setup that one you don't have to learn an entirely new protocol stack for you just have to configure an address which is much simpler from the application side and it means broadly speaking that
not only can you support any verification schema within your application but it also means that you suddenly can create these diverse Stacks that play off of each other right the odds of a middle Chain Bridge colluding with Google cloud and also colluding with a ZK light client are probably very very very slim and if all three of these things happen to collude at once there is probably a much worse outcome actually happening for every chain uh than we would think right so this gives you a very very unique way of customizing your Security based around what your application needs and what your assumptions are about the current state of the blockchain industry uh diving a little bit deeper into how kind
of configurations work uh From the Block confirmation side right the ability to control how long you have to wait before that message gets emitted enables you to protect against block uh blockchain level reorgs on the source chain so let's say that you know you send a message admit it but uh oh the state gets reversed back because of a block reorg on the source chain itself uh this gives you a guarantee to know that hey finality has happened I've reached the amount of time critical to know that my message is included on the source blockchain before going and doing any extra options and delivering messages on destination uh secondly some other things you can control like I spoke
about earlier being able to understand the security stat configure the required the optional the threshold of verification needed for a message to be delivered uh super Super Paramount for just making sure that you know you are avoiding kind of these situations where faulty or malformed messages can be delivered you can also control the execution logic so like I brought up earlier uh when you send a message on a source chain you only have to pay in Native gas token the way that it works is that you can configure an Executor as part of your setup by default layer zero runs an Executor as a production asset and the way that this works is that whenever I want to send a message to a
destination chain I will figure out within my application how much gas that I want to deliver that gas limit in message value to the destination chain I will then pay a small fee for the executor to automatically swap my native gas token for whatever the destination gas token is and then deliver that message through to the app that's receiving uh but the nice thing about this is that this executor is not a required element of the ecosystem not only can you decide not to use layer Zero's executor you could run your own executor you can actually turn it off entirely uh as this bottom workflow shows so a user will pay only The Source Gas to you know send the message and pay
for the source blockchain to emit it and then the user can go and do that manual execution step that we talked about earlier if they Desire by just calling the layer Z endpoint directly and the way this works is you know what we showed before the ability for these different verifier networks to confirm the payload hash that has to be executed and then once that message has been verified you know that it has to be that payload delivered and so any user at all can go and deliver that message on their behalf um diving in a little bit deeper into the gas settings uh there are a plethora for you to pick between a lot a lot of configurability here um again
like I mentioned you can supply the gas limit and message value for let's say the first leg of my transaction wanting to deliver some receiving payload to my destination app and then from there if I want to I can specify those external composable calls that happen afterwards each with their own index so let's say I want to have more than one uh and price the exact gas limit in message value to be delivered per message uh really really useful for if you have a you know very complex app on the destination chain that has to make a lot of external calls but needs to ensure that let's say all execution logic has been satisfied in the receive step before moving
forward and for ensuring that if there's a failure similar along that chain of composable calls you don't have to have everything Atomic where it will all revert it once instead you'll have this opportunity to have it be executed for the LZ receive step and then if let's say there's a gas issue with the compose logic you know that the first call still succeeded uh besides that you can still dive into more looking at non ordering uh layer zero allows you to control the order of your messages so from the source side you're able to you know by default have unordered messaging where if let's say a message fails after to fails to exit execute to be clear uh
after already being verified subsequent nonsense can continue to be executed and subsequently have order delivery toggled on if you'd like for let's say if uh you need an application that absolutely knows the intended order for governance votes for tracking airdrop criteria for tracking whatever it may be for your application on the destination chain uh it can be really really useful to know that if you know knot 2 fails for some reason non 3 and four will Halt and be paused until that message is retried and executed to ensure that the order and validity of messages match what happened on the source chain and is delivered correctly on the
destination um again Max message size is something that you can configure as well the ability to control how many bytes that you want to have as the target message Um this can be useful for again you know making sure that when you deliver to your destination app that these mes aren't malformed and and follow the proper spec of whatever your byes array looks like and then again finally just diving into the composability step making sure that you're able to ensure separate Atomic pieces of your destination execution logic right the ability to for example send tokens to a destination address and then be able to immediately swap those tokens for another erc20 contract right
uh the way this works is that the receive step has its own gas limit and message value so this execution logic will execute atomically on its own and then a call will be made back to the layer zero endpoint and delivered to the destination app for the second composable leg of the transaction again entirely separate if this call fails this call still succeeds and really that's kind of the breadth of all the configurations you can do I feel like at this point I May uh have added a little bit too much uh to go into so feel free to stop me right now if there's any questions about anything related to the configuration stack or the dvns happy to
go through um what each of these mean in a little bit clearer detail so I think we've got a few questions in the in the chat there so what why don't we maybe go through them um so let's do it yeah let's do it all right there we are the architectural changes from V1 to V2 yeah we'll start there um really really good question so I'll go back a few slides um architecturally there are a couple new things added from the
endpoint side so remember that the end points themselves are IM mutable right once a layer zero end points deployed it can't be changed and so the big difference between V1 and V2 is mainly that the V2 protocol uses new endpoints that we've deployed uh the way that these endpoints work they're still immutable uh but they have slightly different interfaces that we've made uh based off of developer feedback over the last year so the endpoint V2 interface in my opinion is a lot simpler to interact with um there have been some optimizations made for uh one making it easier for you deliver more complex payloads uh a lot of that composable logic that I've been mentioning about
the ability to pack more and more calls uh is is really you know one of the things that we added for endpoint V2 to make it more future prooof and just have better uh you know composability from you know the traditional way where you pack all of your calls into one function and then once that function is executed you hope that all of them are delivered but if they if one fails the whole thing reverse uh the endpoint composable logic was made to have it where uh you can have these independent legs of the transaction execute and if one call reverts at the very end of this sequence that I have executing it doesn't cause every previous message that was
successful to revert and ultimately it makes the debugging a lot easier for you as a developer it makes the uh message workflow a lot more extendable and uh that was like one of the key reasons that we built out uh uh the endpoint V2 logic um one of the other things I'll share too if you want to follow along afterwards is this docs page that I wrote I'll just share it in the chat here uh this just gives a V2 overview going through you know this idea of uh how we expanded to uh from the Oracle and relayer setup in V1 to this combo of security stack and executor and then also these new protocol contracts for the message Library for the endpoint
interface to kind of just make things a little bit clearer interface wise and also uh improve message throughput overall um it from the message throughput side it's also interesting we moved from V1 being ordered execution which is what I showed I believe here at the end um previously in layer Z1 V1 all of the message ordering was ordered by default uh and this was uh an assumption that we made when we first released the protocol we initially thought that every application would want to have it where if a message is sent from The Source chain it will be executed in that order on the destination but what we found out
is that for things like token transfers that might be entirely unrelated right for let's say a fungible token like an ec20 uh you don't actually need the ordering of the execution to match the only thing you need is for the verification uh to be you know insured up to a given nons um we can dive into kind of how the non enforcement works at a deeper level but I think this probably suffices for the question right um nice uh is the dvn network running the same logic if so how can we make sure they won't hit a vulnerability at the same time yeah really good comment um so the way that the dvns work is actually very interesting uh they're
not all using the same Cent to run the dvns so for example polyhedra ZK like client is entirely built inhouse by their team using their ZK Bridge uh similarly for chain link ccip Axel's middle Chain Bridge they're not using the same client software to move messages through the network if you actually look at a low level for example when a application is using ccip or Axel you can follow the messaging logic and see within ccip or within how they move the message to the destination chain and so really all these dvns all they're doing and probably should have started with this
slide actually um all they're doing is writing you know their interpretation of this Source payload to the destination message Library they're just writing that payload hash using their own mechanism so polyhedra ZK bridge is writing here Axel could be writing to this message Library ccip could be writing to this message library but what it means is that you have complete Independence essentially on the verification logic and that gives you uh one the strong guarantee that they're entirely separate and unique processes they're not all based on the same client but two uh if you want to run your own dvn you're also introducing more Randomness into the security stack which
uh can potentially actually help security by making your providers more independent so I hope that answers the question a smart contract can't sign on its own behalf so are you relying on The Trusted messagers read The Source or on the user to include information in a message signed by them yeah good question uh the send logic is ultimately up to the application I'll dive into some code examples in a sec but essentially you define an interface right for what are the inputs that this user is going to send for the oft that input is typically uh on the contract level at least and a amount of tokens and amount of erc20 to send to the destination it is the amount
of gas that I want to pay for on the destination chain um typically an of can enforce the amount that they have to send at the application Level so that helps with preventing uh you know underflow of gas to the destination and failing execution uh but generally speaking for smart contracts right you define the interface of whatever inputs you want a user to provide and then your contract will do the encoding logic to turn those inputs into the bytes array and then deliver that bytes to the destination to be decoded uh I hope that is clear to everybody awesome um anything else or
I'll keep going and we can jump into maybe some code examples I have one start a question just about a opinion so we we have this uh we have this token transing from one to another right and you have some gas cost in both the chains at the moment right but yes this is is there any way that we can avoid the gas C on the minding chain say say for example we we have to destroy the destroy the token on the on the source chain right that that includes some cost because you need to verify that is yours that we can agree that that's a cost involved but for mining mining right so can have a mechanism where we can you
know that's how Bank work Banks depositing there is no money it is depositing right so can we have a mechanism where mining is no cost so me then this this problem of uh you you have the problem of transferring that m coins and everything will be soled right definitely um the reason that it's difficult I would say in the current you know cross chain environment is that every chain has different op code cost right and so the way that you actually derive at you know what is the cost of executing these functions versus these other functions on chain uh is derived by what op codes within the environment they're invoking um to send a message ultimately you have to Ping these
onchain elements namely the dvn contracts on the source chain and the executor contract on the source chain so that they know to emit the message but um actually we've seen a couple people do some interesting work with account abstraction to have this type of uh Gas payment abstracted from the end user right it can be paid for by whatever the application is on their behalf uh either through some balance it's pulled from uh whatever it may be and so as an application user like I totally agree having to pay twice to write a message on source and on destination doesn't feel like great ux but I do think that you know as gas costs get cheaper over time at least with uh you know a lot of
the work being done with blobs and as uh you know account abstraction comes more and more viable you can probably reach a state where cross-chain messaging can be done incredibly cheap for the end user uh with just the application owner or organization taking on maybe a brunt of those costs but I think in general it's always going to be difficult because you have a cost of block space right so there's always going to be a cost of including on the source chain and the destination it's just about driving it so low so that no one really knows it's there yeah this could be a something that new chains can adop in and say look we are interoperable we are offering free minting for something like that new change can offer maybe exactly um Stargate V2 which is uh a bridging
protocol built on top of layer zero one of the things that they did with their recent V2 launch was they actually created a bus and so the way you can think about a bus is that there are a ton of different users that each want to send a message to a destination right and so you load the bus with each of their individual messages right and then ship it all at once in one transaction and say you're Distributing the cost across many more users it gives you a lower average cost for the bridging transaction uh and this leads to you know better fees overall for the end user um things like this where you get creative about how do you distribute the cost of block space and how do you most efficiently use it it really are how you can optimize a lot of the bridging cost
I believe yeah talking about the messages so the how the payload is being transferred so each application P transfer individually or you create a block or something how does it uh it works yeah it's all being done individually so I'll actually probably let's just go through a last couple slides and then I think jumping into a code example might be really useful here um just so we can see under the hood what's actually happening so um yeah I think to to wrap up really quick uh and then jump into that exact that use case right uh this Frame work of being able to give applications configurability means that layer zero as a protocol you know isn't optimized for any one use
case it can be optimized for any and so that means that any application whether it's defi specific whether it's social fi gaming nfts whether it's just moving raw data or identity kyc you can use either contract standards that layer zero provides to make it easier to develop or broadly any smart contract interface that can interact with this Slayer zero endpoint emit a message using the configurations that you've set and then deliver them to a destination chain uh as of today we are live across a bunch of different you know sub verticals within the space uh whether that's like traditional Financial Services whether that's with Enterprise users whether that's with stable coins uh token Bridges like Stargate gaming
protocols defi uh because the protocol is so agnostic to the security mechanism that the application uses and how you Orient that application it means that we can you know service a lot of these applications that need different uh identities essentially from Cross chain messaging while still giving you a consistent interface to constantly look back to the endpoint ultimately will always be the contract that you send messages from and you uh or sorry you send messages to and that you receive messages from and so that gives you uh a good framework of understanding how to actually interact with this cross chain protocol how do I configure these new kind of security mechanisms without
needing to go and learn myself an entirely new bridging protocol and how to incorporate it safely within my application without having to kind of reinvent the wheel in that sense uh as of today this slide is actually out of date I need to update this one a bit more uh layer zero is live across 70 plus blockchains uh majority of which right now are evm equivalent uh but I believe as of two weeks ago we launched live on salana uh the salana endpoint is currently live uh so feel free to check that out um and ultimately the goal with this kind of interoperability standard right is that not only can we Service public networks but also private networks and connect them in ways that unlock new application
use cases not only between public networks but also between these private networks that are interested in creating safer ways for users who are afraid of crypto or don't quite understand it to interact more with blockchain in a controlled environment on their chain but still tap into the available resources that are Freer on a public network uh ultimately uh if you want to start developing on layer zero feel free to just scan that QR code um but if not uh I'm gonna actually jump into some of the code really quick to answer that last question uh I have three kind of examples that I hope cover broadly some of the questions that we had earlier in
the chat uh the first one that I'm going to go through is a pingpong contract uh if you're wondering what this repo is um that QR code that I sent it should link to a CLI tool that layer zero has produced um this CLI tool if you look has just spun up a repo that has uh both Foundry and hard hat contracts in it so you can use Foundry or hard hat whatever you want uh does not matter uh and one of the interesting things that you can do with this example is you can utilize this test helper that we've built um this test helper lets you simulate a cross-chain transaction entirely in your unit test um this is
not spitting up a local network with Anvil it's not using any you know local blockchain nodes you're actually just using The Foundry unit test and some contracts that we've spun up to mock the endpoint Behavior mock the verification step and then mock the execution um but at a high level want to take a step back um we had a question earlier which was how do we actually form these inputs and who's the caller that sends these messages right um at a high level this contract is very very simple it's only inheriting this oap standard that we have um and this you know Library called options type three
uh this Library don't worry too much about it this just allows me to enforce the gas amounts that I want users to pay on the destination chain uh you can see here that in this contract I've defined a data variable nothing received yet some random message types that I want to use uh in this case I want to send a message to a destination chain for message type one and then this send ABA which means I want to send a message to the destination chain and then have that destination chain ping back right so I want it to send a return call back to its Center to notify it that you know it received the message um the way that this contract works at a high level super
straight forward um all I do is in the Constructor I provide the endpoint address that I'm going to use and the owner pass that into my OA Library also provide it into the open Zeppelin ownable uh this encoding I'll jump to in a little bit uh and there's three main functions to really pay attention to there's quote there is a send function and there is a receive function uh the way that this send function works is it'll take the destination endpoint ID that I want to send to it will take the message type whether it's just send or you know send ABA and then it'll take a string actually as a message um in this case I just want to send literally a message to store in storage on the
destination chain uh and then some extra options I'll jump in this a little bit in a sec but uh all this function does is when I call send it will invoke the oaps uh send method uh like I showed you in the slides this just calls endpoint do send with the message value I need you know checks if the pier is valid for that destination then sends the message uh but the really interesting bit and I think what people are probably more Curious on is you know we have this method for sending outbound right it's payable by the message sender uh with the message value that they give how is it being received well on the
destination chain uh this contract will also be deployed so I'll have two instances of pingpong pingpong A and pingpong B uh the way that pingpong will work is that when that message is sent verified correctly and delivered uh this LZ receive function will be invoked uh from the endpoint directly uh using that receiver interface and this function will basically Define okay there's a string to data a message type uh and then some of these execution options and we'll decode it from the bytes that I've encoded on the source chain uh what it will do then is it will check hey is this message type a return call it will you know fill in what the
uh new message is and then it will send that message off using the origin uh that's provided as a struct here it will pull hey who was the sender where did it come from from it will pull uh the new message and who to send it to uh in this case send is the message type uh and then some of the execution options that I want to pass to destination chain so altogether when I call send it will send a message this will be received it will call internally another send function and this will go back to the returning contract uh in practice this will look a lot simpler actually in The Foundry test so this
setup super simple I'm just mocking you know there's a chain a and a chain B that I'm working with deploying mock to endpoint a endpoint B and then in this test ABA uh you can see here that I have these settings for enforced options this is the part where I was talking about the gas limits in this case um don't pay attention to the gas amounts here within Foundry it's not actually accurate of a real chain in terms of how much way it will cost but the idea should get across that I can Define how much gas I want every caller of send to pay if I just have them send one message to uh point B it will cost 50,000 gas that I want to deliver to the
destination chain for message type send ABA I will have them pay up front for let's say actually don't need this much but we'll just say 600,000 and 200,000 worth of message value right uh similarly on the receive side I can do the exact same thing so if I'm receiving a message uh back from B to a I want to pay 50,000 gas and uh this gives us kind of a setup for the gas amount of one the gas limit here and the message value um from there once I've kind of set up the settings how I like all I'm going to do is call the set enforced fun uh set enforced
options function on the sender contract and the receiver from there uh generate a quote for how much it's going to cost the nice thing is that you can just generate this quote offchain if you like so generate how much it's going to cost for sending from B to a and then I can pack that amount back into my single uh sending contract here as an option quote it again and then pass that quote as the message value to my user a um the the way that this function is essentially being called is that I'm pranking as a random user I am calling send with message value equal to this quote that I generated for the total gas cost the quote contains the source chain
gas cost um it contains the source chain Cost Plus the price of gas that I want to send plus uh the fees for my chosen security stack so and executor so this is kind of what this quote function is actually doing it's taking all these inputs taking the payload I'm sending the destination I'm sending to uh and these execution options and figuring out what is the total cost of sending this message from there this just verifies that hey I'm delivering the packet to the contract on
chain B and I'm verifying the packet and delivering it to the contract on chain a with that I'll run Forge build make sure it builds correctly yep no changes and then run this contract here and we'll actually be able to look at the stack Trace here to kind of see a little bit deeper what's happening you can see that within this stack trace the ping pong contract on chain B is returning for me chain a says hello and the pingpong contract on chain a is saying chain B says goodbye so we know that the data variables that's what's being called here in our test uh this data um field that's just a string right uh has
been updated correctly by our different contracts on the unique chain and then updates the state and returns State correctly so the neat thing here is that although this example is relatively simple there's a ton of different use cases you could think for for why you might want to have return calls right uh whether that's you know potentially doing some type of kyc check whether that's uh doing a defi operation where you want to let's say pay for some asset that's available on chain B uh using chain A's tokens and then have it return a asset from that chain to you uh we have a lot of Partners For example that create Omni chain nfts and so if you had an omni chain nft Marketplace you could
pay for an nft uh and have it delivered to a source chain for you if it's not currently on that chain at the given time uh a lot of things with this kind of back and forth pattern mechanism can be used and and done um real quick I'm going to stop there and just pause for questions if there's anything about this kind of design pattern or about the protocol to happy to jump into that also yeah I think that was a great example so I think um yeah everyone yeah
awesome uh if that's the case I'll jump in then to another one um really quickly just I don't want to go too far on our time here yeah so this is another interesting example um that we've deployed recently so one of the use cases that you might want to have with a cross chain protocol is rate limiting right the ability to say okay I'm moving this amount of tokens from chain a to chain B but I don't want all of them to be able to move at once let's say I want a hard cap on how many tokens can move uh this what we call an efficient rate limiter is a way for you to basically specify that there is a max amount of tokens that can ever be in Flight right and within this contract the way it
works is it will calculate from the rate limit the amount that have been sent uh when it was last updated uh what the limit is and this window uh Decay and so this graphic here kind of shows you that over time if let's say the max cap is 100 tokens it will Decay as uh this amount in Flight uh increases or decreases right so if 100 tokens are in Flight uh actually I probably should reverse this graphic the the main idea uh is basically that you are limiting the number of outbound tokens that can be sent at any given time and that if someone sends a massive balance of let's 100 tokens right uh that's the max cap
uh the way it will work is it will slowly Decay and allow you to send a little bit more before it hits that Max limit again so you can see um when 100 tokens have been sent no tokens can be further sent again uh at the next Point uh the cool down has applied a little bit so maybe like 10 tokens have now freed up to be transferred uh few seconds after that maybe closer to 30 and so on and soth for you have this Decay R uh but the more interesting bit is probably what you guys are thinking about for the cross chain side so uh this rate limit uh can apply in a lot of different ways um one of the unit tests that I have here is uh basically
checking uh that yes the test uh receive amount will fail when you send too much um actually I want to jump into one maybe a little bit simpler just so we don't spend all our time going through this custom logic right so for the of transfer perfect um basically all I'm setting here uh up higher in this test contract is what the rate limit actually is in this case I'm saying that uh the max amount of tokens that can be sent outbound is two uh to this chain and there is a time limit of 60 seconds right uh what this will do is in this send function
it will first create this struct of send parameters this is a very standard struct for the Omni chain fungible token contract uh you'll probably recognize a few of these prams the first is that it is obviously the destination we want to send to the second Pam is who is the address receiving this token on chain B this can be externally owned account could be a contract doesn't matter you can see here this is the amount of tokens to send this is the minimum amount of tokens to send and finally again those execution options and then two other variables
here uh this one is our composed message so remember I could send if I wanted to a another external call to be executed after this token transfer um I won't do it just yet but uh we will look at that in a moment and then this last one here is a oft command uh also bites um won't go too much into the of commands it's another Advanced function that you can use within uh your of logic to basically have extra checks within your receive side logic to you know invoke different uh different function calls within the LZ receive call itself um but
again the way this send test works is for of that's deployed on CH a it's just an erc20 token we generate a quote using our send prams we store it as a fee we do some asserts just to make sure that you know the balances are correct and then when we call send What's Happening Here is we are going to send an amount of value uh using that quote we generated we're going to pass in that send pram struct that tells us who we're sending to the amount of tokens all of that the fee that we're going to pay uh and then we are saying that it's payable to address this in reality probably message. sender would make more sense here just because there's an external user calling it uh and then testing that
after we've called this send operation that calls the endpoint and you know emits the message we verify the packet through uh and check that you know did the balance deduction happen as expected um afterwards we then check all right is it going to allow us to send the same number of tokens uh within that correct limit right so if we look at this test we can see we're pranking again uh as the user calling send verifying um here skipping ahead 61 seconds pranking sending the message and calling a second time and so if we do Forge test match test actually I'll do
match contract just to make sure we're hitting this one rate limit Mock and then Match test we can see for this one test send of succeeds after waiting limit nice we can see here test passes but more importantly I want to show you what's actually happening we can see here that basically this test is succeeding because we're sending a token amount right to a destination chain we are asserting that hey this is the initial balance for both users the balance of the oft uh for user a on chain a and then
similarly the exact same balance of the of for user B on chain B when we send those tokens we are doing a check here to make sure that the amount sent is debited correctly right and then also checking that the amount uh sent is credited correctly uh and then just enforcing that that rate limit actually is happening the way that we expect um so very very useful kind of um way to think about it uh I know we're kind of running low on time here but I want to um go through one last example too if we have the time for it um are there any questions though really quickly about
you know the rate limits or you know how you can implement this yourself nope okay awesome I will keep jumping along then uh last one is no more mock testing I actually want to look at uh something that is already deployed um actually I will go to um really quickly here give me just two seconds I'm gonna pause my screen share for a moment just so I don't bore you with all of the files on my desktop um but there's a really interesting example of that composed message logic that I wanted to show off as well um
mainly this idea of being able to transfer a token swap it for some amount and then stake it um so I'm going to go to a contract that I already have deployed here inside this you can see again this is the CLI repo I have before uh in here I have some fun other contracts that I've been working through but these are not finished yet unfortunately but uh some of them are which is this erc20 mock think of it just as a standard erc20 uh this swap mock the way that this swap contract works is using that composed interface and then uh just a standard oft so the way that an omni chain fungible
token works as I've kind of shed before right just like erc20 uh under the hood what this contract is doing uh is very very similar to the original erc20 token so if we jump in here we're just inheriting some uh contract Logic for how to interact with the layer zero protocol and the erc20 contract uh pulls in some familiar methods like token to show the token address uh and then has this debit and credit logic and you can see in here that you know whenever a uh message is sent this debit function will be invoked which calls the erc20 burn method to burn that amount from The Source chain and then once that message is verified successfully deliv Del to
destination will get credited and that mint method will be called as well so returning that amount of local decimals delivered um I'm going to go pop into a pretty useful utility that I have here I've deployed this already a couple times but uh I deployed it on arbitrum saoa and Avalanche Fuji and we're going to pop to layer zero scan uh this might not work from my view at least so I might have to paste this link over to you guys to see um we're currently a little bit rate limited from our side just from people spamming the the scan interface but I will uh pop over and send this in chat here so if you take a look at that uh
scan interface from your guys's side you'll see uh a list of 38 different messages right uh the important thing is not really uh just the list of different messages but showing you the interface of multiple different cont contracts on arbitrum and Fuji working together and kind of seeing uh you know where those messages are being sent uh it's really handy because you're able to see clearly from that interface the uh message payloads the execution amounts uh you know how much gas is being paid for for the receive logic and then uh within the actual code snippet the thing that I think will be most useful for you guys
um if we go in here and look bit deeper at the composing mock right this swap um in reality you probably wouldn't deploy this contract outright with an oft but what you might do is have this call some other Bridge interface for some type of token that you want to transfer uh the way that composing works is that you just have to inherit this composer interface uh and what it will do it is it will take in the erc20 token address that I want to let's say swap for right it will take in the endpoint address that is expected to receive messages from on the destination chain and it
will take in the OA address uh essentially what's happening here in this flow is that there's a function called LZ compose the way that the workflow is is happening is that someone will call of send right which will send a message to your specific security stack and also your executors right once that message is verified you can think of it as being of well endpoint dolz received by the destination endpoint and then that is again delivered to the of contract and calls the of methods LZ
receive and So within this workflow um after the message has been successfully delivered a secondary call is made um within of. LZ receive I will make a call to an endpoint method called send compose what send compose will do is it will again store the message back in the current endpoint for that chain and then it will Reit that message as a separate transaction that the executor will invoke uh by calling endpoint dolz compose and that's what's being executed
here this endpoint dolz compose is calling the uh composers LZ compose method and so in this example it's very very simple all it's doing is first checking hey is it coming from the O app I expect from the message and is it coming from the endpoint that I expect and then decoding from that composed message a receiver for these tokens that I'm about to swap it is then decoding the amount that was received to this contract from the of transfer and then just doing a quick erc20 safe transfer from you can think of this as like a lockbox contract for all intensive purposes um ultimately
this logic not super extendable itself directly into an implementation but I would think of it as a good stepping stone for understanding how composability works right the idea Isle that I can s a token my chain a right so a send verify the message receive the tokens those tokens get delivered to this contract um I guess I'll put that here um I'll composer receives of token and then in this secondary workflow it is swapping that token for this nested C20 that's in this contract and so this gives you a very interesting
way of kind of diving through the different uh compos steps that you can look for um what I'll do is because I don't have the ability to show you on scan right now I'll actually just pull up um arbitrum so P you scan really quick uh I had it already for me uh perfect there pull up the swap moot contract it is verified on the Block Explorer you can see that this one is slightly different um I've changed the interface ever so slightly in uh this bottom contract here I believe yep swap mock um you can see here I uh originally was encoding an amount and an address as an example the current code uses
actually uh this method internally uh called amount LD just to know how much from the message itself uh needs to be uh delivered but the most important thing about seeing this block Explorer example is the actual uh erc20 token transfers you can see here there's this repeat pattern of in and out uh basically what you're seeing is whenever an of is received on the arbitrum side it is being uh sent into this contract and then at the exact same time uh one token is being sent out this Mock erc20 and so we have this Mach of as the input The Mach erc20 is the output over and over and over again uh and this kind of
gives you the uh supply line logic that you might expect right uh if you need your application to let's say not revert from the receive logic if let's say this swapping function fails uh you can know that they are separate transactions entirely uh that have their own gas limits their own message values uh and are entirely controllable by the application uh I'm G to paste this here and then I think probably just wrap up for general questions from anybody if you got anything else I think we've got time for just one
question because I think we're right right at time um yeah so Babu go ask your question um no no it was it's not a question this it is very no no no no no I I do not have a question I I was just making sure you all knew that but um yeah we're right at the absolute end um anyway over to you bar yeah so all good the last presentation was really good uh so one thing uh this recent trend of using the intent um to sendage what do you think so in this case we have a latency of know both the both the chains to come to consensus and all those things the intent case the the latency is taken
away and somebody's taken care of your transaction and sort of giving you the token on the other end um what do you think about these two methods compared to your yeah I think intents are interesting in the sense that it requires the prover and oh sorry can you can you hear me okay nice um I think it's interesting because the prover and the filler for those intents uh really do matter a lot of kind of the speed that you see for some intent based protocols is they rely on uh you know finding someone to fill the order relatively quickly and the actual method for how you select who is
filling that order on the destination chain isn't exactly clear in a lot of cases there's a lot of room for potential centralization vectors within um how you prove and and and really what messages are delivered first who is filling the messages out of the available stack of fillers um and I think they're in General probably some scalability concerns I think for one large volumes that potentially you know might drain the filler accounts um in general the method for I think most arbitrary messaging platforms uh ends up being a little bit slower but tends to be more cost effective too I think on the longtail part of it is this ability
one to to spread out cost between the source and the destination but um layer zero uh I think I think with intense it's difficult because you can you could reasonably make a case for for example building like a dvn that does uh intent-based model filling right getting someone to look for a message and maybe optimistically uh you know approving it until someone you know Flags it as invalid uh but there's just uh there's just a lot of uh I guess centralization risk that we personally don't see as being as as solvable I guess at a large scale
to to answer your question yeah yeah thank you so the the last part you shown us was really good so that makes sure that the functionality on everything works very well uh it will be to have some threat model uh in in a sense where what are the what are the possible things can go wrong in between and then testing that case will actually prove so the all the things I shown is all the functions work very well but a lot of the times there is lot of other factors that in between can go wrong so that def that testing will be really helpful to make this video work thank you yeah appreciate it yeah all right well look thank you for coming along today Matt um that was
a great talk um everyone in two weeks time I'm going to talk about random numbers um so yeah look thank you and um yeah thank you again for a great talk and have a great day everyone bye-bye thanks Peter
Related talks
- Unlocking Omnichain Vaults with LayerZero
- The Next Advancement in Cross-Chain UX
- Igor Barinov ~ Creating xDai and Using the Open Source Tools From POA
- Moonbeam: Ethereum compatibility and Polkadot interoperability
- Ethereum L2 + multi-chain = the next step in DeFi UX
- Crosschain Applications using Crosschain Protocol Stack & GPACT
- LayerZero Labs 🛠 Sending Cross Chain Messages - Matthew Krak
- Keynote: Unifying Ethereum Through Intents and ERC-7683
- EthCC 2: Craig Williams
