Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNARK Accounts on Hypersdk. #1

Open
wants to merge 66 commits into
base: main
Choose a base branch
from
Open

SNARK Accounts on Hypersdk. #1

wants to merge 66 commits into from

Conversation

manojkgorle
Copy link
Owner

visit examples/morpheusvm for full details on SNARK accounts on hypersdk.

samliok and others added 30 commits December 1, 2023 16:23
* update public macro to convert from raw_ptr

* harden public macro, and converted params logic

* reorder comments

* HostArgument type + Vec Example(rust)

* added marshaling to go side, and token examples work(hype)

* letsgoo, finally passing dynamic vecs working(needs clean up(from debugging stuff(will do this tmrw, its too late)))

* cleanup logs

* combine HostArg + Arg

* vec<u8> -> &[u8]

* avoid reallocation in as_bytes

* temporary string example/method

* remove VecArg junk

* cargo fmt

* lint

* flatten out tuple

* simplify ParamKind logic

* borsh serialization working(go/rust)

* move all from serde -> borsh(except simulator)

* call_program function

* re added arg types, going to address call_program in another pr

* unsafe + temp removal

* lint

* go lint

* mint recipient struct

* mint recipient struct

* Update x/programs/rust/wasmlanche_sdk/src/types.rs

Co-authored-by: Richard Pringle <rpring9@gmail.com>
Signed-off-by: Sam Liokumovich <65994425+samliok@users.noreply.github.com>

* lint

* remove temp go stuff

* tidy

* remove comment

* decompose newPtr method + nits

* remove fixedLengthKey method

* add comments about address len

* public key

* cargo fmt

* ed25519 from hypersdk crypto

---------

Signed-off-by: Sam Liokumovich <65994425+samliok@users.noreply.github.com>
Co-authored-by: Richard Pringle <rpring9@gmail.com>
* Add note about size encoded keys

Signed-off-by: David Boehm <91908103+dboehm-avalabs@users.noreply.github.com>

* Better phrasing

Signed-off-by: David Boehm <91908103+dboehm-avalabs@users.noreply.github.com>

---------

Signed-off-by: David Boehm <91908103+dboehm-avalabs@users.noreply.github.com>
* tests passing

* remove cache usage

* remove unused arg

* add batch verification tests

* addd benchmark for ed25519consensus

* change min size

* show memory allocs

* replace panic with fatal in benchmark

* add issue to TODO

* properly name benchmarks

* add just verify tests

* j->i
* adding Key struct

* use Key struct in state methods

* comments

* key as ref and lint

* update sdk macro naming

* forgot one is_context() method

* update public macro to convert from raw_ptr

* harden public macro, and converted params logic

* reorder comments

* HostArgument type + Vec Example(rust)

* added marshaling to go side, and token examples work(hype)

* letsgoo, finally passing dynamic vecs working(needs clean up(from debugging stuff(will do this tmrw, its too late)))

* cleanup logs

* combine HostArg + Arg

* vec<u8> -> &[u8]

* avoid reallocation in as_bytes

* temporary string example/method

* remove VecArg junk

* cargo fmt

* lint

* flatten out tuple

* simplify ParamKind logic

* borsh serialization working(go/rust)

* move all from serde -> borsh(except simulator)

* call_program function

* re added arg types, going to address call_program in another pr

* unsafe + temp removal

* lint

* go lint

* mint recipient struct

* mint recipient struct

* Update x/programs/rust/wasmlanche_sdk/src/types.rs

Co-authored-by: Richard Pringle <rpring9@gmail.com>
Signed-off-by: Sam Liokumovich <65994425+samliok@users.noreply.github.com>

* lint

* remove temp go stuff

* tidy

* remove comment

* decompose newPtr method + nits

* remove fixedLengthKey method

* return result in from_raw_ptr

* conflicts from merge

* represent pointers as *const u8

* comments

* remove import

* remove len

* rust lint

* lfg some progress on serialize_param macro

* why are we not putting units in second runtime?

