Code Monkey home page Code Monkey logo

ao's People

Contributors

7i7o avatar bliotti avatar dtfiedler avatar femaury avatar hlolli avatar jfrain99 avatar jrdn91 avatar jshaw-ar avatar kernelwhisperer avatar merdi-kim avatar michaelbuhler avatar ppedziwiatr avatar samcamwilliams avatar smowden avatar tillathehun0 avatar twilson63 avatar vincejuliano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ao's Issues

Update `install_ao` ANT Contract, as part of ao CLI CI

  • Move Dev CLI CI over to be JS based using the Irys SDK and Warp-Contracts SDK (so many dependencies ๐Ÿคข )
  • Add Step to update ANT Contract setRecord for subDomain install
{
	function: "setRecord",
	subDomain: "install",
	transactionId: installTxId,
}

feat(dev-cli): publish command

The hyperbeam CLI needs a publish command that will publish the built Wasm to Arweave with the appropriate tags:

{ name: "App-Name", value: "SmartWeaveContractSource" }
{ name: "App-Version", value: "0.4.0" }
{ name: "Content-Type", value: "application/wasm" }
{ name: "Contract-Type", value: "hyperbeam" }
  • Implement publish module
  • Build as part of p3rmaw3b/hyperbeam image
  • Hook into publish command
    • ability to pass wallet path using -w
    • ability to pass contract Wasm path as parameter

feat(cli): project init script

hb init foo

This script will create the new directory, and create two files:

  • hb.config.json // a project configuration file for the hyperbeam smart contract service
  • src/main.lua // main lua smartweave file

BiBo changes in CU

  • initial state is simply null
  • tags passed to the handler are now just the raw array of { name, value } objects, from Arweave
    • Test contracts will need to use new format for tags
  • handler now accepts (buffer, message, ao)
    • setting up handler returns a Promise
    • invoking the handler does not return a Promise
  • Persist state as buffer instead of object, as part of eval
    • update zod schemas

proposal(ao-cli): Bundler fund management

Also, we may want to consider a few helper commands for irys.

ao irys 
ao irys fund [amount]
ao irys balance

ao irys -w [wallet]:

  • Description: Returns Irys balance

ao irys fund -w [wallet] -h [node] [amount]:

  • Description: funds irys node with AR, amount is in AR

ao irys -w [wallet] balance:

  • Description: returns the balance provided in Irys

Thoughts?

feat(dev-cli): deploy binary artifacts to Arweave, and install script to Arweave

The hyperbeam dev-cli will need to be published to arweave, along with an install script to install that specific version of the cli.

Since we do not know the transaction that will contain the binaries until we publish them

  • Create build script to build the binaries
  • Create install script to install the binary for the specific platform ie. mac, windows, or linux
  • Create CI to publish binaries then. install script pointing to the transaction that contains those binaries
  • Way to keep track of transactions that contain binaries and install scripts

counter example

  • can send and receive messages
  • when receiving a message, increment counter and keep record of who (which process/contract) incremented

Turn SDK Integration Tests back on

As part of #117 , I disabled the SDK integration tests, until we have some ao processes we can use in them.

This issue just tracks turning those back on, so that we don't forget about it.

ao-cli

Using Lua, docker and emscripten create a cli tool that can be used to compile lua scripts into wasm. The tool will need to wrap the lua contracts in a main lua function that deserializes the incoming JSON string and serializes the outgoing table into a json string.

  • create project
  • create README with usage directions
  • #3
  • #5
  • #7
  • create a packer module that packs lua scripts into a single file
  • create source map for lua/wasm
  • create docker container
  • publish docker container
  • create binary builds for hb cli
  • create wasm contract deploy script to arweave using bundlr
  • created ao-loader to manage the loading of ao contracts
  • created ao-sdk to use in the compute unit and handle the basic functions for ao

