Close Menu
Altcoin ObserverAltcoin Observer
  • Regulation
  • Bitcoin
  • Altcoins
  • Market
  • Analysis
  • DeFi
  • Security
  • Ethereum
Categories
  • Altcoins (1,265)
  • Analysis (1,458)
  • Bitcoin (2,036)
  • Blockchain (1,180)
  • DeFi (1,395)
  • Ethereum (1,398)
  • Event (54)
  • Exclusive Deep Dive (1)
  • Landscape Ads (2)
  • Market (1,438)
  • Press Releases (1)
  • Reddit (689)
  • Regulation (1,337)
  • Security (1,929)
  • Thought Leadership (2)
  • Videos (41)
Hand picked
  • Big Banks explore joint Stablecoin-Crypto Venture. Tether’s William Quigley breaks it all down
  • Victory for Binance: the American sec decides to reject the trial
  • Bitget lists Ripple’s Rlusd, triggering the race for the regulated stablescoins
  • US markets close when Trump Drama Muddies Outlook
  • Infinite Node publishes a detailed book of cryptopunks nft
We are social
  • Facebook
  • Twitter
  • Instagram
  • YouTube
Facebook X (Twitter) Instagram
  • About us
  • Disclaimer
  • Terms of service
  • Privacy policy
  • Contact us
Facebook X (Twitter) Instagram YouTube LinkedIn
Altcoin ObserverAltcoin Observer
  • Regulation
  • Bitcoin
  • Altcoins
  • Market
  • Analysis
  • DeFi
  • Security
  • Ethereum
Events
Altcoin ObserverAltcoin Observer
Home»Ethereum»Snake upgrades: more funny things
Ethereum

Snake upgrades: more funny things

April 19, 2025No Comments7 Mins Read
Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
Eth org.jpeg
Share
Facebook Twitter LinkedIn Pinterest Email


In the past two weeks, our main goal has been that all customers have updated POC5 compatibility, and this has certainly been a long road. Among the changes to the virtual machine, in particular:

  • The new INIT / Code mechanism: Basically, when you create a contract, the code provided will run immediately, then the return value of this code will be what will become the contract code. This allows us to have contract initialization code, but to remain in the same format of (nuncio, price, gas, value, data) for transactions and the creation of contracts, which facilitates the creation of new contracts via the transfer of contracts
  • Reorganize transaction and contract data: The command is now (nuncio, price, gas, to, value, data) in transactions and (gas, to, value, datain, datainsz, dataout, dataoutsz) in messages. Note that snake keeps the shipment (at, value, gas), o = msg (at, value, gas, datain, datainsz) and o = msg (to, value, gas, datain, datainsz, dataoutsz).
  • Frame adjustments: The creation of transactions now has 500 gase fees and several other costs have been updated.
  • Codecopy and Calcodes Calldatacopy opcodes: CODECOPY takes code_Index, mem_index, len in arguments, and copies the code of code_index … code_index + len-1 in memory Mem_index … mem_index + len-1. These are very useful when combined with INIT / CODE. There is also the codes size now.

However, the most important changes were with architecture surrounding the protocol. On the graphical interface side, C ++ and Go customers are quickly evolving, and we will see more updates on this side coming very soon. If you have closely followed Ethereum, you have probably seen Denny LottoA complete implementation of a lottery, plus a graphical interface, written and executed inside the C ++ customer. From now on, the C ++ customer will evolve towards a more developer-oriented tool, while the GO customer will start to focus on a user-oriented application (or rather, meta-application). On the compiler side, Snake has undergone a number of substantial improvements.

First, the code. You can take a look in the snake compiler under the hood and you can see All functionsAvailable, as well as their precise translations in EVM code. For example, we have:

72: (‘Access’, 2, 1, 73: (”, ”, 32, ‘Mul’, ‘Add’, ‘MLOAD’),),),),),),)

This means that what access (x, y) really does under the hood is that it compiles recursively what x and y are really, then load the memory in the index x + y * 32; Therefore, X is the pointer towards the start of the table and is the index. This code structure exists from POC4, but now I have upgraded the meta-language used to describe the translations even more, in order to include even if, while and INIT / CODE in this construction (before being special cases); Now, alone and only SEQ remain like special cases, and if I wanted, I could even delete SEQ by reimpling it as rewrite the rule.