* comments

* counter test cleanup

* comment cleanup

* nits

* program struct refactor

* yesss, external function calls working(needs cleanup)

* cleanup

* cargo fmt

* Fix token benchmark

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* nits + Deref on Key struct

* bitwise operations on ptrs passing to the host

* bitwise operations working pasing parameters into wasm

* full circle -> external function calls(needs cleanup)

* ptr cleanup

* comments and nit go cleanup

* updated call_program host function

* SmartPtr type & cleanup utils

* go lint

* rust lint

* update program impl

* return result from rust side host function wrappers

* small rename

* rust lint

* into_bytes function

* smart ptr method refactor

* comments

* int64 conversionn

---------

Signed-off-by: Sam Liokumovich <65994425+samliok@users.noreply.github.com>
Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>
Co-authored-by: Richard Pringle <rpring9@gmail.com>
Co-authored-by: Sam Batschelet <sam.batschelet@avalabs.org>
* Move fixtures into tests directory

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Abstract engine from runtime

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* React to changes

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Nits

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Review comments

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Clarify debug mode

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Nit

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

---------

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>
* Move fixtures into tests directory

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Abstract engine from runtime

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* React to changes

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Nits

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Review comments

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Clarify debug mode

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Nit

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Add host abstraction

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* React to changes

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Cleanup

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* lint

---------

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>
Co-authored-by: samliok <samliok@stanford.edu>
* Move fixtures into tests directory

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Abstract engine from runtime

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* React to changes

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Nits

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Review comments

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Clarify debug mode

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Nit

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Add host abstraction

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* React to changes

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Cleanup

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Move program from runtime

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Add program abstraction

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Implement runtime instance and react to changes

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Nit

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Add RegisterImportWrapFn

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Update examples

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Show example of wrap import function impl

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Remove stale docs

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* Impliment pstate with wrap functionality

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>

* license header lint

* remove hardcoded wrapper funcitons, fixed pstate bugs

* lint

* lint

* Revert "Merge branch 'dynamic_args' into refactor-statekey"

This reverts commit 5c359d9, reversing
changes made to cee952c.

* Revert "Revert "Merge branch 'dynamic_args' into refactor-statekey""

This reverts commit 15b84b5.

* lint

* memory tests

* create WAT program instead of memory.wasm

---------

Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>
Co-authored-by: samliok <samliok@stanford.edu>
* [crypto]: add bls

* [wip: crypto] integrate bls into morpheusvm

* [wip: crypto] add integration test

* [crypto]: support bls + integration test

* [crypto] create wrapper for bls

* [crypto] remove comment

* [crypto] fix BLS unit tests

* [crypto] fix lint

* [crypto] fix lint

* [crypto] fix lint

* [crypto] cleanup

* [crypto] remove blst usage

* [crypto] documentation explaining mul 2

* [crypto] use avalanchego import for Warp in integration test

* [crypto] use switch for checkKeyType

* [crypto] refactor unmarshalBLS

* [crypto] use pointers in BLS struct field

* [crypto] remove deserialize/serialize use from/to

* [crypto] fix return err

* [crypto] address minor changes
* [crypto] remove agg function for BLS signatures

* [crypto] fix lint

* [crypto] support aggregation for public and sig

* [crypto] add aggregation pk and sig test
* add "run all ci" tag

* missed one workflow
* change action interface to include actor address

* moving around interfaces

* use signers

* working on sponsor integration

* working on signer transition

* chain transaction passing tests

* chain package updated

* update rpc

* update actions and auth for morepheus vm

* vm passing

* morephusvm compiles

* fix bls interface

* update state manager

* tokenvm builds

* update mocks

* update morpheusvm integration

* fix load tests

* update README

* nits

* update morepheusvm

* update usage of signatures

* wrong var
* change action interface to include actor address

* moving around interfaces

* use signers

* working on sponsor integration

* working on signer transition

* chain transaction passing tests

* chain package updated

* update rpc

* update actions and auth for morepheus vm