Testing issues

  • index.js sdk readState doesnt work properly, readState works when configured as it is in main.test.js
    - [ ] #34
  • after deploying a contract the sdk throws an error when trying to readState if the block is null in gql
  • evaluating contract VkjFCALjk4xxuCilddKS8ShZ-9HdeqeuYQOgMgWucro after a writeInteraction receiving following output failed to call handle function error: [string "json"]:753: expected argument of type string, got nil
    - [ ] #38

Messenger error handling and error situations

  • test cranking same tx twice, should not try to replay the messages
  • test if 2 message chains rely on the same state. if 2 people crank a tx to receive a balance of 1 and there's only 1 to give one message chain should fail.
  • the above may also leave contracts in a state of disarray contracts should be able to rollback to there healthy state.
  • if the messenger server shuts off and its in the middle of cranking a message chain, when rebooting the server the messenger should be able to pick up where it left off.
  • contracts should receive a failed message and handle that themselves
  • 2 relayers receive the same transaction
  • infinite message loop, the mu never reaches a state of receiving no messages
  • sequencer or cu network request fails in cranking process
  • sign the same transaction and send it to 2 relays

AO Token example

  • test U that lets users mint 1 per day
  • Sends test $U to another process
  • Show an example of a rejected transfer
  • tests
  • sample UI

Something like this:

image

docs

add docs in ao site and readme's

  • intro to lua
  • intro to cli
  • actor oriented messaging
  • sdk usage
  • js vs lua
  • square away readme's

Test lua contracts

  • game of life
  • 3 contracts having a conversation
  • game of life each block as a contract

feat(cli): create compile script

This task is to build out the compile to wasm function

hb build 

This function will call

docker run -v ${PWD}:/src hyperbeam/dev emcc-lua

Implement New ao SDK logic based on new "Data-Item" Centric rules

With the move to be DataItem centric, ao will no longer share many semantics with SmartWeaveContracts:

  • Init-State will not be required, and instead any tags can provided on the initial process spawn, which collectively will serve as the "initial state"
  • Contract-Src will still be required and the rules therein will be the same ie. "must be an ao Contract-Type

In addition to changing semantics, ao will also no longer use the Warp Sequencer, and therefore will not need to register the ao Process at the Warp Gateway (in order for the Warp Sequencer to sequence properly)

The ao SDK will need to implement these new rules

  • Remove accepting initial state, and instead just accept tags
  • Remove registering the Process with the Warp Gateway, and instead ??? (register with AO sequencer?)

feat(messenger): messenger server for cranking hyperbeam messages POC

This server needs to expose an endpoint /crank/:tx this endpoint takes a interaction id to connect to know which messages to crank.

Look at subscribing to the contract to get notifications and cache them in the server.

  • Read /messages endpoint to get outbound messages
  • Sign the messages
  • Dispatch messages to warp sequencer
const result = await warp.contract(CONTRACT).connect(signer).evaluationOptions(options).writeInteraction(input)

// subscribe to events from that contract
// need an internal pub/sub mechanism to trigger when messages are available
// get those messages and subscribe to events and repeat

ao-sdk

create an ao-sdk that supports the readState

  • load contract source
  • load initial state
  • load interactions (according to sort key height)
    • Check local cache for cached state and messages using sort key height
  • evaluate the state
    • save each intermediary result to local cache
  • return result

Messenger protocol

I propose the following protocol/layout for the messenger/sdk

A .drive(muAddress, txId, callBack) (or .crank) is added to the sdk. This can be called immediately after a writeInteraction or any time later down the line. This opens a websocket to the mu and sends a request for status on a txId. The status will be a JSON response 1 of 4 things

{status: "NONE", info: {...message etc}}
{status: "SUCCESS", info: {...message etc}}
{status: "FAILURE", info: {...message etc}}
{status: "PROCESSING", info: {...message etc}}

PROCESSING means the messenger is still cranking, NONE means cranking never started.

When the sdk receives a SUCCESS or FAILURE it will call the callback sent into .drive() or .crank()

Add x64 binary build to ao Dev CLI

Title says it all.

As part of this, I may also try to automate update install_ao g8way, if I can figure out how to add to CI

