EVM: From Solidity to byte code, memory and storage

  Рет қаралды 50,649

Ethereum Engineering Group

Ethereum Engineering Group

Күн бұрын

Slides are here: drive.google.c...
Peter Robinson and David Hyland-Wood described how Solidity code is compiled, deployed, and executes in the Ethereum Virtual Machine. The talk covers EVM opcodes and how code in the EVM uses the various data locations:
Stack: EVM Opcodes pop information from and push data onto the stack.
CallData: Transaction parameters.
Memory: Temporary data store within a transaction.
Storage: Persistent storage that is part of world state.
Code: Stores code and static data such as strings.
Logs: Write-only event log output.

Пікірлер: 62
@guru2491987
@guru2491987 2 жыл бұрын
This is such an amazing talk. Very much appreciate the amount of work that has gone into the slides and the content. I have a much deeper understanding of the EVM thanks to these 1.5 hours. Thank you Peter, David and team.
@ludwigthouvenin2012
@ludwigthouvenin2012 2 жыл бұрын
This is a goldmine, thank you for this amazing presentation.
@frankzheng7925
@frankzheng7925 3 жыл бұрын
An amazing talk about EVM!
@humzakhan288
@humzakhan288 2 жыл бұрын
This is an amazing presentation. The level of detail is top notch. Keep up the good work!
@fode-diop
@fode-diop 10 ай бұрын
This presentation is straight 🔥 Good stuff!
@TheDFIPodcast
@TheDFIPodcast Жыл бұрын
So much win! This is demystifying the deep CS underbelly of Ethereum. Thank you for creating this content!
@0xRoman-c2r
@0xRoman-c2r Жыл бұрын
Awesome video! Thanks for the lecture, very interesting to learn about it
@xmlyyuan
@xmlyyuan 3 жыл бұрын
Very detailed videdo. Also good for knowing how VM works inside in general.
@zes7215
@zes7215 2 жыл бұрын
no such thing as interestx or etc or not
@0xTyfn
@0xTyfn Жыл бұрын
Huge thanks for your hard work sir. I really appreciate it 🎉
@EngenhariadeSoftwareLuciana
@EngenhariadeSoftwareLuciana 2 жыл бұрын
Impressive talk!!! Thank you for sharing.
@wpmeng2859
@wpmeng2859 2 жыл бұрын
Really solidity deep study. Thanks.
@ashh3051
@ashh3051 2 жыл бұрын
Really solid deep dive. Thanks.
@nickeast4853
@nickeast4853 5 ай бұрын
thanks for the detailed explanation !! =] really want to learn more from you ! may I ask a question ? @42:48, why does it have to revert if "CALLDATASIZE - 4" is less than 32 bytes ?
@estela3185
@estela3185 2 жыл бұрын
Amazing video, thank you. Cordiale.
@leeren_
@leeren_ 2 жыл бұрын
Been trying to dig KZbin for ages for a more in-depth talk on the mechanics of the EVM. Just wow - this is incredible. Thank you so much. Hope to help on the education side soon :)
@qazawatzirak2596
@qazawatzirak2596 2 жыл бұрын
Nice explanation. At 20:10 we have the byteCode of runtime. The deploy transaction stores only Init Code fragment (i.e. Contructor). At 27:53 we are doing a code copy (from where it is). My question is, where is the Code ? From where the code is fed to EVM since the transaction does not include the byteCode of runtime ? Meaning, do we send the actual byteCode separately alongside the deploy transaction to a Node ? Also at 30:49, the code (runtime) is copied into the blockchain. Is it copied into the Merkle Praticia tree storage of that deploying account address ? Increasing the deployers nonce
@EthereumEngineeringGroup
@EthereumEngineeringGroup 2 жыл бұрын
The deployment transaction's data includes the byte code of the init code and the run time Solidity code. That is, have a look at the output of solc --bin SomeContract.sol . Those bytes of data for a deploy transaction are treated as code. The codecopy copies the code that is after the init code from where code is executing to memory. A reference to that location in memory is then returned, indicating the code that should be deployed.
@crypto_peng
@crypto_peng 2 жыл бұрын
Definetely would like to have the new version but more visualized explanation for OP_Code again!! Still can't understand very well. Thank you sir!
@0xcoder542
@0xcoder542 2 жыл бұрын
Hi Peter, Thank you for contributing such a valuable video about the Ethereum EVM. I'm interested in the State and the Patricia Trie I would appreciate it if you could share with me the video that you mentioned in this video. Many thanks
@EthereumEngineeringGroup
@EthereumEngineeringGroup 2 жыл бұрын
I think that is going to be one of the videos on Stateless. Have a look at the channel, look at the Videos tab, and then go to the video that was just before this one.
@lorenzocanocesconetto2577
@lorenzocanocesconetto2577 Жыл бұрын
Great talk! Let me point out a small correction though, at 30:53 the second argument of return, i.e., stack[1], is the length of the data and not the ending address
@EthereumEngineeringGroup
@EthereumEngineeringGroup Жыл бұрын
Correct. At some point, I should re-do the talk with many small / minor corrections.
@Elyx0
@Elyx0 3 жыл бұрын
Wonder if they ever got to coding the array index underflow
@MrCoreyTexas
@MrCoreyTexas 2 жыл бұрын
The slide at 57:27 was confusing to me, because I was looking for 0x14, which is what gets assigned to valAddress in the code. Then I realized that 0x05 is 0x14 shifted right 2 bits. So the solidity compiler internally shifts 0x14 right 2 bits, putting 0x05 in the code, then outputs a shift left by 98 bits. Why does it do this? Well, I guess if it had to store 0x100, it could shift that to the right 8 bits, and put 0x01 in the code. So its output would be 1 byte less. Talk about microoptimization! So it doesn't really need to do it for 0x14 but it does anyways to simplify the code of the compiler.
@MrCoreyTexas
@MrCoreyTexas 2 жыл бұрын
Which brings to mind the next question, why does it PUSH5 0x13000000000? Why doesn't it PUSH1 0x13 and SHL by 32 bits? The mind boggles.
@abstractumx
@abstractumx 2 жыл бұрын
thanks for sharing!
@leeren_
@leeren_ 2 жыл бұрын
42:36 Isn't the revert condition specified by assembly revert if (CALLDATASIZE - 4) = CALLDATASIZE - 4 The ISZERO returns 1 if 0x20 >= CALLDATASIZE - 4, 1 if 0x20 < CALLDATASIZE - 4 So it reverts if CALLDATASIZE - 4
@Naz-yi9bs
@Naz-yi9bs 2 жыл бұрын
@18:11 it's mentioned that, val2 = 3; will set "val2" as a state variable. Is that also not the case with val1, it's declared but assigned, however, doesn't that still make it a state variable? Thank you for this amazing video.
@EthereumEngineeringGroup
@EthereumEngineeringGroup 2 жыл бұрын
@naz val1 is also a state variable. It will have its default value, which for uint256 is 0. However, what I was meaning was that in the constructor, all initial values of state variables are set-up.
@miketruk7639
@miketruk7639 Жыл бұрын
@27:09 Storage[1] = 3 Stack[0] is location to write to stack[1] is the value to write but in my mind its like PUSH1 0x03 -> stack[0] = 03 PUSH1 0x01 -> stack[0] = 03, stack[1] = 01 SSTORE -> stack[0] is location (3) and stack[1] is value (1) what am i missing?
@EthereumEngineeringGroup
@EthereumEngineeringGroup Жыл бұрын
stack[0] is the top of the stack. Hence, PUSH1 3: stack[0] = 3, PUSH1 5: stack[0] = 5, stack[1] = 3, and then PUSH1 7: stack[0] = 7, stack[1] = 5, and stack[2] = 3
@0xatharva952
@0xatharva952 2 жыл бұрын
I am 2 years late.. yet learning soo much!
@carsonhalter3134
@carsonhalter3134 Жыл бұрын
@ 13:00 does anyone have the link to the video on Merkle Patricia Trie's?
@EthereumEngineeringGroup
@EthereumEngineeringGroup Жыл бұрын
kzbin.info/www/bejne/o3LTnXeDo7qWqpo
@jayjelaso5354
@jayjelaso5354 4 ай бұрын
what happens to storage data that is persistent and then a revert happens, does it stay there? what about subsequent runs of the contract, does storage stay there for every run of the contract and does it use up the storage.
@jayjelaso5354
@jayjelaso5354 4 ай бұрын
I have a million questions that are simple questions but are not addressed in the documentation and I am trying to piece together the functionality of progrmming in solidity. Sorry to be a downer thanks for all you help and comprising this too low drill down about stack storage and memory and call data
@EthereumEngineeringGroup
@EthereumEngineeringGroup 4 ай бұрын
If there is a revert, storage is reverted to. It is as if the transaction didn't happen (except for the gas charges)
@EthereumEngineeringGroup
@EthereumEngineeringGroup 4 ай бұрын
Storage is persistent across transaction executions
@jayjelaso5354
@jayjelaso5354 4 ай бұрын
@@EthereumEngineeringGroup So previous slots used up are going to stay there and new transactions require new slot storage? thank you for your replies
@crypto_peng
@crypto_peng 2 жыл бұрын
13:50 - Why State Root is 160 bits, and Account Storage Root is 256 bits numbers?
@EthereumEngineeringGroup
@EthereumEngineeringGroup 2 жыл бұрын
Storage slots are in a 256 bit range. Account addresses are 160 bits.
@crypto_peng
@crypto_peng 2 жыл бұрын
@@EthereumEngineeringGroup got it!
@davidz8110
@davidz8110 2 жыл бұрын
This is really great talk! it helps me to get clear of the evm. BTW. could you help update the slide link, it is unavailable now. Thanks!
@EthereumEngineeringGroup
@EthereumEngineeringGroup 2 жыл бұрын
Link updated.
@0xsabir
@0xsabir 2 ай бұрын
what's the init code fragment ? 18:45
@EthereumEngineeringGroup
@EthereumEngineeringGroup 2 ай бұрын
Constructor, initialisation, plus copy the runtime code to the a return address position so it can be installed.
@crypto_peng
@crypto_peng 2 жыл бұрын
Where can I find the community? Nice sharing thanks.
@EthereumEngineeringGroup
@EthereumEngineeringGroup 2 жыл бұрын
Join the meet-up group: www.meetup.com/ethereum-engineering/
@lzy-v5136
@lzy-v5136 2 жыл бұрын
53:57 - where is 0x37?
@EthereumEngineeringGroup
@EthereumEngineeringGroup 2 жыл бұрын
0x36 is a PUSH1 instruction. It pushes the next byte from code onto the stack. As such, the 0x3d value is what is as location 0x37.
@grigrob9
@grigrob9 2 жыл бұрын
18:19 solc compile command
@SaurabhBhai-t8k
@SaurabhBhai-t8k Жыл бұрын
At 1:04 my dog also bark who is there in laptop Screen 😄
@ViceCoin
@ViceCoin Жыл бұрын
Any tools for AndroidOS?
@EthereumEngineeringGroup
@EthereumEngineeringGroup Жыл бұрын
Web3J is a Java library for interacting with Ethereum nodes.
@ViceCoin
@ViceCoin Жыл бұрын
@@EthereumEngineeringGroup All the insalls are CLI prompts (Windows). Any solidity editors for Android? I have a wireless keyboard.
@vinuvinu5884
@vinuvinu5884 3 жыл бұрын
Kannada
@goodboy9758
@goodboy9758 2 жыл бұрын
chi chi ikkada kuda entra
@MartinMarchev
@MartinMarchev Жыл бұрын
Amazing talk! Congrats and the great content and its delivery. Thanks for sharing it with us. 🙏🏻
@AnonymousSkimaHarvey
@AnonymousSkimaHarvey 2 жыл бұрын
This is pure gold. Thank you so much ! (all i need to move on level 18 on Ethernaut)
@gaofan2856
@gaofan2856 2 жыл бұрын
this channel is a hidden gem
🎤 Demystifying EVM Opcodes
29:14
ETHGlobal
Рет қаралды 10 М.
iPhone or Chocolate??
00:16
Hungry FAM
Рет қаралды 36 МЛН
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 1,6 МЛН
Apple peeling hack @scottsreality
00:37
_vector_
Рет қаралды 132 МЛН
Ethereum Explained: The EVM
48:33
Jordan McKinney
Рет қаралды 26 М.
Complete Guide To The EVM | Everything You Need To Know
35:17
Owen Thurm
Рет қаралды 6 М.
More Advanced Solidity and Design Patterns
41:06
Ethereum Engineering Group
Рет қаралды 7 М.
Deep Dive into WazirX hack
1:14:22
Ethereum Engineering Group
Рет қаралды 328
Alex Roan: Hitchhiker’s Guide to the EVM
20:41
Chainlink
Рет қаралды 6 М.
Advanced Smart Contract Hacking
35:17
RSA Conference
Рет қаралды 55 М.
Demystifying Ethereum Assembly by Joshua Riley | Devcon Bogotá
1:59:28
Ethereum Foundation
Рет қаралды 7 М.