* vm passing

* morephusvm compiles

* fix bls interface

* update state manager

* tokenvm builds

* update mocks

* update morpheusvm integration

* fix load tests

* update README

* nits

* update morepheusvm

* update usage of signatures

* wrong var

* update avalanchego

* update merkledb usage

* remove static handlers

* update ANR

* fix tstate test

* addd back mock file

* update ANR

* update mocks

* remove 1337 check

* clean up info log
* preallocate batch size for verification

* fix tests
…s#708)

Node 16 is deprecated and all the actions using 16 are adding warnings
to our jobs that risk obscurring more important notifications.

Ref: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
* `ci`: Add shellcheck step to lint job

* fixup: Configure shellcheck to always require variable quoting

* fixup: Ensure find invocation is compatible for both macos and linux
* Update Simulator to begin running again

* Revert "Update Simulator to begin running again"

This reverts commit e43b879.

* Update memory.go

* fix

* Update Genesis

* Create simulator-tests.yml

* Update simulator-tests.yml

* Update simulator-tests.yml

* Update simulator-tests.yml

* Update tests.simulator.sh

* merge

* add

* Update build.sh

* cleanup

* Update tests.simulator.sh

* Update pstate.go

* Update pstate.go

* Create token.wasm

* Update runtime_test.go

* Update plan.go

* move out of memory

* rename

* comments

* Update .gitignore

* Delete simulator

* Update simulator-tests.yml

* cleanup simulator workflow

* cleanup config

---------

