Patrick O'Grady ๐Ÿ”บ Profile picture
Aug 18 โ€ข 19 tweets โ€ข 7 min read Twitter logo Read on Twitter
1/ Introducing ๐™ƒ๐™ฎ๐™ฅ๐™š๐™ง๐™Ž๐˜ฟ๐™† ๐™‹๐™ง๐™ค๐™œ๐™ง๐™–๐™ข๐™จ: A Minimal, Performance-Focused, WASM-Based Smart Contract Framework for @avax @AvaxDevelopers



Starting ๐™๐™Š๐˜ฟ๐˜ผ๐™”, you can write HyperSDK Programs in #Rust using the ๐˜ฟ๐™š๐™ซ๐™š๐™ก๐™ค๐™ฅ๐™š๐™ง ๐™‹๐™ง๐™š๐™ซ๐™ž๐™š๐™ฌ ๐Ÿ—๏ธ .github.com/ava-labs/hyperโ€ฆ
2/ First, why "Programs" and not "Smart Contracts"?

This is about "familiarity". When new developers hear "smart contract" for the first time, they have no idea what I'm talking about.

"Programs" convey that if you know how to code, you can do this. That's exactly what we want.
3/ So, how do these newfangled HyperSDK Programs look? Not newfangled ๐Ÿ˜‰.

It is difficult/expensive to reach mass adoption if devs have to learn a new language/use odd dialects of existing languages to deploy their code.

HyperSDK Programs meet devs where they are. It's minimal.
4/ @samlioku and @hexfusion prepared a few examples using Rust to showcase this notion of "familiarity".

First up, here is a simple counter: github.com/ava-labs/hyperโ€ฆ
Image
5/ Counters are cool but I'm familiar with tokens...how would I do that?

Look no further:
github.com/ava-labs/hyperโ€ฆ

Image
Image
6/ Programs only get cool once you can call other Programs...can you do that?

I couldn't agree more:
github.com/ava-labs/hyperโ€ฆ

Image
Image
7/ WASM only allows a handful of types to be passed into functions (i32, i64, f32, f64, v128, funcref, externref):



As you can see, we got around this constraint with a macro that magically transforms complex function args:

webassembly.github.io/spec/core/syntโ€ฆ
github.com/ava-labs/hyperโ€ฆ
Image
8/ Everything HyperSDK is performance-driven and Programs are no exception.

To avoid the biggest bottlenecks devs typically run into when using WASM (memory allocation and serialization), complex objs are never injected into the execution environment (just a reference to them).
9/ The primary "learning curve" for HyperSDK Programs relates to storing/interacting with variables in state.

Normally, interacting with complex objects in Rust (or other languages) is just done "in memory" (ex: a map lives on the heap). Not here.
10/ To interact with complex objects (like a map), developers invoke a "host function" to read specific keys from a map stored in the host environment instead of interacting with the object directly in WASM memory:

github.com/ava-labs/hyperโ€ฆ
Image
11/ Rust not your jam (hint: don't tell a Rust dev that) ?

WASM compilation is supported by many languages. We only have a Rust SDK for now but look forward to community SDKs that unblock development in C/C++/Zig/TinyGo ๐Ÿค“ .
12/ What can/can't you do ๐™๐™Š๐˜ฟ๐˜ผ๐™”? (i.e. What's a "Developer Preview"?)

You **can** write your own HyperSDK Programs and run them in a basic WASM runtime.

You **can't** deploy HyperSDK Programs on-chain (yet).
13/ With any new framework, community feedback early and often is critical for world-class DX.

Although the runtime isn't complete/performant yet, we wanted to shift development into the open as soon as there was a basic foundation to build on.

Let us know what could be better!
14/ Concurrently, we are working on a minimal (strip out all unnecessary WASM functionality), metered, deterministic, Golang WASM runtime to execute these programs based on Wazero ().

If you'd like to get involved in this effort, please let us know!github.com/ava-labs/wazero
15/ Other future work includes (but not limited to):
* Program Constraints (enforce end conditions to protect against bugs)
* Multi-Dimensional Fee Pricing (charge for each resource independently):
* Use State Keys to Create Parallel Execution Treegithub.com/ava-labs/hyperโ€ฆ
16/ Check out my talk at Summit II if you want more context on the HyperSDK and HyperSDK Programs:


Image
17/ Lastly, **HUGE** shoutout to @samlioku and @hexfusion for taking this project from a list of bullets I had on paper into an E2E Developer Preview. โค๏ธ

Stay tuned for @samlioku's deep dive later today!
18/ You can read the unrolled version of this thread here: typefully.com/_patrickogradyโ€ฆ
You can chime in on Github here: github.com/ava-labs/hyperโ€ฆ

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Patrick O'Grady ๐Ÿ”บ

Patrick O'Grady ๐Ÿ”บ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @_patrickogrady

Aug 11
1/ ๐Ÿ› ๏ธ ๐Ÿ› ๏ธ #Avalanche Cortina 8 is out: ๐Ÿ› ๏ธ ๐Ÿ› ๏ธ

This is the last release in a series of database migrations. It is optional but recommended.

๐Ÿ” Release Focus: P-Chain Pruning/Indexing + Primary Network Partial Sync + Subnet Validator Diff Regression Fix https://t.co/bUw5r0urpCgithub.com/ava-labs/avalaโ€ฆ

Image
Image
2/ โœ… Compatibility Check: VM Interface (v27) โœ…

Cortina 8 does NOT modify the VM interface. If you are running a Custom VM on v1.10.5-v1.10.7, it will work with v1.10.8.
3/ ๐Ÿšง ATTENTION OPERATORS ๐Ÿšง

AvalancheGo@v1.10.8 prunes unused P-Chain block data when starting up for the first time (in the background).

You will see elevated disk/CPU/memory usage for the first ~10 hours after upgrading. **This is expected.**
Read 12 tweets
Aug 8
1/ Unlike other VMs on #Avalanche, HyperVMs now produce blocks continuously (even if empty). #HyperSDKJournal



Why build a block if it doesn't include any state transitions? Although it may sound "wasteful", it has a number of benefits...github.com/ava-labs/hyperโ€ฆ
2/ Benefit #1: Worst-Case AWM Verification Performance

AWM verification requires fetching the validator set of the P-Chain at the height included in the ProposerVM header of the HyperVM block (computed using reverse diffs).

github.com/ava-labs/avalaโ€ฆ
3/ Benefit #1 (cont.)

If there are long periods with no blocks, producers can reference anything between the P-Chain height in the last accepted ProposerVM header and the current P-Chain height.

(It is prohibited to use a height < the P-Chain height in the last accepted header)
Read 9 tweets
Aug 1
1/ New #Avalanche HyperSDK release is out (probably the biggest yet by LOC):

๐Ÿ”Ž Primary Focus: MorpheusVM + Codec Optimizations + Millisecond Block Times + Remove BlockCost

#HyperSDKJournal https://t.co/DqNnXdBwTlgithub.com/ava-labs/hyperโ€ฆ
Image
Read 6 tweets
Jul 24
Reminder: #Avalanche Warp Messaging **DOES NOT** require the use of a hosted/dedicated relayer or an ordered/unordered channel between Subnets.

Anyone can relay their own message when/if they want.

I elaborated on how this works (in the HyperSDK) here: github.com/ava-labs/hyperโ€ฆ
If you prefer code, I implemented this as a CI check that runs on each TokenVM commit here: github.com/ava-labs/hyperโ€ฆ
You can also view this in action in the demo I filmed here:
Read 4 tweets
Jul 24
1/ I've been asked dozens of times over the last few months to create a minimal demo of using the #Avalanche HyperSDK.

Today, I'm excited to share our "Morpheus Example":

#HyperSDKJournalgithub.com/ava-labs/hyperโ€ฆ
2/ First ... yes, I am obsessed with The Matrix:

3/ "Morpheus Examples" are a minimal glimpse (simple transfers) into what is possible with some new technology/paradigm (HyperSDK).

They should be just enough to give "Neo" (you) just enough to make a choice: go down the rabbit hole or turn back to what is known? Image
Read 9 tweets
Jul 20
1/ Spent the last few days migrating the #Avalanche HyperSDK to use millisecond-denominated block times instead of second-denominated (like all other Avalanche VMs):

Why? So we can remove "block cost" and "surplus fee", of course! โค๏ธ

#HyperSDKJournalgithub.com/ava-labs/hyperโ€ฆ
2/ First, some context...

Block production on Snowman is dynamic (i.e. there is no "slot time" like "every 2s"). Rather, the VM triggers when it wants to build and the consensus engine will ask it to build if it is a preferred producer or no blocks have been produced lately.
3/ I wrote about the unique properties of Snowman/Snowman++ before if you want to dive into this concept:
Read 12 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(