Until now, the most important changes have been for POC5 compatibility. For example, if you run SNAPE Compile_to_Se ​​TROUS ‘RETURN (msg.data (0) * 2)’, you will see:

(“BegInCode0.endCode0“”,,“”DUP“”,,“”MSIZE“”,,“”SWAP“”,,“”MSIZE“”,,“”Begincode_0.endcode_0 “,” Dup “,” Msize “,” Swap “,” Msize “,”BegIncode0​.endcode0​“”,,“”DUP“”,,“”MsIZe“”,,“”SWAP“”,,“”MsIZe“”,,“”Begincode_0 “,” Calldatacopy “,” Return “,” ~ Begincode_0 “,” #Code_Begin “, 2, 0,” Calldataload “,” Mul “,” Msize “,” Swap “,” Msize “,” Mstore “, 32,” Swap “)

The real code is right:

(2, 0, “Calldatalad”, “Mul”, “Msize”, “Swap”, “Msize”, “Mstore”, 32, “Swap”, “Back”)

If you want to see what’s going on here, suppose that a message arrives with its first data 5. We have like this:

2 -> Battery: (2) 0 -> battery: (2, 0) Calldataload -> battery: (2.5) Mul -> battery: (10) Msize -> battery: (10, 0) Swap -> battery: (0, 10) Msize -> battery: (0, 10, 0) MSTORE -> Battery: (0), Memory: (0, 0) -> stack: (32, 0), memory: (0, 0, 0 … 10) return

The last return returns the 32 bytes of memory from 0, or (0, 0, 0 … 10), or number 10.

Now let’s analyze the Wrapper code.

(“BegInCode0.endCode0“”,,“”DUP“”,,“”MSIZE“”,,“”SWAP“”,,“”MSIZE“”,,“”Begincode_0.endcode_0 “,” Dup “,” Msize “,” Swap “,” Msize “,”BegIncode0​.endcode0​“”,,“”DUP“”,,“”MsIZe“”,,“”SWAP“”,,“”MsIZe“”,,“”Begincode_0 “,” Calldatacopy “,” Return “,” ~ Begincode_0 “,” #code_begin “, …..,” #Code_end “,” ~ Endcode_0 “)

I eliminated the internal code explained above to make things clearer. The first thing we see is two labels, Begincode_0 andEndcode_0 and the guards #Code_Begin and #Code_End. The labels mark the start and end of the internal code, and the guards are there for the subsequent stages of the compiler, which understands that everything between the guards must be compiled as if it were a separate program. Now let’s look at the first parts of the code. In this case, we have ~ begincode_0 in position 10 and ~ endcode_0 in position 24 in the final code. BegInCode0AndBegincode_0 and BegIncode0​AdEndcode_0 is used to refer to these positions, and $ begincode_0.endcode_0 refers to the length of the interval between them, 14. Now, do not forget that when the contract is initialized, call data are the code in which you feed. So we have:

14 -> Battery: (14) DUP -> Battery: (14, 14) Msize -> Stack: (14, 14, 0) Swap -> Stack: (14, 0, 14) Msize -> Stack: (14, 0, 14, 0) 10 -> Stack: (14, 0, 14, 0, 0) Calldatacopy -> Stack: (14, 0) MEMORY: (…)

Note how the first half of the code intelligently configures the battery so that it pushes the interior code in the memory indices 0… 13, then immediately returns this piece of memory. In the final compiled code, 600E515B525B600A37F26002600035025B54602052F2, the interior code is well to the right of the initializing code which simply returns it. In more complex contracts, initializers can also serve functions such as the definition of certain storage locations on values, or even the call or the creation of other contracts.

Now let’s introduce the most recent and most funny functionality of snake: Imports. A case of current use in contractual land is that you wish to give a contract the possibility of rejecting new contracts. The problem is, how to put the code for contracts generated in television contracts? Before, the only solution was the uncomfortable approach to compile new contracts first, then put the compiled code in a table. Now we have a better solution: import.

Put the following in ReturnNen.Se:

x = Create (tx.Gas – 100, 0, import (Mul2.se)) Return (msg (x, 0, tx.gas -100, (5), 1))

Now put what follows in Mul2.se:

Return (msg.data (0) * 2)

Now, if you compile Returnern Serpent.se and execute the contractYou notice that, the turn is played, it returns ten years. The reason is obvious. The return contract returned to an instance of the Mul2.se contract, then calls it with the value 5. Mul2.S, as its name suggests, is a doubler, and it therefore returns 5 * 2 = 10. Note that import is not a function in the standard sense; X = import (‘123.se’) will fail and the importation only works in the very specific context of creation.

Now suppose that you create a 1000 line monster contract and want to divide it into files. To do this, we use the insert. Enoute.se, Put:

If msg.data (0) == 1: inet (inner.se)

And in inner.se, put:

Back (3)

The execution of a snake compile exter.Se gives you a nice piece of compiled code which returns 3 if the argument msg.data (0) is equal to one. And that’s all there is.

Snake updates include:

  • An improvement in this mechanism so that it does not load the interior code twice if you try to use the import twice with the same file name
  • Literal chains
  • Space improvements and code efficiency for table literals
  • A debugging decorator (i.e. a compilation function that tells you which snake lines correspond to what the compiled code bytes)

In the short term, however, my own efforts will focus on bugfixes, a series of crossed tests and continuous work on Ethereumjs-Lib.



Source link

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous Article‘Confidence Crisis’—U.S. Dollar Price ‘Collapse’ Predicted To Ignite Bitcoin As Traders ‘Sell America’
Next Article Cryptoslatesolana defies the drop in activity, dominating 70% of the Blockchain Revenue Blockchain Network of decentralized Solana (DAPPS) applications maintain network revenues in the middle of the slowdown in activity.

Related Posts

Ethereum

The FTX reimbursements about to pour $ 5 billion on the market, how will Bitcoin and Ethereum react?

May 29, 2025
Ethereum

Technical indicators indicate a possible continuation of the upward trend

May 29, 2025
Ethereum

Ethereum leads the cryptography market with an increase of 4% to 3 months greater than $ 2,700

May 29, 2025
Add A Comment
Leave A Reply Cancel Reply

Single Page Post
Share
  • Facebook
  • Twitter
  • Instagram
  • YouTube
Featured Content
Event

Crypto Vision Conference 2025: A Breakthrough Day for Web3 in the Philippines

May 29, 2025

Makati City, Philippines — April 26, 2025 — The AIM Conference Center was a hub…

Thought Leadership

The Future of Organizations – Jason Fernandes, Co-Founder AdLunam Talks DAOs & Web3

May 28, 2025

In the latest episode of Token Money Magnet, we dive deep into the world of…

1 2 3 … 48 Next
  • Facebook
  • Twitter
  • Instagram
  • YouTube

Bitget lists Ripple’s Rlusd, triggering the race for the regulated stablescoins

May 29, 2025

SCOOP 180M ADA whales like Etoro Délie – Next Pike Price?

May 29, 2025

UNISWAP broke out with a rally of 17% – but the climb of the UNI is not what seems

May 29, 2025
Facebook X (Twitter) Instagram LinkedIn
  • About us
  • Disclaimer
  • Terms of service
  • Privacy policy
  • Contact us
© 2025 Altcoin Observer. all rights reserved by Tech Team.

Type above and press Enter to search. Press Esc to cancel.

bitcoin
Bitcoin (BTC) $ 106,156.44
ethereum
Ethereum (ETH) $ 2,657.18
tether
Tether (USDT) $ 1.00
xrp
XRP (XRP) $ 2.27
bnb
BNB (BNB) $ 679.42
solana
Solana (SOL) $ 167.66
usd-coin
USDC (USDC) $ 1.00
dogecoin
Dogecoin (DOGE) $ 0.217933
cardano
Cardano (ADA) $ 0.730654
tron
TRON (TRX) $ 0.275013