Move setting up install_ao ANT contract to a separate issue, so as to unblock X64 Mac users asap

feat(cli | loader): Integrate pause and resume into cli and loader

The CLI needs to build a wasm file that contains the following methods:

  • spawn - creates a new process
  • handle - processes a message
  • read or readState?
  • close - frees process

The loader will need to implement the pause and resume methods to allow the cu to stash the state as memory.

  • pause - will take a slice of the HEAPU8 and return it to the caller
  • resume - will take an array and set it on the HEAPU8

This version is built with emscripten, but as long as the abstraction is consistent, we should be able to build a version of the loader that handles wasi and the cu can support both emscripten and wasi implementations.

The loader will also surface the spawn and handle process to the cu to be called.

sdk: unwrap value from failed evaluation

Right now, the inner shape of a failed evaluation (implemented using a transduce) is being exposed when readState returns.

Instead, the SDK should unwrap the value from the transduce and return that instead

Lua Messages API

We'd like to provide an API for Lua SmartWeaveContracts to:

  • send messages to another contract (by way of returning a properly formatted results output)
  • receive messages from other contracts (by way of returning a properly formatted results output)
  • spawn new contract instances (not sure on this mechanism yet. Maybe expose on results?)

We need to decide on what inputs are required, validate those inputs, and then determine a way to expose to the contract.

  • send
  • receive
  • spawn
  • mechanism to expose AoMessages and show that it works as part of a contract invocation

Relay persistance

Right now the relay is all in memory so if something fails theres no way it can pick up where it left off cranking. If someone requests cranking on a tx it should pick up where it left off and not try to crank the same messages

sdk: expose `createContract` api

Contracts are often created programmatically. The ability to create an AO contract, using the SDK, would be great for those use-cases.

  • Expose createContract api
    • accepts initial state as JSON
    • accepts txId for contract source
    • adds necessary tags and publishes to Arweave

Questions:

  • Any other actions that need to be taken ie. w.r.t the sequencer?

Make CU evaluation Cache Persistent on Render

Right now, the cache is blown away on each deploy. This works well in the development stage when the cache shape is in flux.

Eventually though, once the cache shape and debugging is more stable, we'll need to mount a Render Disk and allow placing the PouchDB files on that persistent disk, so the cache will persist across deploys.

Publish AO WASM Loader and AO SDK

Since the packages will be published under the @permaweb scope (@permaweb/ao-loader and @permaweb/ao-sdk), I wasn't able to publish the packages without first needing to login to NPM CLI using the account that issued the Auth token (I think an account owned by @twilson63?)

So once the packages are registered under that scope on NPM, they can be published be CI using the token.

  • Register the @permaweb/ao-loader module on NPM
  • Register the @permaweb/ao-sdk module on NPM
  • Publish the @permaweb/ao-loader module on NPM (can be done with CI)
  • Publish the @permaweb/ao-sdk module on NPM (can be done with CI)
    - [ ] #54

Modify MU api

/message - sends a message to su and does the cranking
/spawn - creates a new AO contract and sends it to the su
/monitor - watches a process for implicit actions and cranks those actions

Rename `hyperbeam` to `ao`

We've settled on ao as the new name for the hyperbeam project. So we need to account for this in the project.

  • Rename CLI from hb -> ao
  • Rename docker image from hyperbeam -> ao
  • Replaces instances of hyperbeam and hb in code with ao
    • Directions in install script
    • Binary name
    • Contract-Type used by CLI and modified Warp SDK
    • loader module name

ao Comput Unit State endpoint `/state/:processId?[to=messageId]`

  • accepts processId and to (messageId)
  • loadProcess
    • verify type is "process"
    • gather tags as state
  • loadSource
  • loadMessages
    • load sequenced messages from SU
    • load scheduled messages based on tags and range being evaluated
  • evaluate each message
    - [ ] verify Data-Item (not sure how to do this)
    - [ ] calculate messageId
    - [ ] if forward-for, check the cache for if message is already evaluated

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.