Co-authored-by: Patrick O'Grady <prohb125@gmail.com>
…ate/Write) (ava-labs#693)

* [chain] statekeys with mode

* [chain] update mock

* [chain] fix lint

* [chain] update docs

* [chain] pass Mode into executor and tstate

* [chain] fix lint

* [chain] remove types

* [chain] impl bit flag for Mode

* [chain] fix test lint

* [chain] inline state.NewKey and remove intermediate k.Name var

* [chain] move consts

* [chain] rename Mode to Permission

* [chain] rename NewKey and HasPermission to use same param var name

* [chain] use single scope map, honour permissions, add unit tests to verify perms

* [chain] remove misc

* [chain] address comments

* [chain] update builder and block tsv keys to write

* [chain] table driven tests

* [chain] use map and prevent duplicate keys and updating key perms

* [chain] support updating of key perms

* [chain] update warp key perms

* [chain] change AddKeyPerm to Add

* [chain] add TODOs and comments

* [chain] create PermissionBit type

* [chain] rename NewPermission to Permission

* [chain] change PermissionBit to int and use switch statement

* [chain] add Allocate permission

* [chain] fix simulator tests

* [chain] address feedback

* [state] add keys test

* [chain] use Permission struct on SDK side and bitset for VM implementations

* Standardize permissions checks

* nit

* [chain] remove ToBytes and FromBytes, fix tests

---------

Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
* [chain/fees] create fees package

* [chain/fees] update morpheusvm to use fees package

* [chain/fees] update tokenvm to use fees package

* [fees] introduce fee-focused interface

* [fees] run mock gen script

* [fees] wip

* [fees] keep Rules

* [fees] fix simulator tests

* [fees] fix mock gen
* Update minimum golang version to v1.21.7

* updates

* tidy

* nits
* update golangci

* update version of golangci

* passing

* nit

* tidy

* nit

* nits

* nit

* fix UTs

---------

Co-authored-by: dhrubabasu <7675102+dhrubabasu@users.noreply.github.com>
* Fix Rust documentation

* Put all Rust CI jobs into one workflow
richardpringle and others added 30 commits March 11, 2024 16:18
* [chain/processor]: fetcher wip

* [processor] txnToFetch working

* [processor] check cache in worker working

* [processor] add keysToFetch

* [processor] add unit tests

* [processor] cleanup + comments

* [processor] remove keysToFetch

* [processor] return wg and add unit test

* [processor] refactor

* [processor] read lock on cache

* [processor] close fetchable chan on completion

* [processor] cleanup

* [processor] use keysToFetch, introduce helpers, introduce Wait, change workers to fetch key

* [processor] first unit test passes

* [processor] unit test passes

* [processor] removed unused code and integration test passes

* [processor] add comments

* [processor] close fetchable chan on completion

* [processor] implement Stop

* [processor] bubble up errors

* [processor] fix lint

* [processor] move lock acq

* [processor] synchronize read of txn wg

* [processor] solve concurrent fetch bug

* [processor] cleanup

* [processor] fix deadlock

* [processor] use cache call once

* [fetcher] change to GetStateFetchConcurrency

* [fetcher] call HandleErrors after e.Wait

* [fetcher] nits

* [fetcher] create wg before acq txnLock

* [fetcher] remove wg from worker

* [fetcher] don't requeue keys already fetched

* [fetcher] skip updateDep when cache hit

* [fetcher] merge updateDep and cache, merge cache/keyLock

* [fetcher] buffer fetchable chan

* [fetcher] check if fetcher has stopped before sending to chan

* [fetcher] check if err not nil to see if fetcher stopped

* [fetcher] rename to Get

* [fetcher] name HandleErrors to Wait

* [fetcher] rename to shouldFetch

* [fetcher] refactor shouldFetch logic

* [fetcher] hold lock in update less

* [fetcher] unify cache into keysToFetch and unit tests also pass

* [fetcher] add Lookup invariant to not call after calling Stop

* [fetcher] add tx to map after setting wg but before enqueing fetchable

* [fetcher] fix lint

* [fetcher] wip return after wg

* [fetcher] close chan after f.wg.wait

* [fetcher] close chan cleanup

* [fetcher] nits

* [fetcher] unify key and txn lock into fetch lock

* [fetcher] close fetchable after all items have been enqueued

* [fetcher] wip close after f.wg.Wait

* [fetcher] Nits (ava-labs#769)

* basic cleanup

* handle errors when adding more items or requesting items

* change ordering

* provision keys by default

* keep consistent args with executor

* remove Lookup

* fix comment

* better handling of done

* handle deadlock case on Get

* only stop if not done

* cleanup should stop

* remove unused id field

* cleanup handleErr

* review nits

* done -> setErr

* nits

* fix bugs

* fix unit tests and integration passes

* fix lint

* fix merge conflict

* only test exposed interfaces

---------

Signed-off-by: William Law <williamlaw.wtl@gmail.com>
Co-authored-by: William Law <williamlaw.wtl@gmail.com>

* [fetcher] unit test nits

* [fetcher] use chan instead of timeout for unit tests

* [fetcher] remove unnecessary for loop

* [fetcher] use outside scope for params in go func

* [fetcher] always close the chan

* [fetcher] comments

---------

Signed-off-by: William Law <williamlaw.wtl@gmail.com>
Co-authored-by: Patrick O'Grady <prohb125@gmail.com>
* More refactoring

* Doc and error message cleanups
* Switch To Using Context

* Wrap `Program` in a `Context`

* Make program runtime tests compile

* Add missing license header

* Use variables in counter-test

* Remove dbg

* Cleanup public functions test

* Fix token Go tests

* Remove unused rust module

Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Signed-off-by: Richard Pringle <rpring9@gmail.com>

* Rename program-id accessor in test

---------

Signed-off-by: Richard Pringle <rpring9@gmail.com>
Co-authored-by: dboehm-avalabs <david.boehm@avalabs.org>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
* Fix TestStop

* Fix TestCallParams

* Fix TestInfiniteLoop

* Fix TestMetering

* Fix TestMeterAfterStop

* Fix TestWithMaxWasmStack

* Fix linter error
* Fix: errors and typos in README.md

Fix typos, format syntax for consistency, and fix commands to run test programs.

Signed-off-by: Kashew <42247026+youngkashew@users.noreply.github.com>

* Update x/programs/cmd/simulator/README.md

Co-authored-by: William Law <williamlaw.wtl@gmail.com>
Signed-off-by: Kashew <42247026+youngkashew@users.noreply.github.com>

* Update x/programs/cmd/simulator/README.md

Co-authored-by: William Law <williamlaw.wtl@gmail.com>
Signed-off-by: Kashew <42247026+youngkashew@users.noreply.github.com>

---------

Signed-off-by: Kashew <42247026+youngkashew@users.noreply.github.com>
Co-authored-by: William Law <williamlaw.wtl@gmail.com>
…ys (ava-labs#814)

* [executor] refactor worker func

* [executor] renaming

* [executor] use blocking/dependency type from programmatic-deploy fork

* [executor] add key type support

* wip

* wip

* switch statements

* programmatic deploy fork + concurrent reads work

* sequential writes work

* w->r->r works

* r->r->w works

* w->r->r...w->r->r works

* r->r->w...r->r->w works

* all unit tests pass

* cleanup

* coverage 97%

* cleanup switch

* switch comments

* self review

* go mod tidy

* add done prints to tests

* rename isAllocateWrite

* remove id from task

* use dummy dep to keep track of all keys

* simplify for loop in adding bt dep

* fix integration bug and add unit test for it

* fix race condition with write-after-read(s) potentially

* run unit tests over multiple iterations

* cut down on unit testing time and add comments

* simplify num times we call add blocking if not exec

* new way to keep track of concurrent Reads

* self review

* have unit tests run under max time

* [executor] Simplify Logic + Speed Up Tests (ava-labs#831)

* first pass

* need to set higher base dependencies

* remove extra logging from tests

* use right var

* tests passing

* cleanup task loop

* make tests faster

* ensure arr order matches

* add more comments

* tests are passing

* ensure we actually stop building early

* add comment about failure case

* add comment about deadlock

* better var names

* add larger unit tests

* ignore lint for rand

* add unique and conflicting keys randomly to txs

* fix for loops

* use max function

* make conflict keys 100 and pick 1-5

* make num slow chan consistent

* use set.Contains to speed up tests

* random perm for each unique key

* group var names

* use numTxs in generating blocking txs

* increase num conflict keys for concurrent Reads and Writes test

* [executor] multi-key conflict bug (ava-labs#837)

* random perm per conflict key

* fix dont block on ourself and edit TestTwoConflictKeys to track this

* keep reading/readers relationship

* make reading a map

* comments

* clarify use of map for reading

* simplify rng for conflict and unique perm

* random perm per conflict key

* make maxDep a param

* add maxDep as const in chain

* placement of maxDep comment

---------

Co-authored-by: Patrick O'Grady <prohb125@gmail.com>
* remove warp

* fix type_parser tests

* fix chain/transaction

* add back ShouldVerifyWithContext

* fix rpc

* mock gen works

* morpheusvm integration passes

* fix load & e2e for morpheus

* tokenvm integration passes

* fix tokenvm e2e and load

* fix tokenvm

* fix morpheus

* fix lint

* fix x/programs

* remove StatelessBlock.bctx

* remove block functions

* update readme

* remove unused outputs

* fix Result.Size()

* inline size into NewWriter

* keep vm.cacheAuth

* storage remove unnecessary alloc

* check no bytes left to read

* update tokenvm readme

* reduce alloc size of v

* remove vm.buildBlock blockCtx

* add todo to remove cachAuth

* unify verify and Verify

* unify buildBlock and BuildBlock
…#857)

* implement new alloc fun with global store

* make sure that only known bounds are reached

* use a map for the store

* remove use of HostPtr

* return pointer from go alloc

* apply review suggestions

* Fix the counter tests

* fix token test

* remove usage of SmartPtr in test

* use is_null to check for pointer nulleness

* silent deprecated tag

* fix clippy in test

* fix panic *expected* messages

* remove useless test

---------

Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
* remove any reference to the Rust build.sh script

* remove target dir

---------

Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
* add cache

* implement cache reads

* actually cache reads

* implement cache delete and handle borsch errors

* use only one cache map

* remove flushed bool

* root of transactions by stateless merkledb

* make root generation a function

* preallocate memory for merkle array and consumebytes flag

* add <*.code-workspace> to .gitignore and remove it from git commit

* move root generation func to merkle package, tx root by items of [txID + result]

* rebase & blk marshal/unmarshal & merkleroot to ids.ID

* write benches for the merkle package

* use crypto/rand, fix var name, report allocs

* put the 10k bench back

* pass config by parameter

* happy clippy

* borrow V

* add TODO

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "put the 10k bench back"

This reverts commit 058d7e7.

* Revert "use crypto/rand, fix var name, report allocs"

This reverts commit 214005b.

* Revert "write benches for the merkle package"

This reverts commit 07993bf.

* Revert "rebase & blk marshal/unmarshal & merkleroot to ids.ID"

This reverts commit 7442836.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "add <*.code-workspace> to .gitignore and remove it from git commit"

This reverts commit ce00289.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* merge main!

* merge imports

---------

Co-authored-by: bianyuanop <chen.me.nan@gmail.com>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
* macro skeleton

* write macro for ffi-safe bindings

* avoid panicking todo!

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>

* remove unused arms

---------

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>
…a-labs#866)

* support program passing in param

* fix inter-program interaction

* update fixture

* keep using `SmartPtr` for now

* remove the need of a new Param type

* lint

* remove param

* fix nits

* remove whitespace

* Cached state values in the program state (ava-labs#840)

* add cache

* implement cache reads

* actually cache reads

* implement cache delete and handle borsch errors

* use only one cache map

* remove flushed bool

* root of transactions by stateless merkledb

* make root generation a function

* preallocate memory for merkle array and consumebytes flag

* add <*.code-workspace> to .gitignore and remove it from git commit

* move root generation func to merkle package, tx root by items of [txID + result]

* rebase & blk marshal/unmarshal & merkleroot to ids.ID

* write benches for the merkle package

* use crypto/rand, fix var name, report allocs

* put the 10k bench back

* pass config by parameter

* happy clippy

* borrow V

* add TODO

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "put the 10k bench back"

This reverts commit 058d7e7.

* Revert "use crypto/rand, fix var name, report allocs"

This reverts commit 214005b.

* Revert "write benches for the merkle package"

This reverts commit 07993bf.

* Revert "rebase & blk marshal/unmarshal & merkleroot to ids.ID"

This reverts commit 7442836.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "add <*.code-workspace> to .gitignore and remove it from git commit"

This reverts commit ce00289.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* merge main!

* merge imports

---------

Co-authored-by: bianyuanop <chen.me.nan@gmail.com>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>

* [x/programs] safe wrapper around C ffi interface (ava-labs#869)

* macro skeleton

* write macro for ffi-safe bindings

* avoid panicking todo!

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>

* remove unused arms

---------

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>

---------

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>
Co-authored-by: bianyuanop <chen.me.nan@gmail.com>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
* Add rust-ci local github-action

* Abstract install-go action

* Centralize Go install parameters

* Consolidate CI

* Comment out code coverage

* Finish centralizing the Go installation for CI

* Handle releases

* Fix passing secret to release-actions

* [ci] Small Tweaks (ava-labs#875)

* nits

* remove labels

---------

Co-authored-by: Patrick O'Grady <prohb125@gmail.com>
Signed-off-by: Richard Pringle <richard.pringle@avalabs.org>
* support program passing in param

* fix inter-program interaction

* update fixture

* keep using `SmartPtr` for now

* remove the need of a new Param type

* lint

* remove param

* fix nits

* remove whitespace

* stop using SmartPtr

* fix tests

* Cached state values in the program state (ava-labs#840)

* add cache

* implement cache reads

* actually cache reads

* implement cache delete and handle borsch errors

* use only one cache map

* remove flushed bool

* root of transactions by stateless merkledb

* make root generation a function

* preallocate memory for merkle array and consumebytes flag

* add <*.code-workspace> to .gitignore and remove it from git commit

* move root generation func to merkle package, tx root by items of [txID + result]

* rebase & blk marshal/unmarshal & merkleroot to ids.ID

* write benches for the merkle package

* use crypto/rand, fix var name, report allocs

* put the 10k bench back

* pass config by parameter

* happy clippy

* borrow V

* add TODO

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "put the 10k bench back"

This reverts commit 058d7e7.

* Revert "use crypto/rand, fix var name, report allocs"

This reverts commit 214005b.

* Revert "write benches for the merkle package"

This reverts commit 07993bf.

* Revert "rebase & blk marshal/unmarshal & merkleroot to ids.ID"

This reverts commit 7442836.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "add <*.code-workspace> to .gitignore and remove it from git commit"

This reverts commit ce00289.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* merge main!

* merge imports

---------

Co-authored-by: bianyuanop <chen.me.nan@gmail.com>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>

* stop using SmartPtr

* Cached state values in the program state (ava-labs#840)

* add cache

* implement cache reads

* actually cache reads

* implement cache delete and handle borsch errors

* use only one cache map

* remove flushed bool

* root of transactions by stateless merkledb

* make root generation a function

* preallocate memory for merkle array and consumebytes flag

* add <*.code-workspace> to .gitignore and remove it from git commit

* move root generation func to merkle package, tx root by items of [txID + result]

* rebase & blk marshal/unmarshal & merkleroot to ids.ID

* write benches for the merkle package

* use crypto/rand, fix var name, report allocs

* put the 10k bench back

* pass config by parameter

* happy clippy

* borrow V

* add TODO

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "put the 10k bench back"

This reverts commit 058d7e7.

* Revert "use crypto/rand, fix var name, report allocs"

This reverts commit 214005b.

* Revert "write benches for the merkle package"

This reverts commit 07993bf.

* Revert "rebase & blk marshal/unmarshal & merkleroot to ids.ID"

This reverts commit 7442836.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "add <*.code-workspace> to .gitignore and remove it from git commit"

This reverts commit ce00289.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* merge main!

* merge imports

---------

Co-authored-by: bianyuanop <chen.me.nan@gmail.com>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>

* [x/programs] safe wrapper around C ffi interface (ava-labs#869)

* macro skeleton

* write macro for ffi-safe bindings

* avoid panicking todo!

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>

* remove unused arms

---------

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>

* support program passing in param

* keep using `SmartPtr` for now

* remove the need of a new Param type

* lint

* stop using SmartPtr

* fix tests

* back off file

* handle put and delete return as a status and remove the `SmartPointer`

* cargo fmt

* fix test

* pass only context ptr as i32

* fix token test

* lint

* remove ignored lint

* update fixtures

* move `CPointer` from `program` to `memory`

* update fixutes to release

* cargo fmt

* Consolidate CI (ava-labs#828)

* Add rust-ci local github-action

* Abstract install-go action

* Centralize Go install parameters

* Consolidate CI

* Comment out code coverage

* Finish centralizing the Go installation for CI

* Handle releases

* Fix passing secret to release-actions

* [ci] Small Tweaks (ava-labs#875)

* nits

* remove labels

---------

Co-authored-by: Patrick O'Grady <prohb125@gmail.com>

* Update vm-release.yml (ava-labs#876)

Signed-off-by: Richard Pringle <richard.pringle@avalabs.org>

* fix inter-program interaction

* keep using `SmartPtr` for now

* lint

* remove param

* fix nits

* stop using SmartPtr

* fix tests

* Cached state values in the program state (ava-labs#840)

* add cache

* implement cache reads

* actually cache reads

* implement cache delete and handle borsch errors

* use only one cache map

* remove flushed bool

* root of transactions by stateless merkledb

* make root generation a function

* preallocate memory for merkle array and consumebytes flag

* add <*.code-workspace> to .gitignore and remove it from git commit

* move root generation func to merkle package, tx root by items of [txID + result]

* rebase & blk marshal/unmarshal & merkleroot to ids.ID

* write benches for the merkle package

* use crypto/rand, fix var name, report allocs

* put the 10k bench back

* pass config by parameter

* happy clippy

* borrow V

* add TODO

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "put the 10k bench back"

This reverts commit 058d7e7.

* Revert "use crypto/rand, fix var name, report allocs"

This reverts commit 214005b.

* Revert "write benches for the merkle package"

This reverts commit 07993bf.

* Revert "rebase & blk marshal/unmarshal & merkleroot to ids.ID"

This reverts commit 7442836.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "add <*.code-workspace> to .gitignore and remove it from git commit"

This reverts commit ce00289.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* merge main!

* merge imports

---------

Co-authored-by: bianyuanop <chen.me.nan@gmail.com>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>

* stop using SmartPtr

* Cached state values in the program state (ava-labs#840)

* add cache

* implement cache reads

* actually cache reads

* implement cache delete and handle borsch errors

* use only one cache map

* remove flushed bool

* root of transactions by stateless merkledb

* make root generation a function

* preallocate memory for merkle array and consumebytes flag

* add <*.code-workspace> to .gitignore and remove it from git commit

* move root generation func to merkle package, tx root by items of [txID + result]

* rebase & blk marshal/unmarshal & merkleroot to ids.ID

* write benches for the merkle package

* use crypto/rand, fix var name, report allocs

* put the 10k bench back

* pass config by parameter

* happy clippy

* borrow V

* add TODO

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "put the 10k bench back"

This reverts commit 058d7e7.

* Revert "use crypto/rand, fix var name, report allocs"

This reverts commit 214005b.

* Revert "write benches for the merkle package"

This reverts commit 07993bf.

* Revert "rebase & blk marshal/unmarshal & merkleroot to ids.ID"

This reverts commit 7442836.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "add <*.code-workspace> to .gitignore and remove it from git commit"

This reverts commit ce00289.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* Revert "pass config by parameter"

This reverts commit 4aec589.

* Revert "move root generation func to merkle package, tx root by items of [txID + result]"

This reverts commit e551960.

* Revert "preallocate memory for merkle array and consumebytes flag"

This reverts commit 68e49b6.

* Revert "make root generation a function"

This reverts commit aa44f97.

* merge main!

* merge imports

---------

Co-authored-by: bianyuanop <chen.me.nan@gmail.com>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>

* [x/programs] safe wrapper around C ffi interface (ava-labs#869)

* macro skeleton

* write macro for ffi-safe bindings

* avoid panicking todo!

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>

* remove unused arms

---------

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>

* keep using `SmartPtr` for now

* fix tests

* handle put and delete return as a status and remove the `SmartPointer`

* cargo fmt

* move `CPointer` from `program` to `memory`

* cargo fmt

---------

Signed-off-by: Franfran <51274081+iFrostizz@users.noreply.github.com>
Signed-off-by: Richard Pringle <richard.pringle@avalabs.org>
Co-authored-by: bianyuanop <chen.me.nan@gmail.com>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
Co-authored-by: Patrick O'Grady <prohb125@gmail.com>
* write tests for params module

* fix clippy

---------

Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
* Make put method take a pointer and a length

* Make get-bytes serialize all its args together

* Make delete use the same calling convention as get

* Cleanup state code

* Cleanup the new call conventions

* Run go formatter

* Delete Go program-example tests

* Make the Go linter happy

* Fix the delete implementation

* Fixup *Args visibility
* Make delete return the old data

* Add comments about enum
* Make `#[public]` ffi functions private and unsafe

* Fix macro warning through type swap

* Encapsulate mutability in the macro
* add log

* reb

* implement linker function

* remove debug leftover

* remove host file

* remove unused explicit type

* apply review suggestions

* address review

* Remove `Log` error from `state::Error`

Signed-off-by: Richard Pringle <rpring9@gmail.com>

---------

Signed-off-by: Richard Pringle <rpring9@gmail.com>
Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet