GithubHelp home page GithubHelp logo

Comments (8)

patrick-ogrady avatar patrick-ogrady commented on August 13, 2024 2

May make sense to restrict access to certain types (like token balances) to enforce safe usage (or to allow tx caller to apply high level constraints -> this could ensure that the expected operations occur at the end no matter what you do without having complex vm/language constraints).

This would look something like increasing/decreasing balance instead of setting balance using arbitrary KV like an ERC20.

from hypersdk.

patrick-ogrady avatar patrick-ogrady commented on August 13, 2024 1

Another comparison repo: https://github.com/simar7/wasm-bench-go (Gasm is wazero)

make bench | prettybench -no-passthrough
benchmark               iter       time/iter   bytes alloc         allocs
---------               ----       ---------   -----------         ------
BenchmarkWasmtime-8   100000   3488.00 ns/op      311 B/op   20 allocs/op
BenchmarkWasmtime-8   100000   3614.00 ns/op      311 B/op   20 allocs/op
BenchmarkWasmtime-8   100000   3543.00 ns/op      311 B/op   20 allocs/op
BenchmarkWasmer-8     100000   1997.00 ns/op      208 B/op   12 allocs/op
BenchmarkWasmer-8     100000   1990.00 ns/op      208 B/op   12 allocs/op
BenchmarkWasmer-8     100000   1950.00 ns/op      208 B/op   12 allocs/op
BenchmarkGasm-8       100000    331.50 ns/op      288 B/op    9 allocs/op
BenchmarkGasm-8       100000    334.40 ns/op      288 B/op    9 allocs/op
BenchmarkGasm-8       100000    332.20 ns/op      288 B/op    9 allocs/op

from hypersdk.

patrick-ogrady avatar patrick-ogrady commented on August 13, 2024 1

These checks could also be function calls rather than state value checks + could be called at the end of each contract execution to catch bugs (as a second layer of defense). Maybe they could have a reserved function name?

from hypersdk.

patrick-ogrady avatar patrick-ogrady commented on August 13, 2024

It would be great if this included a native code upgrade mechanism where anyone could propose a new WASM blob but it must be signed by M of N items (this M of N should be a generic multisig auth that is all on-chain).

from hypersdk.

patrick-ogrady avatar patrick-ogrady commented on August 13, 2024

It would also be great if the builder attached accessed state to the block somehow such that anyone verifying could pre-fetch state (and tx submitter wouldn't need to generate their own access list).

from hypersdk.

patrick-ogrady avatar patrick-ogrady commented on August 13, 2024

wazero is super-fast. You can run make bench.check to compare:

goos: darwin
goarch: arm64
pkg: github.com/tetratelabs/wazero/internal/integration_test/vs/clock
BenchmarkClock/time.Now-10         	29655531	        40.36 ns/op
BenchmarkClock/ClockGettime(CLOCK_REALTIME)-10         	25691346	        47.86 ns/op
BenchmarkClock/time.Since-10                           	55103904	        21.47 ns/op
BenchmarkClock/runtime.nanotime-10                     	73847098	        16.08 ns/op
BenchmarkClock/ClockGettime(CLOCK_MONOTONIC)-10        	21940549	        53.30 ns/op
PASS
ok  	github.com/tetratelabs/wazero/internal/integration_test/vs/clock	7.384s
/Users/patrickogrady/go/src/wazero
package github.com/tetratelabs/wazero/internal/integration_test/vs/wasmedge: build constraints exclude all Go files in /Users/patrickogrady/go/src/wazero/internal/integration_test/vs/wasmedge
/Users/patrickogrady/go/src/wazero
go: downloading github.com/wasmerio/wasmer-go v1.0.4
BenchmarkAllocation/Call-16
wazero-compiler 1384.53 ns/op
wasmer          4659.64 ns/op
BenchmarkFactorial/Call-16
wazero-compiler 449.90  ns/op
wasmer          1185.65 ns/op
BenchmarkHostCall_CrossBoundary/Call-16
wazero-compiler 61.30   ns/op
wasmer          1449.71 ns/op
Benchmark/memory.i32/Call-16
wazero-compiler 257.67 ns/op
wasmer          848.02 ns/op
Benchmark/memory.i64/Call-16
wazero-compiler 255.31 ns/op
wasmer          852.13 ns/op
BenchmarkAllocation/Compile-10         	 1226198	      1006 ns/op	      15 B/op	       1 allocs/op
BenchmarkAllocation/Instantiate-10     	     100	  10837036 ns/op	  132764 B/op	    1126 allocs/op
BenchmarkFactorial/Compile-10          	 1000000	      1009 ns/op	      15 B/op	       1 allocs/op
BenchmarkFactorial/Instantiate-10      	    1515	    689966 ns/op	    1448 B/op	      38 allocs/op
BenchmarkHostCall/Compile-10           	 1000000	      1023 ns/op	      15 B/op	       1 allocs/op
BenchmarkHostCall/Instantiate-10       	   12253	     98669 ns/op	    2392 B/op	      75 allocs/op
BenchmarkMemory/i32/Compile-10         	 1000000	      1093 ns/op	      15 B/op	       1 allocs/op
BenchmarkMemory/i32/Instantiate-10     	    3922	    295475 ns/op	    1584 B/op	      50 allocs/op
BenchmarkMemory/i64/Compile-10         	 1000000	      1110 ns/op	      15 B/op	       1 allocs/op
BenchmarkMemory/i64/Instantiate-10     	    3603	    319300 ns/op	    1584 B/op	      50 allocs/op
PASS
ok  	github.com/tetratelabs/wazero/internal/integration_test/vs/wasmer	29.704s
/Users/patrickogrady/go/src/wazero
BenchmarkAllocation/Call-16
wazero-compiler 1401.85 ns/op
wasmtime        5928.73 ns/op
BenchmarkFactorial/Call-16
wazero-compiler 443.33  ns/op
wasmtime        1580.92 ns/op
BenchmarkHostCall_CrossBoundary/Call-16
wazero-compiler 60.48   ns/op
wasmtime        2206.77 ns/op
Benchmark/memory.i32/Call-16
wazero-compiler 265.67  ns/op
wasmtime        1361.37 ns/op
Benchmark/memory.i64/Call-16
wazero-compiler 259.37  ns/op
wasmtime        1322.83 ns/op
BenchmarkAllocation/Compile-10         	     168	   8037396 ns/op	      41 B/op	       5 allocs/op
BenchmarkAllocation/Instantiate-10     	    2289	    684564 ns/op	    1486 B/op	      93 allocs/op
BenchmarkFactorial/Compile-10          	    2590	    391607 ns/op	      36 B/op	       4 allocs/op
BenchmarkFactorial/Instantiate-10      	  206661	      5159 ns/op	     632 B/op	      28 allocs/op
BenchmarkHostCall/Compile-10           	    5815	    258777 ns/op	      32 B/op	       4 allocs/op
BenchmarkHostCall/Instantiate-10       	   18146	     62208 ns/op	    1103 B/op	      57 allocs/op
BenchmarkMemory/i32/Compile-10         	    4226	    280271 ns/op	      39 B/op	       4 allocs/op
BenchmarkMemory/i32/Instantiate-10     	   32691	     34533 ns/op	     759 B/op	      37 allocs/op
BenchmarkMemory/i64/Compile-10         	    3912	    289622 ns/op	      34 B/op	       4 allocs/op
BenchmarkMemory/i64/Instantiate-10     	   32598	     35850 ns/op	     759 B/op	      37 allocs/op
BenchmarkShorthash/Compile-10          	      73	  15198785 ns/op	     372 B/op	      46 allocs/op
BenchmarkShorthash/Instantiate-10      	    2629	    468577 ns/op	     552 B/op	      41 allocs/op
PASS
ok  	github.com/tetratelabs/wazero/internal/integration_test/vs/wasmtime	32.737s
/Users/patrickogrady/go/src/wazero

from hypersdk.

patrick-ogrady avatar patrick-ogrady commented on August 13, 2024

More generically, you could assert any state at the end of a user TX.

This would be required if tokens were defined as a contract instead of a higher-level primitive.

from hypersdk.

github-actions avatar github-actions commented on August 13, 2024

This issue has become stale because it has been open 60 days with no activity. Adding the lifecycle/frozen label will exempt this issue from future lifecycle events.

from hypersdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.